-
Type: Task
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Sharding
-
Sharding 2021-09-20, Sharding 2021-10-04
-
0
-
1
Tasks for this ticket
Implementation
- Source everywhere getDestinedRecipient() is currently called. These places are where the ReshardingDonorWriteRouter should be constructed instead.
- OpObserverImpl::onInserts() should construct the ReshardingDonorWriteRouter once outside of the for loop. ReshardingDonorWriteRouter would have cached the ScopedCollectionFilter, ShardKeyPattern, and ChunkManager upon construction so calling ReshardingDonorWriteRouter::getDestinedRecipient() in a loop won't do extra work.
- repl::logInsertOps() should be changed to take a const ReshardingDonorWriteRouter& as an argument.
- OpObserverImpl::onInserts() should construct the ReshardingDonorWriteRouter once outside of the for loop. ReshardingDonorWriteRouter would have cached the ScopedCollectionFilter, ShardKeyPattern, and ChunkManager upon construction so calling ReshardingDonorWriteRouter::getDestinedRecipient() in a loop won't do extra work.
- All OpObserverImpl methods should use ReshardingDonorWriteRouter::getCollectionShardingState() to avoid getting the CollectionShardingState from the map a second time. Note that when the mongod isn't a shardsvr, ReshardingDonorWriteRouter::getCollectionShardingState() will return nullptr. This is acceptable because OpObserverShardingImpl won't have been registered for non-shardsvrs either and so the CollectionShardingState* pointer won't ever be dereferenced.
Code cleanup
- Remove the old free-standing getDestinedRecipient function.
- Change all unit tests that call the free-standing getDestinedRecipient function to instead create the ReshardingDonorWriteRouter object and call the corresponding function.
Unit tests
- We don't need any extra unit testing here. In the previous ticket, we swap over the getDestinedRecipient unit tests to use our new class, and replacing other calls to the function with your class will be sufficient testing coverage.
- duplicates
-
SERVER-58915 Implement ReshardingDonorWriteRouter functionality along with unit tests
- Closed
- has to be done after
-
SERVER-58915 Implement ReshardingDonorWriteRouter functionality along with unit tests
- Closed
- is duplicated by
-
SERVER-57666 Convert getDestinedRecipient() in resharding_util to be a class method
- Closed
- is related to
-
SERVER-52974 Checking if destined recipient has changed for resharding creates another full copy of the updated document
- Closed
-
SERVER-53678 No-op for filling in destined recipient for insert oplog entries adds overhead on non-shardsvrs
- Closed
-
SERVER-53679 No-op for filling in destined recipient for insert oplog entries adds overhead on shardsvrs not running resharding
- Closed