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

Define utility function for getting recipient which would own document under new shard key

    XMLWordPrintable

Details

    • Fully Compatible
    • Sharding 2020-09-21

    Description

      Add a utility function to identify the recipient shard which would own the document under the new shard key pattern. One idea is to get the ChunkManager for the new sharded collection (the one under the new shard key pattern), then use ChunkManager::findIntersectingChunk() to find the overlapping chunk on the recipient, and finally use Chunk::getShardId() to get the destined recipient. boost::none would be returned if there isn't an active resharding operation.

      This function must return boost::none if the donor shard doesn't own the document under the current shard key pattern.

      boost::optional<ShardId> getDestinedRecipient(const NamespaceString& sourceNss, BSONObj fullDocument);
      

      Attachments

        Issue Links

          Activity

            People

              alex.taskov@mongodb.com Alexander Taskov (Inactive)
              max.hirschhorn@mongodb.com Max Hirschhorn
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: