From 241c2703c81f14dee0fd01ad4c9b3d92c5c94131 Mon Sep 17 00:00:00 2001 From: Meng Xu Date: Tue, 24 Mar 2020 16:44:17 -0700 Subject: [PATCH] Fix atomicParallelRestore interface --- fdbclient/BackupAgent.actor.h | 2 +- fdbclient/FileBackupAgent.actor.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fdbclient/BackupAgent.actor.h b/fdbclient/BackupAgent.actor.h index 4f74d5606b..ac47c2cdf9 100644 --- a/fdbclient/BackupAgent.actor.h +++ b/fdbclient/BackupAgent.actor.h @@ -279,7 +279,7 @@ public: Future parallelRestoreFinish(Database cx); Future submitParallelRestore(Database cx, Key backupTag, Standalone> backupRanges, KeyRef bcUrl, Version targetVersion, bool locked); - Future atomicParallelRestore(FileBackupAgent* backupAgent, Database cx, Key tagName, Standalone> ranges, Key addPrefix, Key removePrefix); + Future atomicParallelRestore(Database cx, Key tagName, Standalone> ranges, Key addPrefix, Key removePrefix); // restore() will // - make sure that url is readable and appears to be a complete backup diff --git a/fdbclient/FileBackupAgent.actor.cpp b/fdbclient/FileBackupAgent.actor.cpp index 092667e558..431e4f30fa 100644 --- a/fdbclient/FileBackupAgent.actor.cpp +++ b/fdbclient/FileBackupAgent.actor.cpp @@ -4450,6 +4450,7 @@ public: ryw_tr->reset(); loop { + try { ryw_tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); ryw_tr->setOption(FDBTransactionOptions::LOCK_AWARE); @@ -4475,7 +4476,7 @@ public: // Similar to atomicRestore, only used in simulation test. // locks the database before discontinuing the backup and that same lock is then used while doing the restore. //the tagname of the backup must be the same as the restore. - ACTOR Future atomicParallelRestore(FileBackupAgent* backupAgent, Database cx, Key tagName, Standalone> ranges, Key addPrefix, Key removePrefix) { + ACTOR static Future atomicParallelRestore(FileBackupAgent* backupAgent, Database cx, Key tagName, Standalone> ranges, Key addPrefix, Key removePrefix) { state Reference ryw_tr = Reference(new ReadYourWritesTransaction(cx)); state BackupConfig backupConfig; loop { @@ -4594,6 +4595,10 @@ Future FileBackupAgent::submitParallelRestore(Database cx, Key backupTag, return FileBackupAgentImpl::submitParallelRestore(cx, backupTag, backupRanges, bcUrl, targetVersion, locked); } +Future FileBackupAgent::atomicParallelRestore(Database cx, Key tagName, Standalone> ranges, Key addPrefix, Key removePrefix) { + return FileBackupAgentImpl::atomicParallelRestore(this, cx, tagName, ranges, addPrefix, removePrefix); +} + Future FileBackupAgent::restore(Database cx, Optional cxOrig, Key tagName, Key url, Standalone> ranges, bool waitForComplete, Version targetVersion, bool verbose, Key addPrefix, Key removePrefix, bool lockDB) { return FileBackupAgentImpl::restore(this, cx, cxOrig, tagName, url, ranges, waitForComplete, targetVersion, verbose, addPrefix, removePrefix, lockDB, deterministicRandom()->randomUniqueID()); }