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

The presplit optimisation of shardCollection will always assign a chunk to the primary shard

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Catalog and Routing
    • 2

      When shardCollection is invoked on an empty collection specifying a hashed key, the DDL will perform an optimisation: it will split its key space in a number of chunks (using the numInitialChunks parameter) and then distribute them across different shards; by this way, the collection will be added to the sharding catalog as already balanced.

      The distribution is not random: instead, chunks will be assigned to shards following the alphabetical order of shard IDs (except for the primary shard, that is assured to always receive at least one chunk).

      Such strategy may lead to a state of data imbalance at cluster level when:

      • there is a high number of empty collections being sharded with a hashed key
      • the value of numInitialChunks is lower than the number of shards in the cluster.

      In order to mitigate such effect (in addition to what documented in SERVER-72650) the constraint of always having at least one chunk in the primary shard of the collection being sharded could be removed.

            Assignee:
            backlog-server-catalog-and-routing [DO NOT USE] Backlog - Catalog and Routing
            Reporter:
            paolo.polato@mongodb.com Paolo Polato
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: