[SERVER-52639] Fail resharding operation if new shard key includes array Created: 05/Nov/20  Updated: 29/Oct/23  Resolved: 02/Mar/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Task Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Alexander Taskov (Inactive)
Resolution: Fixed Votes: 0
Labels: PM-234-M2.5, PM-234-T-data-clone, PM-234-T-oplog-apply
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
causes SERVER-54984 Relax invariant in ReshardingOpObserv... Closed
Related
related to SERVER-59023 Resharding can fail with NamespaceNot... Closed
related to SERVER-60094 ReshardingOplogApplicationRules does ... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2021-02-22, Sharding 2021-03-08
Participants:
Linked BF Score: 153
Story Points: 2

 Description   

Sharding prevents documents with array values for the shard key pattern from being written (for inserts, for updates). We either need a similar restriction for the new shard key while resharding is in-progress, or these inserts/updates must cause the resharding operation to fail.



 Comments   
Comment by Githook User [ 02/Mar/21 ]

Author:

{'name': 'Alex Taskov', 'email': 'alex.taskov@mongodb.com', 'username': 'alextaskov'}

Message: SERVER-52639 Fail resharding operation if new shard key includes array
Branch: master
https://github.com/mongodb/mongo/commit/33083e137fa08dc48eb5dee666e285dbbb4e28c5

Comment by Max Hirschhorn [ 01/Feb/21 ]

My thought here would be to call ShardKeyPattern::extractShardKeyFromDoc() for every insert and update to the temporary resharding collection as part of ReshardingOpObserver and to throw if ShardKeyPattern::extractShardKeyFromDoc() returns an empty BSONObj.

The idea is that both the ReshardingCollectionCloner and ReshardingOplogApplier would cause the recipient shard to transition to the kError state as a result of this exception being propagated to the RecipientStateMachine.

Generated at Thu Feb 08 05:28:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.