BasicKV::PrefixLookup: I notice the founction may return one KV pair. it is designing for that or a bug?
Opened this issue · 3 comments
SYaoJun commented
zz-jason commented
It's a bug, BasicKv hasn't been fully tested. Would you like to fix this issue?
SYaoJun commented
yes, I can follow the BasicKV::ScanAsc() function, which use a pessimistic method. Actually, I want to fix it based on optimistic method. But I don't know how to handle the situation when a leaf node need move to their neighbor leaf
zz-jason commented
When latch conflict happens (the page being scanned is modified by others at the same time), an optimistic scan needs to:
- retry from the beginning (or retry scanning from the upper bound key of the last unchanged page)
- clear all the previously scanned and buffered key values
The current API sends each scanned key value to a custom callback, which makes the retry hard to implement. The easiest way to correctly implement ScanDesc or ScanAsc is to use a pessimistic shared iterator.