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:
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!
- duplicates
-
WT-3070 Fix search_near() for index cursor
- Closed