summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJiawei Yang <jiawei.yang@mongodb.com>2023-04-03 20:33:14 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-03 22:47:17 +0000
commitbb7497ecfdd45b7e87c0015aa515e2838414318d (patch)
tree3de555e7bd2eb60f5ea4a59335f28d7fd239c219 /src
parentf12c4e88077d90a99b985fd04ea5b7e03b5973cc (diff)
downloadmongo-bb7497ecfdd45b7e87c0015aa515e2838414318d.tar.gz
SERVER-75551 change threshold in slow PrimaryOnlyService stepup test to a larger value
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/repl/primary_only_service_test.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/repl/primary_only_service_test.cpp b/src/mongo/db/repl/primary_only_service_test.cpp
index 277400040fa..e27ce16581b 100644
--- a/src/mongo/db/repl/primary_only_service_test.cpp
+++ b/src/mongo/db/repl/primary_only_service_test.cpp
@@ -1155,6 +1155,14 @@ TEST_F(PrimaryOnlyServiceTest, StateTransitionFromRebuildingShouldWakeUpConditio
}
TEST_F(PrimaryOnlyServiceTest, PrimaryOnlyServiceLogSlowServices) {
+ // We change slow stepUp threshold to a extremely large value to avoid test failure in some slow
+ // test environments.
+ const auto oldSlowServiceOnStepUpCompleteThresholdMS =
+ repl::slowServiceOnStepUpCompleteThresholdMS.load();
+ const auto oldSlowTotalOnStepUpCompleteThresholdMS =
+ repl::slowTotalOnStepUpCompleteThresholdMS.load();
+ repl::slowServiceOnStepUpCompleteThresholdMS.store(1000000);
+ repl::slowTotalOnStepUpCompleteThresholdMS.store(1000000);
std::string slowSingleServiceStepUpCompleteMsg =
"Duration spent in PrimaryOnlyServiceRegistry::onStepUpComplete for service "
"exceeded slowServiceOnStepUpCompleteThresholdMS";
@@ -1171,6 +1179,10 @@ TEST_F(PrimaryOnlyServiceTest, PrimaryOnlyServiceLogSlowServices) {
ASSERT_EQ(0, countTextFormatLogLinesContaining(slowSingleServiceStepUpCompleteMsg));
ASSERT_EQ(0, countTextFormatLogLinesContaining(slowTotalTimeStepUpCompleteMsg));
+ // Reset thresholds.
+ repl::slowServiceOnStepUpCompleteThresholdMS.store(oldSlowServiceOnStepUpCompleteThresholdMS);
+ repl::slowTotalOnStepUpCompleteThresholdMS.store(oldSlowTotalOnStepUpCompleteThresholdMS);
+
// Use the "PrimaryOnlyServiceHangBeforeLaunchingStepUpLogic", which is encountered
// via PrimaryOnlyServiceRegistry::onStepUpComplete, to simulate a slow primary-only
// service.