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.
- is related to
-
SERVER-55412 Mirrored reads should propagate the shard version field
- Closed