[SERVER-22739] Sharding SecondaryPreferred read commands routed to a primary do not handle StaleConfigException Created: 18/Feb/16 Updated: 11/Jul/18 Resolved: 11/Aug/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | 3.0.9, 3.2.13, 3.4.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kaloian Manassiev | Assignee: | Esha Maharishi (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: | Run the following JS script:
|
||||||||||||||||||||||||||||||||||||||
| Sprint: | Sharding 11 (03/11/16), Sharding 2017-08-21 | ||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||||||||||||||||||||||||
| Description |
|
SecondaryPreferred reads are allowed to be routed to a primary host if this is deemed the most appropriate. Legacy style queries disable the version checking and so they go over unversioned connections. However other command implementations, such as distinct or count which use ShardCollection will fail with a cryptic NodeNotFound error if they get routed to a primary with the SecondaryPreferred preference set, because they do not expect to see StaleConfigException. See the included repro script for more information. |
| Comments |
| Comment by Esha Maharishi (Inactive) [ 11/Jul/18 ] | |||||||
|
Note that the above comment was made shortly before the distinct command was made to send shardVersion under So, the distinct command is no longer an exception; I added this comment for posterity. | |||||||
| Comment by Esha Maharishi (Inactive) [ 11/Aug/17 ] | |||||||
|
This should be fixed by the Safe Secondary Reads project in 3.6 (PM-256), which sends shardVersions on read requests from mongos to shards (with some known exceptions, such as distinct and geoNear) regardless of the readPreference. | |||||||
| Comment by Kaloian Manassiev [ 18/Feb/16 ] | |||||||
|
Confirmed that bug reproduces in 3.0 with similar (but different error message):
Attaching a repro script in the repro steps section. | |||||||
| Comment by Spencer Brody (Inactive) [ 18/Feb/16 ] | |||||||
|
How long has this issue existed for? Is it a regression? |