Using the repro attached, when keys are not evicted, they remain in the insert list. When this is the case, the field cbt->tmp->data is not set and the condition added as part of WT-8044 does not work as expected because it is NULL. When the keys are evicted, cbt->tmp->data is updated and the field can be used.
The field that seems to be always set whether the keys are in the inserted list or on disk is cbt->upd_value->buf. The suggested change is the following:
diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c index b3d879fae..d8df06486 100644 --- a/src/btree/bt_cursor.c +++ b/src/btree/bt_cursor.c @@ -688,7 +688,7 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp) * 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) + __wt_prefix_match(&state.key, &cbt->upd_value->buf) != 0) valid = false;
With this change, the issue does not reproduce.
EDIT: Seems that a better way to retrieve the key would be usingĀ wt_key_return
Definition of done:
- Check the reproducers and confirm the issue does not occur
- Modify the existing test_search_near02 so we also do the test when keys are not evicted
- has to be done before
-
WT-7924 Create a stress test for prefix search near key validation
- Closed