rocksdb/tools
Hui Xiao 3573558ec5 Rewrite memory-charging feature's option API (#9926)
Summary:
**Context:**
Previous PR https://github.com/facebook/rocksdb/pull/9748, https://github.com/facebook/rocksdb/pull/9073, https://github.com/facebook/rocksdb/pull/8428 added separate flag for each charged memory area. Such API design is not scalable as we charge more and more memory areas. Also, we foresee an opportunity to consolidate this feature with other cache usage related features such as `cache_index_and_filter_blocks` using `CacheEntryRole`.

Therefore we decided to consolidate all these flags with `CacheUsageOptions cache_usage_options` and this PR serves as the first step by consolidating memory-charging related flags.

**Summary:**
- Replaced old API reference with new ones, including making `kCompressionDictionaryBuildingBuffer` opt-out and added a unit test for that
- Added missing db bench/stress test for some memory charging features
- Renamed related test suite to indicate they are under the same theme of memory charging
- Refactored a commonly used mocked cache component in memory charging related tests to reduce code duplication
- Replaced the phrases "memory tracking" / "cache reservation" (other than CacheReservationManager-related ones) with "memory charging" for standard description of this feature.

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

Test Plan:
- New unit test for opt-out `kCompressionDictionaryBuildingBuffer` `TEST_F(ChargeCompressionDictionaryBuildingBufferTest, Basic)`
- New unit test for option validation/sanitization `TEST_F(CacheUsageOptionsOverridesTest, SanitizeAndValidateOptions)`
- CI
- db bench (in case querying new options introduces regression) **+0.5% micros/op**: `TEST_TMPDIR=/dev/shm/testdb ./db_bench -benchmarks=fillseq -db=$TEST_TMPDIR  -charge_compression_dictionary_building_buffer=1(remove this for comparison)  -compression_max_dict_bytes=10000 -disable_auto_compactions=1 -write_buffer_size=100000 -num=4000000 | egrep 'fillseq'`

#-run | (pre-PR) avg micros/op | std micros/op | (post-PR)  micros/op | std micros/op | change (%)
-- | -- | -- | -- | -- | --
10 | 3.9711 | 0.264408 | 3.9914 | 0.254563 | 0.5111933721
20 | 3.83905 | 0.0664488 | 3.8251 | 0.0695456 | **-0.3633711465**
40 | 3.86625 | 0.136669 | 3.8867 | 0.143765 | **0.5289363078**

- db_stress: `python3 tools/db_crashtest.py blackbox  -charge_compression_dictionary_building_buffer=1 -charge_filter_construction=1 -charge_table_reader=1 -cache_size=1` killed as normal

Reviewed By: ajkr

Differential Revision: D36054712

Pulled By: hx235

fbshipit-source-id: d406e90f5e0c5ea4dbcb585a484ad9302d4302af
2022-05-17 15:01:51 -07:00
..
advisor
block_cache_analyzer Use std::numeric_limits<> (#9954) 2022-05-05 13:08:21 -07:00
dump
analyze_txn_stress_test.sh
auto_sanity_test.sh
backup_db.sh
benchmark.sh
benchmark_leveldb.sh
blob_dump.cc
check_all_python.py
check_format_compatible.sh Fix format_compatible blowing away its TEST_TMPDIR (#9970) 2022-05-09 13:38:46 -07:00
CMakeLists.txt
db_bench.cc
db_bench_tool.cc Rewrite memory-charging feature's option API (#9926) 2022-05-17 15:01:51 -07:00
db_bench_tool_test.cc
db_crashtest.py Rewrite memory-charging feature's option API (#9926) 2022-05-17 15:01:51 -07:00
db_repl_stress.cc
db_sanity_test.cc Remove own ToString() (#9955) 2022-05-06 13:03:58 -07:00
dbench_monitor
Dockerfile
generate_random_db.sh
ingest_external_sst.sh
io_tracer_parser.cc
io_tracer_parser_test.cc
io_tracer_parser_tool.cc
io_tracer_parser_tool.h
ldb.cc
ldb_cmd.cc Support single delete in ldb (#9469) 2022-05-10 16:37:19 -07:00
ldb_cmd_impl.h Support single delete in ldb (#9469) 2022-05-10 16:37:19 -07:00
ldb_cmd_test.cc Remove own ToString() (#9955) 2022-05-06 13:03:58 -07:00
ldb_test.py Add blob dump support to the dump_live_files command (#9896) 2022-04-22 16:54:43 -07:00
ldb_tool.cc Default try_load_options to true when DB is specified (#9937) 2022-05-04 08:49:46 -07:00
pflag
reduce_levels_test.cc Remove own ToString() (#9955) 2022-05-06 13:03:58 -07:00
regression_test.sh
restore_db.sh
rocksdb_dump_test.sh
run_blob_bench.sh
run_flash_bench.sh
run_leveldb.sh
sample-dump.dmp
simulated_hybrid_file_system.cc
simulated_hybrid_file_system.h
sst_dump.cc
sst_dump_test.cc
sst_dump_tool.cc Use std::numeric_limits<> (#9954) 2022-05-05 13:08:21 -07:00
trace_analyzer.cc
trace_analyzer_test.cc
trace_analyzer_tool.cc Use std::numeric_limits<> (#9954) 2022-05-05 13:08:21 -07:00
trace_analyzer_tool.h
verify_random_db.sh
write_external_sst.sh
write_stress.cc
write_stress_runner.py