SERVER-112357 moveChunk with waitForDelete must not hang when range deleter is disabled (#44167)

GitOrigin-RevId: 720d45cbdf1495194807c6c1fcadab11e92af6af
This commit is contained in:
Pol Piñol Castuera 2025-11-19 15:42:37 +01:00 committed by MongoDB Bot
parent ba235332c5
commit bcf1ea4b28
4 changed files with 36 additions and 1 deletions

View File

@ -494,6 +494,8 @@ last-continuous:
ticket: SERVER-110953
- test_file: jstests/concurrency/fsm_workloads/timeseries/timeseries_create_indexes.js
ticket: SERVER-113887
- test_file: jstests/sharding/disable_resumable_range_deleter.js
ticket: SERVER-112357
suites: null
last-lts:
all:
@ -1045,4 +1047,6 @@ last-lts:
ticket: SERVER-110953
- test_file: jstests/concurrency/fsm_workloads/timeseries/timeseries_create_indexes.js
ticket: SERVER-113887
- test_file: jstests/sharding/disable_resumable_range_deleter.js
ticket: SERVER-112357
suites: null

View File

@ -155,6 +155,27 @@ jsTest.log(
{moveChunk: ns, find: nonConflictingChunk, to: st.shard0.shardName, _waitForDelete: true}));
})();
jsTest.log(
"Test Case: moveChunk with _waitForDelete should succeed and not hang when the range deleter is disabled");
(() => {
// Disable the resumable range deleter on shard0.
st.shard0.adminCommand({setParameter: 1, disableResumableRangeDeleter: true});
// The moveChunk command should succeed because the migration commits successfully, even though
// the range deleter cannot be waited on due to being disabled.
assert.commandWorked(
st.s.adminCommand(
{moveChunk: ns, find: chunkOnShard0, to: st.shard1.shardName, _waitForDelete: true}),
);
// Re-enable the range deleter on shard0 to allow cleanup.
st.shard0.adminCommand({setParameter: 1, disableResumableRangeDeleter: false});
// Move the chunk back to its original shard to maintain consistency for subsequent test cases.
assert.commandWorked(
st.s.adminCommand({moveChunk: ns, find: chunkOnShard0, to: st.shard0.shardName}));
})();
jsTest.log(
"Restart shard0 with a delay between range deletions and a low wait timeout, this way, with a " +
"large enough collection, there will be a timeout on a recipient when waiting for the range" +

View File

@ -659,6 +659,14 @@ SharedSemiFuture<void> RangeDeleterService::registerTask(
task->clearPending();
}
if (isDisabled()) {
return SemiFuture<void>::makeReady(
Status(ErrorCodes::ResumableRangeDeleterDisabled,
"Not waiting to complete the range deletion task because the resumable "
"range deleter is disabled"))
.share();
}
return task->getCompletionFuture();
}

View File

@ -625,7 +625,9 @@ TEST_F(RangeDeleterServiceTest, RegisterTaskWithDisableResumableRangeDeleterFlag
registerAndCreatePersistentTask(opCtx,
taskWithOngoingQueries->getTask(),
taskWithOngoingQueries->getOngoingQueriesFuture());
ASSERT(!completionFuture.isReady());
ASSERT(completionFuture.isReady());
ASSERT_THROWS_CODE(
completionFuture.get(opCtx), DBException, ErrorCodes::ResumableRangeDeleterDisabled);
ASSERT_EQ(1, rds->getNumRangeDeletionTasksForCollection(uuidCollA));
auto overlappingRangeFuture = rds->getOverlappingRangeDeletionsFuture(