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

Make shards validate shardKey in dataSize command

    • Fully Compatible
    • ALL
    • v4.4, v4.2, v4.0, v3.6
    • Sharding 2020-04-20

      Currently, the dataSize command can fail with BadValue error due to shard key validation if it is run on a stale mongos after the collection is resharded with a different shard key. This is because the mongos validates the command's keyPattern with its stale ChunkManager before sending requests to shards. Since the command fails with BadValue, nothing causes the mongos to refresh so the command continues to fail after that. 

       

      To resolve this, we should make each shard validate "shardKey", "min" and "max" by itself. That way, if the mongos is stale, the dataSize command would fail with StaleConfig (instead of BadValue) in the initial try. This error would cause the stale mongos to refresh and the command to succeed when the mongos retries .

       

            Assignee:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Reporter:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: