summaryrefslogtreecommitdiff
path: root/src/mongo/db/index_builds_coordinator_mongod.cpp
diff options
context:
space:
mode:
authorYu Jin Kang Park <yujin.kang@mongodb.com>2023-04-25 08:17:38 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-25 08:58:22 +0000
commit49af32533833ff66b0a65dc93394ac09ddeab807 (patch)
tree3319ef67795a2802e631eb74945600a7175669af /src/mongo/db/index_builds_coordinator_mongod.cpp
parentc35bad3b048e8d885bf0b7517aacd2349ea81d14 (diff)
downloadmongo-49af32533833ff66b0a65dc93394ac09ddeab807.tar.gz
SERVER-76170 Disallow vote abort if the node already voted commit for index build
Diffstat (limited to 'src/mongo/db/index_builds_coordinator_mongod.cpp')
-rw-r--r--src/mongo/db/index_builds_coordinator_mongod.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/index_builds_coordinator_mongod.cpp b/src/mongo/db/index_builds_coordinator_mongod.cpp
index 013d1dbd527..5a5773b1877 100644
--- a/src/mongo/db/index_builds_coordinator_mongod.cpp
+++ b/src/mongo/db/index_builds_coordinator_mongod.cpp
@@ -798,6 +798,14 @@ void IndexBuildsCoordinatorMongod::_signalPrimaryForCommitReadiness(
logAttrs(replState->dbName),
"collectionUUID"_attr = replState->collectionUUID);
+ // Indicate that the index build in this node has already tried to vote for commit readiness.
+ // We do not try to determine whether the vote has actually succeeded or not, as it is
+ // challenging due to the asynchronous request and potential concurrent interrupts. After this
+ // point, the node cannot vote to abort this index build, and if it needs to abort the index
+ // build it must try to do so independently. Meaning, as a primary it will succeed, but as a
+ // secondary it will fassert.
+ replState->setVotedForCommitReadiness(opCtx);
+
const auto generateCmd = [](const UUID& uuid, const std::string& address) {
return BSON("voteCommitIndexBuild" << uuid << "hostAndPort" << address << "writeConcern"
<< BSON("w"