@nxtedition/rocksdb 7.1.20 → 7.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deps/rocksdb/rocksdb/CMakeLists.txt +13 -6
- package/deps/rocksdb/rocksdb/Makefile +1 -1
- package/deps/rocksdb/rocksdb/TARGETS +2 -0
- package/deps/rocksdb/rocksdb/cache/cache_reservation_manager_test.cc +1 -0
- package/deps/rocksdb/rocksdb/cache/cache_test.cc +4 -4
- package/deps/rocksdb/rocksdb/cache/clock_cache.cc +139 -161
- package/deps/rocksdb/rocksdb/cache/clock_cache.h +92 -82
- package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache.cc +16 -3
- package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache.h +9 -3
- package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache_test.cc +73 -30
- package/deps/rocksdb/rocksdb/cache/fast_lru_cache.cc +25 -67
- package/deps/rocksdb/rocksdb/cache/fast_lru_cache.h +41 -40
- package/deps/rocksdb/rocksdb/cache/lru_cache.cc +109 -155
- package/deps/rocksdb/rocksdb/cache/lru_cache.h +127 -149
- package/deps/rocksdb/rocksdb/cache/lru_cache_test.cc +75 -80
- package/deps/rocksdb/rocksdb/cache/sharded_cache.cc +22 -172
- package/deps/rocksdb/rocksdb/cache/sharded_cache.h +272 -85
- package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.cc +12 -4
- package/deps/rocksdb/rocksdb/db/blob/blob_counting_iterator_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_file_addition_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_file_builder_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_file_cache_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_file_garbage_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_file_reader_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_garbage_meter_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_source_test.cc +13 -4
- package/deps/rocksdb/rocksdb/db/builder.cc +1 -1
- package/deps/rocksdb/rocksdb/db/column_family.cc +15 -1
- package/deps/rocksdb/rocksdb/db/compact_files_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/compaction/clipping_iterator_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction.cc +25 -7
- package/deps/rocksdb/rocksdb/db/compaction/compaction.h +10 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.cc +22 -8
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.h +14 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +38 -12
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +9 -6
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +408 -6
- package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.cc +244 -54
- package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.h +27 -6
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.cc +25 -30
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.cc +87 -26
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.cc +23 -4
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +61 -0
- package/deps/rocksdb/rocksdb/db/compaction/tiered_compaction_test.cc +294 -21
- package/deps/rocksdb/rocksdb/db/comparator_db_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/cuckoo_table_db_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +28 -10
- package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +4 -4
- package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +272 -0
- package/deps/rocksdb/rocksdb/db/db_flush_test.cc +38 -0
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +69 -25
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +7 -3
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +29 -12
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_debug.cc +0 -12
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +10 -4
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +35 -22
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +5 -1
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +40 -5
- package/deps/rocksdb/rocksdb/db/db_iter.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_iter_stress_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_iter_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_iterator_test.cc +22 -0
- package/deps/rocksdb/rocksdb/db/db_kv_checksum_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_logical_block_size_cache_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_range_del_test.cc +72 -5
- package/deps/rocksdb/rocksdb/db/db_tailing_iter_test.cc +60 -21
- package/deps/rocksdb/rocksdb/db/db_test.cc +170 -1
- package/deps/rocksdb/rocksdb/db/db_test2.cc +9 -3
- package/deps/rocksdb/rocksdb/db/db_test_util.cc +19 -0
- package/deps/rocksdb/rocksdb/db/db_test_util.h +32 -0
- package/deps/rocksdb/rocksdb/db/db_with_timestamp_basic_test.cc +444 -3
- package/deps/rocksdb/rocksdb/db/db_write_test.cc +8 -8
- package/deps/rocksdb/rocksdb/db/dbformat.cc +13 -0
- package/deps/rocksdb/rocksdb/db/dbformat.h +59 -4
- package/deps/rocksdb/rocksdb/db/dbformat_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/experimental.cc +3 -1
- package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc +24 -3
- package/deps/rocksdb/rocksdb/db/fault_injection_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/filename_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/flush_job.cc +4 -3
- package/deps/rocksdb/rocksdb/db/flush_job_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/forward_iterator.cc +85 -43
- package/deps/rocksdb/rocksdb/db/forward_iterator.h +3 -1
- package/deps/rocksdb/rocksdb/db/internal_stats.cc +33 -6
- package/deps/rocksdb/rocksdb/db/internal_stats.h +6 -0
- package/deps/rocksdb/rocksdb/db/listener_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/log_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/log_writer.cc +1 -1
- package/deps/rocksdb/rocksdb/db/log_writer.h +1 -1
- package/deps/rocksdb/rocksdb/db/manual_compaction_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/memtable.cc +158 -56
- package/deps/rocksdb/rocksdb/db/memtable.h +2 -0
- package/deps/rocksdb/rocksdb/db/memtable_list_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/merge_helper_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/options_file_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/perf_context_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/periodic_task_scheduler_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/plain_table_db_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/prefix_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/range_del_aggregator.cc +52 -9
- package/deps/rocksdb/rocksdb/db/range_del_aggregator.h +31 -2
- package/deps/rocksdb/rocksdb/db/range_del_aggregator_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.cc +81 -42
- package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.h +78 -12
- package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/repair_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/seqno_time_test.cc +154 -27
- package/deps/rocksdb/rocksdb/db/seqno_to_time_mapping.cc +21 -4
- package/deps/rocksdb/rocksdb/db/seqno_to_time_mapping.h +4 -1
- package/deps/rocksdb/rocksdb/db/table_cache.cc +18 -6
- package/deps/rocksdb/rocksdb/db/table_properties_collector_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/version_builder_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/version_edit_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/version_set.cc +15 -7
- package/deps/rocksdb/rocksdb/db/version_set.h +2 -1
- package/deps/rocksdb/rocksdb/db/version_set_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/version_util.h +3 -1
- package/deps/rocksdb/rocksdb/db/wal_manager_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.cc +28 -9
- package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.h +21 -0
- package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization_test.cc +30 -0
- package/deps/rocksdb/rocksdb/db/wide/wide_columns.cc +4 -0
- package/deps/rocksdb/rocksdb/db/write_batch.cc +30 -7
- package/deps/rocksdb/rocksdb/db/write_batch_internal.h +24 -13
- package/deps/rocksdb/rocksdb/db/write_batch_test.cc +5 -4
- package/deps/rocksdb/rocksdb/db/write_callback_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/write_controller_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/batched_ops_stress.cc +104 -60
- package/deps/rocksdb/rocksdb/db_stress_tool/cf_consistency_stress.cc +199 -108
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.cc +39 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +8 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.cc +3 -1
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +19 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_shared_state.h +26 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +247 -118
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.h +24 -4
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +18 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/expected_state.cc +129 -1
- package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.cc +22 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.h +4 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +312 -117
- package/deps/rocksdb/rocksdb/env/env_basic_test.cc +1 -0
- package/deps/rocksdb/rocksdb/env/fs_posix.cc +10 -2
- package/deps/rocksdb/rocksdb/env/io_posix_test.cc +1 -0
- package/deps/rocksdb/rocksdb/env/mock_env_test.cc +1 -0
- package/deps/rocksdb/rocksdb/file/delete_scheduler.cc +5 -1
- package/deps/rocksdb/rocksdb/file/delete_scheduler_test.cc +1 -0
- package/deps/rocksdb/rocksdb/file/prefetch_test.cc +1 -0
- package/deps/rocksdb/rocksdb/file/writable_file_writer.h +1 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +49 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/cache.h +44 -18
- package/deps/rocksdb/rocksdb/include/rocksdb/db.h +8 -7
- package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +6 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/listener.h +3 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/secondary_cache.h +17 -4
- package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_reader.h +4 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_writer.h +7 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/universal_compaction.h +1 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/wide_columns.h +9 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/write_batch.h +3 -6
- package/deps/rocksdb/rocksdb/logging/auto_roll_logger_test.cc +1 -0
- package/deps/rocksdb/rocksdb/logging/env_logger_test.cc +1 -0
- package/deps/rocksdb/rocksdb/logging/event_logger_test.cc +1 -0
- package/deps/rocksdb/rocksdb/memory/arena.cc +23 -88
- package/deps/rocksdb/rocksdb/memory/arena.h +25 -31
- package/deps/rocksdb/rocksdb/memory/arena_test.cc +61 -0
- package/deps/rocksdb/rocksdb/memory/memory_allocator_test.cc +1 -0
- package/deps/rocksdb/rocksdb/memtable/inlineskiplist_test.cc +1 -0
- package/deps/rocksdb/rocksdb/memtable/skiplist_test.cc +1 -0
- package/deps/rocksdb/rocksdb/memtable/write_buffer_manager_test.cc +1 -0
- package/deps/rocksdb/rocksdb/monitoring/histogram_test.cc +1 -0
- package/deps/rocksdb/rocksdb/monitoring/iostats_context_test.cc +1 -0
- package/deps/rocksdb/rocksdb/options/cf_options.cc +19 -0
- package/deps/rocksdb/rocksdb/options/cf_options.h +8 -0
- package/deps/rocksdb/rocksdb/options/configurable_test.cc +1 -0
- package/deps/rocksdb/rocksdb/options/options.cc +7 -0
- package/deps/rocksdb/rocksdb/options/options_helper.cc +6 -0
- package/deps/rocksdb/rocksdb/options/options_settable_test.cc +6 -0
- package/deps/rocksdb/rocksdb/options/options_test.cc +63 -40
- package/deps/rocksdb/rocksdb/port/mmap.cc +98 -0
- package/deps/rocksdb/rocksdb/port/mmap.h +70 -0
- package/deps/rocksdb/rocksdb/port/stack_trace.cc +7 -0
- package/deps/rocksdb/rocksdb/port/stack_trace.h +4 -1
- package/deps/rocksdb/rocksdb/port/win/port_win.h +2 -7
- package/deps/rocksdb/rocksdb/src.mk +1 -0
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.cc +7 -7
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +3 -3
- package/deps/rocksdb/rocksdb/table/block_based/block_test.cc +1 -0
- package/deps/rocksdb/rocksdb/table/block_based/data_block_hash_index_test.cc +1 -0
- package/deps/rocksdb/rocksdb/table/block_based/full_filter_block_test.cc +1 -0
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block_test.cc +1 -0
- package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_builder_test.cc +1 -0
- package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_reader_test.cc +1 -0
- package/deps/rocksdb/rocksdb/table/get_context.cc +19 -1
- package/deps/rocksdb/rocksdb/table/get_context.h +9 -0
- package/deps/rocksdb/rocksdb/table/merger_test.cc +1 -0
- package/deps/rocksdb/rocksdb/table/merging_iterator.cc +10 -11
- package/deps/rocksdb/rocksdb/table/mock_table.cc +37 -19
- package/deps/rocksdb/rocksdb/table/mock_table.h +5 -1
- package/deps/rocksdb/rocksdb/table/sst_file_reader.cc +6 -0
- package/deps/rocksdb/rocksdb/table/sst_file_reader_test.cc +33 -0
- package/deps/rocksdb/rocksdb/table/sst_file_writer.cc +45 -6
- package/deps/rocksdb/rocksdb/test_util/testharness.h +2 -0
- package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc +1 -0
- package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +5 -0
- package/deps/rocksdb/rocksdb/tools/db_bench_tool_test.cc +1 -0
- package/deps/rocksdb/rocksdb/tools/io_tracer_parser_test.cc +1 -0
- package/deps/rocksdb/rocksdb/tools/ldb_cmd_test.cc +36 -0
- package/deps/rocksdb/rocksdb/tools/reduce_levels_test.cc +1 -0
- package/deps/rocksdb/rocksdb/tools/trace_analyzer_test.cc +1 -0
- package/deps/rocksdb/rocksdb/trace_replay/block_cache_tracer_test.cc +1 -0
- package/deps/rocksdb/rocksdb/trace_replay/io_tracer_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/autovector_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/bloom_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/coding_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/crc32c_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/dynamic_bloom_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/file_reader_writer_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/filelock_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/gflags_compat.h +12 -7
- package/deps/rocksdb/rocksdb/util/hash_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/heap_test.cc +4 -2
- package/deps/rocksdb/rocksdb/util/random_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/rate_limiter_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/repeatable_thread_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/ribbon_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/slice_transform_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/thread_list_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/thread_local_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/timer_test.cc +1 -0
- package/deps/rocksdb/rocksdb/util/work_queue_test.cc +4 -0
- package/deps/rocksdb/rocksdb/utilities/agg_merge/agg_merge_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/backup/backup_engine.cc +13 -0
- package/deps/rocksdb/rocksdb/utilities/backup/backup_engine_test.cc +9 -3
- package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_format_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_functional_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_row_merge_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_serialize_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/env_mirror_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/env_timed_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/fault_injection_secondary_cache.h +8 -0
- package/deps/rocksdb/rocksdb/utilities/memory/memory_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/object_registry_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/options/options_util_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/persistent_cache/hash_table_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/persistent_cache/persistent_cache_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/simulator_cache/cache_simulator_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/timestamped_snapshot_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/write_committed_transaction_ts_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_transaction_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/ttl/ttl_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/util_merge_operators_test.cc +1 -0
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +7 -0
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_test.cc +20 -0
- package/index.js +12 -4
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
|
@@ -10,122 +10,309 @@
|
|
|
10
10
|
#pragma once
|
|
11
11
|
|
|
12
12
|
#include <atomic>
|
|
13
|
+
#include <cstdint>
|
|
13
14
|
#include <string>
|
|
14
15
|
|
|
16
|
+
#include "port/lang.h"
|
|
15
17
|
#include "port/port.h"
|
|
16
18
|
#include "rocksdb/cache.h"
|
|
19
|
+
#include "util/hash.h"
|
|
20
|
+
#include "util/mutexlock.h"
|
|
17
21
|
|
|
18
22
|
namespace ROCKSDB_NAMESPACE {
|
|
19
23
|
|
|
20
|
-
//
|
|
21
|
-
class
|
|
24
|
+
// Optional base class for classes implementing the CacheShard concept
|
|
25
|
+
class CacheShardBase {
|
|
22
26
|
public:
|
|
23
|
-
explicit
|
|
27
|
+
explicit CacheShardBase(CacheMetadataChargePolicy metadata_charge_policy)
|
|
24
28
|
: metadata_charge_policy_(metadata_charge_policy) {}
|
|
25
|
-
virtual ~CacheShard() = default;
|
|
26
29
|
|
|
27
30
|
using DeleterFn = Cache::DeleterFn;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
31
|
+
|
|
32
|
+
// Expected by concept CacheShard (TODO with C++20 support)
|
|
33
|
+
// Some Defaults
|
|
34
|
+
std::string GetPrintableOptions() const { return ""; }
|
|
35
|
+
using HashVal = uint64_t;
|
|
36
|
+
using HashCref = uint64_t;
|
|
37
|
+
static inline HashVal ComputeHash(const Slice& key) {
|
|
38
|
+
return GetSliceNPHash64(key);
|
|
39
|
+
}
|
|
40
|
+
static inline uint32_t HashPieceForSharding(HashCref hash) {
|
|
41
|
+
return Lower32of64(hash);
|
|
42
|
+
}
|
|
43
|
+
void AppendPrintableOptions(std::string& /*str*/) const {}
|
|
44
|
+
|
|
45
|
+
// Must be provided for concept CacheShard (TODO with C++20 support)
|
|
46
|
+
/*
|
|
47
|
+
struct HandleImpl { // for concept HandleImpl
|
|
48
|
+
HashVal hash;
|
|
49
|
+
HashCref GetHash() const;
|
|
50
|
+
...
|
|
51
|
+
};
|
|
52
|
+
Status Insert(const Slice& key, HashCref hash, void* value, size_t charge,
|
|
53
|
+
DeleterFn deleter, HandleImpl** handle,
|
|
54
|
+
Cache::Priority priority) = 0;
|
|
55
|
+
Status Insert(const Slice& key, HashCref hash, void* value,
|
|
56
|
+
const Cache::CacheItemHelper* helper, size_t charge,
|
|
57
|
+
HandleImpl** handle, Cache::Priority priority) = 0;
|
|
58
|
+
HandleImpl* Lookup(const Slice& key, HashCref hash) = 0;
|
|
59
|
+
HandleImpl* Lookup(const Slice& key, HashCref hash,
|
|
60
|
+
const Cache::CacheItemHelper* helper,
|
|
61
|
+
const Cache::CreateCallback& create_cb,
|
|
62
|
+
Cache::Priority priority, bool wait,
|
|
63
|
+
Statistics* stats) = 0;
|
|
64
|
+
bool Release(HandleImpl* handle, bool useful, bool erase_if_last_ref) = 0;
|
|
65
|
+
bool IsReady(HandleImpl* handle) = 0;
|
|
66
|
+
void Wait(HandleImpl* handle) = 0;
|
|
67
|
+
bool Ref(HandleImpl* handle) = 0;
|
|
68
|
+
void Erase(const Slice& key, HashCref hash) = 0;
|
|
69
|
+
void SetCapacity(size_t capacity) = 0;
|
|
70
|
+
void SetStrictCapacityLimit(bool strict_capacity_limit) = 0;
|
|
71
|
+
size_t GetUsage() const = 0;
|
|
72
|
+
size_t GetPinnedUsage() const = 0;
|
|
73
|
+
size_t GetOccupancyCount() const = 0;
|
|
74
|
+
size_t GetTableAddressCount() const = 0;
|
|
53
75
|
// Handles iterating over roughly `average_entries_per_lock` entries, using
|
|
54
76
|
// `state` to somehow record where it last ended up. Caller initially uses
|
|
55
|
-
// *state == 0 and implementation sets *state =
|
|
77
|
+
// *state == 0 and implementation sets *state = SIZE_MAX to indicate
|
|
56
78
|
// completion.
|
|
57
|
-
|
|
79
|
+
void ApplyToSomeEntries(
|
|
58
80
|
const std::function<void(const Slice& key, void* value, size_t charge,
|
|
59
81
|
DeleterFn deleter)>& callback,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
82
|
+
size_t average_entries_per_lock, size_t* state) = 0;
|
|
83
|
+
void EraseUnRefEntries() = 0;
|
|
84
|
+
*/
|
|
63
85
|
|
|
64
86
|
protected:
|
|
65
87
|
const CacheMetadataChargePolicy metadata_charge_policy_;
|
|
66
88
|
};
|
|
67
89
|
|
|
68
|
-
//
|
|
90
|
+
// Portions of ShardedCache that do not depend on the template parameter
|
|
91
|
+
class ShardedCacheBase : public Cache {
|
|
92
|
+
public:
|
|
93
|
+
ShardedCacheBase(size_t capacity, int num_shard_bits,
|
|
94
|
+
bool strict_capacity_limit,
|
|
95
|
+
std::shared_ptr<MemoryAllocator> memory_allocator);
|
|
96
|
+
virtual ~ShardedCacheBase() = default;
|
|
97
|
+
|
|
98
|
+
int GetNumShardBits() const;
|
|
99
|
+
uint32_t GetNumShards() const;
|
|
100
|
+
|
|
101
|
+
uint64_t NewId() override;
|
|
102
|
+
|
|
103
|
+
bool HasStrictCapacityLimit() const override;
|
|
104
|
+
size_t GetCapacity() const override;
|
|
105
|
+
|
|
106
|
+
using Cache::GetUsage;
|
|
107
|
+
size_t GetUsage(Handle* handle) const override;
|
|
108
|
+
std::string GetPrintableOptions() const override;
|
|
109
|
+
|
|
110
|
+
protected: // fns
|
|
111
|
+
virtual void AppendPrintableOptions(std::string& str) const = 0;
|
|
112
|
+
size_t GetPerShardCapacity() const;
|
|
113
|
+
size_t ComputePerShardCapacity(size_t capacity) const;
|
|
114
|
+
|
|
115
|
+
protected: // data
|
|
116
|
+
std::atomic<uint64_t> last_id_; // For NewId
|
|
117
|
+
const uint32_t shard_mask_;
|
|
118
|
+
|
|
119
|
+
// Dynamic configuration parameters, guarded by config_mutex_
|
|
120
|
+
bool strict_capacity_limit_;
|
|
121
|
+
size_t capacity_;
|
|
122
|
+
mutable port::Mutex config_mutex_;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Generic cache interface that shards cache by hash of keys. 2^num_shard_bits
|
|
69
126
|
// shards will be created, with capacity split evenly to each of the shards.
|
|
70
|
-
// Keys are sharded by the
|
|
71
|
-
|
|
127
|
+
// Keys are typically sharded by the lowest num_shard_bits bits of hash value
|
|
128
|
+
// so that the upper bits of the hash value can keep a stable ordering of
|
|
129
|
+
// table entries even as the table grows (using more upper hash bits).
|
|
130
|
+
// See CacheShardBase above for what is expected of the CacheShard parameter.
|
|
131
|
+
template <class CacheShard>
|
|
132
|
+
class ShardedCache : public ShardedCacheBase {
|
|
72
133
|
public:
|
|
134
|
+
using HashVal = typename CacheShard::HashVal;
|
|
135
|
+
using HashCref = typename CacheShard::HashCref;
|
|
136
|
+
using HandleImpl = typename CacheShard::HandleImpl;
|
|
137
|
+
|
|
73
138
|
ShardedCache(size_t capacity, int num_shard_bits, bool strict_capacity_limit,
|
|
74
|
-
std::shared_ptr<MemoryAllocator>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
virtual
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
139
|
+
std::shared_ptr<MemoryAllocator> allocator)
|
|
140
|
+
: ShardedCacheBase(capacity, num_shard_bits, strict_capacity_limit,
|
|
141
|
+
allocator),
|
|
142
|
+
shards_(reinterpret_cast<CacheShard*>(port::cacheline_aligned_alloc(
|
|
143
|
+
sizeof(CacheShard) * GetNumShards()))),
|
|
144
|
+
destroy_shards_in_dtor_(false) {}
|
|
145
|
+
|
|
146
|
+
virtual ~ShardedCache() {
|
|
147
|
+
if (destroy_shards_in_dtor_) {
|
|
148
|
+
ForEachShard([](CacheShard* cs) { cs->~CacheShard(); });
|
|
149
|
+
}
|
|
150
|
+
port::cacheline_aligned_free(shards_);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
CacheShard& GetShard(HashCref hash) {
|
|
154
|
+
return shards_[CacheShard::HashPieceForSharding(hash) & shard_mask_];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const CacheShard& GetShard(HashCref hash) const {
|
|
158
|
+
return shards_[CacheShard::HashPieceForSharding(hash) & shard_mask_];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
void SetCapacity(size_t capacity) override {
|
|
162
|
+
MutexLock l(&config_mutex_);
|
|
163
|
+
capacity_ = capacity;
|
|
164
|
+
auto per_shard = ComputePerShardCapacity(capacity);
|
|
165
|
+
ForEachShard([=](CacheShard* cs) { cs->SetCapacity(per_shard); });
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
void SetStrictCapacityLimit(bool s_c_l) override {
|
|
169
|
+
MutexLock l(&config_mutex_);
|
|
170
|
+
strict_capacity_limit_ = s_c_l;
|
|
171
|
+
ForEachShard(
|
|
172
|
+
[s_c_l](CacheShard* cs) { cs->SetStrictCapacityLimit(s_c_l); });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
Status Insert(const Slice& key, void* value, size_t charge, DeleterFn deleter,
|
|
176
|
+
Handle** handle, Priority priority) override {
|
|
177
|
+
HashVal hash = CacheShard::ComputeHash(key);
|
|
178
|
+
auto h_out = reinterpret_cast<HandleImpl**>(handle);
|
|
179
|
+
return GetShard(hash).Insert(key, hash, value, charge, deleter, h_out,
|
|
180
|
+
priority);
|
|
181
|
+
}
|
|
182
|
+
Status Insert(const Slice& key, void* value, const CacheItemHelper* helper,
|
|
183
|
+
size_t charge, Handle** handle = nullptr,
|
|
184
|
+
Priority priority = Priority::LOW) override {
|
|
185
|
+
if (!helper) {
|
|
186
|
+
return Status::InvalidArgument();
|
|
187
|
+
}
|
|
188
|
+
HashVal hash = CacheShard::ComputeHash(key);
|
|
189
|
+
auto h_out = reinterpret_cast<HandleImpl**>(handle);
|
|
190
|
+
return GetShard(hash).Insert(key, hash, value, helper, charge, h_out,
|
|
191
|
+
priority);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
Handle* Lookup(const Slice& key, Statistics* /*stats*/) override {
|
|
195
|
+
HashVal hash = CacheShard::ComputeHash(key);
|
|
196
|
+
HandleImpl* result = GetShard(hash).Lookup(key, hash);
|
|
197
|
+
return reinterpret_cast<Handle*>(result);
|
|
198
|
+
}
|
|
199
|
+
Handle* Lookup(const Slice& key, const CacheItemHelper* helper,
|
|
200
|
+
const CreateCallback& create_cb, Priority priority, bool wait,
|
|
201
|
+
Statistics* stats = nullptr) override {
|
|
202
|
+
HashVal hash = CacheShard::ComputeHash(key);
|
|
203
|
+
HandleImpl* result = GetShard(hash).Lookup(key, hash, helper, create_cb,
|
|
204
|
+
priority, wait, stats);
|
|
205
|
+
return reinterpret_cast<Handle*>(result);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
void Erase(const Slice& key) override {
|
|
209
|
+
HashVal hash = CacheShard::ComputeHash(key);
|
|
210
|
+
GetShard(hash).Erase(key, hash);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
bool Release(Handle* handle, bool useful,
|
|
214
|
+
bool erase_if_last_ref = false) override {
|
|
215
|
+
auto h = reinterpret_cast<HandleImpl*>(handle);
|
|
216
|
+
return GetShard(h->GetHash()).Release(h, useful, erase_if_last_ref);
|
|
217
|
+
}
|
|
218
|
+
bool IsReady(Handle* handle) override {
|
|
219
|
+
auto h = reinterpret_cast<HandleImpl*>(handle);
|
|
220
|
+
return GetShard(h->GetHash()).IsReady(h);
|
|
221
|
+
}
|
|
222
|
+
void Wait(Handle* handle) override {
|
|
223
|
+
auto h = reinterpret_cast<HandleImpl*>(handle);
|
|
224
|
+
GetShard(h->GetHash()).Wait(h);
|
|
225
|
+
}
|
|
226
|
+
bool Ref(Handle* handle) override {
|
|
227
|
+
auto h = reinterpret_cast<HandleImpl*>(handle);
|
|
228
|
+
return GetShard(h->GetHash()).Ref(h);
|
|
229
|
+
}
|
|
230
|
+
bool Release(Handle* handle, bool erase_if_last_ref = false) override {
|
|
231
|
+
return Release(handle, true /*useful*/, erase_if_last_ref);
|
|
232
|
+
}
|
|
233
|
+
using ShardedCacheBase::GetUsage;
|
|
234
|
+
size_t GetUsage() const override {
|
|
235
|
+
return SumOverShards2(&CacheShard::GetUsage);
|
|
236
|
+
}
|
|
237
|
+
size_t GetPinnedUsage() const override {
|
|
238
|
+
return SumOverShards2(&CacheShard::GetPinnedUsage);
|
|
239
|
+
}
|
|
240
|
+
size_t GetOccupancyCount() const override {
|
|
241
|
+
return SumOverShards2(&CacheShard::GetPinnedUsage);
|
|
242
|
+
}
|
|
243
|
+
size_t GetTableAddressCount() const override {
|
|
244
|
+
return SumOverShards2(&CacheShard::GetTableAddressCount);
|
|
245
|
+
}
|
|
246
|
+
void ApplyToAllEntries(
|
|
111
247
|
const std::function<void(const Slice& key, void* value, size_t charge,
|
|
112
248
|
DeleterFn deleter)>& callback,
|
|
113
|
-
const ApplyToAllEntriesOptions& opts) override
|
|
114
|
-
|
|
115
|
-
|
|
249
|
+
const ApplyToAllEntriesOptions& opts) override {
|
|
250
|
+
uint32_t num_shards = GetNumShards();
|
|
251
|
+
// Iterate over part of each shard, rotating between shards, to
|
|
252
|
+
// minimize impact on latency of concurrent operations.
|
|
253
|
+
std::unique_ptr<size_t[]> states(new size_t[num_shards]{});
|
|
116
254
|
|
|
117
|
-
|
|
118
|
-
|
|
255
|
+
size_t aepl = opts.average_entries_per_lock;
|
|
256
|
+
aepl = std::min(aepl, size_t{1});
|
|
257
|
+
|
|
258
|
+
bool remaining_work;
|
|
259
|
+
do {
|
|
260
|
+
remaining_work = false;
|
|
261
|
+
for (uint32_t i = 0; i < num_shards; i++) {
|
|
262
|
+
if (states[i] != SIZE_MAX) {
|
|
263
|
+
shards_[i].ApplyToSomeEntries(callback, aepl, &states[i]);
|
|
264
|
+
remaining_work |= states[i] != SIZE_MAX;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
} while (remaining_work);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
virtual void EraseUnRefEntries() override {
|
|
271
|
+
ForEachShard([](CacheShard* cs) { cs->EraseUnRefEntries(); });
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
void DisownData() override {
|
|
275
|
+
// Leak data only if that won't generate an ASAN/valgrind warning.
|
|
276
|
+
if (!kMustFreeHeapAllocations) {
|
|
277
|
+
destroy_shards_in_dtor_ = false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
119
280
|
|
|
120
281
|
protected:
|
|
121
|
-
inline
|
|
282
|
+
inline void ForEachShard(const std::function<void(CacheShard*)>& fn) {
|
|
283
|
+
uint32_t num_shards = GetNumShards();
|
|
284
|
+
for (uint32_t i = 0; i < num_shards; i++) {
|
|
285
|
+
fn(shards_ + i);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
inline size_t SumOverShards(
|
|
290
|
+
const std::function<size_t(CacheShard&)>& fn) const {
|
|
291
|
+
uint32_t num_shards = GetNumShards();
|
|
292
|
+
size_t result = 0;
|
|
293
|
+
for (uint32_t i = 0; i < num_shards; i++) {
|
|
294
|
+
result += fn(shards_[i]);
|
|
295
|
+
}
|
|
296
|
+
return result;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
inline size_t SumOverShards2(size_t (CacheShard::*fn)() const) const {
|
|
300
|
+
return SumOverShards([fn](CacheShard& cs) { return (cs.*fn)(); });
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Must be called exactly once by derived class constructor
|
|
304
|
+
void InitShards(const std::function<void(CacheShard*)>& placement_new) {
|
|
305
|
+
ForEachShard(placement_new);
|
|
306
|
+
destroy_shards_in_dtor_ = true;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
void AppendPrintableOptions(std::string& str) const override {
|
|
310
|
+
shards_[0].AppendPrintableOptions(str);
|
|
311
|
+
}
|
|
122
312
|
|
|
123
313
|
private:
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
size_t capacity_;
|
|
127
|
-
bool strict_capacity_limit_;
|
|
128
|
-
std::atomic<uint64_t> last_id_;
|
|
314
|
+
CacheShard* const shards_;
|
|
315
|
+
bool destroy_shards_in_dtor_;
|
|
129
316
|
};
|
|
130
317
|
|
|
131
318
|
// 512KB is traditional minimum shard size.
|
|
@@ -45,6 +45,7 @@ void ArenaWrappedDBIter::Init(
|
|
|
45
45
|
sv_number_ = version_number;
|
|
46
46
|
read_options_ = read_options;
|
|
47
47
|
allow_refresh_ = allow_refresh;
|
|
48
|
+
memtable_range_tombstone_iter_ = nullptr;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
Status ArenaWrappedDBIter::Refresh() {
|
|
@@ -89,18 +90,25 @@ Status ArenaWrappedDBIter::Refresh() {
|
|
|
89
90
|
// Refresh range-tombstones in MemTable
|
|
90
91
|
if (!read_options_.ignore_range_deletions) {
|
|
91
92
|
SuperVersion* sv = cfd_->GetThreadLocalSuperVersion(db_impl_);
|
|
93
|
+
TEST_SYNC_POINT_CALLBACK("ArenaWrappedDBIter::Refresh:SV", nullptr);
|
|
92
94
|
auto t = sv->mem->NewRangeTombstoneIterator(
|
|
93
95
|
read_options_, latest_seq, false /* immutable_memtable */);
|
|
94
96
|
if (!t || t->empty()) {
|
|
97
|
+
// If memtable_range_tombstone_iter_ points to a non-empty tombstone
|
|
98
|
+
// iterator, then it means sv->mem is not the memtable that
|
|
99
|
+
// memtable_range_tombstone_iter_ points to, so SV must have changed
|
|
100
|
+
// after the sv_number_ != cur_sv_number check above. We will fall
|
|
101
|
+
// back to re-init the InternalIterator, and the tombstone iterator
|
|
102
|
+
// will be freed during db_iter destruction there.
|
|
95
103
|
if (memtable_range_tombstone_iter_) {
|
|
96
|
-
|
|
97
|
-
|
|
104
|
+
assert(!*memtable_range_tombstone_iter_ ||
|
|
105
|
+
sv_number_ != cfd_->GetSuperVersionNumber());
|
|
98
106
|
}
|
|
99
107
|
delete t;
|
|
100
108
|
} else { // current mutable memtable has range tombstones
|
|
101
109
|
if (!memtable_range_tombstone_iter_) {
|
|
102
110
|
delete t;
|
|
103
|
-
|
|
111
|
+
db_impl_->ReturnAndCleanupSuperVersion(cfd_, sv);
|
|
104
112
|
// The memtable under DBIter did not have range tombstone before
|
|
105
113
|
// refresh.
|
|
106
114
|
reinit_internal_iter();
|
|
@@ -112,7 +120,7 @@ Status ArenaWrappedDBIter::Refresh() {
|
|
|
112
120
|
&cfd_->internal_comparator(), nullptr, nullptr);
|
|
113
121
|
}
|
|
114
122
|
}
|
|
115
|
-
|
|
123
|
+
db_impl_->ReturnAndCleanupSuperVersion(cfd_, sv);
|
|
116
124
|
}
|
|
117
125
|
// Refresh latest sequence number
|
|
118
126
|
db_iter_->set_sequence(latest_seq);
|
|
@@ -321,6 +321,7 @@ TEST(BlobCountingIteratorTest, CorruptBlobIndex) {
|
|
|
321
321
|
} // namespace ROCKSDB_NAMESPACE
|
|
322
322
|
|
|
323
323
|
int main(int argc, char** argv) {
|
|
324
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
324
325
|
::testing::InitGoogleTest(&argc, argv);
|
|
325
326
|
return RUN_ALL_TESTS();
|
|
326
327
|
}
|
|
@@ -205,6 +205,7 @@ TEST_F(BlobFileAdditionTest, ForwardIncompatibleCustomField) {
|
|
|
205
205
|
} // namespace ROCKSDB_NAMESPACE
|
|
206
206
|
|
|
207
207
|
int main(int argc, char** argv) {
|
|
208
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
208
209
|
::testing::InitGoogleTest(&argc, argv);
|
|
209
210
|
return RUN_ALL_TESTS();
|
|
210
211
|
}
|
|
@@ -674,6 +674,7 @@ TEST_P(BlobFileBuilderIOErrorTest, IOError) {
|
|
|
674
674
|
} // namespace ROCKSDB_NAMESPACE
|
|
675
675
|
|
|
676
676
|
int main(int argc, char** argv) {
|
|
677
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
677
678
|
::testing::InitGoogleTest(&argc, argv);
|
|
678
679
|
return RUN_ALL_TESTS();
|
|
679
680
|
}
|
|
@@ -263,6 +263,7 @@ TEST_F(BlobFileCacheTest, GetBlobFileReader_CacheFull) {
|
|
|
263
263
|
} // namespace ROCKSDB_NAMESPACE
|
|
264
264
|
|
|
265
265
|
int main(int argc, char** argv) {
|
|
266
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
266
267
|
::testing::InitGoogleTest(&argc, argv);
|
|
267
268
|
return RUN_ALL_TESTS();
|
|
268
269
|
}
|
|
@@ -168,6 +168,7 @@ TEST_F(BlobFileGarbageTest, ForwardIncompatibleCustomField) {
|
|
|
168
168
|
} // namespace ROCKSDB_NAMESPACE
|
|
169
169
|
|
|
170
170
|
int main(int argc, char** argv) {
|
|
171
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
171
172
|
::testing::InitGoogleTest(&argc, argv);
|
|
172
173
|
return RUN_ALL_TESTS();
|
|
173
174
|
}
|
|
@@ -1018,6 +1018,7 @@ TEST_P(BlobFileReaderDecodingErrorTest, DecodingError) {
|
|
|
1018
1018
|
} // namespace ROCKSDB_NAMESPACE
|
|
1019
1019
|
|
|
1020
1020
|
int main(int argc, char** argv) {
|
|
1021
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
1021
1022
|
::testing::InitGoogleTest(&argc, argv);
|
|
1022
1023
|
return RUN_ALL_TESTS();
|
|
1023
1024
|
}
|
|
@@ -191,6 +191,7 @@ TEST(BlobGarbageMeterTest, InlinedTTLBlobIndex) {
|
|
|
191
191
|
} // namespace ROCKSDB_NAMESPACE
|
|
192
192
|
|
|
193
193
|
int main(int argc, char** argv) {
|
|
194
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
194
195
|
::testing::InitGoogleTest(&argc, argv);
|
|
195
196
|
return RUN_ALL_TESTS();
|
|
196
197
|
}
|
|
@@ -1304,12 +1304,20 @@ TEST_F(BlobSecondaryCacheTest, GetBlobsFromSecondaryCache) {
|
|
|
1304
1304
|
blob_offsets[1]));
|
|
1305
1305
|
|
|
1306
1306
|
// key1's dummy handle is in the primary cache and key1's item is still
|
|
1307
|
-
// in the secondary cache. So, the primary cache's Lookup()
|
|
1308
|
-
//
|
|
1307
|
+
// in the secondary cache. So, the primary cache's Lookup() without
|
|
1308
|
+
// secondary cache support cannot see it. (NOTE: The dummy handle used
|
|
1309
|
+
// to be a leaky abstraction but not anymore.)
|
|
1310
|
+
handle1 = blob_cache->Lookup(key1, statistics);
|
|
1311
|
+
ASSERT_EQ(handle1, nullptr);
|
|
1312
|
+
|
|
1313
|
+
// But after another access, it is promoted to primary cache
|
|
1314
|
+
ASSERT_TRUE(blob_source.TEST_BlobInCache(file_number, file_size,
|
|
1315
|
+
blob_offsets[1]));
|
|
1316
|
+
|
|
1317
|
+
// And Lookup() can find it (without secondary cache support)
|
|
1309
1318
|
handle1 = blob_cache->Lookup(key1, statistics);
|
|
1310
1319
|
ASSERT_NE(handle1, nullptr);
|
|
1311
|
-
|
|
1312
|
-
ASSERT_EQ(blob_cache->Value(handle1), nullptr);
|
|
1320
|
+
ASSERT_NE(blob_cache->Value(handle1), nullptr);
|
|
1313
1321
|
blob_cache->Release(handle1);
|
|
1314
1322
|
}
|
|
1315
1323
|
}
|
|
@@ -1610,6 +1618,7 @@ TEST_F(BlobSourceCacheReservationTest, IncreaseCacheReservationOnFullCache) {
|
|
|
1610
1618
|
} // namespace ROCKSDB_NAMESPACE
|
|
1611
1619
|
|
|
1612
1620
|
int main(int argc, char** argv) {
|
|
1621
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
1613
1622
|
::testing::InitGoogleTest(&argc, argv);
|
|
1614
1623
|
return RUN_ALL_TESTS();
|
|
1615
1624
|
}
|
|
@@ -90,7 +90,7 @@ Status BuildTable(
|
|
|
90
90
|
iter->SeekToFirst();
|
|
91
91
|
std::unique_ptr<CompactionRangeDelAggregator> range_del_agg(
|
|
92
92
|
new CompactionRangeDelAggregator(&tboptions.internal_comparator,
|
|
93
|
-
snapshots));
|
|
93
|
+
snapshots, full_history_ts_low));
|
|
94
94
|
uint64_t num_unfragmented_tombstones = 0;
|
|
95
95
|
uint64_t total_tombstone_payload_bytes = 0;
|
|
96
96
|
for (auto& range_del_iter : range_del_iters) {
|
|
@@ -233,6 +233,21 @@ ColumnFamilyOptions SanitizeOptions(const ImmutableDBOptions& db_options,
|
|
|
233
233
|
result.min_write_buffer_number_to_merge = 1;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
if (db_options.atomic_flush && result.min_write_buffer_number_to_merge > 1) {
|
|
237
|
+
ROCKS_LOG_WARN(
|
|
238
|
+
db_options.logger,
|
|
239
|
+
"Currently, if atomic_flush is true, then triggering flush for any "
|
|
240
|
+
"column family internally (non-manual flush) will trigger flushing "
|
|
241
|
+
"all column families even if the number of memtables is smaller "
|
|
242
|
+
"min_write_buffer_number_to_merge. Therefore, configuring "
|
|
243
|
+
"min_write_buffer_number_to_merge > 1 is not compatible and should "
|
|
244
|
+
"be satinized to 1. Not doing so will lead to data loss and "
|
|
245
|
+
"inconsistent state across multiple column families when WAL is "
|
|
246
|
+
"disabled, which is a common setting for atomic flush");
|
|
247
|
+
|
|
248
|
+
result.min_write_buffer_number_to_merge = 1;
|
|
249
|
+
}
|
|
250
|
+
|
|
236
251
|
if (result.num_levels < 1) {
|
|
237
252
|
result.num_levels = 1;
|
|
238
253
|
}
|
|
@@ -276,7 +291,6 @@ ColumnFamilyOptions SanitizeOptions(const ImmutableDBOptions& db_options,
|
|
|
276
291
|
}
|
|
277
292
|
|
|
278
293
|
if (result.compaction_style == kCompactionStyleFIFO) {
|
|
279
|
-
result.num_levels = 1;
|
|
280
294
|
// since we delete level0 files in FIFO compaction when there are too many
|
|
281
295
|
// of them, these options don't really mean anything
|
|
282
296
|
result.level0_slowdown_writes_trigger = std::numeric_limits<int>::max();
|
|
@@ -490,6 +490,7 @@ TEST_F(CompactFilesTest, GetCompactionJobInfo) {
|
|
|
490
490
|
} // namespace ROCKSDB_NAMESPACE
|
|
491
491
|
|
|
492
492
|
int main(int argc, char** argv) {
|
|
493
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
493
494
|
::testing::InitGoogleTest(&argc, argv);
|
|
494
495
|
return RUN_ALL_TESTS();
|
|
495
496
|
}
|