diff options
author | Enrico Golfieri <enrico.golfieri@mongodb.com> | 2022-07-12 09:11:35 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-07-12 09:51:45 +0000 |
commit | b45994f9b363a24be2126dc628f6fd43213c438b (patch) | |
tree | 9cdba9c987e3c1e2f3767e6c41d27da1e8de6fd8 /src | |
parent | 06447495aafc669b7212f9da10619fd2a3747332 (diff) | |
download | mongo-b45994f9b363a24be2126dc628f6fd43213c438b.tar.gz |
SERVER-67730 CSRS stepdown during rename must not leave orphned entries in `config.chunks`
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/s/rename_collection_coordinator.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/s/rename_collection_coordinator.cpp b/src/mongo/db/s/rename_collection_coordinator.cpp index b96a89e62d7..2df1f73ada5 100644 --- a/src/mongo/db/s/rename_collection_coordinator.cpp +++ b/src/mongo/db/s/rename_collection_coordinator.cpp @@ -335,6 +335,18 @@ ExecutorFuture<void> RenameCollectionCoordinator::_runImpl( "admin", cmdObj.addFields(getCurrentSession().toBSON()), Shard::RetryPolicy::kIdempotent))); + + // (SERVER-67730) Delete potential orphaned chunk entries from CSRS since + // ConfigsvrRenameCollectionMetadata is not idempotent in case of a CSRS step-down + auto uuid = _doc.getTargetUUID(); + if (uuid) { + auto query = BSON("uuid" << *uuid); + uassertStatusOK(Grid::get(opCtx)->catalogClient()->removeConfigDocuments( + opCtx, + ChunkType::ConfigNS, + query, + ShardingCatalogClient::kMajorityWriteConcern)); + } })) .then(_executePhase( Phase::kUnblockCRUD, |