diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2021-10-29 19:13:04 +0200 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-31 08:03:14 +0000 |
commit | 5a75cc4c9fc29b462f4d4a5d56096b804a009b07 (patch) | |
tree | f77ab6936f2ca2e9fe8d191ae65de05923bca4e6 /src | |
parent | 6699c75fb23b5640c94a8c21fa4ad757a21f56b4 (diff) | |
download | mongo-5a75cc4c9fc29b462f4d4a5d56096b804a009b07.tar.gz |
Revert "SERVER-60081 Make ChunkVersion::IGNORED not consider the migration critical section"
This reverts commit a83b0c692c886a595b27358fc5eb585547e0297a.
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/s/collection_sharding_runtime.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/mongo/db/s/collection_sharding_runtime.cpp b/src/mongo/db/s/collection_sharding_runtime.cpp index 3ca33e0f85a..c08134ab030 100644 --- a/src/mongo/db/s/collection_sharding_runtime.cpp +++ b/src/mongo/db/s/collection_sharding_runtime.cpp @@ -333,23 +333,24 @@ CollectionShardingRuntime::_getMetadataWithVersionCheckAt( const auto& currentMetadata = optCurrentMetadata->get(); - if (ChunkVersion::isIgnoredVersion(receivedShardVersion)) - return optCurrentMetadata; - auto wantedShardVersion = currentMetadata.getShardVersion(); - if (auto criticalSectionSignal = _critSec.getSignal( + { + auto criticalSectionSignal = _critSec.getSignal( opCtx->lockState()->isWriteLocked() ? ShardingMigrationCriticalSection::kWrite - : ShardingMigrationCriticalSection::kRead)) { - uasserted(StaleConfigInfo(_nss, - receivedShardVersion, - wantedShardVersion, - ShardingState::get(opCtx)->shardId(), - std::move(criticalSectionSignal)), - str::stream() << "migration commit in progress for " << _nss.ns()); + : ShardingMigrationCriticalSection::kRead); + + uassert(StaleConfigInfo(_nss, + receivedShardVersion, + wantedShardVersion, + ShardingState::get(opCtx)->shardId(), + std::move(criticalSectionSignal)), + str::stream() << "migration commit in progress for " << _nss.ns(), + !criticalSectionSignal); } - if (wantedShardVersion.isWriteCompatibleWith(receivedShardVersion)) + if (wantedShardVersion.isWriteCompatibleWith(receivedShardVersion) || + ChunkVersion::isIgnoredVersion(receivedShardVersion)) return optCurrentMetadata; StaleConfigInfo sci( |