diff options
author | Samy Lanka <samy.lanka@mongodb.com> | 2020-07-24 18:37:33 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-21 04:19:04 +0000 |
commit | a47eeed28cebfe6713c935ea70c2dfc7fa836b5a (patch) | |
tree | 296ed301a8fad52da2a7590ec0d000dee90b54c6 | |
parent | cebe3848cc403ecbb63453685c49478708d39b37 (diff) | |
download | mongo-a47eeed28cebfe6713c935ea70c2dfc7fa836b5a.tar.gz |
SERVER-47604 Don't log that index build failed if it continues in the background due to a repl state transition
(cherry picked from commit 5eb282fc586d7ba55587346c014d2610937c03a8)
-rw-r--r-- | src/mongo/db/commands/create_indexes.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp index 52103b31f4c..97333524ec4 100644 --- a/src/mongo/db/commands/create_indexes.cpp +++ b/src/mongo/db/commands/create_indexes.cpp @@ -614,6 +614,7 @@ bool runCreateIndexesWithCoordinator(OperationContext* opCtx, "firstIndex"_attr = specs[0][IndexDescriptor::kIndexNameFieldName]); hangCreateIndexesBeforeStartingIndexBuild.pauseWhileSet(opCtx); + bool shouldContinueInBackground = false; try { auto buildIndexFuture = uassertStatusOK(indexBuildsCoord->startIndexBuild( opCtx, dbname, *collectionUUID, specs, buildUUID, protocol, indexBuildOptions)); @@ -640,9 +641,7 @@ bool runCreateIndexesWithCoordinator(OperationContext* opCtx, // background and will complete when this node receives a commitIndexBuild oplog // entry from the new primary. if (ErrorCodes::InterruptedDueToReplStateChange == interruptionEx.code()) { - LOGV2(20442, - "Index build: ignoring interrupt and continuing in background", - "buildUUID"_attr = buildUUID); + shouldContinueInBackground = true; throw; } } @@ -678,9 +677,7 @@ bool runCreateIndexesWithCoordinator(OperationContext* opCtx, // background and will complete when this node receives a commitIndexBuild oplog // entry from the new primary. if (IndexBuildProtocol::kTwoPhase == protocol) { - LOGV2(20445, - "Index build: ignoring interrupt and continuing in background", - "buildUUID"_attr = buildUUID); + shouldContinueInBackground = true; throw; } @@ -709,8 +706,15 @@ bool runCreateIndexesWithCoordinator(OperationContext* opCtx, return true; } + if (shouldContinueInBackground) { + LOGV2(4760400, + "Index build: ignoring interrupt and continuing in background", + "buildUUID"_attr = buildUUID); + } else { + LOGV2(20449, "Index build: failed", "buildUUID"_attr = buildUUID, "error"_attr = ex); + } + // All other errors should be forwarded to the caller with index build information included. - LOGV2(20449, "Index build: failed", "buildUUID"_attr = buildUUID, "error"_attr = ex); ex.addContext(str::stream() << "Index build failed: " << buildUUID << ": Collection " << ns << " ( " << *collectionUUID << " )"); |