-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Sharding
-
Fully Compatible
-
ALL
-
Sharding 2021-02-08
-
1
UpdateStage::wasExistingShardKeyUpdated() and UpdateStage::wasReshardingKeyUpdated() are both functions which either return true, return false, or throw. Due to the short-circuiting behavior of || it is possible for UpdateStage::wasExistingShardKeyUpdated() to return true when UpdateStage::wasReshardingKeyUpdated() would have thrown a WouldChangeOwningShard exception.
const auto& newObj = newObjCopy ? *newObjCopy : _doc.getObject(); return wasExistingShardKeyUpdated(css, collDesc, newObj, oldObj) || wasReshardingKeyUpdated(collDesc, newObj, oldObj);
With a current shard key pattern of {donor: 1, slot: 1} and a new shard key pattern of {recipient: 1, slot: 1}, the following update would cause UpdateStage::wasExistingShardKeyUpdated() to return true and cause UpdateStage::wasReshardingKeyUpdated() to throw WouldChangeOwningShard.
{insert: "reshard_coll", documents: [{_id: 452, donor: "donor1", recipient: "recipient0", slot: 25, num: 10}]} {update: "reshard_coll", updates: [{q: {donor: "donor1", slot: 25}, u: {donor: "donor1", recipient: "recipient1", slot: 14, num: 12}}]}
- is related to
-
SERVER-52974 Checking if destined recipient has changed for resharding creates another full copy of the updated document
- Closed
-
SERVER-49825 Replicate updates changing value under new shard key pattern as delete + insert in a transaction
- Closed
-
SERVER-52683 Relax restrictions for updates to new shard key fields during resharding
- Closed