diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2021-06-16 02:55:38 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-16 03:18:28 +0000 |
commit | ee1cea12a8108f35f24069bde1f8a8be350c16fb (patch) | |
tree | dbf964c9abc19274a45d1dbdb88c33c0076603a5 | |
parent | b065ffbb33bb891b87620fb24cd6652527df6912 (diff) | |
download | mongo-ee1cea12a8108f35f24069bde1f8a8be350c16fb.tar.gz |
SERVER-57668 Cache post-transformed chunk bounds for resharding cloning.
(cherry picked from commit 6659e192ee5feceda14bebe1cb22f219d5d765fd)
-rw-r--r-- | src/mongo/db/s/resharding/resharding_collection_cloner.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/mongo/db/s/resharding/resharding_collection_cloner.cpp b/src/mongo/db/s/resharding/resharding_collection_cloner.cpp index c91fcdf8ff0..7d085a3a825 100644 --- a/src/mongo/db/s/resharding/resharding_collection_cloner.cpp +++ b/src/mongo/db/s/resharding/resharding_collection_cloner.cpp @@ -172,23 +172,23 @@ std::unique_ptr<Pipeline, PipelineDeleter> ReshardingCollectionCloner::makePipel Doc{{"$expr", Doc{{"$eq", Arr{V{"$shard"_sd}, V{_recipientShard.toString()}}}}}}}}}, - V{Doc(fromjson("{$match: {$expr: {$let: {\ - vars: {\ - min: {$map: {input: {$objectToArray: '$_id'}, in: '$$this.v'}},\ - max: {$map: {input: {$objectToArray: '$max'}, in: '$$this.v'}}\ - },\ - in: {$and: [\ - {$gte: ['$$sk', '$$min']},\ - {$cond: {\ - if: {$allElementsTrue: [{$map: {\ - input: '$$max',\ - in: {$eq: [{$type: '$$this'}, 'maxKey']}\ - }}]},\ - then: {$lte: ['$$sk', '$$max']},\ - else: {$lt: ['$$sk', '$$max']}\ - }}\ + V{Doc{fromjson("{$replaceWith: {\ + min: {$map: {input: {$objectToArray: '$_id'}, in: '$$this.v'}},\ + max: {$map: {input: {$objectToArray: '$max'}, in: '$$this.v'}}\ + }}")}}, + V{Doc{fromjson("{$addFields: {\ + isGlobalMax: {$allElementsTrue: [{$map: {\ + input: '$max',\ + in: {$eq: [{$type: '$$this'}, 'maxKey']}\ + }}]}\ + }}")}}, + V{Doc{fromjson("{$match: {$expr: {$and: [\ + {$gte: ['$$sk', '$min']},\ + {$or: [\ + {$lt: ['$$sk', '$max']},\ + '$isGlobalMax'\ ]}\ - }}}}"))}}}, + ]}}}")}}}}, {"as", "intersectingChunk"_sd}}}} .toBson() .firstElement(), |