[SERVER-78252] Block chunk migrations for hashed shard keys if you don’t have the shard key index Created: 20/Jun/23  Updated: 29/Oct/23  Resolved: 04/Aug/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.2, 5.0.22, 6.0.12

Type: Improvement Priority: Major - P3
Reporter: Garaudy Etienne Assignee: Sanika Phanse (Inactive)
Resolution: Fixed Votes: 0
Labels: sharding-nyc-subteam2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-78863 Audit places in the codebase that rel... Closed
is related to SERVER-78253 Allow folks with hashed shard keys to... Closed
Assigned Teams:
Sharding NYC
Backwards Compatibility: Fully Compatible
Backport Requested:
v7.0, v6.0, v5.0
Sprint: Sharding NYC 2023-07-10, Sharding NYC 2023-07-24, Sharding NYC 2023-08-07
Participants:
Story Points: 3

 Description   

Since we are now allowing customers to drop the hashed shard key index (for write performance reasons), we should block chunk migrations for hashed shard keys if you don’t have the supporting shard key index.



 Comments   
Comment by Githook User [ 09/Oct/23 ]

Author:

{'name': 'Sanika Phanse', 'email': 'sanika.phanse@mongodb.com', 'username': 'sphanse99'}

Message: SERVER-78252 Block chunk migrations for hashed shard keys if you don’t have the shard key index
Branch: v5.0
https://github.com/mongodb/mongo/commit/7f341c87b9c3b6e1605003988999f3fb388d25be

Comment by Githook User [ 05/Oct/23 ]

Author:

{'name': 'Sanika Phanse', 'email': 'sanika.phanse@mongodb.com', 'username': 'sphanse99'}

Message: SERVER-78252 Block chunk migrations for hashed shard keys if you don’t have the shard key index
Branch: v6.0
https://github.com/mongodb/mongo/commit/75d18c97e477a37419e0a162415b94fa896707a0

Comment by Githook User [ 19/Sep/23 ]

Author:

{'name': 'Sanika Phanse', 'email': 'sanika.phanse@mongodb.com', 'username': 'sphanse99'}

Message: SERVER-78252 Block chunk migrations for hashed shard keys if you don’t have the shard key index
Branch: v7.0
https://github.com/mongodb/mongo/commit/02b3c655e1302209ef046da6ba3ef6749dd0b62a

Comment by Githook User [ 03/Aug/23 ]

Author:

{'name': 'Sanika Phanse', 'email': 'sanika.phanse@mongodb.com', 'username': 'sphanse99'}

Message: SERVER-78252 Block chunk migrations when index is missing
Branch: minh.luu-no_compile_sys-perf
https://github.com/mongodb/mongo/commit/c6fe98d8601911dd4035aff39510a711b9febefe

Comment by Githook User [ 03/Aug/23 ]

Author:

{'name': 'Sanika Phanse', 'email': 'sanika.phanse@mongodb.com', 'username': 'sphanse99'}

Message: SERVER-78252 Block chunk migrations when index is missing
Branch: master
https://github.com/mongodb/mongo/commit/c6fe98d8601911dd4035aff39510a711b9febefe

Comment by Max Hirschhorn [ 27/Jun/23 ]

I think beyond chunk migration and range deletion, the following list of callers to use an index which is compatible with the shard key pattern need to accept there won't be one (perhaps by explicitly erroring) when the system is in this state.

$ git grep findShardKeyPrefixedIndex -- ':!*test*'
src/mongo/db/commands/dbcommands.cpp:361:                const auto shardKeyIdx = findShardKeyPrefixedIndex(opCtx,
src/mongo/db/s/analyze_shard_key_cmd_util.cpp:600:    const auto index = findShardKeyPrefixedIndex(opCtx,
src/mongo/db/s/auto_split_vector.cpp:161:        const auto shardKeyIdx = findShardKeyPrefixedIndex(opCtx,
src/mongo/db/s/check_sharding_index_command.cpp:105:        const auto shardKeyIdx = findShardKeyPrefixedIndex(opCtx,
src/mongo/db/s/metadata_consistency_util.cpp:103:        if (!findShardKeyPrefixedIndex(opCtx, localColl, shardKey, false /*requireSingleKey*/)) {
src/mongo/db/s/migration_chunk_cloner_source.cpp:1065:    const auto shardKeyIdx = findShardKeyPrefixedIndex(opCtx,
src/mongo/db/s/range_deletion_util.cpp:89:    const auto shardKeyIdx = findShardKeyPrefixedIndex(
src/mongo/db/s/shard_key_index_util.cpp:45:boost::optional<ShardKeyIndex> _findShardKeyPrefixedIndex(
src/mongo/db/s/shard_key_index_util.cpp:197:    return !_findShardKeyPrefixedIndex(opCtx,
src/mongo/db/s/shard_key_index_util.cpp:206:boost::optional<ShardKeyIndex> findShardKeyPrefixedIndex(OperationContext* opCtx,
src/mongo/db/s/shard_key_index_util.cpp:211:    return _findShardKeyPrefixedIndex(opCtx,
src/mongo/db/s/shard_key_index_util.h:93:boost::optional<ShardKeyIndex> findShardKeyPrefixedIndex(OperationContext* opCtx,
src/mongo/db/s/shard_key_util.cpp:416:            findShardKeyPrefixedIndex(_opCtx,
src/mongo/db/s/split_chunk.cpp:214:        const auto shardKeyIdx = findShardKeyPrefixedIndex(
src/mongo/db/s/split_vector.cpp:87:        const auto shardKeyIdx = findShardKeyPrefixedIndex(opCtx,

Generated at Thu Feb 08 06:37:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.