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

shardCollection with hashed shard key may fail to evenly distribute chunks across shards when executed during an FCV downgrade

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 8.0.0-rc0, 7.3.0
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL
    • CAR Team 2024-04-01, CAR Team 2024-04-15, CAR Team 2024-04-29, CAR Team 2024-05-13, CAR Team 2024-05-27, CAR Team 2024-06-10
    • 111
    • 1

      Sample scenario for repro

      In a n-sharded cluster, an empty collection targeted with a createCollection({key: hashed}) should produce a routing table with the following chunk distribution:

      • if gOneChunkPerShardEmptyCollectionWithHashedShardKey is enabled (>= 7.2), n chunks and 1 chunk per shard
      • if gOneChunkPerShardEmptyCollectionWithHashedShardKey is not enabled (<7.2), 2*n chunks and 2 chunks per shard

      The logic is nevertheless flawed: the feature flag is queried multiple times during the generation of the routing table - and its value may be unstable across reads. As a consequence of this, we might end up in a state where shardCollection generates n chunks (feature flag on) but only distributes them across n/2 shards (feature flag off) when the DDL is executed concurrently with a FCV downgrade.

            Assignee:
            Unassigned Unassigned
            Reporter:
            yuhong.zhang@mongodb.com Yuhong Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: