[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: |
|
||||||||||||
| 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
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: (cherry picked from commit 1e286d48d8bad81bdd4e11e5717fb72d5f3c0084) |
| Comment by Githook User [ 26/Sep/23 ] |
|
Author: {'name': 'James Bronsted', 'email': 'james.bronsted@mongodb.com', 'username': 'jpbronsted'}Message: (cherry picked from commit 1e286d48d8bad81bdd4e11e5717fb72d5f3c0084) |
| Comment by Githook User [ 26/Sep/23 ] |
|
Author: {'name': 'James Bronsted', 'email': 'james.bronsted@mongodb.com', 'username': 'jpbronsted'}Message: (cherry picked from commit 1e286d48d8bad81bdd4e11e5717fb72d5f3c0084) |
| Comment by Githook User [ 26/Sep/23 ] |
|
Author: {'name': 'James Bronsted', 'email': 'james.bronsted@mongodb.com', 'username': 'jpbronsted'}Message: (cherry picked from commit 1e286d48d8bad81bdd4e11e5717fb72d5f3c0084) |
| Comment by Githook User [ 25/Sep/23 ] |
|
Author: {'name': 'James Bronsted', 'email': 'james.bronsted@mongodb.com', 'username': 'jpbronsted'}Message: |
| 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." |