[SERVER-58918] Replace getDestinedRecipient() in the code-base with calls into the ReshardingDonorWriteRouter object Created: 28/Jul/21  Updated: 12/Oct/21  Resolved: 21/Sep/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Blake Oler Assignee: Randolph Tan
Resolution: Duplicate Votes: 0
Labels: PM-234-M3, PM-234-T-oplog-fetch
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-58915 Implement ReshardingDonorWriteRouter ... Closed
is duplicated by SERVER-57666 Convert getDestinedRecipient() in res... Closed
Gantt Dependency
has to be done after SERVER-58915 Implement ReshardingDonorWriteRouter ... Closed
Related
is related to SERVER-52974 Checking if destined recipient has ch... Closed
is related to SERVER-53678 No-op for filling in destined recipie... Closed
is related to SERVER-53679 No-op for filling in destined recipie... Closed
Sprint: Sharding 2021-09-20, Sharding 2021-10-04
Participants:
Linked BF Score: 0
Story Points: 1

 Description   

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.
  • 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.


 Comments   
Comment by Max Hirschhorn [ 21/Sep/21 ]

This work was done as part of SERVER-58915 instead.

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