SERVER-125628 mergeChunks should leave shard catalog metadata non-authoritative (#53953)

GitOrigin-RevId: 8c0ed7e62f31b5e3ee654619a9cddab87d90ce0e
This commit is contained in:
Silvia Surroca 2026-05-19 13:22:42 +02:00 committed by MongoDB Bot
parent f3d4df67b4
commit c8bd5e574f
2 changed files with 14 additions and 1 deletions

View File

@ -143,6 +143,19 @@ ExecutorFuture<void> MergeChunksCoordinator::_runImpl(
return metadata;
}();
// Because this is a non-authoritative update, we must mark the CSR metadata as
// kNonAuthoritative so that the following refresh will fetch the metadata from the config
// server. Leaving it kAuthoritative would short-circuit the refresh against the durable
// shard catalog and keep the CSR pinned to the pre-merge version. This must be done before
// starting the operation to ensure the CSR is left as kNonAuthoritative in case of an
// unexpected failure.
// TODO (SERVER-125784) The clearFilteringMetadata_nonAuthoritative should go away once
// merge becomes authoritative.
{
auto scopedCsr = CollectionShardingRuntime::acquireExclusive(opCtx, nss());
scopedCsr->clearFilteringMetadata_nonAuthoritative(opCtx);
}
auto const shardingState = ShardingState::get(opCtx);
ConfigSvrMergeChunks configRequest{

View File

@ -197,7 +197,7 @@ public:
// Because this is a non-authoritative update, we must mark the CSR metadata as
// kNonAuthoritative so that the following refresh will fetch the metadata from the
// config server. Leaving it kAuthoritative would short-circuit the refresh against the
// durable shard catalog and keep the CSR pinned to the pre-split version.
// durable shard catalog and keep the CSR pinned to the pre-merge version.
// This must be done before starting the operation to ensure the CSR is left as
// kNonAuthoritative in case of an unexpected failure.
// TODO (SERVER-125784) The clearFilteringMetadata_nonAuthoritative should go away once