@nxtedition/rocksdb 9.0.0 → 9.0.1
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/binding.cc +0 -21
- package/deps/rocksdb/rocksdb/CMakeLists.txt +13 -9
- package/deps/rocksdb/rocksdb/Makefile +15 -6
- package/deps/rocksdb/rocksdb/README.md +29 -0
- package/deps/rocksdb/rocksdb/TARGETS +17 -2
- package/deps/rocksdb/rocksdb/cache/cache.cc +35 -0
- package/deps/rocksdb/rocksdb/cache/cache_bench_tool.cc +74 -15
- package/deps/rocksdb/rocksdb/cache/cache_helpers.cc +2 -1
- package/deps/rocksdb/rocksdb/cache/cache_reservation_manager.h +4 -3
- package/deps/rocksdb/rocksdb/cache/cache_test.cc +16 -4
- package/deps/rocksdb/rocksdb/cache/charged_cache.cc +4 -2
- package/deps/rocksdb/rocksdb/cache/charged_cache.h +5 -3
- package/deps/rocksdb/rocksdb/cache/clock_cache.cc +2024 -14
- package/deps/rocksdb/rocksdb/cache/clock_cache.h +349 -23
- package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache.cc +126 -51
- package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache.h +9 -0
- package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache_test.cc +182 -7
- package/deps/rocksdb/rocksdb/cache/lru_cache_test.cc +31 -14
- package/deps/rocksdb/rocksdb/cache/secondary_cache.cc +0 -33
- package/deps/rocksdb/rocksdb/cache/secondary_cache_adapter.cc +293 -17
- package/deps/rocksdb/rocksdb/cache/secondary_cache_adapter.h +21 -5
- package/deps/rocksdb/rocksdb/cache/sharded_cache.cc +10 -0
- package/deps/rocksdb/rocksdb/cache/sharded_cache.h +8 -3
- package/deps/rocksdb/rocksdb/cache/tiered_secondary_cache.cc +119 -0
- package/deps/rocksdb/rocksdb/cache/tiered_secondary_cache.h +155 -0
- package/deps/rocksdb/rocksdb/cache/tiered_secondary_cache_test.cc +711 -0
- package/deps/rocksdb/rocksdb/cache/typed_cache.h +17 -11
- package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.cc +25 -11
- package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.h +1 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_contents.h +2 -1
- package/deps/rocksdb/rocksdb/db/blob/blob_file_reader.cc +2 -1
- package/deps/rocksdb/rocksdb/db/blob/db_blob_basic_test.cc +8 -0
- package/deps/rocksdb/rocksdb/db/blob/db_blob_index_test.cc +7 -3
- package/deps/rocksdb/rocksdb/db/builder.cc +3 -3
- package/deps/rocksdb/rocksdb/db/c.cc +64 -0
- package/deps/rocksdb/rocksdb/db/c_test.c +36 -0
- package/deps/rocksdb/rocksdb/db/column_family.cc +23 -15
- package/deps/rocksdb/rocksdb/db/column_family.h +9 -0
- package/deps/rocksdb/rocksdb/db/column_family_test.cc +101 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction.cc +36 -23
- package/deps/rocksdb/rocksdb/db/compaction/compaction.h +24 -10
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.cc +3 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +42 -18
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +7 -3
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +4 -2
- package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.cc +8 -6
- package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.h +1 -1
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.cc +3 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +61 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.cc +146 -64
- package/deps/rocksdb/rocksdb/db/compaction/tiered_compaction_test.cc +13 -39
- package/deps/rocksdb/rocksdb/db/comparator_db_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_basic_test.cc +29 -7
- package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +8 -3
- package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +59 -0
- package/deps/rocksdb/rocksdb/db/db_compaction_filter_test.cc +27 -3
- package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +186 -2
- package/deps/rocksdb/rocksdb/db/db_flush_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_impl/compacted_db_impl.cc +17 -5
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +519 -240
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +104 -43
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +169 -66
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_debug.cc +2 -1
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +12 -4
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +50 -14
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.cc +85 -53
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.h +3 -7
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +99 -82
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.h +4 -14
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +24 -21
- package/deps/rocksdb/rocksdb/db/db_info_dumper.cc +6 -0
- package/deps/rocksdb/rocksdb/db/db_iter.cc +83 -55
- package/deps/rocksdb/rocksdb/db/db_iter.h +10 -2
- package/deps/rocksdb/rocksdb/db/db_iter_test.cc +29 -0
- package/deps/rocksdb/rocksdb/db/db_iterator_test.cc +276 -21
- package/deps/rocksdb/rocksdb/db/db_log_iter_test.cc +35 -0
- package/deps/rocksdb/rocksdb/db/db_merge_operator_test.cc +187 -1
- package/deps/rocksdb/rocksdb/db/db_options_test.cc +258 -0
- package/deps/rocksdb/rocksdb/db/db_range_del_test.cc +258 -0
- package/deps/rocksdb/rocksdb/db/db_rate_limiter_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_readonly_with_timestamp_test.cc +52 -0
- package/deps/rocksdb/rocksdb/db/db_secondary_test.cc +74 -1
- package/deps/rocksdb/rocksdb/db/db_sst_test.cc +22 -4
- package/deps/rocksdb/rocksdb/db/db_tailing_iter_test.cc +3 -1
- package/deps/rocksdb/rocksdb/db/db_test.cc +134 -30
- package/deps/rocksdb/rocksdb/db/db_test2.cc +3 -0
- package/deps/rocksdb/rocksdb/db/db_test_util.cc +11 -6
- package/deps/rocksdb/rocksdb/db/db_test_util.h +5 -2
- package/deps/rocksdb/rocksdb/db/db_universal_compaction_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_wal_test.cc +12 -0
- package/deps/rocksdb/rocksdb/db/db_with_timestamp_basic_test.cc +337 -1
- package/deps/rocksdb/rocksdb/db/deletefile_test.cc +2 -0
- package/deps/rocksdb/rocksdb/db/error_handler.cc +51 -34
- package/deps/rocksdb/rocksdb/db/error_handler.h +7 -6
- package/deps/rocksdb/rocksdb/db/external_sst_file_test.cc +58 -0
- package/deps/rocksdb/rocksdb/db/flush_job.cc +17 -19
- package/deps/rocksdb/rocksdb/db/flush_job.h +3 -3
- package/deps/rocksdb/rocksdb/db/flush_job_test.cc +2 -1
- package/deps/rocksdb/rocksdb/db/manual_compaction_test.cc +2 -0
- package/deps/rocksdb/rocksdb/db/memtable.cc +18 -70
- package/deps/rocksdb/rocksdb/db/memtable_list.cc +1 -1
- package/deps/rocksdb/rocksdb/db/memtable_list.h +11 -1
- package/deps/rocksdb/rocksdb/db/memtable_list_test.cc +1 -1
- package/deps/rocksdb/rocksdb/db/merge_helper.cc +330 -115
- package/deps/rocksdb/rocksdb/db/merge_helper.h +100 -12
- package/deps/rocksdb/rocksdb/db/merge_operator.cc +82 -0
- package/deps/rocksdb/rocksdb/db/merge_test.cc +267 -0
- package/deps/rocksdb/rocksdb/db/perf_context_test.cc +3 -0
- package/deps/rocksdb/rocksdb/db/periodic_task_scheduler.h +4 -4
- package/deps/rocksdb/rocksdb/db/plain_table_db_test.cc +2 -0
- package/deps/rocksdb/rocksdb/db/prefix_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/range_del_aggregator.h +4 -0
- package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.h +4 -0
- package/deps/rocksdb/rocksdb/db/repair.cc +4 -3
- package/deps/rocksdb/rocksdb/db/seqno_time_test.cc +454 -70
- package/deps/rocksdb/rocksdb/db/seqno_to_time_mapping.cc +105 -69
- package/deps/rocksdb/rocksdb/db/seqno_to_time_mapping.h +83 -46
- package/deps/rocksdb/rocksdb/db/table_cache.cc +32 -19
- package/deps/rocksdb/rocksdb/db/table_cache.h +12 -6
- package/deps/rocksdb/rocksdb/db/version_edit.h +10 -4
- package/deps/rocksdb/rocksdb/db/version_set.cc +75 -73
- package/deps/rocksdb/rocksdb/db/version_set.h +8 -8
- package/deps/rocksdb/rocksdb/db/version_set_sync_and_async.h +2 -5
- package/deps/rocksdb/rocksdb/db/version_set_test.cc +22 -11
- package/deps/rocksdb/rocksdb/db/wide/db_wide_basic_test.cc +525 -0
- package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.cc +6 -22
- package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.h +0 -20
- package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization_test.cc +0 -29
- package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper.cc +46 -0
- package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper.h +40 -0
- package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper_test.cc +39 -0
- package/deps/rocksdb/rocksdb/db/write_batch.cc +44 -20
- package/deps/rocksdb/rocksdb/db_stress_tool/CMakeLists.txt +1 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/batched_ops_stress.cc +4 -4
- package/deps/rocksdb/rocksdb/db_stress_tool/cf_consistency_stress.cc +4 -7
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.cc +88 -10
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +15 -10
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.cc +108 -58
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +36 -14
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_listener.h +34 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_shared_state.h +1 -1
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +195 -130
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.h +4 -2
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +12 -12
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_wide_merge_operator.cc +51 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_wide_merge_operator.h +27 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/expected_state.cc +3 -6
- package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.cc +14 -11
- package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +44 -38
- package/deps/rocksdb/rocksdb/env/env.cc +5 -0
- package/deps/rocksdb/rocksdb/env/unique_id_gen.cc +1 -0
- package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.cc +50 -29
- package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.h +32 -2
- package/deps/rocksdb/rocksdb/file/prefetch_test.cc +513 -30
- package/deps/rocksdb/rocksdb/file/random_access_file_reader.cc +8 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/advanced_cache.h +38 -13
- package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +14 -7
- package/deps/rocksdb/rocksdb/include/rocksdb/c.h +42 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/cache.h +65 -12
- package/deps/rocksdb/rocksdb/include/rocksdb/compaction_filter.h +11 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/comparator.h +26 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/db.h +37 -4
- package/deps/rocksdb/rocksdb/include/rocksdb/env.h +2 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +1 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/filter_policy.h +8 -3
- package/deps/rocksdb/rocksdb/include/rocksdb/iterator.h +10 -4
- package/deps/rocksdb/rocksdb/include/rocksdb/listener.h +4 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/memory_allocator.h +1 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/merge_operator.h +55 -4
- package/deps/rocksdb/rocksdb/include/rocksdb/options.h +45 -5
- package/deps/rocksdb/rocksdb/include/rocksdb/port_defs.h +4 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/rate_limiter.h +9 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/secondary_cache.h +79 -8
- package/deps/rocksdb/rocksdb/include/rocksdb/statistics.h +16 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/status.h +35 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/system_clock.h +15 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/table_properties.h +14 -3
- package/deps/rocksdb/rocksdb/include/rocksdb/thread_status.h +2 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/types.h +7 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/ldb_cmd.h +6 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/options_type.h +2 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction.h +9 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/version.h +2 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/wide_columns.h +53 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/write_batch.h +0 -2
- package/deps/rocksdb/rocksdb/memory/jemalloc_nodump_allocator.cc +2 -2
- package/deps/rocksdb/rocksdb/memory/jemalloc_nodump_allocator.h +1 -1
- package/deps/rocksdb/rocksdb/microbench/README.md +60 -0
- package/deps/rocksdb/rocksdb/monitoring/instrumented_mutex.h +1 -1
- package/deps/rocksdb/rocksdb/monitoring/statistics.cc +6 -0
- package/deps/rocksdb/rocksdb/monitoring/stats_history_test.cc +18 -7
- package/deps/rocksdb/rocksdb/monitoring/thread_status_util_debug.cc +4 -0
- package/deps/rocksdb/rocksdb/options/customizable_test.cc +4 -0
- package/deps/rocksdb/rocksdb/options/db_options.cc +47 -2
- package/deps/rocksdb/rocksdb/options/db_options.h +3 -0
- package/deps/rocksdb/rocksdb/options/options_helper.cc +12 -0
- package/deps/rocksdb/rocksdb/options/options_settable_test.cc +3 -1
- package/deps/rocksdb/rocksdb/options/options_test.cc +6 -1
- package/deps/rocksdb/rocksdb/plugin/README.md +43 -0
- package/deps/rocksdb/rocksdb/port/README +10 -0
- package/deps/rocksdb/rocksdb/port/port_example.h +1 -1
- package/deps/rocksdb/rocksdb/port/port_posix.cc +1 -1
- package/deps/rocksdb/rocksdb/port/port_posix.h +7 -4
- package/deps/rocksdb/rocksdb/port/stack_trace.cc +5 -0
- package/deps/rocksdb/rocksdb/port/win/port_win.h +5 -2
- package/deps/rocksdb/rocksdb/src.mk +7 -1
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +1 -1
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.cc +3 -1
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.cc +275 -61
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.h +96 -4
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +179 -62
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +35 -22
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_impl.h +12 -8
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +14 -9
- package/deps/rocksdb/rocksdb/table/block_based/block_cache.cc +3 -1
- package/deps/rocksdb/rocksdb/table/block_based/block_cache.h +26 -7
- package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.cc +15 -12
- package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.h +10 -5
- package/deps/rocksdb/rocksdb/table/block_based/block_test.cc +39 -18
- package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.cc +6 -6
- package/deps/rocksdb/rocksdb/table/block_based/filter_policy.cc +44 -26
- package/deps/rocksdb/rocksdb/table/block_based/filter_policy_internal.h +2 -1
- package/deps/rocksdb/rocksdb/table/block_based/index_reader_common.cc +1 -1
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.cc +10 -8
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_iterator.cc +4 -2
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_reader.cc +3 -2
- package/deps/rocksdb/rocksdb/table/block_based/uncompression_dict_reader.cc +1 -1
- package/deps/rocksdb/rocksdb/table/block_fetcher.cc +3 -2
- package/deps/rocksdb/rocksdb/table/block_fetcher.h +4 -0
- package/deps/rocksdb/rocksdb/table/block_fetcher_test.cc +6 -2
- package/deps/rocksdb/rocksdb/table/get_context.cc +52 -89
- package/deps/rocksdb/rocksdb/table/get_context.h +12 -3
- package/deps/rocksdb/rocksdb/table/internal_iterator.h +11 -0
- package/deps/rocksdb/rocksdb/table/iterator_wrapper.h +29 -1
- package/deps/rocksdb/rocksdb/table/merging_iterator.cc +12 -0
- package/deps/rocksdb/rocksdb/table/sst_file_dumper.cc +33 -6
- package/deps/rocksdb/rocksdb/table/sst_file_reader_test.cc +1 -0
- package/deps/rocksdb/rocksdb/table/sst_file_writer.cc +2 -4
- package/deps/rocksdb/rocksdb/table/table_reader.h +6 -0
- package/deps/rocksdb/rocksdb/test_util/mock_time_env.h +31 -0
- package/deps/rocksdb/rocksdb/test_util/secondary_cache_test_util.cc +2 -1
- package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_pysim.py +3 -3
- package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +26 -43
- package/deps/rocksdb/rocksdb/tools/ldb_cmd.cc +213 -28
- package/deps/rocksdb/rocksdb/tools/ldb_cmd_impl.h +36 -0
- package/deps/rocksdb/rocksdb/tools/ldb_tool.cc +0 -1
- package/deps/rocksdb/rocksdb/tools/sst_dump_test.cc +33 -10
- package/deps/rocksdb/rocksdb/util/bloom_test.cc +32 -11
- package/deps/rocksdb/rocksdb/util/cast_util.h +10 -0
- package/deps/rocksdb/rocksdb/util/comparator.cc +26 -1
- package/deps/rocksdb/rocksdb/util/compression.h +9 -3
- package/deps/rocksdb/rocksdb/util/crc32c.cc +7 -1
- package/deps/rocksdb/rocksdb/util/distributed_mutex.h +1 -1
- package/deps/rocksdb/rocksdb/util/overload.h +23 -0
- package/deps/rocksdb/rocksdb/util/rate_limiter.cc +53 -18
- package/deps/rocksdb/rocksdb/util/rate_limiter_impl.h +6 -1
- package/deps/rocksdb/rocksdb/util/rate_limiter_test.cc +90 -19
- package/deps/rocksdb/rocksdb/util/slice_test.cc +30 -0
- package/deps/rocksdb/rocksdb/util/status.cc +1 -0
- package/deps/rocksdb/rocksdb/util/string_util.cc +39 -0
- package/deps/rocksdb/rocksdb/util/string_util.h +10 -0
- package/deps/rocksdb/rocksdb/util/thread_operation.h +2 -0
- package/deps/rocksdb/rocksdb/util/udt_util.cc +42 -0
- package/deps/rocksdb/rocksdb/util/udt_util.h +19 -0
- package/deps/rocksdb/rocksdb/util/udt_util_test.cc +14 -0
- package/deps/rocksdb/rocksdb/util/xxhash.h +0 -3
- package/deps/rocksdb/rocksdb/util/xxph3.h +0 -4
- package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_impl.cc +2 -1
- package/deps/rocksdb/rocksdb/utilities/fault_injection_env.h +1 -0
- package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.cc +19 -15
- package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.h +11 -7
- package/deps/rocksdb/rocksdb/utilities/fault_injection_secondary_cache.h +5 -0
- package/deps/rocksdb/rocksdb/utilities/merge_operators/string_append/stringappend_test.cc +3 -0
- package/deps/rocksdb/rocksdb/utilities/option_change_migration/option_change_migration_test.cc +9 -0
- package/deps/rocksdb/rocksdb/utilities/simulator_cache/sim_cache.cc +7 -4
- package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/README +13 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_test.cc +41 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.cc +15 -9
- package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.h +4 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.cc +155 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.h +6 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/write_committed_transaction_ts_test.cc +81 -1
- package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.cc +2 -6
- package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn_db.cc +7 -5
- package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn.cc +2 -1
- package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +3 -2
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +57 -27
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +127 -120
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +129 -59
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_test.cc +105 -8
- package/deps/rocksdb/rocksdb.gyp +4 -2
- package/index.js +0 -8
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/deps/rocksdb/rocksdb/cmake/modules/CxxFlags.cmake +0 -7
- package/deps/rocksdb/rocksdb/cmake/modules/FindJeMalloc.cmake +0 -29
- package/deps/rocksdb/rocksdb/cmake/modules/FindNUMA.cmake +0 -29
- package/deps/rocksdb/rocksdb/cmake/modules/FindSnappy.cmake +0 -29
- package/deps/rocksdb/rocksdb/cmake/modules/FindTBB.cmake +0 -33
- package/deps/rocksdb/rocksdb/cmake/modules/Findgflags.cmake +0 -29
- package/deps/rocksdb/rocksdb/cmake/modules/Findlz4.cmake +0 -29
- package/deps/rocksdb/rocksdb/cmake/modules/Finduring.cmake +0 -26
- package/deps/rocksdb/rocksdb/cmake/modules/Findzstd.cmake +0 -29
- package/deps/rocksdb/rocksdb/cmake/modules/ReadVersion.cmake +0 -10
package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc
CHANGED
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
4
4
|
// (found in the LICENSE.Apache file in the root directory).
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
#include "utilities/write_batch_with_index/write_batch_with_index_internal.h"
|
|
8
7
|
|
|
9
8
|
#include "db/column_family.h"
|
|
10
9
|
#include "db/db_impl/db_impl.h"
|
|
11
|
-
#include "db/merge_context.h"
|
|
12
10
|
#include "db/merge_helper.h"
|
|
11
|
+
#include "options/cf_options.h"
|
|
13
12
|
#include "rocksdb/comparator.h"
|
|
14
13
|
#include "rocksdb/db.h"
|
|
15
14
|
#include "rocksdb/utilities/write_batch_with_index.h"
|
|
@@ -21,19 +20,18 @@ namespace ROCKSDB_NAMESPACE {
|
|
|
21
20
|
BaseDeltaIterator::BaseDeltaIterator(ColumnFamilyHandle* column_family,
|
|
22
21
|
Iterator* base_iterator,
|
|
23
22
|
WBWIIteratorImpl* delta_iterator,
|
|
24
|
-
const Comparator* comparator
|
|
25
|
-
const ReadOptions* read_options)
|
|
23
|
+
const Comparator* comparator)
|
|
26
24
|
: forward_(true),
|
|
27
25
|
current_at_base_(true),
|
|
28
26
|
equal_keys_(false),
|
|
29
27
|
status_(Status::OK()),
|
|
28
|
+
column_family_(column_family),
|
|
30
29
|
base_iterator_(base_iterator),
|
|
31
30
|
delta_iterator_(delta_iterator),
|
|
32
|
-
comparator_(comparator)
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
comparator_(comparator) {
|
|
32
|
+
assert(base_iterator_);
|
|
33
|
+
assert(delta_iterator_);
|
|
35
34
|
assert(comparator_);
|
|
36
|
-
wbwii_.reset(new WriteBatchWithIndexInternal(column_family));
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
bool BaseDeltaIterator::Valid() const {
|
|
@@ -148,33 +146,8 @@ Slice BaseDeltaIterator::key() const {
|
|
|
148
146
|
: delta_iterator_->Entry().key;
|
|
149
147
|
}
|
|
150
148
|
|
|
151
|
-
Slice BaseDeltaIterator::
|
|
152
|
-
|
|
153
|
-
return base_iterator_->value();
|
|
154
|
-
} else {
|
|
155
|
-
WriteEntry delta_entry = delta_iterator_->Entry();
|
|
156
|
-
if (wbwii_->GetNumOperands() == 0) {
|
|
157
|
-
return delta_entry.value;
|
|
158
|
-
} else if (delta_entry.type == kDeleteRecord ||
|
|
159
|
-
delta_entry.type == kSingleDeleteRecord) {
|
|
160
|
-
status_ =
|
|
161
|
-
wbwii_->MergeKey(delta_entry.key, nullptr, merge_result_.GetSelf());
|
|
162
|
-
} else if (delta_entry.type == kPutRecord) {
|
|
163
|
-
status_ = wbwii_->MergeKey(delta_entry.key, &delta_entry.value,
|
|
164
|
-
merge_result_.GetSelf());
|
|
165
|
-
} else if (delta_entry.type == kMergeRecord) {
|
|
166
|
-
if (equal_keys_) {
|
|
167
|
-
Slice base_value = base_iterator_->value();
|
|
168
|
-
status_ = wbwii_->MergeKey(delta_entry.key, &base_value,
|
|
169
|
-
merge_result_.GetSelf());
|
|
170
|
-
} else {
|
|
171
|
-
status_ =
|
|
172
|
-
wbwii_->MergeKey(delta_entry.key, nullptr, merge_result_.GetSelf());
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
merge_result_.PinSelf();
|
|
176
|
-
return merge_result_;
|
|
177
|
-
}
|
|
149
|
+
Slice BaseDeltaIterator::timestamp() const {
|
|
150
|
+
return current_at_base_ ? base_iterator_->timestamp() : Slice();
|
|
178
151
|
}
|
|
179
152
|
|
|
180
153
|
Status BaseDeltaIterator::status() const {
|
|
@@ -273,17 +246,70 @@ void BaseDeltaIterator::AdvanceBase() {
|
|
|
273
246
|
|
|
274
247
|
bool BaseDeltaIterator::BaseValid() const { return base_iterator_->Valid(); }
|
|
275
248
|
bool BaseDeltaIterator::DeltaValid() const { return delta_iterator_->Valid(); }
|
|
249
|
+
|
|
250
|
+
void BaseDeltaIterator::ResetValue() { value_.clear(); }
|
|
251
|
+
|
|
252
|
+
void BaseDeltaIterator::SetValueFromBase() {
|
|
253
|
+
assert(current_at_base_);
|
|
254
|
+
assert(BaseValid());
|
|
255
|
+
assert(value_.empty());
|
|
256
|
+
|
|
257
|
+
value_ = base_iterator_->value();
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
void BaseDeltaIterator::SetValueFromDelta() {
|
|
261
|
+
assert(!current_at_base_);
|
|
262
|
+
assert(DeltaValid());
|
|
263
|
+
assert(value_.empty());
|
|
264
|
+
|
|
265
|
+
WriteEntry delta_entry = delta_iterator_->Entry();
|
|
266
|
+
|
|
267
|
+
if (merge_context_.GetNumOperands() == 0) {
|
|
268
|
+
value_ = delta_entry.value;
|
|
269
|
+
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (delta_entry.type == kDeleteRecord ||
|
|
274
|
+
delta_entry.type == kSingleDeleteRecord) {
|
|
275
|
+
status_ = WriteBatchWithIndexInternal::MergeKeyWithNoBaseValue(
|
|
276
|
+
column_family_, delta_entry.key, merge_context_, &merge_result_);
|
|
277
|
+
} else if (delta_entry.type == kPutRecord) {
|
|
278
|
+
status_ = WriteBatchWithIndexInternal::MergeKeyWithPlainBaseValue(
|
|
279
|
+
column_family_, delta_entry.key, delta_entry.value, merge_context_,
|
|
280
|
+
&merge_result_);
|
|
281
|
+
} else if (delta_entry.type == kMergeRecord) {
|
|
282
|
+
if (equal_keys_) {
|
|
283
|
+
status_ = WriteBatchWithIndexInternal::MergeKeyWithPlainBaseValue(
|
|
284
|
+
column_family_, delta_entry.key, base_iterator_->value(),
|
|
285
|
+
merge_context_, &merge_result_);
|
|
286
|
+
} else {
|
|
287
|
+
status_ = WriteBatchWithIndexInternal::MergeKeyWithNoBaseValue(
|
|
288
|
+
column_family_, delta_entry.key, merge_context_, &merge_result_);
|
|
289
|
+
}
|
|
290
|
+
} else {
|
|
291
|
+
status_ = Status::NotSupported("Unsupported entry type for merge");
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (!status_.ok()) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
value_ = merge_result_;
|
|
299
|
+
}
|
|
300
|
+
|
|
276
301
|
void BaseDeltaIterator::UpdateCurrent() {
|
|
277
302
|
// Suppress false positive clang analyzer warnings.
|
|
278
303
|
#ifndef __clang_analyzer__
|
|
279
304
|
status_ = Status::OK();
|
|
305
|
+
ResetValue();
|
|
306
|
+
|
|
280
307
|
while (true) {
|
|
281
308
|
auto delta_result = WBWIIteratorImpl::kNotFound;
|
|
282
309
|
WriteEntry delta_entry;
|
|
283
310
|
if (DeltaValid()) {
|
|
284
311
|
assert(delta_iterator_->status().ok());
|
|
285
|
-
delta_result =
|
|
286
|
-
delta_iterator_->FindLatestUpdate(wbwii_->GetMergeContext());
|
|
312
|
+
delta_result = delta_iterator_->FindLatestUpdate(&merge_context_);
|
|
287
313
|
delta_entry = delta_iterator_->Entry();
|
|
288
314
|
} else if (!delta_iterator_->status().ok()) {
|
|
289
315
|
// Expose the error status and stop.
|
|
@@ -303,24 +329,18 @@ void BaseDeltaIterator::UpdateCurrent() {
|
|
|
303
329
|
// Finished
|
|
304
330
|
return;
|
|
305
331
|
}
|
|
306
|
-
if (iterate_upper_bound_) {
|
|
307
|
-
if (comparator_->CompareWithoutTimestamp(
|
|
308
|
-
delta_entry.key, /*a_has_ts=*/false, *iterate_upper_bound_,
|
|
309
|
-
/*b_has_ts=*/false) >= 0) {
|
|
310
|
-
// out of upper bound -> finished.
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
332
|
if (delta_result == WBWIIteratorImpl::kDeleted &&
|
|
315
|
-
|
|
333
|
+
merge_context_.GetNumOperands() == 0) {
|
|
316
334
|
AdvanceDelta();
|
|
317
335
|
} else {
|
|
318
336
|
current_at_base_ = false;
|
|
337
|
+
SetValueFromDelta();
|
|
319
338
|
return;
|
|
320
339
|
}
|
|
321
340
|
} else if (!DeltaValid()) {
|
|
322
341
|
// Delta has finished.
|
|
323
342
|
current_at_base_ = true;
|
|
343
|
+
SetValueFromBase();
|
|
324
344
|
return;
|
|
325
345
|
} else {
|
|
326
346
|
int compare =
|
|
@@ -332,8 +352,9 @@ void BaseDeltaIterator::UpdateCurrent() {
|
|
|
332
352
|
equal_keys_ = true;
|
|
333
353
|
}
|
|
334
354
|
if (delta_result != WBWIIteratorImpl::kDeleted ||
|
|
335
|
-
|
|
355
|
+
merge_context_.GetNumOperands() > 0) {
|
|
336
356
|
current_at_base_ = false;
|
|
357
|
+
SetValueFromDelta();
|
|
337
358
|
return;
|
|
338
359
|
}
|
|
339
360
|
// Delta is less advanced and is delete.
|
|
@@ -343,6 +364,7 @@ void BaseDeltaIterator::UpdateCurrent() {
|
|
|
343
364
|
}
|
|
344
365
|
} else {
|
|
345
366
|
current_at_base_ = true;
|
|
367
|
+
SetValueFromBase();
|
|
346
368
|
return;
|
|
347
369
|
}
|
|
348
370
|
}
|
|
@@ -453,10 +475,10 @@ WBWIIteratorImpl::Result WBWIIteratorImpl::FindLatestUpdate(
|
|
|
453
475
|
}
|
|
454
476
|
|
|
455
477
|
Status ReadableWriteBatch::GetEntryFromDataOffset(size_t data_offset,
|
|
456
|
-
WriteType* type, Slice*
|
|
478
|
+
WriteType* type, Slice* key,
|
|
457
479
|
Slice* value, Slice* blob,
|
|
458
480
|
Slice* xid) const {
|
|
459
|
-
if (type == nullptr ||
|
|
481
|
+
if (type == nullptr || key == nullptr || value == nullptr ||
|
|
460
482
|
blob == nullptr || xid == nullptr) {
|
|
461
483
|
return Status::InvalidArgument("Output parameters cannot be null");
|
|
462
484
|
}
|
|
@@ -472,7 +494,7 @@ Status ReadableWriteBatch::GetEntryFromDataOffset(size_t data_offset,
|
|
|
472
494
|
Slice input = Slice(rep_.data() + data_offset, rep_.size() - data_offset);
|
|
473
495
|
char tag;
|
|
474
496
|
uint32_t column_family;
|
|
475
|
-
Status s = ReadRecordFromWriteBatch(&input, &tag, &column_family,
|
|
497
|
+
Status s = ReadRecordFromWriteBatch(&input, &tag, &column_family, key, value,
|
|
476
498
|
blob, xid);
|
|
477
499
|
if (!s.ok()) {
|
|
478
500
|
return s;
|
|
@@ -630,81 +652,66 @@ bool WBWIIteratorImpl::MatchesKey(uint32_t cf_id, const Slice& key) {
|
|
|
630
652
|
}
|
|
631
653
|
}
|
|
632
654
|
|
|
633
|
-
WriteBatchWithIndexInternal::
|
|
634
|
-
ColumnFamilyHandle* column_family
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
Statistics* statistics = db_options_->statistics.get();
|
|
675
|
-
Env* env = db_options_->env;
|
|
676
|
-
Logger* logger = db_options_->info_log.get();
|
|
677
|
-
SystemClock* clock = env->GetSystemClock().get();
|
|
678
|
-
// `op_failure_scope` (an output parameter) is not provided (set to
|
|
679
|
-
// nullptr) since a failure must be propagated regardless of its value.
|
|
680
|
-
return MergeHelper::TimedFullMerge(
|
|
681
|
-
merge_operator, key, value, context.GetOperands(), result, logger,
|
|
682
|
-
statistics, clock, /* result_operand */ nullptr,
|
|
683
|
-
/* update_num_ops_stats */ false,
|
|
684
|
-
/* op_failure_scope */ nullptr);
|
|
685
|
-
} else {
|
|
686
|
-
const auto cf_opts = cfh->cfd()->ioptions();
|
|
687
|
-
// `op_failure_scope` (an output parameter) is not provided (set to
|
|
688
|
-
// nullptr) since a failure must be propagated regardless of its value.
|
|
689
|
-
return MergeHelper::TimedFullMerge(
|
|
690
|
-
merge_operator, key, value, context.GetOperands(), result,
|
|
691
|
-
cf_opts->logger, cf_opts->stats, cf_opts->clock,
|
|
692
|
-
/* result_operand */ nullptr, /* update_num_ops_stats */ false,
|
|
693
|
-
/* op_failure_scope */ nullptr);
|
|
694
|
-
}
|
|
695
|
-
} else {
|
|
696
|
-
return Status::InvalidArgument("Must provide a column_family");
|
|
655
|
+
Status WriteBatchWithIndexInternal::MergeKeyWithNoBaseValue(
|
|
656
|
+
ColumnFamilyHandle* column_family, const Slice& key,
|
|
657
|
+
const MergeContext& context, std::string* result) {
|
|
658
|
+
// TODO: support wide columns in WBWI
|
|
659
|
+
|
|
660
|
+
if (!column_family) {
|
|
661
|
+
return Status::InvalidArgument("Must provide a column family");
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
const auto& ioptions = GetImmutableOptions(column_family);
|
|
665
|
+
|
|
666
|
+
const auto* merge_operator = ioptions.merge_operator.get();
|
|
667
|
+
if (!merge_operator) {
|
|
668
|
+
return Status::InvalidArgument(
|
|
669
|
+
"Merge operator must be set for column family");
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// `op_failure_scope` (an output parameter) is not provided (set to
|
|
673
|
+
// nullptr) since a failure must be propagated regardless of its value.
|
|
674
|
+
return MergeHelper::TimedFullMerge(
|
|
675
|
+
merge_operator, key, MergeHelper::kNoBaseValue, context.GetOperands(),
|
|
676
|
+
ioptions.logger, ioptions.stats, ioptions.clock,
|
|
677
|
+
/* update_num_ops_stats */ false, result,
|
|
678
|
+
/* columns */ nullptr, /* op_failure_scope */ nullptr);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
Status WriteBatchWithIndexInternal::MergeKeyWithPlainBaseValue(
|
|
682
|
+
ColumnFamilyHandle* column_family, const Slice& key, const Slice& value,
|
|
683
|
+
const MergeContext& context, std::string* result) {
|
|
684
|
+
// TODO: support wide columns in WBWI
|
|
685
|
+
|
|
686
|
+
if (!column_family) {
|
|
687
|
+
return Status::InvalidArgument("Must provide a column family");
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
const auto& ioptions = GetImmutableOptions(column_family);
|
|
691
|
+
|
|
692
|
+
const auto* merge_operator = ioptions.merge_operator.get();
|
|
693
|
+
if (!merge_operator) {
|
|
694
|
+
return Status::InvalidArgument(
|
|
695
|
+
"Merge operator must be set for column family");
|
|
697
696
|
}
|
|
697
|
+
|
|
698
|
+
// `op_failure_scope` (an output parameter) is not provided (set to
|
|
699
|
+
// nullptr) since a failure must be propagated regardless of its value.
|
|
700
|
+
return MergeHelper::TimedFullMerge(
|
|
701
|
+
merge_operator, key, MergeHelper::kPlainBaseValue, value,
|
|
702
|
+
context.GetOperands(), ioptions.logger, ioptions.stats, ioptions.clock,
|
|
703
|
+
/* update_num_ops_stats */ false, result,
|
|
704
|
+
/* columns */ nullptr, /* op_failure_scope */ nullptr);
|
|
698
705
|
}
|
|
699
706
|
|
|
700
707
|
WBWIIteratorImpl::Result WriteBatchWithIndexInternal::GetFromBatch(
|
|
701
|
-
WriteBatchWithIndex* batch,
|
|
702
|
-
std::string* value, Status* s) {
|
|
708
|
+
WriteBatchWithIndex* batch, ColumnFamilyHandle* column_family,
|
|
709
|
+
const Slice& key, MergeContext* context, std::string* value, Status* s) {
|
|
703
710
|
*s = Status::OK();
|
|
704
711
|
|
|
705
712
|
std::unique_ptr<WBWIIteratorImpl> iter(
|
|
706
713
|
static_cast_with_check<WBWIIteratorImpl>(
|
|
707
|
-
batch->NewIterator(
|
|
714
|
+
batch->NewIterator(column_family)));
|
|
708
715
|
|
|
709
716
|
// Search the iterator for this key, and updates/merges to it.
|
|
710
717
|
iter->Seek(key);
|
|
@@ -718,7 +725,8 @@ WBWIIteratorImpl::Result WriteBatchWithIndexInternal::GetFromBatch(
|
|
|
718
725
|
} else if (result == WBWIIteratorImpl::Result::kFound) { // PUT
|
|
719
726
|
Slice entry_value = iter->Entry().value;
|
|
720
727
|
if (context->GetNumOperands() > 0) {
|
|
721
|
-
*s =
|
|
728
|
+
*s = MergeKeyWithPlainBaseValue(column_family, key, entry_value, *context,
|
|
729
|
+
value);
|
|
722
730
|
if (!s->ok()) {
|
|
723
731
|
result = WBWIIteratorImpl::Result::kError;
|
|
724
732
|
}
|
|
@@ -727,7 +735,7 @@ WBWIIteratorImpl::Result WriteBatchWithIndexInternal::GetFromBatch(
|
|
|
727
735
|
}
|
|
728
736
|
} else if (result == WBWIIteratorImpl::kDeleted) {
|
|
729
737
|
if (context->GetNumOperands() > 0) {
|
|
730
|
-
*s =
|
|
738
|
+
*s = MergeKeyWithNoBaseValue(column_family, key, *context, value);
|
|
731
739
|
if (s->ok()) {
|
|
732
740
|
result = WBWIIteratorImpl::Result::kFound;
|
|
733
741
|
} else {
|
|
@@ -739,4 +747,3 @@ WBWIIteratorImpl::Result WriteBatchWithIndexInternal::GetFromBatch(
|
|
|
739
747
|
}
|
|
740
748
|
|
|
741
749
|
} // namespace ROCKSDB_NAMESPACE
|
|
742
|
-
|
package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
// (found in the LICENSE.Apache file in the root directory).
|
|
5
5
|
#pragma once
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
#include <limits>
|
|
9
8
|
#include <string>
|
|
10
9
|
#include <vector>
|
|
@@ -21,10 +20,9 @@
|
|
|
21
20
|
|
|
22
21
|
namespace ROCKSDB_NAMESPACE {
|
|
23
22
|
|
|
24
|
-
class MergeContext;
|
|
25
23
|
class WBWIIteratorImpl;
|
|
26
|
-
class WriteBatchWithIndexInternal;
|
|
27
24
|
struct Options;
|
|
25
|
+
struct ImmutableOptions;
|
|
28
26
|
|
|
29
27
|
// when direction == forward
|
|
30
28
|
// * current_at_base_ <=> base_iterator > delta_iterator
|
|
@@ -36,8 +34,7 @@ class BaseDeltaIterator : public Iterator {
|
|
|
36
34
|
public:
|
|
37
35
|
BaseDeltaIterator(ColumnFamilyHandle* column_family, Iterator* base_iterator,
|
|
38
36
|
WBWIIteratorImpl* delta_iterator,
|
|
39
|
-
const Comparator* comparator
|
|
40
|
-
const ReadOptions* read_options = nullptr);
|
|
37
|
+
const Comparator* comparator);
|
|
41
38
|
|
|
42
39
|
~BaseDeltaIterator() override {}
|
|
43
40
|
|
|
@@ -49,7 +46,8 @@ class BaseDeltaIterator : public Iterator {
|
|
|
49
46
|
void Next() override;
|
|
50
47
|
void Prev() override;
|
|
51
48
|
Slice key() const override;
|
|
52
|
-
Slice value() const override;
|
|
49
|
+
Slice value() const override { return value_; }
|
|
50
|
+
Slice timestamp() const override;
|
|
53
51
|
Status status() const override;
|
|
54
52
|
void Invalidate(Status s);
|
|
55
53
|
|
|
@@ -60,18 +58,22 @@ class BaseDeltaIterator : public Iterator {
|
|
|
60
58
|
void AdvanceBase();
|
|
61
59
|
bool BaseValid() const;
|
|
62
60
|
bool DeltaValid() const;
|
|
61
|
+
void ResetValue();
|
|
62
|
+
void SetValueFromBase();
|
|
63
|
+
void SetValueFromDelta();
|
|
63
64
|
void UpdateCurrent();
|
|
64
65
|
|
|
65
|
-
std::unique_ptr<WriteBatchWithIndexInternal> wbwii_;
|
|
66
66
|
bool forward_;
|
|
67
67
|
bool current_at_base_;
|
|
68
68
|
bool equal_keys_;
|
|
69
|
-
|
|
69
|
+
Status status_;
|
|
70
|
+
ColumnFamilyHandle* column_family_;
|
|
70
71
|
std::unique_ptr<Iterator> base_iterator_;
|
|
71
72
|
std::unique_ptr<WBWIIteratorImpl> delta_iterator_;
|
|
72
73
|
const Comparator* comparator_; // not owned
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
MergeContext merge_context_;
|
|
75
|
+
std::string merge_result_;
|
|
76
|
+
Slice value_;
|
|
75
77
|
};
|
|
76
78
|
|
|
77
79
|
// Key used by skip list, as the binary searchable index of WriteBatchWithIndex.
|
|
@@ -196,59 +198,107 @@ class WBWIIteratorImpl : public WBWIIterator {
|
|
|
196
198
|
WBWIIteratorImpl(uint32_t column_family_id,
|
|
197
199
|
WriteBatchEntrySkipList* skip_list,
|
|
198
200
|
const ReadableWriteBatch* write_batch,
|
|
199
|
-
WriteBatchEntryComparator* comparator
|
|
201
|
+
WriteBatchEntryComparator* comparator,
|
|
202
|
+
const Slice* iterate_lower_bound = nullptr,
|
|
203
|
+
const Slice* iterate_upper_bound = nullptr)
|
|
200
204
|
: column_family_id_(column_family_id),
|
|
201
205
|
skip_list_iter_(skip_list),
|
|
202
206
|
write_batch_(write_batch),
|
|
203
|
-
comparator_(comparator)
|
|
207
|
+
comparator_(comparator),
|
|
208
|
+
iterate_lower_bound_(iterate_lower_bound),
|
|
209
|
+
iterate_upper_bound_(iterate_upper_bound) {}
|
|
204
210
|
|
|
205
211
|
~WBWIIteratorImpl() override {}
|
|
206
212
|
|
|
207
213
|
bool Valid() const override {
|
|
208
|
-
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
const WriteBatchIndexEntry* iter_entry = skip_list_iter_.key();
|
|
212
|
-
return (iter_entry != nullptr &&
|
|
213
|
-
iter_entry->column_family == column_family_id_);
|
|
214
|
+
return !out_of_bound_ && ValidRegardlessOfBoundLimit();
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
void SeekToFirst() override {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
if (iterate_lower_bound_ != nullptr) {
|
|
219
|
+
WriteBatchIndexEntry search_entry(
|
|
220
|
+
iterate_lower_bound_ /* search_key */, column_family_id_,
|
|
221
|
+
true /* is_forward_direction */, false /* is_seek_to_first */);
|
|
222
|
+
skip_list_iter_.Seek(&search_entry);
|
|
223
|
+
} else {
|
|
224
|
+
WriteBatchIndexEntry search_entry(
|
|
225
|
+
nullptr /* search_key */, column_family_id_,
|
|
226
|
+
true /* is_forward_direction */, true /* is_seek_to_first */);
|
|
227
|
+
skip_list_iter_.Seek(&search_entry);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (ValidRegardlessOfBoundLimit()) {
|
|
231
|
+
out_of_bound_ = TestOutOfBound();
|
|
232
|
+
}
|
|
221
233
|
}
|
|
222
234
|
|
|
223
235
|
void SeekToLast() override {
|
|
224
|
-
WriteBatchIndexEntry search_entry
|
|
225
|
-
|
|
226
|
-
|
|
236
|
+
WriteBatchIndexEntry search_entry =
|
|
237
|
+
(iterate_upper_bound_ != nullptr)
|
|
238
|
+
? WriteBatchIndexEntry(
|
|
239
|
+
iterate_upper_bound_ /* search_key */, column_family_id_,
|
|
240
|
+
true /* is_forward_direction */, false /* is_seek_to_first */)
|
|
241
|
+
: WriteBatchIndexEntry(
|
|
242
|
+
nullptr /* search_key */, column_family_id_ + 1,
|
|
243
|
+
true /* is_forward_direction */, true /* is_seek_to_first */);
|
|
244
|
+
|
|
227
245
|
skip_list_iter_.Seek(&search_entry);
|
|
228
246
|
if (!skip_list_iter_.Valid()) {
|
|
229
247
|
skip_list_iter_.SeekToLast();
|
|
230
248
|
} else {
|
|
231
249
|
skip_list_iter_.Prev();
|
|
232
250
|
}
|
|
251
|
+
|
|
252
|
+
if (ValidRegardlessOfBoundLimit()) {
|
|
253
|
+
out_of_bound_ = TestOutOfBound();
|
|
254
|
+
}
|
|
233
255
|
}
|
|
234
256
|
|
|
235
257
|
void Seek(const Slice& key) override {
|
|
258
|
+
if (BeforeLowerBound(&key)) { // cap to prevent out of bound
|
|
259
|
+
SeekToFirst();
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
|
|
236
263
|
WriteBatchIndexEntry search_entry(&key, column_family_id_,
|
|
237
264
|
true /* is_forward_direction */,
|
|
238
265
|
false /* is_seek_to_first */);
|
|
239
266
|
skip_list_iter_.Seek(&search_entry);
|
|
267
|
+
|
|
268
|
+
if (ValidRegardlessOfBoundLimit()) {
|
|
269
|
+
out_of_bound_ = TestOutOfBound();
|
|
270
|
+
}
|
|
240
271
|
}
|
|
241
272
|
|
|
242
273
|
void SeekForPrev(const Slice& key) override {
|
|
274
|
+
if (AtOrAfterUpperBound(&key)) { // cap to prevent out of bound
|
|
275
|
+
SeekToLast();
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
243
279
|
WriteBatchIndexEntry search_entry(&key, column_family_id_,
|
|
244
280
|
false /* is_forward_direction */,
|
|
245
281
|
false /* is_seek_to_first */);
|
|
246
282
|
skip_list_iter_.SeekForPrev(&search_entry);
|
|
283
|
+
|
|
284
|
+
if (ValidRegardlessOfBoundLimit()) {
|
|
285
|
+
out_of_bound_ = TestOutOfBound();
|
|
286
|
+
}
|
|
247
287
|
}
|
|
248
288
|
|
|
249
|
-
void Next() override {
|
|
289
|
+
void Next() override {
|
|
290
|
+
skip_list_iter_.Next();
|
|
291
|
+
if (ValidRegardlessOfBoundLimit()) {
|
|
292
|
+
out_of_bound_ = TestOutOfBound();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
250
295
|
|
|
251
|
-
void Prev() override {
|
|
296
|
+
void Prev() override {
|
|
297
|
+
skip_list_iter_.Prev();
|
|
298
|
+
if (ValidRegardlessOfBoundLimit()) {
|
|
299
|
+
out_of_bound_ = TestOutOfBound();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
252
302
|
|
|
253
303
|
WriteEntry Entry() const override;
|
|
254
304
|
|
|
@@ -289,6 +339,45 @@ class WBWIIteratorImpl : public WBWIIterator {
|
|
|
289
339
|
WriteBatchEntrySkipList::Iterator skip_list_iter_;
|
|
290
340
|
const ReadableWriteBatch* write_batch_;
|
|
291
341
|
WriteBatchEntryComparator* comparator_;
|
|
342
|
+
const Slice* iterate_lower_bound_;
|
|
343
|
+
const Slice* iterate_upper_bound_;
|
|
344
|
+
bool out_of_bound_ = false;
|
|
345
|
+
|
|
346
|
+
bool TestOutOfBound() const {
|
|
347
|
+
const Slice& curKey = Entry().key;
|
|
348
|
+
return AtOrAfterUpperBound(&curKey) || BeforeLowerBound(&curKey);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
bool ValidRegardlessOfBoundLimit() const {
|
|
352
|
+
if (!skip_list_iter_.Valid()) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
const WriteBatchIndexEntry* iter_entry = skip_list_iter_.key();
|
|
356
|
+
return iter_entry != nullptr &&
|
|
357
|
+
iter_entry->column_family == column_family_id_;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
bool AtOrAfterUpperBound(const Slice* k) const {
|
|
361
|
+
if (iterate_upper_bound_ == nullptr) {
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return comparator_->GetComparator(column_family_id_)
|
|
366
|
+
->CompareWithoutTimestamp(*k, /*a_has_ts=*/false,
|
|
367
|
+
*iterate_upper_bound_,
|
|
368
|
+
/*b_has_ts=*/false) >= 0;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
bool BeforeLowerBound(const Slice* k) const {
|
|
372
|
+
if (iterate_lower_bound_ == nullptr) {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return comparator_->GetComparator(column_family_id_)
|
|
377
|
+
->CompareWithoutTimestamp(*k, /*a_has_ts=*/false,
|
|
378
|
+
*iterate_lower_bound_,
|
|
379
|
+
/*b_has_ts=*/false) < 0;
|
|
380
|
+
}
|
|
292
381
|
};
|
|
293
382
|
|
|
294
383
|
class WriteBatchWithIndexInternal {
|
|
@@ -296,14 +385,15 @@ class WriteBatchWithIndexInternal {
|
|
|
296
385
|
static const Comparator* GetUserComparator(const WriteBatchWithIndex& wbwi,
|
|
297
386
|
uint32_t cf_id);
|
|
298
387
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
388
|
+
static Status MergeKeyWithNoBaseValue(ColumnFamilyHandle* column_family,
|
|
389
|
+
const Slice& key,
|
|
390
|
+
const MergeContext& context,
|
|
391
|
+
std::string* result);
|
|
392
|
+
|
|
393
|
+
static Status MergeKeyWithPlainBaseValue(ColumnFamilyHandle* column_family,
|
|
394
|
+
const Slice& key, const Slice& value,
|
|
395
|
+
const MergeContext& context,
|
|
396
|
+
std::string* result);
|
|
307
397
|
|
|
308
398
|
// If batch contains a value for key, store it in *value and return kFound.
|
|
309
399
|
// If batch contains a deletion for key, return Deleted.
|
|
@@ -313,30 +403,10 @@ class WriteBatchWithIndexInternal {
|
|
|
313
403
|
// and return kMergeInProgress
|
|
314
404
|
// If batch does not contain this key, return kNotFound
|
|
315
405
|
// Else, return kError on error with error Status stored in *s.
|
|
316
|
-
WBWIIteratorImpl::Result GetFromBatch(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
WBWIIteratorImpl::Result GetFromBatch(WriteBatchWithIndex* batch,
|
|
322
|
-
const Slice& key,
|
|
323
|
-
MergeContext* merge_context,
|
|
324
|
-
std::string* value, Status* s);
|
|
325
|
-
Status MergeKey(const Slice& key, const Slice* value,
|
|
326
|
-
std::string* result) const {
|
|
327
|
-
return MergeKey(key, value, merge_context_, result);
|
|
328
|
-
}
|
|
329
|
-
Status MergeKey(const Slice& key, const Slice* value,
|
|
330
|
-
const MergeContext& context, std::string* result) const;
|
|
331
|
-
size_t GetNumOperands() const { return merge_context_.GetNumOperands(); }
|
|
332
|
-
MergeContext* GetMergeContext() { return &merge_context_; }
|
|
333
|
-
Slice GetOperand(int index) const { return merge_context_.GetOperand(index); }
|
|
334
|
-
|
|
335
|
-
private:
|
|
336
|
-
DB* db_;
|
|
337
|
-
const DBOptions* db_options_;
|
|
338
|
-
ColumnFamilyHandle* column_family_;
|
|
339
|
-
MergeContext merge_context_;
|
|
406
|
+
static WBWIIteratorImpl::Result GetFromBatch(
|
|
407
|
+
WriteBatchWithIndex* batch, ColumnFamilyHandle* column_family,
|
|
408
|
+
const Slice& key, MergeContext* merge_context, std::string* value,
|
|
409
|
+
Status* s);
|
|
340
410
|
};
|
|
341
411
|
|
|
342
412
|
} // namespace ROCKSDB_NAMESPACE
|