Skip to content

Commit 2d60c95

Browse files
committed
PSMDB-1078: fix KV engine tests for ephemeral storage engines
Update RollingBackToLastStable and CommitBehindStable test cases to handle ephemeral storage engine behavior where the last stable recovery timestamp is set immediately when setStableTimestamp is called, unlike non ephemeral storage engine that require a checkpoint to advance the timestamp.
1 parent f4d0882 commit 2d60c95

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/mongo/db/storage/kv/kv_engine_test_harness.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,13 @@ TEST_F(KVEngineTestHarness, RollingBackToLastStable) {
959959
ASSERT(!engine->getLastStableRecoveryTimestamp());
960960
ASSERT_EQUALS(engine->getAllDurableTimestamp(), Timestamp(1, 1));
961961
engine->setStableTimestamp(Timestamp(1, 1), false);
962-
ASSERT(!engine->getLastStableRecoveryTimestamp());
962+
963+
if (engine->isEphemeral()) {
964+
// Ephemeral storage engines set the last stable timestamp immediately.
965+
ASSERT_EQ(engine->getLastStableRecoveryTimestamp(), Timestamp(1, 1));
966+
} else {
967+
ASSERT(!engine->getLastStableRecoveryTimestamp());
968+
}
963969

964970
// Force a checkpoint to be taken. This should advance the last stable timestamp.
965971
auto opCtx = _makeOperationContext(engine);
@@ -1026,7 +1032,13 @@ DEATH_TEST_REGEX_F(KVEngineTestHarness, CommitBehindStable, "Fatal assertion.*39
10261032
// Set the stable timestamp to (2, 2).
10271033
ASSERT(!engine->getLastStableRecoveryTimestamp());
10281034
engine->setStableTimestamp(Timestamp(2, 2), false);
1029-
ASSERT(!engine->getLastStableRecoveryTimestamp());
1035+
1036+
if (engine->isEphemeral()) {
1037+
// Ephemeral storage engines set the last stable timestamp immediately.
1038+
ASSERT_EQ(engine->getLastStableRecoveryTimestamp(), Timestamp(2, 2));
1039+
} else {
1040+
ASSERT(!engine->getLastStableRecoveryTimestamp());
1041+
}
10301042

10311043
// Force a checkpoint to be taken. This should advance the last stable timestamp.
10321044
auto opCtx = _makeOperationContext(engine);

0 commit comments

Comments
 (0)