summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierlauro Sciarelli <pierlauro.sciarelli@mongodb.com>2021-06-22 07:32:16 +0000
committerPierlauro Sciarelli <pierlauro.sciarelli@mongodb.com>2021-06-22 10:08:53 +0000
commit229bb7ded25205abe83d11980a42282639f4a137 (patch)
treec285041d90bb61d459121c353595f78ce09ae466
parentb26580dfde7dcf4889b3485a7223431de6a64224 (diff)
downloadmongo-229bb7ded25205abe83d11980a42282639f4a137.tar.gz
SERVER-57847 RenameRangeDeletionsTest fixture should join the MigrationUtilExecutor on teardown
-rw-r--r--src/mongo/db/s/range_deletion_util_test.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mongo/db/s/range_deletion_util_test.cpp b/src/mongo/db/s/range_deletion_util_test.cpp
index 5ae6cd644a9..7dcfb1f6cf3 100644
--- a/src/mongo/db/s/range_deletion_util_test.cpp
+++ b/src/mongo/db/s/range_deletion_util_test.cpp
@@ -140,15 +140,20 @@ class RenameRangeDeletionsTest : public RangeDeleterTest {
public:
const NamespaceString kToNss = NamespaceString(kNss.db(), "toColl");
+ void setUp() override {
+ RangeDeleterTest::setUp();
+
+ // Suspending range deletions in order to rename tasks with "pending" set to false.
+ // Otherwise, they could potentially complete before the rename.
+ globalFailPointRegistry().find("suspendRangeDeletion")->setMode(FailPoint::alwaysOn);
+ }
+
void tearDown() override {
DBDirectClient client(operationContext());
- client.dropCollection(kNss.ns());
client.dropCollection(kToNss.ns());
-
- migrationutil::getMigrationUtilExecutor(getServiceContext())->shutdown();
-
- WaitForMajorityService::get(getServiceContext()).shutDown();
- ShardServerTestFixture::tearDown();
+ // Re-enabling range deletions to drain tasks on the executor
+ globalFailPointRegistry().find("suspendRangeDeletion")->setMode(FailPoint::off);
+ RangeDeleterTest::tearDown();
}
};
@@ -946,6 +951,7 @@ TEST_F(RenameRangeDeletionsTest, BasicRenameRangeDeletionsTest) {
const auto range = ChunkRange(BSON(kShardKey << 0), BSON(kShardKey << 1));
RangeDeletionTask task(
UUID::gen(), kNss, UUID::gen(), ShardId("donor"), range, CleanWhenEnum::kDelayed);
+ task.setPending(false);
tasks.push_back(task);
rangeDeletionsStore.add(operationContext(), task);
}
@@ -992,6 +998,7 @@ TEST_F(RenameRangeDeletionsTest, IdempotentRenameRangeDeletionsTest) {
RangeDeletionTask task(
UUID::gen(), kNss, UUID::gen(), ShardId("donor"), range, CleanWhenEnum::kDelayed);
tasks.push_back(task);
+ task.setPending(false);
rangeDeletionsStore.add(operationContext(), task);
}