• Tomislav Novak's avatar
    Fix a perf regression in ForwardIterator · 5508122e
    Tomislav Novak authored
    Summary:
    I noticed that memtable iterator usually crosses the `iterate_upper_bound`
    threshold when tailing. Changes introduced in D43833 made `NeedToSeekImmutable`
    always return true in such case, even when `Seek()` only needs to rewind the
    memtable iterator. In a test I ran, this caused the "tailing efficiency"
    (ratio of calls to `Seek()` that only affect the memtable versus all seeks)
    to drop almost to zero.
    
    This diff attempts to fix the regression by using a different flag to indicate
    that `current_` is over the limit instead of resetting `valid_` in
    `UpdateCurrent()`.
    
    Test Plan: `DBTestTailingIterator.TailingIteratorUpperBound`
    
    Reviewers: sdong, rven
    
    Reviewed By: rven
    
    Subscribers: dhruba, march
    
    Differential Revision: https://reviews.facebook.net/D45909
    5508122e