From c72363a27709f9ac73cbb8dfbb53a4e27c19a3c9 Mon Sep 17 00:00:00 2001 From: Gregory Wlodarek Date: Mon, 12 Sep 2022 14:53:18 +0000 Subject: SERVER-60753 Skip removing index build entries explicitly from 'config.system.indexBuilds' when recovering from the oplog as a standalone (cherry picked from commit c7f9bb9676a8859a21aaea5fdd81e23a4e9d79e8) --- .../standalone_replication_recovery_relaxes_index_constraints.js | 5 +++++ src/mongo/db/index_builds_coordinator.cpp | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jstests/replsets/standalone_replication_recovery_relaxes_index_constraints.js b/jstests/replsets/standalone_replication_recovery_relaxes_index_constraints.js index 3b8de49b3bd..596192d5955 100644 --- a/jstests/replsets/standalone_replication_recovery_relaxes_index_constraints.js +++ b/jstests/replsets/standalone_replication_recovery_relaxes_index_constraints.js @@ -57,6 +57,11 @@ node = rst.restart(node, { noReplSet: true, setParameter: {recoverFromOplogAsStandalone: true, logComponentVerbosity: logLevel} }); + +// Verify that the 'config.system.indexBuilds' collection is empty after recovering from the oplog +// in standalone mode. +assert.eq(0, node.getCollection("config.system.indexBuilds").count()); + reconnect(node); rst.stopSet(); diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp index 0cf8bf00c6a..e801fd1c9fd 100644 --- a/src/mongo/db/index_builds_coordinator.cpp +++ b/src/mongo/db/index_builds_coordinator.cpp @@ -192,8 +192,9 @@ void removeIndexBuildEntryAfterCommitOrAbort(OperationContext* opCtx, } if (replCoord->getSettings().shouldRecoverFromOplogAsStandalone()) { - // TODO SERVER-60753: Remove this mixed-mode write. - opCtx->recoveryUnit()->allowUntimestampedWrite(); + // Writes to the 'config.system.indexBuilds' collection are replicated and the index entry + // will be removed when the delete oplog entry is replayed at a later time. + return; } auto status = indexbuildentryhelpers::removeIndexBuildEntry( -- cgit v1.2.1