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

AutoSplitVector should not use clientReadable to reorder shard key fields

    • Fully Compatible
    • ALL
    • v6.0, v5.0, v4.4
    • Sharding EMEA 2022-08-08, Sharding EMEA 2022-08-22

      The clientReadable function converts MinKey into {$minElement: 1} for readability purposes. However, the bsonObj {$minElement: 1} does not compare as less than all values the same way that MinKey does.

      This is fine for the prettyKey function for logging, but can cause issues when used in the orderShardKeyFields function, whose results are compared. The repro included in this patch triggers the dassert about shard key ordering because the comparison of null and {$minElement: 1} returns null < {$minElement: 1} while minKey should be less than null.

      This problem is also present in splitvector - as part of this ticket we should investigate whether this can cause problems on older versions.

            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            allison.easton@mongodb.com Allison Easton
            0 Vote for this issue
            4 Start watching this issue