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

Make shards validate shardKey in dataSize command

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.6, 4.0.19, 4.4.0-rc2, 4.7.0
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.4, v4.2, v4.0, v3.6
    • Sprint:
      Sharding 2020-04-20

      Description

      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 .

       

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: