summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMatthew Saltz <matthew.saltz@mongodb.com>2020-01-31 15:54:05 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-01-31 21:22:38 +0000
commit9f61271cd1027ff787efc5b1259a7d20e446ed99 (patch)
tree01961b6bed307126e74595a25b5586380b24f0d7 /src/mongo
parenta9aab7d9449cff5cd7e17b8221e700dc041da2c1 (diff)
downloadmongo-9f61271cd1027ff787efc5b1259a7d20e446ed99.tar.gz
SERVER-45913 Suspend range deletion for racy MetadataManager unit tests
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/s/metadata_manager_test.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/db/s/metadata_manager_test.cpp b/src/mongo/db/s/metadata_manager_test.cpp
index a36d99e0a75..05907e39215 100644
--- a/src/mongo/db/s/metadata_manager_test.cpp
+++ b/src/mongo/db/s/metadata_manager_test.cpp
@@ -179,9 +179,12 @@ TEST_F(MetadataManagerTest, CleanUpForMigrateIn) {
ASSERT_EQ(0UL, _manager->numberOfRangesToCleanStillInUse());
}
-TEST_F(MetadataManagerTest, AddRangeNotificationsBlockAndYield) {
+TEST_F(MetadataManagerTest, TrackOrphanedDataCleanupBlocksOnScheduledRangeDeletions) {
ChunkRange cr1(BSON("key" << 0), BSON("key" << 10));
+ // Enable fail point to suspendRangeDeletion.
+ globalFailPointRegistry().find("suspendRangeDeletion")->setMode(FailPoint::alwaysOn);
+
auto notifn1 = _manager->cleanUpRange(cr1, false /*delayBeforeDeleting*/);
ASSERT_FALSE(notifn1.isReady());
ASSERT_EQ(_manager->numberOfRangesToClean(), 1UL);
@@ -189,6 +192,8 @@ TEST_F(MetadataManagerTest, AddRangeNotificationsBlockAndYield) {
auto optNotifn = _manager->trackOrphanedDataCleanup(cr1);
ASSERT_FALSE(notifn1.isReady());
ASSERT_FALSE(optNotifn->isReady());
+
+ globalFailPointRegistry().find("suspendRangeDeletion")->setMode(FailPoint::off);
}
TEST_F(MetadataManagerTest, CleanupNotificationsAreSignaledWhenMetadataManagerIsDestroyed) {
@@ -287,9 +292,14 @@ TEST_F(MetadataManagerTest, RangesToCleanMembership) {
ASSERT_EQ(0UL, _manager->numberOfRangesToClean());
+ // Enable fail point to suspendRangeDeletion.
+ globalFailPointRegistry().find("suspendRangeDeletion")->setMode(FailPoint::alwaysOn);
+
auto notifn = _manager->cleanUpRange(cr, false /*delayBeforeDeleting*/);
ASSERT(!notifn.isReady());
ASSERT_EQ(1UL, _manager->numberOfRangesToClean());
+
+ globalFailPointRegistry().find("suspendRangeDeletion")->setMode(FailPoint::off);
}
TEST_F(MetadataManagerTest, ClearUnneededChunkManagerObjectsLastSnapshotInList) {