[SERVER-34868] A cursor with the "exhaust" option does not return documents inserted in the same txn Created: 07/May/18 Updated: 29/Oct/23 Resolved: 17/May/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying, Replication |
| Affects Version/s: | 3.7.9 |
| Fix Version/s: | 3.6.9, 4.0.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Robert Guo (Inactive) | Assignee: | William Schultz (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||
| Backport Requested: |
v3.6
|
||||||||||||||||||||||||||||
| Steps To Reproduce: |
|
||||||||||||||||||||||||||||
| Sprint: | Repl 2018-05-21 | ||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Description |
|
The batch size, number of inserted documents, and whether there are existing documents in the collection do not seem to matter. See repro for more detail. |
| Comments |
| Comment by Githook User [ 28/Sep/18 ] |
|
Author: {'name': 'William Schultz', 'email': 'william.schultz@mongodb.com', 'username': 'will62794'}Message: (cherry picked from commit b188d762b8920f791906c80570f770dd9fc09731) |
| Comment by Githook User [ 17/May/18 ] |
|
Author: {'username': 'will62794', 'name': 'William Schultz', 'email': 'william.schultz@mongodb.com'}Message: |
| Comment by William Schultz (Inactive) [ 17/May/18 ] |
|
Ok, I will make that the main task for this ticket. |
| Comment by Spencer Brody (Inactive) [ 16/May/18 ] |
|
I think we should fix it now even if it was a bug with Sessions (or really with causal consistency) previously, because transactions makes it worse. I think we should just error in the shell if we're running against a Session and we try to set the exhaust option. |
| Comment by William Schultz (Inactive) [ 16/May/18 ] |
|
Yeah, that may be reasonable. But this just doesn't really seem like a transactions bug. There's a more basic issue in that the shell doesn't actually run the find command on the session at all when you add the exhaust option. See this other script: exhaust_in_session.js |
| Comment by Spencer Brody (Inactive) [ 15/May/18 ] |
|
It'd probably be nice to return an error in the shell to the user if they ask for something we don't support, rather than silently changing their behavior to not use a transaction when they are expecting that they are inside a transaction. |
| Comment by William Schultz (Inactive) [ 15/May/18 ] |
|
Specifying the exhaust option on a find command in the shell forces it execute as an OP_QUERY request, due to this check in mongo/shell/query.js. I believe this would cause the command to get sent to the server without any session information, so it clearly wouldn't execute as part of a transaction. robert.guo I think we can probably close this as "Works As Designed", if my understanding here is correct. |
| Comment by William Schultz (Inactive) [ 15/May/18 ] |
|
According to the local snapshot reads design, we should explicitly forbid specifying readConcern:snapshot for OP_QUERY requests. |
| Comment by William Schultz (Inactive) [ 15/May/18 ] |
|
I think this may be an issue with the shell as opposed to an issue with the server. It appears that for some reason, specifying the exhaust option on a find command causes it to execute differently in the shell, as an OP_QUERY request, which is handled via a different code path in the server, and wouldn't cause us to trigger the proper transaction related logic. The comment here seems to indicate that exhaust option for find commands is not supported. Need to investigate more to understand the full context here. |