summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Polato <paolo.polato@mongodb.com>2022-12-22 07:57:24 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-12-22 08:34:03 +0000
commitf132d69031b6554d22aef026c941eab4ddff24ca (patch)
tree343b5b429d7ed3e64bc52d97710c30b3575c305d
parent2be70c695b451e70a36174ce2704c71a95f21e53 (diff)
downloadmongo-f132d69031b6554d22aef026c941eab4ddff24ca.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.cpp7
1 files changed, 7 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..2f3c292cc53 100644
--- a/src/mongo/db/s/create_collection_coordinator.cpp
+++ b/src/mongo/db/s/create_collection_coordinator.cpp
@@ -493,6 +493,13 @@ 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(),
+ *createCollectionResponseOpt->getCollectionUUID(),
+ _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