• Martin Hansson's avatar
    Bug#50939: Loose Index Scan unduly relies on engine to · 1c5200f6
    Martin Hansson authored
    remember range endpoints
    
    The Loose Index Scan optimization keeps track of a sequence
    of intervals. For the current interval it maintains the
    current interval's endpoints. But the maximum endpoint was
    not stored in the SQL layer; rather, it relied on the
    storage engine to retain this value in-between reads. By
    coincidence this holds for MyISAM and InnoDB. Not for the
    partitioning engine, however.
    
    Fixed by making the key values iterator 
    (QUICK_RANGE_SELECT) keep track of the current maximum endpoint.
    This is also more efficient as we save a call through the
    handler API in case of open-ended intervals.
    
    The code to calculate endpoints was extracted into 
    separate methods in QUICK_RANGE_SELECT, and it was possible to
    get rid of some code duplication as part of fix.
    1c5200f6
range.test 48.7 KB