[SERVER-76037] Write commands using updateOne without shard key path fails spuriously when predicate refers to 'let' parameter Created: 12/Apr/23 Updated: 29/Oct/23 Resolved: 22/Apr/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.1.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | David Storch | Assignee: | Jason Zhang |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||||||
| Assigned Teams: |
Sharding NYC
|
|||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | |||||||||||||||||||
| Operating System: | ALL | |||||||||||||||||||
| Steps To Reproduce: | Repro script:
This only repros the problem if run in the sharded collection passthrough with the feature flag enabled. I'm running it with the following resmoke.py invocation:
|
|||||||||||||||||||
| Sprint: | Sharding NYC 2023-05-01 | |||||||||||||||||||
| Participants: | ||||||||||||||||||||
| Description |
|
Recently we've seen a few problems where query parsing in sharded contexts can fail because we are failing to plumb through the let parameters and runtimeConstants: see
In this case, we use a code path which is guarded behind featureFlagUpdateOneWithoutShardKey. We call extractShardKeyFromBasicQuery(), passing through the predicate but not the let parameters or runtime constants. This function then attempts to parse the predicate without providing the let parameters or runtime constants on the ExpressionContext, causing parsing to fail with an error like the following:
I've provided complete repro instructions in the "Steps to Reproduce" section. This bug does not exist in the release configuration of the server, so it seems like we should fix it as part of the "updateOne without shard key" project which I believe covers delete as well. The solution should be similar to that from |
| Comments |
| Comment by Githook User [ 22/Apr/23 ] |
|
Author: {'name': 'Jason Zhang', 'email': 'jason.zhang@mongodb.com', 'username': 'jz1242'}Message: |
| Comment by David Storch [ 13/Apr/23 ] |
|
jason.zhang@mongodb.com I left a couple of TODOs that need to be handled as part of this ticket: |
| Comment by David Storch [ 13/Apr/23 ] |
|
I'm generalizing the title, since I think the bug applies to all write commands, not just deletes. |