0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

Import wiredtiger: 22ccc89622a94818aed9b6714f134d34819f388e from branch mongodb-5.0

ref: cd498c9ee9..22ccc89622
for: 5.1.0

WT-7267       Compare entire history store key when inferring cursor position in `search_near`
This commit is contained in:
Chenhao Qu 2021-05-19 05:34:33 +00:00 committed by Evergreen Agent
parent e9c838ed66
commit 615195e7cf
2 changed files with 21 additions and 5 deletions

View File

@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-5.0",
"commit": "cd498c9ee924e49661e70ca78ec384e8c9081bb8"
"commit": "22ccc89622a94818aed9b6714f134d34819f388e"
}

View File

@ -651,9 +651,17 @@ __curhs_search_near(WT_CURSOR *cursor, int *exactp)
break;
/*
* We are now smaller than the key range, which indicates nothing is visible to
* us in the specified key range.
* We're comparing the entire history store key (as opposed to just the data
* store component) because ordering can be different between the data store and
* history store due to packing. Since we know we're NOT in the specified key
* range due to the check above, checking whether we're before or after the full
* history store key that we're running a `search near` on will tell us whether
* we're before or after the specified key range.
*
* If we're before the specified key range, that means nothing is visible to us
* in the specified key range and we should terminate the search.
*/
WT_ERR(__wt_compare(session, NULL, &file_cursor->key, srch_key, &cmp));
if (cmp < 0) {
ret = WT_NOTFOUND;
goto err;
@ -719,9 +727,17 @@ __curhs_search_near(WT_CURSOR *cursor, int *exactp)
break;
/*
* We are now larger than the key range, which indicates nothing is visible to
* us in the specified key range.
* We're comparing the entire history store key (as opposed to just the data
* store component) because ordering can be different between the data store and
* history store due to packing. Since we know we're NOT in the specified key
* range due to the check above, checking whether we're before or after the full
* history store key that we're running a `search near` on will tell us whether
* we're before or after the specified key range.
*
* If we're after the specified key range, that means nothing is visible to us
* in the specified key range and we should terminate the search.
*/
WT_ERR(__wt_compare(session, NULL, &file_cursor->key, srch_key, &cmp));
if (cmp > 0) {
ret = WT_NOTFOUND;
goto err;