summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllison Easton <allison.easton@mongodb.com>2022-08-30 07:32:10 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-05 06:48:32 +0000
commit6863b640032e056b25fa8a1ea328b9f07cda4977 (patch)
tree5c5641fcab9e800aaf61588217153958c475faa2
parentcd67916e3d99adcb85b1db846b5518400d7115de (diff)
downloadmongo-6863b640032e056b25fa8a1ea328b9f07cda4977.tar.gz
SERVER-69180 Split and Merge commands need to refresh filtering metadata before checking preconditions
(cherry picked from commit 3f101399b8b165cb1e3a70bd56d9be7978124f51)
-rw-r--r--src/mongo/db/s/shardsvr_merge_chunks_command.cpp1
-rw-r--r--src/mongo/db/s/shardsvr_split_chunk_command.cpp2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/s/shardsvr_merge_chunks_command.cpp b/src/mongo/db/s/shardsvr_merge_chunks_command.cpp
index 7c844d3444f..3c049387b8f 100644
--- a/src/mongo/db/s/shardsvr_merge_chunks_command.cpp
+++ b/src/mongo/db/s/shardsvr_merge_chunks_command.cpp
@@ -95,6 +95,7 @@ void mergeChunks(OperationContext* opCtx,
// Check that the preconditions for merge chunks are met and throw StaleShardVersion otherwise.
const auto metadataBeforeMerge = [&]() {
+ onShardVersionMismatch(opCtx, nss, boost::none);
OperationShardingState::unsetShardRoleForLegacyDDLOperationsSentWithShardVersionIfNeeded(
opCtx, nss);
const auto metadata = checkCollectionIdentity(opCtx, nss, expectedEpoch, expectedTimestamp);
diff --git a/src/mongo/db/s/shardsvr_split_chunk_command.cpp b/src/mongo/db/s/shardsvr_split_chunk_command.cpp
index bdcae8af9ad..3d11f8990fc 100644
--- a/src/mongo/db/s/shardsvr_split_chunk_command.cpp
+++ b/src/mongo/db/s/shardsvr_split_chunk_command.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/s/chunk_operation_precondition_checks.h"
#include "mongo/db/s/collection_sharding_runtime.h"
#include "mongo/db/s/operation_sharding_state.h"
+#include "mongo/db/s/shard_filtering_metadata_refresh.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/s/split_chunk.h"
#include "mongo/logv2/log.h"
@@ -159,6 +160,7 @@ public:
// Check that the preconditions for split chunk are met and throw StaleShardVersion
// otherwise.
{
+ onShardVersionMismatch(opCtx, nss, boost::none);
OperationShardingState::
unsetShardRoleForLegacyDDLOperationsSentWithShardVersionIfNeeded(opCtx, nss);
const auto metadata = checkCollectionIdentity(