use speedUp to extend transaction window

This commit is contained in:
Xiaoxi Wang 2022-06-29 10:42:26 -07:00
parent b4b4a4a2f9
commit 5e8f55768a
3 changed files with 11 additions and 8 deletions

View File

@ -7509,9 +7509,10 @@ ACTOR Future<Void> 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;
}

View File

@ -997,6 +997,7 @@ ACTOR Future<Void> 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<Void> checkConsistency(Database cx,
if (testResults.ok() || lastRun) {
if (g_network->isSimulated()) {
g_simulator.connectionFailuresDisableDuration = connectionFailures;
g_simulator.speedUpSimulation = false;
}
return Void();
}

View File

@ -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));
}
}