• A
    dedup ReadOptions in iterator hierarchy (#7210) · a4a4a2da
    Andrew Kryczka 提交于
    Summary:
    Previously, a `ReadOptions` object was stored in every `BlockBasedTableIterator`
    and every `LevelIterator`. This redundancy consumes extra memory,
    resulting in the `Arena` making more allocations, and iteration
    observing worse cache performance.
    
    This PR migrates callers of `NewInternalIterator()` and
    `MakeInputIterator()` to provide a `ReadOptions` object guaranteed to
    outlive the returned iterator. When the iterator's lifetime will be managed by the
    user, this lifetime guarantee is achieved by storing the `ReadOptions`
    value in `ArenaWrappedDBIter`. Then, sub-iterators of `NewInternalIterator()` and
    `MakeInputIterator()` can hold a reference-to-const `ReadOptions`.
    
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/7210
    
    Test Plan:
    - `make check` under ASAN and valgrind
    - benchmark: on a DB with 2 L0 files and 3 L1+ levels, this PR reduced `Arena` allocation 4792 -> 4160 bytes.
    
    Reviewed By: anand1976
    
    Differential Revision: D22861323
    
    Pulled By: ajkr
    
    fbshipit-source-id: 54aebb3e89c872eeab0f5793b4b6e42878d093ce
    a4a4a2da
compaction_job.cc 69.9 KB