Compare commits

..

No commits in common. "54e1b344dbd84fdfe0bd5901a45939f8e5650b59" and "5df8e304c675662cc17f81af0b99481b14ca0114" have entirely different histories.

1 changed files with 12 additions and 2 deletions

View File

@ -553,7 +553,8 @@ class MongoClientInterface {
}
// Attempt to repair master
setTimeout(() => {
this.asyncRepair(c, bucketName, objName, mst, log);
this.asyncRepair(c, bucketName, objName, mst, log,
{ action: 'put' });
}, ASYNC_REPAIR_TIMEOUT);
return cb(null, `{"versionId": "${objVal.versionId}"}`);
});
@ -700,13 +701,22 @@ class MongoClientInterface {
* Get the latest version and repair. The process is safe because
* we never replace a non-PHD master
*/
asyncRepair(c, bucketName, objName, mst, log) {
asyncRepair(c, bucketName, objName, mst, log, options) {
this.getLatestVersion(c, objName, log, (err, value) => {
if (err) {
log.error('async-repair: getting latest version',
{ error: err.message });
return undefined;
}
// if a PHD was created on put, compare latest version with
// the version id saved on PHD
if (options && options.action === 'put') {
// if version id does not match, PHD has been replaced and
// we should ignore this repair
if (value.versionId !== mst.versionId) {
return undefined;
}
}
this.repair(c, bucketName, objName, value, mst, log, err => {
if (err) {
log.error('async-repair failed', { error: err.message });