0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-50446 make index builds non-resumable when commit quorum is disabled

This commit is contained in:
Benety Goh 2020-08-25 06:39:26 -04:00 committed by Evergreen Agent
parent 0439b7a1bf
commit 7e9b19f630

View File

@ -413,6 +413,28 @@ bool isIndexBuildResumable(OperationContext* opCtx,
return false;
}
// IndexBuildsOptions::commitQuorum will be set if we are primary. Otherwise, we have to check
// the config.system.indexBuilds collection.
if (indexBuildOptions.commitQuorum) {
if (indexBuildOptions.commitQuorum->numNodes == CommitQuorumOptions::kDisabled) {
return false;
}
} else {
auto swCommitQuorum = indexbuildentryhelpers::getCommitQuorum(opCtx, replState.buildUUID);
if (!swCommitQuorum.isOK()) {
LOGV2(5044600,
"Index build: cannot read commit quorum from config db. "
"Index build will not be resumable.",
"buildUUID"_attr = replState.buildUUID,
"error"_attr = swCommitQuorum.getStatus());
return false;
}
auto commitQuorum = swCommitQuorum.getValue();
if (commitQuorum.numNodes == CommitQuorumOptions::kDisabled) {
return false;
}
}
return true;
}