Skip to content
  • Mike Kolupaev's avatar
    Add DBOptions. avoid_unnecessary_blocking_io to defer file deletions (#5043) · 120bc471
    Mike Kolupaev authored
    Summary:
    Just like ReadOptions::background_purge_on_iterator_cleanup but for ColumnFamilyHandle instead of Iterator.
    
    In our use case we sometimes call ColumnFamilyHandle's destructor from low-latency threads, and sometimes it blocks the thread for a few seconds deleting the files. To avoid that, we can either offload ColumnFamilyHandle's destruction to a background thread on our side, or add this option on rocksdb side. This PR does the latter, to be consistent with how we solve exactly the same problem for iterators using background_purge_on_iterator_cleanup option.
    
    (EDIT: It's avoid_unnecessary_blocking_io now, and affects both CF drops and iterator destructors.)
    I'm not quite comfortable with having two separate options (background_purge_on_iterator_cleanup and background_purge_on_cf_cleanup) for such a rarely used thing. Maybe we should merge them? Rename background_purge_on_cf_cleanup to something like delete_files_on_background_threads_only or avoid_blocking_io_in_unexpected_places, and make iterators use it instead of the one in ReadOptions? I can do that here if you guys think it's better.
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/5043
    
    Differential Revision: D14339233
    
    Pulled By: al13n321
    
    fbshipit-source-id: ccf7efa11c85c9a5b91d969bb55627d0fb01e7b8
    120bc471