Skip to content

Commit ae79b7d

Browse files
committed
PSMDB-1078: fix TemporaryRecordStoreSimple test to handle ObjectIsBusy from dropIdent
The TemporaryRecordStoreSimple test can fail when dropIdent() returns ErrorCodes::ObjectIsBusy, which occurs when the ident is temporarily in use. This is a transient condition that should be retried. This change adds retry logic to the test, retrying dropIdent() until it succeeds when ObjectIsBusy is returned. This matches the pattern used in production code (e.g. WiredTigerKVEngine::dropIdentForImport).
1 parent 8149d23 commit ae79b7d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,14 @@ TEST_F(KVEngineTestHarness, TemporaryRecordStoreSimple) {
389389
engine->checkpoint();
390390

391391
WriteUnitOfWork wuow(opCtx.get());
392-
ASSERT_OK(engine->dropIdent(shard_role_details::getRecoveryUnit(opCtx.get()), ident));
392+
393+
// Drop the temporary record store in a loop in case it returns ErrorCodes::ObjectIsBusy
394+
Status status = Status::OK();
395+
do {
396+
status = engine->dropIdent(shard_role_details::getRecoveryUnit(opCtx.get()), ident);
397+
ASSERT(status.isOK() || status == ErrorCodes::ObjectIsBusy);
398+
} while (status == ErrorCodes::ObjectIsBusy);
399+
393400
wuow.commit();
394401
}
395402
}

0 commit comments

Comments
 (0)