diff options
author | Josef Ahmad <josef.ahmad@mongodb.com> | 2023-05-11 17:28:23 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-11 21:10:01 +0000 |
commit | d4fd4604a6f857504d7b6bf37478b5ac06a99d4c (patch) | |
tree | 8986afc182ab3507656902873f5bc923bd59adcb /src/mongo/db/index_builds_coordinator.cpp | |
parent | a732d6f8067c089e27a293a01e47e1526709626d (diff) | |
download | mongo-d4fd4604a6f857504d7b6bf37478b5ac06a99d4c.tar.gz |
SERVER-74210 Improve createIndexes errmsg on secondary abort
Diffstat (limited to 'src/mongo/db/index_builds_coordinator.cpp')
-rw-r--r-- | src/mongo/db/index_builds_coordinator.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp index 17fe7380a5d..851f35d8a3f 100644 --- a/src/mongo/db/index_builds_coordinator.cpp +++ b/src/mongo/db/index_builds_coordinator.cpp @@ -2846,6 +2846,15 @@ void IndexBuildsCoordinator::_runIndexBuildInner( } } + // Replace the status with the replica set index build state. + // This returns a meaningful error message to the createIndexes caller in case of an external + // abort, e.g. a secondary voting to abort the index build. Not doing so would return a generic, + // not too helpful "operation was interrupted" error message, because the 'voteAbortIndexBuild' + // command kills the index build's operation context. + if (replState->isAborted()) { + status.addContext(replState->getAbortStatus().reason()); + } + // If the index build has already been cleaned-up because it encountered an error, there is no // work to do. If feature flag IndexBuildGracefulErrorHandling is not enabled, the most routine // case is for this to be due to a self-abort caused by constraint checking during the commit |