Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-8092

Prefix early exit when keys are present in the insert list

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.1, 5.0.4, 4.4.10, 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • 5
    • Storage - Ra 2021-09-20, Storage - Ra 2021-10-04

      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

        1. repro.py
          8 kB
        2. repro2.py
          4 kB

            Assignee:
            jie.chen@mongodb.com Jie Chen
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: