Skip to content

Commit 26e6cb7

Browse files
committed
Fix tests where backup agents are not resumed
Also consolidate key updates for pausing backups. 20250520-175022-jzhou-10106ade7e0ad74f 100k backup 20250520-175208-jzhou-15255334e0c57eec
1 parent 0edb204 commit 26e6cb7

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

fdbclient/FileBackupAgent.actor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7274,22 +7274,23 @@ class FileBackupAgentImpl {
72747274

72757275
ACTOR static Future<Void> changePause(FileBackupAgent* backupAgent, Database db, bool pause) {
72767276
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(db));
7277-
state Future<Void> change = backupAgent->taskBucket->changePause(db, pause);
72787277

72797278
loop {
72807279
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
72817280
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
72827281
tr->setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
72837282

72847283
try {
7284+
// This is the pause key is in the task bucket, for backup agents
7285+
backupAgent->taskBucket->changePause(tr, pause);
7286+
// This is backup workers' pause key.
72857287
tr->set(backupPausedKey, pause ? "1"_sr : "0"_sr);
72867288
wait(tr->commit());
72877289
break;
72887290
} catch (Error& e) {
72897291
wait(tr->onError(e));
72907292
}
72917293
}
7292-
wait(change);
72937294
TraceEvent("FileBackupAgentChangePaused").detail("Action", pause ? "Paused" : "Resumed");
72947295
return Void();
72957296
}

fdbserver/workloads/Backup.actor.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,9 @@ struct BackupWorkload : TestWorkload {
118118

119119
// Resume the backup agent if it is paused
120120
ACTOR static Future<Void> resumeAgent(Database cx, FileBackupAgent* backupAgent) {
121-
bool active = wait(backupAgent->checkActive(cx));
122-
if (!active) {
123-
wait(backupAgent->changePause(cx, false));
124-
TraceEvent("BW_AgentResumed").log();
125-
}
121+
TraceEvent("BW_AgentResuming").log();
122+
wait(backupAgent->changePause(cx, false));
123+
TraceEvent("BW_AgentResumed").log();
126124
return Void();
127125
}
128126

fdbserver/workloads/Restore.actor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,9 @@ struct RestoreWorkload : TestWorkload {
111111

112112
// Resume the backup agent if it is paused
113113
ACTOR static Future<Void> resumeAgent(Database cx, FileBackupAgent* backupAgent) {
114-
bool active = wait(backupAgent->checkActive(cx));
115-
if (!active) {
116-
wait(backupAgent->changePause(cx, false));
117-
}
114+
TraceEvent("RW_AgentResuming").log();
115+
wait(backupAgent->changePause(cx, false));
116+
TraceEvent("RW_AgentResumed").log();
118117
return Void();
119118
}
120119

@@ -137,7 +136,8 @@ struct RestoreWorkload : TestWorkload {
137136
state DatabaseConfiguration config = wait(getDatabaseConfiguration(cx));
138137
TraceEvent("RW_Arguments")
139138
.detail("BackupTag", printable(self->backupTag))
140-
.detail("PerformRestore", self->performRestore);
139+
.detail("PerformRestore", self->performRestore)
140+
.detail("AllowPauses", self->allowPauses);
141141

142142
if (self->allowPauses && BUGGIFY) {
143143
cp = changePaused(cx, &backupAgent);

0 commit comments

Comments
 (0)