rocksdb/include/rocksdb
Zhongyi Xie 2f41ecfe75 Refactor trimming logic for immutable memtables (#5022)
Summary:
MyRocks currently sets `max_write_buffer_number_to_maintain` in order to maintain enough history for transaction conflict checking. The effectiveness of this approach depends on the size of memtables. When memtables are small, it may not keep enough history; when memtables are large, this may consume too much memory.
We are proposing a new way to configure memtable list history: by limiting the memory usage of immutable memtables. The new option is `max_write_buffer_size_to_maintain` and it will take precedence over the old `max_write_buffer_number_to_maintain` if they are both set to non-zero values. The new option accounts for the total memory usage of flushed immutable memtables and mutable memtable. When the total usage exceeds the limit, RocksDB may start dropping immutable memtables (which is also called trimming history), starting from the oldest one.
The semantics of the old option actually works both as an upper bound and lower bound. History trimming will start if number of immutable memtables exceeds the limit, but it will never go below (limit-1) due to history trimming.
In order the mimic the behavior with the new option, history trimming will stop if dropping the next immutable memtable causes the total memory usage go below the size limit. For example, assuming the size limit is set to 64MB, and there are 3 immutable memtables with sizes of 20, 30, 30. Although the total memory usage is 80MB > 64MB, dropping the oldest memtable will reduce the memory usage to 60MB < 64MB, so in this case no memtable will be dropped.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5022

Differential Revision: D14394062

Pulled By: miasantreble

fbshipit-source-id: 60457a509c6af89d0993f988c9b5c2aa9e45f5c5
2019-08-23 13:55:34 -07:00
..
utilities Refactor trimming logic for immutable memtables (#5022) 2019-08-23 13:55:34 -07:00
advanced_options.h Refactor trimming logic for immutable memtables (#5022) 2019-08-23 13:55:34 -07:00
c.h Refactor trimming logic for immutable memtables (#5022) 2019-08-23 13:55:34 -07:00
cache.h Move the uncompression dictionary object out of the block cache (#5584) 2019-07-23 16:01:44 -07:00
cleanable.h Support pragma once in all header files and cleanup some warnings (#4339) 2018-09-05 18:13:31 -07:00
compaction_filter.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
compaction_job_stats.h Add a new CPU time counter to compaction report (#4889) 2019-01-29 17:24:00 -08:00
comparator.h The ObjectRegistry class replaces the Registrar and NewCustomObjects.… (#5293) 2019-07-23 17:13:05 -07:00
concurrent_task_limiter.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
convenience.h Do readahead in VerifyChecksum() (#5713) 2019-08-16 16:42:56 -07:00
db_bench_tool.h Change RocksDB License 2017-07-15 16:11:23 -07:00
db_dump_tool.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
db.h Do readahead in VerifyChecksum() (#5713) 2019-08-16 16:42:56 -07:00
env_encryption.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
env.h The ObjectRegistry class replaces the Registrar and NewCustomObjects.… (#5293) 2019-07-23 17:13:05 -07:00
experimental.h Change RocksDB License 2017-07-15 16:11:23 -07:00
filter_policy.h Remove a couple of non-public includes from public header file (#5219) 2019-04-19 11:10:33 -07:00
flush_block_policy.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
iostats_context.h Add a new CPU time counter to compaction report (#4889) 2019-01-29 17:24:00 -08:00
iterator.h Revert "BaseDeltaIterator: always check valid() before accessing key(… (#4744) 2018-12-03 23:38:27 -08:00
ldb_tool.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
listener.h Add copyright headers per FB open-source checkup tool. (#5199) 2019-04-18 10:55:01 -07:00
memory_allocator.h JemallocNodumpAllocator: option to limit tcache memory usage (#4736) 2018-11-29 17:33:40 -08:00
memtablerep.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
merge_operator.h The ObjectRegistry class replaces the Registrar and NewCustomObjects.… (#5293) 2019-07-23 17:13:05 -07:00
metadata.h Export Import sst files (#5495) 2019-07-17 12:27:14 -07:00
options.h Introduce IngestExternalFileOptions.verify_checksums_readahead_size (#5721) 2019-08-20 10:43:39 -07:00
perf_context.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
perf_level.h Introduce a CPU time counter in perf_context (#4741) 2018-12-20 12:03:44 -08:00
persistent_cache.h Change RocksDB License 2017-07-15 16:11:23 -07:00
rate_limiter.h Fix typos in comments (#4819) 2018-12-26 09:43:56 -08:00
slice_transform.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
slice.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
snapshot.h Change RocksDB License 2017-07-15 16:11:23 -07:00
sst_dump_tool.h tools: use provided options instead of the default (#4839) 2019-01-03 11:23:49 -08:00
sst_file_manager.h Smooth the deletion of WAL files (#5116) 2019-03-28 15:17:13 -07:00
sst_file_reader.h Do readahead in VerifyChecksum() (#5713) 2019-08-16 16:42:56 -07:00
sst_file_writer.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
statistics.h WritePrepared: fix Get without snapshot (#5664) 2019-08-05 13:41:21 -07:00
stats_history.h Persistent Stats: persist stats history to disk (#5046) 2019-06-17 15:21:50 -07:00
status.h New API to get all merge operands for a Key (#5604) 2019-08-06 14:26:44 -07:00
table_properties.h Add copyright headers per FB open-source checkup tool. (#5199) 2019-04-18 10:55:01 -07:00
table.h LRU Cache to enable mid-point insertion by default (#5508) 2019-06-27 10:20:57 -07:00
thread_status.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
threadpool.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
trace_reader_writer.h Add the max trace file size limitation option to Tracing (#4610) 2018-11-27 14:27:05 -08:00
transaction_log.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
types.h WriteUnPrepared: less virtual in iterator callback (#5049) 2019-04-02 14:47:16 -07:00
universal_compaction.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
version.h Update history and version for 6.4.0 (#5652) 2019-07-30 16:10:06 -07:00
wal_filter.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
write_batch_base.h Fix WriteBatchBase::DeleteRange API comment (#4935) 2019-01-31 14:43:40 -08:00
write_batch.h WriteUnPrepared: savepoint support (#5627) 2019-07-31 13:39:39 -07:00
write_buffer_manager.h WriteBufferManger doens't cost to cache if no limit is set (#4695) 2018-11-18 16:55:43 -08:00