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

split command should only allow NumberLongs for hashed shard keys

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.13
    • Affects Version/s: 2.7.4
    • Component/s: Sharding
    • Fully Compatible
    • Sharding 2017-07-10, Sharding 2017-07-31

      When using a hashed shard key, the hashes are all NumberLong values. However, the split command allows splitting at values that are not NumberLongs. Such split attempts are non-sensical and should be rejected.

      One particular case is splitting at a double-precision value. Since doubles and NumberLongs are sorted according to the actual numeric value, this leads to chunks with double precision min/max (or mixed double/NumberLong), rather than exclusively NumberLongs. The problem gradually worsens as chunks are auto-split, until eventually SERVER-14759 is hit.

      However, this is still a problem in its own right, because not all NumberLongs can be represented as doubles (which is of course why NumberLongs are used in the first place). Thus, even in the absence of SERVER-14759 this is still a problem, because it prevents chunks in a hashed shard key from being split as finely as they ought to be. This may lead to uneven load between shards, which is against the design goals of hashed shard keys.

      It is true that auto-splits are always correctly calculated as NumberLongs, but there are some situations where manual splits are required. In this case, SERVER-14217 means that it is easy to accidentally split at double precision values instead of NumberLongs.

            Assignee:
            hugh.han Hugh Han
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: