summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/collection_sharding_runtime_test.cpp
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2020-03-11 18:29:23 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-11 23:13:38 +0000
commit90eefa051e6015514dcc6256d0f42b76bf041a76 (patch)
tree734352949bfc4a13ef69493616acbc05aae2306a /src/mongo/db/s/collection_sharding_runtime_test.cpp
parentabd4c261113bb98cbacef3db12d48b38344b5399 (diff)
downloadmongo-90eefa051e6015514dcc6256d0f42b76bf041a76.tar.gz
SERVER-46395 Ensure range deletion task document exists during deletion.
Changes the range deletion task to guarantee a batch of documents can only be removed while the corresponding range deletion task document exists. If the range deletion task document doesn't exist or a stepdown could lead to it not existing, then the range deletion task is abandoned. Changes the deletion of the range deletion task document to use the _id index of the config.rangeDeletions collection rather than being a collection scan.
Diffstat (limited to 'src/mongo/db/s/collection_sharding_runtime_test.cpp')
-rw-r--r--src/mongo/db/s/collection_sharding_runtime_test.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/s/collection_sharding_runtime_test.cpp b/src/mongo/db/s/collection_sharding_runtime_test.cpp
index 103dad1eef9..3d5616d5068 100644
--- a/src/mongo/db/s/collection_sharding_runtime_test.cpp
+++ b/src/mongo/db/s/collection_sharding_runtime_test.cpp
@@ -273,6 +273,7 @@ TEST_F(CollectionShardingRuntimeWithRangeDeleterTest,
auto cleanupComplete =
csr().cleanUpRange(ChunkRange(BSON(kShardKey << MINKEY), BSON(kShardKey << MAXKEY)),
+ boost::none,
CollectionShardingRuntime::CleanWhen::kNow);
operationContext()->setDeadlineAfterNowBy(Milliseconds(100), ErrorCodes::MaxTimeMSExpired);
@@ -297,10 +298,12 @@ TEST_F(CollectionShardingRuntimeWithRangeDeleterTest,
auto cleanupCompleteFirst =
csr().cleanUpRange(ChunkRange(BSON(kShardKey << MINKEY), BSON(kShardKey << middleKey)),
+ boost::none,
CollectionShardingRuntime::CleanWhen::kNow);
auto cleanupCompleteSecond =
csr().cleanUpRange(ChunkRange(BSON(kShardKey << middleKey), BSON(kShardKey << MAXKEY)),
+ boost::none,
CollectionShardingRuntime::CleanWhen::kNow);
auto status = CollectionShardingRuntime::waitForClean(
@@ -325,6 +328,7 @@ TEST_F(CollectionShardingRuntimeWithRangeDeleterTest,
auto cleanupComplete =
csr().cleanUpRange(ChunkRange(BSON(kShardKey << MINKEY), BSON(kShardKey << MAXKEY)),
+ boost::none,
CollectionShardingRuntime::CleanWhen::kNow);
auto status = CollectionShardingRuntime::waitForClean(