diff options
author | Luke Chen <luke.chen@mongodb.com> | 2021-10-07 17:44:57 +1100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-07 07:04:01 +0000 |
commit | 58971da1ef93435a9f62bf4708a81713def6e88c (patch) | |
tree | c75ff94f74016177b2eef5f82c76a7d79238e8a5 /src/third_party/wiredtiger/src/btree/bt_cursor.c | |
parent | cf4ce26ca21a836aa336313a4a10676ca91c3131 (diff) | |
download | mongo-r4.4.10-rc0.tar.gz |
Import wiredtiger: e8bf2e5fcb33197b73c7bb550742926f59e22218 from branch mongodb-4.4r4.4.10-rc0r4.4.10
ref: a9bd69a7ca..e8bf2e5fcb
for: 4.4.10
WT-5270 Create wtperf script for evergreen
WT-7169 Commit ts should not be lesser than the last durable ts in test_timestamp22.py
WT-7392 Added evicted flag to dhandle for use by session sweep
WT-7757 Skip obsolete leaf pages without having to read them
WT-7924 Create a stress test for prefix search near key validation
WT-7980 Create interface to "log:" cursor which switches log files before returning them
WT-7992 Provide API to return the last key in a table regardless of visibility
WT-8022 Verify WT_CURSOR.modify return values in format test program
WT-8036 Added connection panic flag in two assert statements in wt_evict_thread_run and _wt_evict_thread_stop.
WT-8048 Remove split_8 timing stress configuration
WT-8055 Fix issue when compact quits when running at the same time as a checkpoint
WT-8059 Add a check in salvage when no overflow items are found
WT-8068 Improve __rollback_row_modify control flow
WT-8069 Coverity analysis defect 120706: Redundant test
WT-8070 Remove discrepancy between prefix_key and prefix_search
WT-8078 Implement tiered storage local retention caching
WT-8086 Create cpp test for prefix search near entries
WT-8092 Prefix early exit when keys are present in the insert list
WT-8101 Enable diagnostic mode for the CPP tests in evergreen
WT-8115 Define macros only when necessary in cpp files
WT-8119 Add targeted compact testing to the existing testing framework
WT-8146 Stop the tracking component when a CPP test ends
WT-8161 Reduce verbosity of CMake Evergreen smoke
WT-8162 Refactor uses of SMOKE arg in 'define_c_test' helper
WT-8164 Disable rollback_to_stable10 python test on Windows
WT-8171 Implement a C style test in the CPP testing framework
WT-8193 Wrong corner case in VLCS rollback-to-stable
Diffstat (limited to 'src/third_party/wiredtiger/src/btree/bt_cursor.c')
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_cursor.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_cursor.c b/src/third_party/wiredtiger/src/btree/bt_cursor.c index b3d879fae8f..6cd2b3c3fc7 100644 --- a/src/third_party/wiredtiger/src/btree/bt_cursor.c +++ b/src/third_party/wiredtiger/src/btree/bt_cursor.c @@ -684,15 +684,8 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp) } /* - * If a valid key has been found and we are doing a prefix search near, we want to return the - * key only if it is a prefix match. - */ - if (valid && F_ISSET(cursor, WT_CURSTD_PREFIX_SEARCH) && - __wt_prefix_match(&state.key, cbt->tmp) != 0) - valid = false; - - /* - * If we find a valid key, return it. + * If we find a valid key, check if we are performing a prefix search near. If we are, return + * the record only if it is a prefix match. If not, return the record. * * Else, creating a record past the end of the tree in a fixed-length column-store implicitly * fills the gap with empty records. In this case, we instantiate the empty record, it's an @@ -708,8 +701,22 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp) */ if (valid) { exact = cbt->compare; - ret = __cursor_kv_return(cbt, cbt->upd_value); - } else if (__cursor_fix_implicit(btree, cbt)) { + /* + * Set the cursor key before the prefix search near check. If the prefix doesn't match, + * restore the cursor state, and continue to search for a valid key. Otherwise set the + * cursor value and return the valid record. + */ + WT_ERR(__wt_key_return(cbt)); + if (F_ISSET(cursor, WT_CURSTD_PREFIX_SEARCH) && + __wt_prefix_match(&state.key, &cursor->key) != 0) + __cursor_state_restore(cursor, &state); + else { + WT_ERR(__wt_value_return(cbt, cbt->upd_value)); + goto done; + } + } + + if (__cursor_fix_implicit(btree, cbt)) { cbt->recno = cursor->recno; cbt->v = 0; cursor->value.data = &cbt->v; |