• P
    Fix a major performance bug in 6.21 for cache entry stats (#8369) · 2f93a3b8
    Peter Dillinger 提交于
    Summary:
    In final polishing of https://github.com/facebook/rocksdb/issues/8297 (after most manual testing), I
    broke my own caching layer by sanitizing an input parameter with
    std::min(0, x) instead of std::max(0, x). I resisted unit testing the
    timing part of the result caching because historically, these test
    are either flaky or difficult to write, and this was not a correctness
    issue. This bug is essentially unnoticeable with a small number
    of column families but can explode background work with a
    large number of column families.
    
    This change fixes the logical error, removes some unnecessary related
    optimization, and adds mock time/sleeps to the unit test to ensure we
    can cache hit within the age limit.
    
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/8369
    
    Test Plan: added time testing logic to existing unit test
    
    Reviewed By: ajkr
    
    Differential Revision: D28950892
    
    Pulled By: pdillinger
    
    fbshipit-source-id: e79cd4ff3eec68fd0119d994f1ed468c38026c3b
    2f93a3b8
internal_stats.cc 67.7 KB