[SERVER-58669] createIndexes, dropIndexes, and collMod may still fail with ReshardCollectionInProgress after resharding operation completes Created: 19/Jul/21  Updated: 29/Oct/23  Resolved: 26/Jul/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.0.0
Fix Version/s: 5.0.3, 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Janna Golden
Resolution: Fixed Votes: 0
Labels: PM-234-M3, PM-234-T-lifecycle
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0
Sprint: Sharding 2021-07-26, Sharding 2021-08-09
Participants:
Story Points: 1

 Description   

CollectionMetadata::throwIfReshardingInProgress() throws if the collection metadata has "reshardingFields" present. This is problematic because recipient shards are not guaranteed to learn of when the "reshardingFields" are removed has been the config.collections entry.

The changes from 184a553 as part of SERVER-55114 added logic to ReshardingCoordinator to trigger a best-effort refresh of the recipient shards after the coordinator had removed the "reshardingFields" from the config.collections entry. However, this logic isn't guaranteed to run in the presence of failovers because it occurs after the coordinator state document has been removed from disk.

void CollectionMetadata::throwIfReshardingInProgress(NamespaceString const& nss) const {
    if (isSharded() && getReshardingFields()) {
        LOGV2(5277122, "reshardCollection in progress", "namespace"_attr = nss.toString());
 
        uasserted(ErrorCodes::ReshardCollectionInProgress,
                  "reshardCollection is in progress for namespace " + nss.toString());
    }
}

We should instead make it permissible to run the createIndexes, dropIndexes, and collMod command when the coordinator state is CoordinatorStateEnum::kAborting or CoordinatorStateEnum::kCommitting. The critical section will take care of ensuring the commands happen on the correct side of the rename for the temporary resharding collection.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 17/Aug/21 ]

Author:

{'name': 'jannaerin', 'email': 'golden.janna@gmail.com', 'username': 'jannaerin'}

Message: SERVER-58669 Allow collMod, createIndexes, and dropIndexes once resharding coordinator has made a decision

(cherry picked from commit a1e57d2985b672c898431b7787e53c547bbd2753)

SERVER-58917 Wait until donors/recipients are aware that coordinator has persisted decision before expecting successful collMod, createIndexes, and dropIndexes in resharding_prohibited_commands.js

(cherry picked from commit 8179692b362d8237f201719946eb46bac6a5e961)
Branch: v5.0
https://github.com/mongodb/mongo/commit/7758ae1a0a21c662f028a687ff6b25506a52c33c

Comment by Githook User [ 26/Jul/21 ]

Author:

{'name': 'jannaerin', 'email': 'golden.janna@gmail.com', 'username': 'jannaerin'}

Message: SERVER-58669 Allow collMod, createIndexes, and dropIndexes once resharding coordinator has made a decision
Branch: master
https://github.com/mongodb/mongo/commit/a1e57d2985b672c898431b7787e53c547bbd2753

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