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

XMLWordPrintableJSON

    • Fully Compatible
    • Sharding 2020-09-21
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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);
      

            Assignee:
            Alexander Taskov (Inactive)
            Reporter:
            Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: