diff options
author | Silvia Surroca <silvia.surroca@mongodb.com> | 2022-09-21 15:00:58 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-21 15:45:13 +0000 |
commit | 1d61d0b76ec6b6c130d6d2433d56df5524a7a82c (patch) | |
tree | dded2d54c09668cd55d4630bb0371903899d9391 /src/mongo/db/s/range_deleter_service.cpp | |
parent | 40fbb65d3607bc78429fa19ad77f7d962a218056 (diff) | |
download | mongo-1d61d0b76ec6b6c130d6d2433d56df5524a7a82c.tar.gz |
SERVER-69768 Include key pattern in range deletion task documents
Diffstat (limited to 'src/mongo/db/s/range_deleter_service.cpp')
-rw-r--r-- | src/mongo/db/s/range_deleter_service.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mongo/db/s/range_deleter_service.cpp b/src/mongo/db/s/range_deleter_service.cpp index ee5ff61f608..e0027e09bfe 100644 --- a/src/mongo/db/s/range_deleter_service.cpp +++ b/src/mongo/db/s/range_deleter_service.cpp @@ -320,7 +320,8 @@ SharedSemiFuture<void> RangeDeleterService::registerTask( .then([this, dbName = rdt.getNss().dbName(), collectionUuid = rdt.getCollectionUuid(), - range = rdt.getRange()]() { + range = rdt.getRange(), + optKeyPattern = rdt.getKeyPattern()]() { return withTemporaryOperationContext( [&](OperationContext* opCtx) { // A task is considered completed when all the following conditions are met: @@ -344,10 +345,16 @@ SharedSemiFuture<void> RangeDeleterService::registerTask( "range"_attr = redact(range.toString())); auto shardKeyPattern = - getShardKeyPattern(opCtx, dbName, collectionUuid); - - uassertStatusOK(deleteRangeInBatches( - opCtx, dbName, collectionUuid, shardKeyPattern, range)); + (optKeyPattern ? *optKeyPattern + : getShardKeyPattern( + opCtx, dbName, collectionUuid)); + + uassertStatusOK( + deleteRangeInBatches(opCtx, + dbName, + collectionUuid, + shardKeyPattern.toBSON(), + range)); orphansRemovalCompleted = true; } catch (ExceptionFor<ErrorCodes::NamespaceNotFound>&) { // No orphaned documents to remove from a dropped collection |