diff options
author | Pierlauro Sciarelli <pierlauro.sciarelli@mongodb.com> | 2022-06-08 07:13:15 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-08 07:41:02 +0000 |
commit | 36fd043c358946d78a7fad0d69c1d08deed2790e (patch) | |
tree | e0f5119d1edb15f93fbf0011a5b9a9c87c7d33c1 /src/mongo/db/s | |
parent | ada9a8dcd4d6548f70afbce6dcbe3f7920bce253 (diff) | |
download | mongo-36fd043c358946d78a7fad0d69c1d08deed2790e.tar.gz |
SERVER-66958 Handle potential multiple "processing" range deletions on step-up
Diffstat (limited to 'src/mongo/db/s')
-rw-r--r-- | src/mongo/db/s/migration_util.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/mongo/db/s/migration_util.cpp b/src/mongo/db/s/migration_util.cpp index bd8600c1518..c3751d7bd5f 100644 --- a/src/mongo/db/s/migration_util.cpp +++ b/src/mongo/db/s/migration_util.cpp @@ -520,14 +520,27 @@ void resubmitRangeDeletionsOnStepUp(ServiceContext* serviceContext) { FindCommandRequest findCommand(NamespaceString::kRangeDeletionNamespace); findCommand.setFilter(BSON(RangeDeletionTask::kProcessingFieldName << true)); auto cursor = client.find(std::move(findCommand)); - if (cursor->more()) { - return migrationutil::submitRangeDeletionTask( + + auto retFuture = ExecutorFuture<void>(getMigrationUtilExecutor(serviceContext)); + + int rangeDeletionsMarkedAsProcessing = 0; + while (cursor->more()) { + retFuture = migrationutil::submitRangeDeletionTask( opCtx.get(), RangeDeletionTask::parse(IDLParserErrorContext("rangeDeletionRecovery"), cursor->next())); - } else { - return ExecutorFuture<void>(getMigrationUtilExecutor(serviceContext)); + rangeDeletionsMarkedAsProcessing++; } + + if (rangeDeletionsMarkedAsProcessing > 1) { + LOGV2_WARNING( + 6695800, + "Rescheduling several range deletions marked as processing. Orphans count " + "may be off while they are not drained", + "numRangeDeletionsMarkedAsProcessing"_attr = rangeDeletionsMarkedAsProcessing); + } + + return retFuture; }) .then([serviceContext] { ThreadClient tc("ResubmitRangeDeletions", serviceContext); |