From 2d0dbd57e85b782dc220e9f2ec61c1de83d7dd78 Mon Sep 17 00:00:00 2001 From: Evan Tschannen Date: Thu, 1 Jun 2017 12:08:21 -0700 Subject: [PATCH] randomized the delays in atomic switchover workload --- fdbserver/workloads/AtomicSwitchover.actor.cpp | 17 +++++++---------- tests/slow/ApiCorrectnessSwitchover.txt | 3 --- tests/slow/WriteDuringReadSwitchover.txt | 3 --- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/fdbserver/workloads/AtomicSwitchover.actor.cpp b/fdbserver/workloads/AtomicSwitchover.actor.cpp index 9134303c0f..0889867e1e 100644 --- a/fdbserver/workloads/AtomicSwitchover.actor.cpp +++ b/fdbserver/workloads/AtomicSwitchover.actor.cpp @@ -26,16 +26,16 @@ //A workload which test the correctness of backup and restore process struct AtomicSwitchoverWorkload : TestWorkload { - double switch1After, switch2After, stopAfter; + double switch1delay, switch2delay, stopDelay; Standalone> backupRanges; Database extraDB; AtomicSwitchoverWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) { - switch1After = getOption(options, LiteralStringRef("switch1After"), 20.0); - switch2After = getOption(options, LiteralStringRef("switch2After"), 30.0); - stopAfter = getOption(options, LiteralStringRef("stopAfter"), 40.0); + switch1delay = getOption(options, LiteralStringRef("switch1delay"), 50.0); + switch2delay = getOption(options, LiteralStringRef("switch2delay"), 50.0); + stopDelay = getOption(options, LiteralStringRef("stopDelay"), 50.0); backupRanges.push_back_deep(backupRanges.arena(), normalKeys); @@ -153,27 +153,24 @@ struct AtomicSwitchoverWorkload : TestWorkload { ACTOR static Future _start(Database cx, AtomicSwitchoverWorkload* self) { state DatabaseBackupAgent backupAgent(cx); state DatabaseBackupAgent restoreAgent(self->extraDB); - state Future switch1After = delay(self->switch1After); - state Future switch2After = delay(self->switch2After); - state Future stopAfter = delay(self->stopAfter); state Future disabler = disableConnectionFailuresAfter(300, "atomicSwitchover"); TraceEvent("AS_Wait1"); int _ = wait( backupAgent.waitBackup(self->extraDB, BackupAgentBase::getDefaultTag(), false) ); TraceEvent("AS_Ready1"); - Void _ = wait( switch1After ); + Void _ = wait( delay(g_random->random01()*self->switch1delay) ); TraceEvent("AS_Switch1"); Void _ = wait( backupAgent.atomicSwitchover(self->extraDB, BackupAgentBase::getDefaultTag(), self->backupRanges, StringRef(), StringRef()) ); TraceEvent("AS_Wait2"); int _ = wait( restoreAgent.waitBackup(cx, BackupAgentBase::getDefaultTag(), false) ); TraceEvent("AS_Ready2"); - Void _ = wait( switch2After ); + Void _ = wait( delay(g_random->random01()*self->switch2delay) ); TraceEvent("AS_Switch2"); Void _ = wait( restoreAgent.atomicSwitchover(cx, BackupAgentBase::getDefaultTag(), self->backupRanges, StringRef(), StringRef()) ); TraceEvent("AS_Wait3"); int _ = wait( backupAgent.waitBackup(self->extraDB, BackupAgentBase::getDefaultTag(), false) ); TraceEvent("AS_Ready3"); - Void _ = wait( stopAfter ); + Void _ = wait( delay(g_random->random01()*self->stopDelay) ); TraceEvent("AS_Abort"); Void _ = wait( backupAgent.abortBackup(self->extraDB, BackupAgentBase::getDefaultTag()) ); TraceEvent("AS_Done"); diff --git a/tests/slow/ApiCorrectnessSwitchover.txt b/tests/slow/ApiCorrectnessSwitchover.txt index 6a9c452b8d..1e09ab2ff8 100644 --- a/tests/slow/ApiCorrectnessSwitchover.txt +++ b/tests/slow/ApiCorrectnessSwitchover.txt @@ -22,9 +22,6 @@ randomTestDuration=60 timeout=2100 testName=AtomicSwitchover -switch1After=10.0 -switch2After=20.0 -stopAfter=130.0 clearAfterTest=false simBackupAgents=BackupToDB extraDB=2 \ No newline at end of file diff --git a/tests/slow/WriteDuringReadSwitchover.txt b/tests/slow/WriteDuringReadSwitchover.txt index 4bc185bc2a..9e740f3cb4 100644 --- a/tests/slow/WriteDuringReadSwitchover.txt +++ b/tests/slow/WriteDuringReadSwitchover.txt @@ -6,9 +6,6 @@ testTitle=WriteDuringReadTest minNode=1 testName=AtomicSwitchover - switch1After=50.0 - switch2After=90.0 - stopAfter=130.0 clearAfterTest=false simBackupAgents=BackupToDB extraDB=2