[SERVER-65955] Shell's special query path for exhaust queries or "$cmd" queries trips tassert on negative limit Created: 26/Apr/22 Updated: 29/Oct/23 Resolved: 11/Jun/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.1.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Mindaugas Malinauskas | Assignee: | David Storch |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Sprint: | QE 2022-06-13 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Linked BF Score: | 15 | ||||||||||||||||||||||||
| Description |
|
The shell currently has two separate paths for running find commands: the DBCommandCursor path which is implemented primarily in the JavaScript layer, and the C++ native path. Historically, the former was used for find commands and the latter was used for legacy OP_QUERY find. However, OP_QUERY find is no longer supported by the shell. The only cases in which the C++ path currently get used are for queries against the "$cmd" namespace and for exhaust queries. The C++ native path is broken when given a negative limit. This trips a tassert in the shell. Examples:
The work for this ticket is to fix the shell so that these queries work as expected, which will resolve the linked build failure. As far as I can tell, there is no reason to use the C++ path for "$cmd" namespaces. I think this relates to some old behavior around pseudo-commands which is no longer relevant. We should just use the normal DBCommandCursor path in this case. We still need to use the C++ native path for exhaust queries. (Note, however, that SERVER-20770 and SERVER-58491 suggest consolidating the two code paths in the shell.) A good fix for this problem would be to add support for exhaust in the new DBClientBase::find() API and then migrate the shell from DBClientBase::query_DEPRECATED() to DBClientBase::find(). |
| Comments |
| Comment by Githook User [ 10/Jun/22 ] |
|
Author: {'name': 'David Storch', 'email': 'david.storch@mongodb.com', 'username': 'dstorch'}Message: In doing so, this also fixes the shell's C++ native query |
| Comment by David Storch [ 08/Jun/22 ] |
|
I've updated the title and description to provide a more accurate description of the bug as well as my planned fix. |
| Comment by Connie Chen [ 26/Apr/22 ] |
|
We should investigate what dependencies DB.fsyncUnlock() has (if any) |