[SERVER-58914] Create ReshardingDonorWriteRouter class with function stubs Created: 28/Jul/21  Updated: 29/Oct/23  Resolved: 16/Aug/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 5.0.4, 5.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Blake Oler Assignee: Junhson Jean-Baptiste (Inactive)
Resolution: Fixed 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:
Backports
Duplicate
is duplicated by SERVER-57666 Convert getDestinedRecipient() in res... Closed
Gantt Dependency
has to be done before SERVER-58915 Implement ReshardingDonorWriteRouter ... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v5.0
Sprint: Sharding 2021-08-09, Sharding 2021-08-23
Participants:
Story Points: 1

 Description   

Context

getDestinedRecipient() is called on the write path for insert, updates, and deletes. Special care has needed to be taken to avoid introducing a performance regression on non-shardsvrs and on collections in sharded clusters not undergoing a resharding operation (SERVER-52974, SERVER-53678, SERVER-53679). More care is still needed.

Converting getDestinedRecipient() into a class will make it more straightforward to make explicit what components must be lazily initialized and what components must be cached so introducing the resharding feature is performance neutral when not in active use.

class ReshardingDonorWriteRouter {
public:
    ReshardingDonorWriteRouter(OperationContext* opCtx,
                               const NamespaceString& sourceNss,
                               CatalogCache* catalogCache);
 
    ReshardingDonorWriteRouter(OperationContext* opCtx,
                               const NamespaceString& sourceNss,
                               CatalogCache* catalogCache,
                               CollectionShardingState* css,
                               const ScopedCollectionDescription* collDesc);
 
    CollectionShardingState* getCollectionShardingState() const;
 
    boost::optional<ShardId> getDestinedRecipient(const BSONObj& fullDocument) const;
 
private:
    CollectionShardingState* const _css;
    const ScopedCollectionDescription* const _collDesc;
 
    boost::optional<ScopedCollectionFilter> _ownershipFilter;
    boost::optional<ShardKeyPattern> _reshardingKeyPattern;
    boost::optional<ChunkManager> _tempReshardingChunkMgr;
};

Task for this ticket

  1. Create the ReshardingDonorWriteRouter class using the above template, with its own dedicated .h and .cpp files. Place this class/file inside libsharding_api_d.
  2. Implement all of the functions with no-op bodies in the cpp file. This should just look like ReshardingDonorWriteRouter::memberFunction(){ }


 Comments   
Comment by Githook User [ 25/Oct/21 ]

Author:

{'name': 'Junhson Jean-Baptiste', 'email': 'junhson.jean-baptiste@mongodb.com', 'username': 'junhsonjb'}

Message: SERVER-58914 Create ReshardingDonorWriteRouter class with function stubs

(cherry picked from commit 0c2174868263483e6d1973a5f490052e92e70750)
Branch: v5.0
https://github.com/mongodb/mongo/commit/6aec5b3bf11bc33f60b739063df48747126c91f4

Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 12/Aug/21 ]

Author:

{'name': 'Junhson Jean-Baptiste', 'email': 'junhson.jean-baptiste@mongodb.com', 'username': 'junhsonjb'}

Message: SERVER-58914 Create ReshardingDonorWriteRouter class with function stubs
Branch: master
https://github.com/mongodb/mongo/commit/0c2174868263483e6d1973a5f490052e92e70750

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