summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Polato <paolo.polato@mongodb.com>2022-12-20 09:58:46 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-12-20 10:38:36 +0000
commit3972acca68f5fbb20e9395a8702a25386977820d (patch)
tree3b331452223b6d960c1e2e7bae889b5b7c859194
parent86879bd6bc684703083729f979c43a5788979014 (diff)
downloadmongo-3972acca68f5fbb20e9395a8702a25386977820d.tar.gz
SERVER-70100 Ensure at-least-once emission of oplog entry on shardCollection() completion
-rw-r--r--src/mongo/db/s/create_collection_coordinator.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/s/create_collection_coordinator.cpp b/src/mongo/db/s/create_collection_coordinator.cpp
index 31d302b9989..ba4eaf99e6e 100644
--- a/src/mongo/db/s/create_collection_coordinator.cpp
+++ b/src/mongo/db/s/create_collection_coordinator.cpp
@@ -493,6 +493,10 @@ ExecutorFuture<void> CreateCollectionCoordinator::_runImpl(
getCollation(opCtx, nss(), _request.getCollation()).second,
_request.getUnique().value_or(false))) {
+ // Ensure that the completion of the request gets recorded at least once on the
+ // oplog.
+ _writeOplogMessage(opCtx, nss(), *_collectionUUID, _request.toBSON());
+
// The critical section can still be held here if the node committed the
// sharding of the collection but then it stepped down before it managed to
// delete the coordinator document