summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorSamy Lanka <samy.lanka@mongodb.com>2020-07-24 18:37:33 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-11 18:47:27 +0000
commit5eb282fc586d7ba55587346c014d2610937c03a8 (patch)
treef357e20304dca9ea50ba5b23479cf23a78489417 /src/mongo/db/commands
parent7188dadfb837f4f27f85304430b2eacd93add99a (diff)
downloadmongo-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.cpp18
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 << " )");