From b4e62b9b3ec4370ed8507816b7bc63a2563ededf Mon Sep 17 00:00:00 2001 From: Zhe Wu Date: Tue, 21 Mar 2023 22:03:17 -0700 Subject: [PATCH] Update log cursor timeout check --- fdbrpc/include/fdbrpc/simulator.h | 1 + fdbrpc/sim2.actor.cpp | 5 +++-- fdbserver/LogSystemPeekCursor.actor.cpp | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fdbrpc/include/fdbrpc/simulator.h b/fdbrpc/include/fdbrpc/simulator.h index 21ce6c255e..c5901a16bb 100644 --- a/fdbrpc/include/fdbrpc/simulator.h +++ b/fdbrpc/include/fdbrpc/simulator.h @@ -325,6 +325,7 @@ public: double lastConnectionFailure; double connectionFailuresDisableDuration; bool speedUpSimulation; + double connectionFailureEnableTime; // Last time connection failure is enabled. BackupAgentType backupAgents; BackupAgentType drAgents; bool restarted = false; diff --git a/fdbrpc/sim2.actor.cpp b/fdbrpc/sim2.actor.cpp index 709c21e2db..d3ab5b8a65 100644 --- a/fdbrpc/sim2.actor.cpp +++ b/fdbrpc/sim2.actor.cpp @@ -73,8 +73,8 @@ ISimulator::ISimulator() : desiredCoordinators(1), physicalDatacenters(1), processesPerMachine(0), listenersPerProcess(1), usableRegions(1), allowLogSetKills(true), tssMode(TSSMode::Disabled), configDBType(ConfigDBType::DISABLED), isStopped(false), lastConnectionFailure(0), connectionFailuresDisableDuration(0), speedUpSimulation(false), - backupAgents(BackupAgentType::WaitForType), drAgents(BackupAgentType::WaitForType), allSwapsDisabled(false), - blobGranulesEnabled(false) {} + connectionFailureEnableTime(0), backupAgents(BackupAgentType::WaitForType), drAgents(BackupAgentType::WaitForType), + allSwapsDisabled(false), blobGranulesEnabled(false) {} ISimulator::~ISimulator() = default; bool simulator_should_inject_fault(const char* context, const char* file, int line, int error_code) { @@ -2785,6 +2785,7 @@ void enableConnectionFailures(std::string const& context) { if (g_network->isSimulated()) { g_simulator->connectionFailuresDisableDuration = 0; g_simulator->speedUpSimulation = false; + g_simulator->connectionFailureEnableTime = now(); TraceEvent(SevWarnAlways, ("EnableConnectionFailures_" + context).c_str()); } } diff --git a/fdbserver/LogSystemPeekCursor.actor.cpp b/fdbserver/LogSystemPeekCursor.actor.cpp index e99e259981..db251899be 100644 --- a/fdbserver/LogSystemPeekCursor.actor.cpp +++ b/fdbserver/LogSystemPeekCursor.actor.cpp @@ -343,7 +343,9 @@ ACTOR Future serverPeekParallelGetMore(ILogSystem::ServerPeekCursor* self, // A cursor for a log router can be delayed indefinitely during a network partition, so only fail // simulation tests sufficiently far after we finish simulating network partitions. CODE_PROBE(e.code() == error_code_timed_out, "peek cursor timed out"); - if (now() >= FLOW_KNOBS->SIM_SPEEDUP_AFTER_SECONDS + SERVER_KNOBS->PEEK_TRACKER_EXPIRATION_TIME) { + if (g_network->isSimulated() && now() >= g_simulator->connectionFailureEnableTime + + FLOW_KNOBS->SIM_SPEEDUP_AFTER_SECONDS + + SERVER_KNOBS->PEEK_TRACKER_EXPIRATION_TIME) { ASSERT_WE_THINK(e.code() == error_code_operation_obsolete || SERVER_KNOBS->PEEK_TRACKER_EXPIRATION_TIME < 10); }