diff options
Diffstat (limited to 'src/mongo/db/s/auto_split_vector.cpp')
-rw-r--r-- | src/mongo/db/s/auto_split_vector.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mongo/db/s/auto_split_vector.cpp b/src/mongo/db/s/auto_split_vector.cpp index ecb2b568c38..41e1149a5f2 100644 --- a/src/mongo/db/s/auto_split_vector.cpp +++ b/src/mongo/db/s/auto_split_vector.cpp @@ -35,7 +35,6 @@ #include "mongo/base/status_with.h" #include "mongo/db/bson/dotted_path_support.h" -#include "mongo/db/catalog/index_catalog.h" #include "mongo/db/catalog_raii.h" #include "mongo/db/dbhelpers.h" #include "mongo/db/exec/working_set_common.h" @@ -44,6 +43,8 @@ #include "mongo/db/namespace_string.h" #include "mongo/db/query/internal_plans.h" #include "mongo/db/query/plan_executor.h" +#include "mongo/db/s/shard_key_index_util.h" + #include "mongo/logv2/log.h" namespace mongo { @@ -62,8 +63,9 @@ BSONObj prettyKey(const BSONObj& keyPattern, const BSONObj& key) { * object extended to cover the entire shardKey. See KeyPattern::extendRangeBound documentation for * some examples. */ -const std::tuple<BSONObj, BSONObj> getMinMaxExtendedBounds( - const IndexCatalog::ShardKeyIndex& shardKeyIdx, const BSONObj& min, const BSONObj& max) { +const std::tuple<BSONObj, BSONObj> getMinMaxExtendedBounds(const ShardKeyIndex& shardKeyIdx, + const BSONObj& min, + const BSONObj& max) { KeyPattern kp(shardKeyIdx.keyPattern()); // Extend min to get (min, MinKey, MinKey, ....) @@ -122,9 +124,11 @@ std::pair<std::vector<BSONObj>, bool> autoSplitVector(OperationContext* opCtx, // Allow multiKey based on the invariant that shard keys must be single-valued. Therefore, // any multi-key index prefixed by shard key cannot be multikey over the shard key fields. - auto catalog = collection->getIndexCatalog(); - auto shardKeyIdx = catalog->findShardKeyPrefixedIndex( - opCtx, *collection, keyPattern, /*requireSingleKey=*/false); + auto shardKeyIdx = findShardKeyPrefixedIndex(opCtx, + *collection, + collection->getIndexCatalog(), + keyPattern, + /*requireSingleKey=*/false); uassert(ErrorCodes::IndexNotFound, str::stream() << "couldn't find index over splitting key " << keyPattern.clientReadable().toString(), |