diff --git a/fdbserver/workloads/IncrementalBackup.actor.cpp b/fdbserver/workloads/IncrementalBackup.actor.cpp index 2537a84c90..1f2cfd866e 100644 --- a/fdbserver/workloads/IncrementalBackup.actor.cpp +++ b/fdbserver/workloads/IncrementalBackup.actor.cpp @@ -19,6 +19,7 @@ */ #include "fdbclient/FDBTypes.h" +#include "fdbclient/ReadYourWrites.h" #include "fdbrpc/simulator.h" #include "fdbclient/BackupAgent.actor.h" #include "fdbclient/BackupContainer.h" @@ -32,12 +33,14 @@ struct IncrementalBackupWorkload : TestWorkload { FileBackupAgent backupAgent; bool submitOnly; bool restoreOnly; + bool waitVersion; IncrementalBackupWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) { backupDir = getOption(options, LiteralStringRef("backupDir"), LiteralStringRef("file://simfdb/backups/")); tag = getOption(options, LiteralStringRef("tag"), LiteralStringRef("default")); submitOnly = getOption(options, LiteralStringRef("submitOnly"), false); restoreOnly = getOption(options, LiteralStringRef("restoreOnly"), false); + waitVersion = getOption(options, LiteralStringRef("waitVersion"), false); } virtual std::string description() { return "IncrementalBackup"; } @@ -76,6 +79,17 @@ struct IncrementalBackupWorkload : TestWorkload { TraceEvent("IBackupRestoreAttempt"); wait(success(self->backupAgent.waitBackup(cx, self->tag.toString(), false, &backupContainer, &backupUID))); // TODO: add testing scenario for atomics and beginVersion + if (self->waitVersion) { + state Reference tr(new ReadYourWritesTransaction(cx)); + state Version v = wait(tr->getReadVersion()); + loop { + BackupDescription desc = wait(backupContainer->describeBackup()); + if (desc.maxLogEnd.get() >= v) break; + // Avoid spamming requests with a delay + wait(delay(3.0)); + } + + } wait(success(self->backupAgent.restore(cx, cx, Key(self->tag.toString()), Key(backupContainer->getURL()), true, -1, true, normalKeys, Key(), Key(), true, true))); TraceEvent("IBackupRestoreSuccess"); diff --git a/tests/fast/IncrementalBackup.toml b/tests/fast/IncrementalBackup.toml index ab965a3886..90c5898d7b 100644 --- a/tests/fast/IncrementalBackup.toml +++ b/tests/fast/IncrementalBackup.toml @@ -16,7 +16,7 @@ simBackupAgents = 'BackupToFile' testName = 'Cycle' nodeCount = 3000 transactionsPerSecond = 3000.0 - testDuration = 120.0 + testDuration = 10.0 expectedRate = 0 [[test]] @@ -28,6 +28,7 @@ simBackupAgents = 'BackupToFile' testName = 'IncrementalBackup' tag = 'default' restoreOnly = true + waitVersion = true [[test]]