Compare commits

...

1 Commits

Author SHA1 Message Date
vrancurel f5321e594c bugfix: list version is incorrect
list version is incorrect because sometimes
we replace the master with an incorrect last version
because inserts are sometimes swapped. Add a check
to be sure we always replace the master with a
smaller (thus more recent) version.
2018-06-25 10:43:03 -07:00
1 changed files with 9 additions and 2 deletions

View File

@ -335,7 +335,11 @@ class MongoClientInterface {
/* /*
* In this case we generate a versionId and * In this case we generate a versionId and
* sequentially create the object THEN update the master * sequentially create the object THEN update the master.
*
* It is possible that 2 version creations are inverted
* in flight so we also check that we update a master only
* if the version in place is greater that the one we set.
*/ */
putObjectVerCase1(c, bucketName, objName, objVal, params, log, cb) { putObjectVerCase1(c, bucketName, objName, objVal, params, log, cb) {
const versionId = generateVersionId(this.replicationGroupId); const versionId = generateVersionId(this.replicationGroupId);
@ -355,7 +359,10 @@ class MongoClientInterface {
}, { }, {
updateOne: { updateOne: {
filter: { filter: {
_id: objName, '_id': objName,
'value.versionId': {
$gt: versionId,
},
}, },
update: { update: {
_id: objName, value: objVal, _id: objName, value: objVal,