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

Mirrored reads should include databaseVersion in addition to shardVersion

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0-rc0, 5.0.22, 6.0.11, 7.0.3, 4.4.26
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Service Arch
    • Fully Compatible
    • ALL
    • v7.0, v6.0, v5.0, v4.4
    • Service Arch 2023-10-02

      mongos attaches shardVersion for sharded collections and attaches databaseVersion for unsharded collection, however mirrored reads only attach shardVersion but not databaseVersion (e.g. here and here). The missing databaseVersion may cause the same problem as in SERVER-55412 (which attached shardVersion for mirrored reads) because from looking at this code, it seems missing databaseVersion may also result in the INCLUDE_SHARD_FILTER query phase to be dropped which is the same issue in SERVER-55412.


      To clarify, either a shardVersion or a databaseVersion is sufficient to ensure that the INCLUDE_SHARD_FILTER query phase will be enabled. However, for unsharded collections, the logic in the ShardFilter stage that would access routing table metadata doesn't execute; instead, we rely on the database sharding state check to refresh the routing table. A missing databaseVersion will cause that check to return early without raising the exception that forces the routing table to be refreshed.

            james.bronsted@mongodb.com James Bronsted
            wenbin.zhu@mongodb.com Wenbin Zhu
            0 Vote for this issue
            4 Start watching this issue