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

Sample documents to pick new split points for resharding when new shard key has a hashed field

    • Fully Compatible
    • Sharding 2020-08-10

      Once the new $hash expression is created in SERVER-49214, we can use a similar agg pipeline as defined in SERVER-49510 to pick new split points during resharding for a shard key with a hashed field. The pipeline should use $hash for a hashed field, it should look like:

      [
          {
              $sample: { size: numInitialChunks * s (where s = oversampling ratio }
          },
          {
              $project: {
                  _id: 0,
                  "sk0": {$ifNull: ["$shardKeyField0", null]}, 
                  "sk1": {$toHashedIndexKey: <input>},
                  ... and so on for each shard key field
              }
          },
          {
              $sort: { sk0: 1, sk1: 1 }
          },
      ]
      

            Assignee:
            kshitij.gupta@mongodb.com Kshitij Gupta
            Reporter:
            janna.golden@mongodb.com Janna Golden
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: