Skip to content
  • Cheng Chang's avatar
    Reduce memory copies when fetching and uncompressing blocks from SST files (#6689) · 40497a87
    Cheng Chang authored
    Summary:
    In https://github.com/facebook/rocksdb/pull/6455, we modified the interface of `RandomAccessFileReader::Read` to be able to get rid of memcpy in direct IO mode.
    This PR applies the new interface to `BlockFetcher` when reading blocks from SST files in direct IO mode.
    
    Without this PR, in direct IO mode, when fetching and uncompressing compressed blocks, `BlockFetcher` will first copy the raw compressed block into `BlockFetcher::compressed_buf_` or `BlockFetcher::stack_buf_` inside `RandomAccessFileReader::Read` depending on the block size. then during uncompressing, it will copy the uncompressed block into `BlockFetcher::heap_buf_`.
    
    In this PR, we get rid of the first memcpy and directly uncompress the block from `direct_io_buf_` to `heap_buf_`.
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/6689
    
    Test Plan: A new unit test `block_fetcher_test` is added.
    
    Reviewed By: anand1976
    
    Differential Revision: D21006729
    
    Pulled By: cheng-chang
    
    fbshipit-source-id: 2370b92c24075692423b81277415feb2aed5d980
    40497a87