-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 5.0.0
-
Component/s: Sharding
-
Fully Compatible
-
ALL
-
v5.0
-
Sharding 2021-08-09, Sharding 2021-08-23
-
2
A secondary which steps up to be primary won't necessarily have loaded the collection metadata for temporary resharding collection. This can lead assertCanExtractShardKeyFromDocs() to throw a NamespaceNotSharded exception when the ReshardingOplogApplier attempts to write to the temporary resharding collection.
The ReshardingCollectionCloner and ReshardingOplogApplier rely on assertCanExtractShardKeyFromDocs() to ensure an update doesn't write an invalid shard key value (e.g. an array value) under the new shard key pattern. We must either
- (a) ensure the collection metadata for the temporary resharding collection has been loaded before the ReshardingCollectionCloner or ReshardingOplogApplier attempt to write to it, or
- (b) retry in ReshardingCollectionCloner and ReshardingOplogApplier on the exception thrown by assertCanExtractShardKeyFromDocs(), or
- (c) move the checks into ReshardingCollectionCloner and ReshardingOplogApplier directly, and allow unversioned (direct) writes to the temporary resharding collection if they are being performed by an internal (system) Client.
const auto metadata = CollectionShardingRuntime::get(opCtx, nss)->getCurrentMetadataIfKnown(); // A user can manually create a 'db.system.resharding.' collection that isn't guaranteed to be // sharded outside of running reshardCollection. uassert(ErrorCodes::NamespaceNotSharded, str::stream() << "Temporary resharding collection " << nss.toString() << " is not sharded", metadata && metadata->isSharded());
- is caused by
-
SERVER-54984 Relax invariant in ReshardingOpObserver about temporary resharding collection being sharded
- Closed
- is depended on by
-
SERVER-53351 Add resharding fuzzer task with step-ups enabled for shards
- Closed
- is related to
-
SERVER-52639 Fail resharding operation if new shard key includes array
- Closed
- related to
-
SERVER-60094 ReshardingOplogApplicationRules does not version all writes
- Closed
-
SERVER-62178 Resharding can fail with NamespaceNotSharded if recipient primary fails over before creating temporary resharding collection
- Closed