diff options
Diffstat (limited to 'src/mongo/db/s/collection_sharding_runtime_test.cpp')
| -rw-r--r-- | src/mongo/db/s/collection_sharding_runtime_test.cpp | 50 |
1 files changed, 5 insertions, 45 deletions
diff --git a/src/mongo/db/s/collection_sharding_runtime_test.cpp b/src/mongo/db/s/collection_sharding_runtime_test.cpp index d4cc012de28..dcee5b73ac0 100644 --- a/src/mongo/db/s/collection_sharding_runtime_test.cpp +++ b/src/mongo/db/s/collection_sharding_runtime_test.cpp @@ -289,16 +289,14 @@ public: StaticCatalogClient(std::vector<ShardType> shards) : _shards(std::move(shards)) {} StatusWith<repl::OpTimeWith<std::vector<ShardType>>> getAllShards( - OperationContext* opCtx, - repl::ReadConcernLevel readConcern, - bool excludeDraining) override { + OperationContext* opCtx, repl::ReadConcernLevel readConcern) override { return repl::OpTimeWith<std::vector<ShardType>>(_shards); } - std::vector<CollectionType> getCollections(OperationContext* opCtx, - StringData dbName, - repl::ReadConcernLevel readConcernLevel, - const BSONObj& sort) override { + std::vector<CollectionType> getCollections( + OperationContext* opCtx, + StringData dbName, + repl::ReadConcernLevel readConcernLevel) override { return _colls; } @@ -541,43 +539,5 @@ TEST_F(CollectionShardingRuntimeWithRangeDeleterTest, ASSERT(cleanupComplete.isReady()); } -TEST_F(CollectionShardingRuntimeWithRangeDeleterTest, - WaitForCleanCorrectEvenAfterClearFollowedBySetFilteringMetadata) { - globalFailPointRegistry().find("suspendRangeDeletion")->setMode(FailPoint::alwaysOn); - ScopeGuard resetFailPoint( - [=] { globalFailPointRegistry().find("suspendRangeDeletion")->setMode(FailPoint::off); }); - - OperationContext* opCtx = operationContext(); - auto metadata = makeShardedMetadata(opCtx, uuid()); - csr().setFilteringMetadata(opCtx, metadata); - const ChunkRange range = ChunkRange(BSON(kShardKey << MINKEY), BSON(kShardKey << MAXKEY)); - const auto task = insertRangeDeletionTask(opCtx, kTestNss, uuid(), range, 0); - - // Schedule range deletion that will hang due to `suspendRangeDeletion` failpoint - auto cleanupComplete = - csr().cleanUpRange(range, task.getId(), CollectionShardingRuntime::CleanWhen::kNow); - - // Clear and set again filtering metadata - csr().clearFilteringMetadata(opCtx); - csr().setFilteringMetadata(opCtx, metadata); - - auto waitForCleanUp = [&](Date_t timeout) { - return CollectionShardingRuntime::waitForClean(opCtx, kTestNss, uuid(), range, timeout); - }; - - // Check that the hanging range deletion is still tracked even following a clear of the metadata - auto status = waitForCleanUp(Date_t::now() + Milliseconds(100)); - ASSERT_NOT_OK(status); - ASSERT(!cleanupComplete.isReady()); - - globalFailPointRegistry().find("suspendRangeDeletion")->setMode(FailPoint::off); - resetFailPoint.dismiss(); - - // Check that the range deletion is not tracked anymore after it succeeds - status = waitForCleanUp(Date_t::max()); - ASSERT_OK(status); - ASSERT(cleanupComplete.isReady()); -} - } // namespace } // namespace mongo |
