rocksdb/file
Peter Dillinger 3fd1f11d35 Fix race to make BlockBasedTableOptions effectively mutable (#13082)
Summary:
Fix a longstanding race condition in SetOptions for `block_based_table_factory` options. The fix is mostly described in new, unified `TableFactoryParseFn()` in `cf_options.cc`. Also in this PR:
* Adds a virtual `Clone()` function to TableFactory
* To avoid behavioral hiccups with `SetOptions`, make the "hidden state" of `BlockBasedTableFactory` shared between an original and a clone. For example, `TailPrefetchStats`
* `Configurable` was allowed to be copied but was not safe to do so, because the copy would have and use pointers into object it was copied from (!!!). This has been fixed using relative instead of absolute pointers, though it's still technically relying on undefined behavior (consistent object layout for non-standard-layout types).

For future follow-up:
* Deny SetOptions on block cache options (dubious and not yet made safe with proper shared_ptr handling)

Fixes https://github.com/facebook/rocksdb/issues/10079

Pull Request resolved: https://github.com/facebook/rocksdb/pull/13082

Test Plan:
added to unit tests and crash test

Ran TSAN blackbox crashtest for hours with options to amplify potential race (see https://github.com/facebook/rocksdb/issues/10079)

Reviewed By: cbi42

Differential Revision: D64947243

Pulled By: pdillinger

fbshipit-source-id: 8390299149f50e2a2b39a5247680f2637edb23c8
2024-10-25 10:24:54 -07:00
..
delete_scheduler.cc
delete_scheduler.h
delete_scheduler_test.cc
file_prefetch_buffer.cc
file_prefetch_buffer.h
file_util.cc
file_util.h
filename.cc
filename.h
line_file_reader.cc
line_file_reader.h
prefetch_test.cc
random_access_file_reader.cc
random_access_file_reader.h
random_access_file_reader_test.cc
read_write_util.cc
read_write_util.h
readahead_file_info.h
readahead_raf.cc
readahead_raf.h
sequence_file_reader.cc
sequence_file_reader.h
sst_file_manager_impl.cc
sst_file_manager_impl.h
writable_file_writer.cc
writable_file_writer.h