FastRestore:bug fix: Lock DB successfully
This commit is contained in:
parent
0f03a0d3bb
commit
5e9a6edfe6
|
@ -1000,7 +1000,7 @@ public:
|
|||
Version end = i->endVersion;
|
||||
restorable.logs.push_back(*i);
|
||||
|
||||
//printf("\t[INFO] Log File:%s\n", i->toString().c_str());
|
||||
printf("\t[INFO] Log File:%s\n", i->toString().c_str());
|
||||
|
||||
// Add logs to restorable logs set until continuity is broken OR we reach targetVersion
|
||||
while(++i != logs.end()) {
|
||||
|
@ -1010,7 +1010,7 @@ public:
|
|||
if(i->beginVersion == end) {
|
||||
restorable.logs.push_back(*i);
|
||||
end = i->endVersion;
|
||||
//printf("\t[INFO] Log File:%s\n", i->toString().c_str());
|
||||
printf("\t[INFO] Log File:%s\n", i->toString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3534,6 +3534,7 @@ public:
|
|||
|
||||
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
|
||||
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
|
||||
printf("[Debug] submitRestore\n");
|
||||
|
||||
// Get old restore config for this tag
|
||||
state KeyBackedTag tag = makeRestoreTag(tagName.toString());
|
||||
|
|
|
@ -3893,7 +3893,20 @@ int restoreStatusIndex = 0;
|
|||
|
||||
|
||||
ACTOR static Future<Void> _lockDB(Database cx, UID uid, bool lockDB) {
|
||||
printf("[Lock] DB will be locked\n");
|
||||
printf("[Lock] DB will be locked, uid:%s, lockDB:%d\n", uid.toString().c_str(), lockDB);
|
||||
|
||||
ASSERT( lockDB );
|
||||
|
||||
loop {
|
||||
try {
|
||||
wait(lockDatabase(cx, uid));
|
||||
break;
|
||||
} catch( Error &e ) {
|
||||
printf("Transaction Error when we lockDB. Error:%s\n", e.what());
|
||||
wait(tr->onError(e));
|
||||
}
|
||||
}
|
||||
|
||||
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
|
||||
loop {
|
||||
try {
|
||||
|
@ -3901,10 +3914,7 @@ ACTOR static Future<Void> _lockDB(Database cx, UID uid, bool lockDB) {
|
|||
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
|
||||
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
|
||||
|
||||
if (lockDB)
|
||||
wait(lockDatabase(tr, uid));
|
||||
else
|
||||
wait(checkDatabaseLock(tr, uid));
|
||||
wait(checkDatabaseLock(tr, uid));
|
||||
|
||||
tr->commit();
|
||||
break;
|
||||
|
@ -3914,6 +3924,7 @@ ACTOR static Future<Void> _lockDB(Database cx, UID uid, bool lockDB) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return Void();
|
||||
}
|
||||
|
||||
|
|
|
@ -408,6 +408,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload {
|
|||
auto range = self->backupRanges[restoreIndex];
|
||||
Standalone<StringRef> restoreTag(self->backupTag.toString() + "_" + std::to_string(restoreIndex));
|
||||
restoreTags.push_back(restoreTag);
|
||||
printf("BackupCorrectness, backupAgent.restore is called for restoreIndex:%d\n", restoreIndex);
|
||||
restores.push_back(backupAgent.restore(cx, restoreTag, KeyRef(lastBackupContainer->getURL()), true, targetVersion, true, range, Key(), Key(), self->locked));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue