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-11 18:47:27 +0000 |
commit | 5eb282fc586d7ba55587346c014d2610937c03a8 (patch) | |
tree | f357e20304dca9ea50ba5b23479cf23a78489417 /src/mongo/db/commands | |
parent | 7188dadfb837f4f27f85304430b2eacd93add99a (diff) | |
download | mongo-5eb282fc586d7ba55587346c014d2610937c03a8.tar.gz |
SERVER-47604 Don't log that index build failed if it continues in the background due to a repl state transition
Diffstat (limited to 'src/mongo/db/commands')
-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 0a9e6c50e56..25a58800dbc 100644 --- a/src/mongo/db/commands/create_indexes.cpp +++ b/src/mongo/db/commands/create_indexes.cpp @@ -584,6 +584,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)); @@ -610,9 +611,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; } } @@ -648,9 +647,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; } @@ -679,8 +676,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 << " )"); |