-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 5.0.0
-
Component/s: None
-
Fully Compatible
-
ALL
-
v5.0
-
Sharding 2021-07-26, Sharding 2021-08-09
-
1
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.