• Daniel Murphy's avatar
    [LevelDatabase] Switched file handle eviction to LRU (previously MRU) · 2a9a8201
    Daniel Murphy authored
    During compaction each level is scanned at the same time sequentially.
    This means there are files being read from each level at the same
    time but each level is read in a sequential manner. Files are read
    multiple times during scanning, first reading the end of the file then
    contents inside.
    
    Because of this behavior, most-recently-used eviction is the worst
    because:
    1. The multiple reads in a file (in a non-sequential manner) causes a
       ton of filesystem thrashing here.
    2. Files are never re-read once they are finished being scanned in a
       level, so there is no reason to keep it the handle around.
    
    Least-recently-used eviction more closely models the reading behavior
    of a leveldb compaction, and this uses leveldb's sharded LRU cache.
    
    File thrashing here is the suspected cause of the assigned bug, where
    leveldb never opens. This is a speculative but educated guess fix.
    
    Bug: 795369
    Change-Id: I7f4965a2a93b05ae558688e58d220b0fcf549430
    Reviewed-on: https://chromium-review.googlesource.com/905575
    Commit-Queue: Victor Costan <pwnall@chromium.org>
    Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
    Reviewed-by: default avatarChris Mumford <cmumford@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#537275}
    2a9a8201
env_chromium.h 12.5 KB