diff options
author | Luke Chen <luke.chen@mongodb.com> | 2021-03-23 16:11:10 +1100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-23 05:50:04 +0000 |
commit | 34d23ddd9cc9132fff6e9fe4ab3d287d6b8d3955 (patch) | |
tree | 3c1e043047036283c3ae29b7fa5c163ab14fa929 /src/third_party/wiredtiger/src/cursor | |
parent | 8fe0dc5cdcb8dd8f6258e1e628eec77a1e6a6be3 (diff) | |
download | mongo-34d23ddd9cc9132fff6e9fe4ab3d287d6b8d3955.tar.gz |
Import wiredtiger: d9105d6af2c94c01c2afeab787fec209169d6d06 from branch mongodb-5.0
ref: 472c9d8a9e..d9105d6af2
for: 5.0.0
WT-7331 Fix exact return when we place the history store cursor on e exact key initially
Diffstat (limited to 'src/third_party/wiredtiger/src/cursor')
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_hs.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/third_party/wiredtiger/src/cursor/cur_hs.c b/src/third_party/wiredtiger/src/cursor/cur_hs.c index d4cda2065c6..c2f62cc544d 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_hs.c +++ b/src/third_party/wiredtiger/src/cursor/cur_hs.c @@ -613,8 +613,8 @@ __curhs_search_near(WT_CURSOR *cursor, int *exactp) if (exact >= 0) { /* - * We placed the file cursor before the search key. Try first to walk forwards to see if we - * can find a visible record. If nothing is visible, try to walk backwards. + * We placed the file cursor after or exactly at the search key. Try first to walk forwards + * to see if we can find a visible record. If nothing is visible, try to walk backwards. */ WT_ERR_NOTFOUND_OK(__curhs_next_visible(session, hs_cursor), true); if (ret == WT_NOTFOUND) { @@ -657,7 +657,7 @@ __curhs_search_near(WT_CURSOR *cursor, int *exactp) } WT_ERR(ret); /* - * Keeping looking for the first visible update in the specified range when walking + * Keep looking for the first visible update in the specified range when walking * backwards. */ WT_ERR(__curhs_prev_visible(session, hs_cursor)); @@ -669,15 +669,19 @@ __curhs_search_near(WT_CURSOR *cursor, int *exactp) } else { WT_ERR(ret); /* - * We find an update when walking forwards. If initially we land on the same key as the - * specified key, exact will be 0 and we should return that. If it is not visible, we + * We find an update when walking forwards. If initially we landed on the same key as + * the specified key, we need to compare the keys to see where we are now. Otherwise, we * must have found a key that is larger than the specified key. */ - *exactp = exact; + if (exact == 0) { + WT_ERR(__wt_compare(session, NULL, &file_cursor->key, srch_key, &cmp)); + *exactp = cmp; + } else + *exactp = exact; } } else { /* - * We placed the file cursor after the search key. Try first to walk backwards to see if we + * We placed the file cursor before the search key. Try first to walk backwards to see if we * can find a visible record. If nothing is visible, try to walk forwards. */ WT_ERR_NOTFOUND_OK(__curhs_prev_visible(session, hs_cursor), true); @@ -721,7 +725,7 @@ __curhs_search_near(WT_CURSOR *cursor, int *exactp) } WT_ERR(ret); /* - * Keeping looking for the first visible update in the specified range when walking + * Keep looking for the first visible update in the specified range when walking * forwards. */ WT_ERR(__curhs_next_visible(session, hs_cursor)); |