diff options
author | Sergi Mateo Bellido <sergi.mateo-bellido@mongodb.com> | 2022-09-14 10:01:04 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-14 10:27:13 +0000 |
commit | d23fde882fbf40b56b906a25d4f1a9c127574b99 (patch) | |
tree | 0ae1dc1355c72bbd3d77084bd662d0f4b3859197 | |
parent | e5de2ad1815d9a9a6a0783c520985cdb0d2a3f06 (diff) | |
download | mongo-d23fde882fbf40b56b906a25d4f1a9c127574b99.tar.gz |
Revert "SERVER-64730 Interrupt ongoing refreshes after entering into the critical section"
This reverts commit e5de2ad1815d9a9a6a0783c520985cdb0d2a3f06.
4 files changed, 7 insertions, 17 deletions
diff --git a/jstests/sharding/libs/resharding_test_fixture.js b/jstests/sharding/libs/resharding_test_fixture.js index 8925c6dca88..330d68892fb 100644 --- a/jstests/sharding/libs/resharding_test_fixture.js +++ b/jstests/sharding/libs/resharding_test_fixture.js @@ -598,11 +598,7 @@ var ReshardingTest = class { /** @private */ _checkConsistency() { - // The "available" read concern level won't block this find cmd behind the critical section. - // Tests for resharding are not expected to have unowned documents in the collection being - // resharded. - const nsCursor = - this._st.s.getCollection(this._ns).find().readConcern("available").sort({_id: 1}); + const nsCursor = this._st.s.getCollection(this._ns).find().sort({_id: 1}); const tempNsCursor = this._st.s.getCollection(this._tempNs).find().sort({_id: 1}); const diff = ((diff) => { diff --git a/src/mongo/db/s/collection_sharding_runtime.cpp b/src/mongo/db/s/collection_sharding_runtime.cpp index 4960ed1166c..539c5ad0a87 100644 --- a/src/mongo/db/s/collection_sharding_runtime.cpp +++ b/src/mongo/db/s/collection_sharding_runtime.cpp @@ -157,10 +157,6 @@ void CollectionShardingRuntime::checkShardVersionOrThrow(OperationContext* opCtx void CollectionShardingRuntime::enterCriticalSectionCatchUpPhase(const CSRLock&, const BSONObj& reason) { _critSec.enterCriticalSectionCatchUpPhase(reason); - - if (_shardVersionInRecoverOrRefresh) { - _shardVersionInRecoverOrRefresh->cancellationSource.cancel(); - } } void CollectionShardingRuntime::enterCriticalSectionCommitPhase(const CSRLock&, diff --git a/src/mongo/db/s/collection_sharding_runtime.h b/src/mongo/db/s/collection_sharding_runtime.h index 6af24245375..c38e571ac49 100644 --- a/src/mongo/db/s/collection_sharding_runtime.h +++ b/src/mongo/db/s/collection_sharding_runtime.h @@ -119,10 +119,10 @@ public: * Marks the collection's filtering metadata as UNKNOWN, meaning that all attempts to check for * shard version match will fail with StaleConfig errors in order to trigger an update. * - * Interrupts any ongoing shard metadata refresh. - * * It is safe to call this method with only an intent lock on the collection (as opposed to - * setFilteringMetadata which requires exclusive). + * setFilteringMetadata which requires exclusive), however note that clearing a collection's + * filtering metadata will interrupt all in-progress orphan cleanups in which case orphaned data + * will remain behind on disk. */ void clearFilteringMetadata(OperationContext* opCtx); @@ -131,8 +131,6 @@ public: * with both the collection lock and CSRLock held in exclusive mode. * * In these methods, the CSRLock ensures concurrent access to the critical section. - * - * Entering into the Critical Section interrupts any ongoing filtering metadata refresh. */ void enterCriticalSectionCatchUpPhase(const CSRLock&, const BSONObj& reason); void enterCriticalSectionCommitPhase(const CSRLock&, const BSONObj& reason); diff --git a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp index 60684b85385..c00d00ff670 100644 --- a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp +++ b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp @@ -128,7 +128,8 @@ bool joinShardVersionOperation(OperationContext* opCtx, try { inRecoverOrRefresh->get(opCtx); } catch (const ExceptionFor<ErrorCodes::ShardVersionRefreshCanceled>&) { - // The ongoing refresh has finished, although it was interrupted. + // The ongoing refresh has finished, although it was canceled by a + // 'clearFilteringMetadata'. } } @@ -225,8 +226,7 @@ SharedSemiFuture<void> recoverRefreshShardVersion(ServiceContext* serviceContext if (cancellationToken.isCanceled() && (status.isOK() || status == ErrorCodes::Interrupted)) { uasserted(ErrorCodes::ShardVersionRefreshCanceled, - "Shard version refresh canceled by an interruption, probably due to a " - "'clearFilteringMetadata'"); + "Shard version refresh canceled by a 'clearFilteringMetadata'"); } return status; }) |