Skip to content

Commit fe70bca

Browse files
pierlauroMongoDB Bot
authored andcommitted
SERVER-113597 Explicitly check for stale version context in VersionContextDrainTest::RandomMixedOperations (#43702)
GitOrigin-RevId: 595cf44b8adff595dd02883608b263e0987b5812
1 parent d54da1a commit fe70bca

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/mongo/db/version_context_decoration_test.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ TEST_F(VersionContextDrainTest, RandomOperationsToWaitOn) {
307307
operationContext(), kCurrentVersion, Date_t::now());
308308
}
309309

310-
TEST_F(VersionContextDrainTest, RamdomMixedOperations) {
310+
TEST_F(VersionContextDrainTest, RandomMixedOperations) {
311311
std::vector<ScopedHoldOperation> ops;
312312
const int nOps = SecureRandom().nextInt64() % 5;
313313

@@ -350,7 +350,10 @@ TEST_F(VersionContextDrainTest, RamdomMixedOperations) {
350350
OperationContext* opCtx = op.first->getOperationContext();
351351
invariant(opCtx);
352352

353-
if (!opCtx->isKillPending() && VersionContext::getDecoration(opCtx) != kCurrentVersion) {
353+
const bool notKillPending = !opCtx->isKillPending();
354+
const bool withStaleVersion = VersionContext::getDecoration(opCtx) == kStaleVersion;
355+
356+
if (notKillPending && withStaleVersion) {
354357
nRunningOpsStaleOfcv--;
355358
}
356359
}

0 commit comments

Comments
 (0)