summaryrefslogtreecommitdiff
path: root/src/mongo/db/index_builds_coordinator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/index_builds_coordinator.cpp')
-rw-r--r--src/mongo/db/index_builds_coordinator.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp
index 30b66e249b5..0c3cea6fc00 100644
--- a/src/mongo/db/index_builds_coordinator.cpp
+++ b/src/mongo/db/index_builds_coordinator.cpp
@@ -191,6 +191,11 @@ void removeIndexBuildEntryAfterCommitOrAbort(OperationContext* opCtx,
return;
}
+ if (replCoord->getSettings().shouldRecoverFromOplogAsStandalone()) {
+ // TODO SERVER-60753: Remove this mixed-mode write.
+ opCtx->recoveryUnit()->allowUntimestampedWrite();
+ }
+
auto status = indexbuildentryhelpers::removeIndexBuildEntry(
opCtx, indexBuildEntryCollection, replState.buildUUID);
if (!status.isOK()) {
@@ -545,6 +550,10 @@ Status IndexBuildsCoordinator::_startIndexBuildForRecovery(OperationContext* opC
CollectionWriter collection(opCtx, nss);
{
+ // TODO SERVER-64760: Remove this usage of `allowUntimestampedWrite`. We often have a valid
+ // timestamp for this write, but the callers of this function don't pass it through.
+ opCtx->recoveryUnit()->allowUntimestampedWrite();
+
// These steps are combined into a single WUOW to ensure there are no commits without
// the indexes.
// 1) Drop all unfinished indexes.
@@ -1880,6 +1889,12 @@ Status IndexBuildsCoordinator::_setUpIndexBuildForTwoPhaseRecovery(
const UUID& buildUUID) {
NamespaceStringOrUUID nssOrUuid{dbName.toString(), collectionUUID};
+ if (opCtx->recoveryUnit()->isActive()) {
+ // This function is shared by multiple callers. Some of which have opened a transaction to
+ // perform reads. This function may make mixed-mode writes. Mixed-mode assertions can only
+ // be suppressed when beginning a fresh transaction.
+ opCtx->recoveryUnit()->abandonSnapshot();
+ }
// Don't use the AutoGet helpers because they require an open database, which may not be the
// case when an index builds is restarted during recovery.
@@ -2057,6 +2072,10 @@ IndexBuildsCoordinator::PostSetupAction IndexBuildsCoordinator::_setUpIndexBuild
options.protocol = replState->protocol;
try {
+ // TODO SERVER-64760: Remove this usage of `allowUntimestampedWrite`. There are cases where
+ // a timestamp is available to use, but the information is not passed through.
+ opCtx->recoveryUnit()->allowUntimestampedWrite();
+
if (!replSetAndNotPrimary) {
// On standalones and primaries, call setUpIndexBuild(), which makes the initial catalog
// write. On primaries, this replicates the startIndexBuild oplog entry.