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

search_near() for index with custom collator

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: WT2.9.0, WT2.9.1
    • Fix Version/s: WT2.9.2, 3.2.13, 3.4.3, 3.5.4
    • Labels:
      None
    • Sprint:
      Storage 2017-02-13

      Description

      Hi!
      When I search in the index that use custom collator and index key is variable length field, custom collator function can receive invalid WT_ITEM arg. I attached program that reproduce error. It looks like error happens because of next code in __curindex_search_near function:

      cur_index.c

      found_key = child->key;
      if (found_key.size > cursor->key.size)
          found_key.size = cursor->key.size;
      

      Function __curindex_search has same problem.

      Also, I see strange result of search_near() for same index but without custom collator. Attached program has next output:

      def_collator index:
      k = 123
      k = 12345
      custom_collator index:
      k = 123
      k = 12345
      def_collator: search_key = 1234 found_key = 12345 exact = -1
      wiredtiger_unpack_str(s2, &skey2) at (search_near_custom_coll.c:41) failed: Invalid argument [22]
      

      Index def_collator has 2 keys insight: "123" and "12345". I call search_near() for the key = "1234" and get found_key = "12345" with exact = -1. Does the exact should be equal to 1? It seems that "1234" < "12345".

      Thanks!

        Attachments

        1. index_cursor_dup.c
          3 kB
        2. search_near_custom_coll_extr.c
          4 kB
        3. search_near_custom_coll.c
          4 kB
        4. search_near_mod.c
          4 kB

          Issue Links

            Activity

              People

              • Assignee:
                donald.anderson Donald Anderson
                Reporter:
                Denis Shkirya Denis Shkirya
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: