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

XMLWordPrintableJSON

    • Fully Compatible
    • Sharding 2020-08-10
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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 (Inactive)
              Reporter:
              Janna Golden
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: