-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Sharding
-
Fully Compatible
-
v5.0
-
Sharding 2021-08-09, Sharding 2021-08-23
-
1
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
- Create the ReshardingDonorWriteRouter class using the above template, with its own dedicated .h and .cpp files. Place this class/file inside libsharding_api_d.
- Implement all of the functions with no-op bodies in the cpp file. This should just look like ReshardingDonorWriteRouter::memberFunction(){ }
- has to be done before
-
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