summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/shard_key_index_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/shard_key_index_util.cpp')
-rw-r--r--src/mongo/db/s/shard_key_index_util.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mongo/db/s/shard_key_index_util.cpp b/src/mongo/db/s/shard_key_index_util.cpp
index 833d27d709a..4359d731dbb 100644
--- a/src/mongo/db/s/shard_key_index_util.cpp
+++ b/src/mongo/db/s/shard_key_index_util.cpp
@@ -68,6 +68,10 @@ boost::optional<ShardKeyIndex> _findShardKeyPrefixedIndex(
continue;
}
+ if (indexDescriptor->hidden()) {
+ continue;
+ }
+
if (isCompatibleWithShardKey(
opCtx, collection, indexEntry, shardKey, requireSingleKey, errMsg)) {
if (!indexEntry->isMultikey(opCtx, collection)) {
@@ -179,11 +183,11 @@ bool isCompatibleWithShardKey(OperationContext* opCtx,
return false;
}
-bool isLastShardKeyIndex(OperationContext* opCtx,
- const CollectionPtr& collection,
- const IndexCatalog* indexCatalog,
- const std::string& indexName,
- const BSONObj& shardKey) {
+bool isLastNonHiddenShardKeyIndex(OperationContext* opCtx,
+ const CollectionPtr& collection,
+ const IndexCatalog* indexCatalog,
+ const std::string& indexName,
+ const BSONObj& shardKey) {
return !_findShardKeyPrefixedIndex(
opCtx, collection, indexCatalog, indexName, shardKey, true /* requireSingleKey */)
.has_value();