diff options
author | Benety Goh <benety@mongodb.com> | 2019-10-26 00:12:41 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-26 00:12:41 +0000 |
commit | 3d9d8d9989c3f1912c934b9c22c9413ab1495af0 (patch) | |
tree | 1637bac3f2942de1f670b08424f8d849de133b30 | |
parent | ea85dc042b53aff72b2566ba9bdd0bf6c83f561b (diff) | |
download | mongo-3d9d8d9989c3f1912c934b9c22c9413ab1495af0.tar.gz |
SERVER-44186 createIndexes command logs interruption exception details
-rw-r--r-- | src/mongo/db/commands/create_indexes.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp index 93de2e317de..3567b3509ba 100644 --- a/src/mongo/db/commands/create_indexes.cpp +++ b/src/mongo/db/commands/create_indexes.cpp @@ -729,28 +729,32 @@ bool runCreateIndexesWithCoordinator(OperationContext* opCtx, try { stats = buildIndexFuture.get(opCtx); } catch (const ExceptionForCat<ErrorCategory::Interruption>& interruptionEx) { + log() << "Index build interrupted: " << buildUUID << ": " << interruptionEx; + // It is unclear whether the interruption originated from the current opCtx instance // for the createIndexes command or that the IndexBuildsCoordinator task was interrupted // independently of this command invocation. We'll defensively abort the index build // with the assumption that if the index build was already in the midst of tearing down, // this be a no-op. - log() << "Index build interrupted: " << buildUUID << ": aborting index build."; indexBuildsCoord->abortIndexBuildByBuildUUID( opCtx, buildUUID, str::stream() << "Index build interrupted: " << buildUUID << ": " << interruptionEx.toString()); log() << "Index build aborted: " << buildUUID; + throw; } catch (const ExceptionForCat<ErrorCategory::NotMasterError>& ex) { - log() << "Index build interrupted: " << buildUUID - << ": aborting index build due to change in replication state."; + log() << "Index build interrupted due to change in replication state: " << buildUUID + << ": " << ex; + indexBuildsCoord->abortIndexBuildByBuildUUID( opCtx, buildUUID, str::stream() << "Index build interrupted due to change in replication state: " << buildUUID << ": " << ex.toString()); log() << "Index build aborted due to NotMaster error: " << buildUUID; + throw; } |