[SERVER-79471] Mirrored reads should include databaseVersion in addition to shardVersion Created: 28/Jul/23  Updated: 29/Oct/23  Resolved: 25/Sep/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.2.0-rc0, 5.0.22, 6.0.11, 7.0.3, 4.4.26

Type: Bug Priority: Major - P3
Reporter: Wenbin Zhu Assignee: James Bronsted
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-55412 Mirrored reads should propagate the s... Closed
Assigned Teams:
Service Arch
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0, v6.0, v5.0, v4.4
Sprint: Service Arch 2023-10-02
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 26/Sep/23 ]

Author:

{'name': 'James Bronsted', 'email': 'james.bronsted@mongodb.com', 'username': 'jpbronsted'}

Message: SERVER-79471 include databaseVersion in mirrored reads

(cherry picked from commit 1e286d48d8bad81bdd4e11e5717fb72d5f3c0084)
Branch: v4.4
https://github.com/mongodb/mongo/commit/fc9d31dfc046c161802e2d72c613822460610969

Comment by Githook User [ 26/Sep/23 ]

Author:

{'name': 'James Bronsted', 'email': 'james.bronsted@mongodb.com', 'username': 'jpbronsted'}

Message: SERVER-79471 include databaseVersion in mirrored reads

(cherry picked from commit 1e286d48d8bad81bdd4e11e5717fb72d5f3c0084)
Branch: v7.0
https://github.com/mongodb/mongo/commit/a1e2e227762163d8fc405f56708d41ec3d34b550

Comment by Githook User [ 26/Sep/23 ]

Author:

{'name': 'James Bronsted', 'email': 'james.bronsted@mongodb.com', 'username': 'jpbronsted'}

Message: SERVER-79471 include databaseVersion in mirrored reads

(cherry picked from commit 1e286d48d8bad81bdd4e11e5717fb72d5f3c0084)
Branch: v6.0
https://github.com/mongodb/mongo/commit/ff5a4e42a462e43e4dd1257b8cdb7df5dbd5b241

Comment by Githook User [ 26/Sep/23 ]

Author:

{'name': 'James Bronsted', 'email': 'james.bronsted@mongodb.com', 'username': 'jpbronsted'}

Message: SERVER-79471 include databaseVersion in mirrored reads

(cherry picked from commit 1e286d48d8bad81bdd4e11e5717fb72d5f3c0084)
Branch: v5.0
https://github.com/mongodb/mongo/commit/a3ef7f0536f5c89f70fd1f29d36e50f4d11e6dd4

Comment by Githook User [ 25/Sep/23 ]

Author:

{'name': 'James Bronsted', 'email': 'james.bronsted@mongodb.com', 'username': 'jpbronsted'}

Message: SERVER-79471 include databaseVersion in mirrored reads
Branch: master
https://github.com/mongodb/mongo/commit/1e286d48d8bad81bdd4e11e5717fb72d5f3c0084

Comment by Wenbin Zhu [ 28/Jul/23 ]

From sergi.mateo-bellido@mongodb.com:

"For reads over unsharded collections the routers attach 2 things: the proper dbVersion and a dummy shardVersion that  just states that the collection is unsharded. Having the proper dbVersion is what give us the guarantee that the read will be routed to the primary shard. When a mongod process replicates that read, it should also include the dbVersion, otherwise we won't be able to validate whether that read was routed to the right node."

Generated at Thu Feb 08 06:41:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.