Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-58914

Create ReshardingDonorWriteRouter class with function stubs

    • Fully Compatible
    • v5.0
    • Sharding 2021-08-09, Sharding 2021-08-23
    • 1


      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 {
          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;
          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(){ }

            junhson.jean-baptiste@mongodb.com Junhson Jean-Baptiste (Inactive)
            blake.oler@mongodb.com Blake Oler
            0 Vote for this issue
            3 Start watching this issue