From 5e8f55768a4cda7839402253adaa8cd97b00f634 Mon Sep 17 00:00:00 2001 From: Xiaoxi Wang Date: Wed, 29 Jun 2022 10:42:26 -0700 Subject: [PATCH] use speedUp to extend transaction window --- fdbserver/storageserver.actor.cpp | 7 ++++--- fdbserver/tester.actor.cpp | 2 ++ fdbserver/workloads/Cycle.actor.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index f4167cbe4a..ae542496d6 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -7509,9 +7509,10 @@ ACTOR Future update(StorageServer* data, bool* pReceivedUpdate) { if (data->otherError.getFuture().isReady()) data->otherError.getFuture().get(); - Version maxVersionsInMemory = (g_network->isSimulated() && g_simulator.speedUpSimulation) - ? 5 * SERVER_KNOBS->VERSIONS_PER_SECOND - : SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS; + Version maxVersionsInMemory = + (g_network->isSimulated() && g_simulator.speedUpSimulation) + ? std::max(5 * SERVER_KNOBS->VERSIONS_PER_SECOND, SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS) + : SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS; for (int i = 0; i < data->recoveryVersionSkips.size(); i++) { maxVersionsInMemory += data->recoveryVersionSkips[i].second; } diff --git a/fdbserver/tester.actor.cpp b/fdbserver/tester.actor.cpp index b7fd85c554..bf5b97ef62 100644 --- a/fdbserver/tester.actor.cpp +++ b/fdbserver/tester.actor.cpp @@ -997,6 +997,7 @@ ACTOR Future checkConsistency(Database cx, state double connectionFailures; if (g_network->isSimulated()) { + // NOTE: the value will be reset after consistency check connectionFailures = g_simulator.connectionFailuresDisableDuration; g_simulator.connectionFailuresDisableDuration = 1e6; g_simulator.speedUpSimulation = true; @@ -1037,6 +1038,7 @@ ACTOR Future checkConsistency(Database cx, if (testResults.ok() || lastRun) { if (g_network->isSimulated()) { g_simulator.connectionFailuresDisableDuration = connectionFailures; + g_simulator.speedUpSimulation = false; } return Void(); } diff --git a/fdbserver/workloads/Cycle.actor.cpp b/fdbserver/workloads/Cycle.actor.cpp index 0fc90f2ab0..6d2fb054f3 100644 --- a/fdbserver/workloads/Cycle.actor.cpp +++ b/fdbserver/workloads/Cycle.actor.cpp @@ -260,11 +260,11 @@ struct CycleWorkload : TestWorkload { } catch (Error& e) { retryCount++; TraceEvent(retryCount > 20 ? SevWarnAlways : SevWarn, "CycleCheckError").error(e); -// if (g_network->isSimulated() && retryCount > 50) { -// TEST(true); // Cycle check enable speedUpSimulation because too many transaction_too_old() -// // try to make the read window back to normal size (5 * version_per_sec) -// g_simulator.speedUpSimulation = true; -// } + if (g_network->isSimulated() && retryCount > 50) { + TEST(true); // Cycle check enable speedUpSimulation because too many transaction_too_old() + // try to make the read window back to normal size (5 * version_per_sec) + g_simulator.speedUpSimulation = true; + } wait(tr.onError(e)); } }