[SERVER-43176] Restrict SortedDataInterface::seekExact to only return exact KeyString matches Created: 05/Sep/19 Updated: 29/Oct/23 Resolved: 01/Dec/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance |
| Affects Version/s: | None |
| Fix Version/s: | 5.2.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Louis Williams | Assignee: | Louis Williams |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Execution Team 2021-11-15, Execution Team 2021-11-29, Execution Team 2021-12-13 |
| Participants: |
| Description |
|
We can narrow the scope of the function so that it's semantics are more obvious. That is: only return exact KeyString matches. Don't try to compare without the RecordId just to satisfy the API. Additionally, IndexAccessMethod::findSingle() is the only caller of SortedDataInterface::seekExact. And index lookups on the _id index are the only callers of findSingle(). For example: all indexes but the _id index store keys as the concatenation of KeyString+RecordId. If I seek with seekExact on the _id index, I simply pass that key to the storage engine and get a match. If I seek with seekExact on a non-_id index, it would be incorrect to ever return a key, because there will never be an exact match unless a RecordID is also part of the seeked-for KeyString (and that is pointless). |
| Comments |
| Comment by Githook User [ 01/Dec/21 ] |
|
Author: {'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}Message: This replaces SortedDataInterface::Cursor::seekExact with a findLoc |
| Comment by Louis Williams [ 05/Sep/19 ] |
|
This would also allow us to do what I suggested before in |