rocksdb-native 2.2.0 → 2.3.0
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.c +92 -10
- package/index.js +9 -0
- package/lib/batch.js +11 -1
- package/lib/iterator.js +3 -1
- package/lib/snapshot.js +21 -0
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/darwin-arm64/rocksdb-native.node +0 -0
- package/prebuilds/darwin-x64/rocksdb-native.bare +0 -0
- package/prebuilds/darwin-x64/rocksdb-native.node +0 -0
- package/prebuilds/linux-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/linux-arm64/rocksdb-native.node +0 -0
- package/prebuilds/linux-x64/rocksdb-native.bare +0 -0
- package/prebuilds/linux-x64/rocksdb-native.node +0 -0
- package/prebuilds/win32-x64/rocksdb-native.bare +0 -0
- package/prebuilds/win32-x64/rocksdb-native.node +0 -0
- package/vendor/librocksdb/include/rocksdb.h +38 -4
- package/vendor/librocksdb/src/rocksdb.cc +114 -14
- package/vendor/librocksdb/vendor/rocksdb/CMakeLists.txt +21 -4
- package/vendor/librocksdb/vendor/rocksdb/cache/secondary_cache_adapter.cc +6 -3
- package/vendor/librocksdb/vendor/rocksdb/db/arena_wrapped_db_iter.cc +4 -4
- package/vendor/librocksdb/vendor/rocksdb/db/arena_wrapped_db_iter.h +4 -2
- package/vendor/librocksdb/vendor/rocksdb/db/attribute_group_iterator_impl.cc +20 -0
- package/vendor/librocksdb/vendor/rocksdb/db/attribute_group_iterator_impl.h +83 -0
- package/vendor/librocksdb/vendor/rocksdb/db/builder.cc +9 -5
- package/vendor/librocksdb/vendor/rocksdb/db/builder.h +1 -1
- package/vendor/librocksdb/vendor/rocksdb/db/c.cc +231 -6
- package/vendor/librocksdb/vendor/rocksdb/db/c_test.c +202 -2
- package/vendor/librocksdb/vendor/rocksdb/db/coalescing_iterator.cc +47 -0
- package/vendor/librocksdb/vendor/rocksdb/db/coalescing_iterator.h +79 -0
- package/vendor/librocksdb/vendor/rocksdb/db/column_family.cc +28 -0
- package/vendor/librocksdb/vendor/rocksdb/db/column_family.h +17 -0
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction.cc +8 -1
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction.h +11 -9
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_iterator.cc +50 -23
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_iterator.h +13 -0
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_job.cc +22 -25
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_job.h +2 -0
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_outputs.cc +8 -1
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_outputs.h +1 -0
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker.cc +40 -17
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker.h +20 -14
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_level.cc +11 -6
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_universal.cc +77 -24
- package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_service_job.cc +2 -0
- package/vendor/librocksdb/vendor/rocksdb/db/convenience.cc +3 -0
- package/vendor/librocksdb/vendor/rocksdb/db/db_filesnapshot.cc +125 -31
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl.cc +457 -231
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl.h +172 -73
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_compaction_flush.cc +152 -133
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_debug.cc +5 -0
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_files.cc +58 -52
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_follower.cc +348 -0
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_follower.h +54 -0
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_open.cc +136 -117
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_secondary.cc +4 -3
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_secondary.h +7 -6
- package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_write.cc +134 -80
- package/vendor/librocksdb/vendor/rocksdb/db/db_iter.cc +11 -0
- package/vendor/librocksdb/vendor/rocksdb/db/db_test2.cc +1 -1
- package/vendor/librocksdb/vendor/rocksdb/db/db_test_util.cc +11 -1
- package/vendor/librocksdb/vendor/rocksdb/db/db_test_util.h +11 -7
- package/vendor/librocksdb/vendor/rocksdb/db/dbformat.cc +19 -4
- package/vendor/librocksdb/vendor/rocksdb/db/dbformat.h +3 -2
- package/vendor/librocksdb/vendor/rocksdb/db/error_handler.cc +34 -39
- package/vendor/librocksdb/vendor/rocksdb/db/error_handler.h +3 -4
- package/vendor/librocksdb/vendor/rocksdb/db/event_helpers.cc +6 -3
- package/vendor/librocksdb/vendor/rocksdb/db/experimental.cc +3 -2
- package/vendor/librocksdb/vendor/rocksdb/db/external_sst_file_ingestion_job.cc +76 -18
- package/vendor/librocksdb/vendor/rocksdb/db/external_sst_file_ingestion_job.h +11 -0
- package/vendor/librocksdb/vendor/rocksdb/db/flush_job.cc +37 -5
- package/vendor/librocksdb/vendor/rocksdb/db/flush_job.h +14 -0
- package/vendor/librocksdb/vendor/rocksdb/db/import_column_family_job.cc +49 -45
- package/vendor/librocksdb/vendor/rocksdb/db/internal_stats.cc +60 -1
- package/vendor/librocksdb/vendor/rocksdb/db/internal_stats.h +20 -1
- package/vendor/librocksdb/vendor/rocksdb/db/log_reader.cc +15 -6
- package/vendor/librocksdb/vendor/rocksdb/db/log_writer.cc +59 -10
- package/vendor/librocksdb/vendor/rocksdb/db/log_writer.h +8 -0
- package/vendor/librocksdb/vendor/rocksdb/db/memtable.cc +24 -40
- package/vendor/librocksdb/vendor/rocksdb/db/memtable.h +10 -10
- package/vendor/librocksdb/vendor/rocksdb/db/memtable_list.cc +9 -8
- package/vendor/librocksdb/vendor/rocksdb/db/multi_cf_iterator_impl.h +296 -0
- package/vendor/librocksdb/vendor/rocksdb/db/range_tombstone_fragmenter.h +8 -10
- package/vendor/librocksdb/vendor/rocksdb/db/repair.cc +4 -3
- package/vendor/librocksdb/vendor/rocksdb/db/seqno_to_time_mapping.cc +30 -0
- package/vendor/librocksdb/vendor/rocksdb/db/seqno_to_time_mapping.h +9 -0
- package/vendor/librocksdb/vendor/rocksdb/db/table_cache.cc +17 -2
- package/vendor/librocksdb/vendor/rocksdb/db/table_cache.h +9 -1
- package/vendor/librocksdb/vendor/rocksdb/db/table_properties_collector.h +9 -2
- package/vendor/librocksdb/vendor/rocksdb/db/transaction_log_impl.cc +3 -3
- package/vendor/librocksdb/vendor/rocksdb/db/transaction_log_impl.h +7 -7
- package/vendor/librocksdb/vendor/rocksdb/db/version_edit.cc +0 -1
- package/vendor/librocksdb/vendor/rocksdb/db/version_edit_handler.cc +39 -5
- package/vendor/librocksdb/vendor/rocksdb/db/version_edit_handler.h +24 -15
- package/vendor/librocksdb/vendor/rocksdb/db/version_set.cc +117 -64
- package/vendor/librocksdb/vendor/rocksdb/db/version_set.h +27 -10
- package/vendor/librocksdb/vendor/rocksdb/db/wal_manager.cc +37 -29
- package/vendor/librocksdb/vendor/rocksdb/db/wal_manager.h +6 -5
- package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_columns.cc +2 -3
- package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_columns_helper.cc +6 -0
- package/vendor/librocksdb/vendor/rocksdb/db/write_batch.cc +89 -31
- package/vendor/librocksdb/vendor/rocksdb/db/write_thread.cc +53 -5
- package/vendor/librocksdb/vendor/rocksdb/db/write_thread.h +36 -4
- package/vendor/librocksdb/vendor/rocksdb/env/composite_env_wrapper.h +21 -0
- package/vendor/librocksdb/vendor/rocksdb/env/env.cc +15 -0
- package/vendor/librocksdb/vendor/rocksdb/env/fs_on_demand.cc +331 -0
- package/vendor/librocksdb/vendor/rocksdb/env/fs_on_demand.h +139 -0
- package/vendor/librocksdb/vendor/rocksdb/env/io_posix.cc +8 -6
- package/vendor/librocksdb/vendor/rocksdb/env/io_posix.h +1 -1
- package/vendor/librocksdb/vendor/rocksdb/file/delete_scheduler.cc +130 -27
- package/vendor/librocksdb/vendor/rocksdb/file/delete_scheduler.h +61 -8
- package/vendor/librocksdb/vendor/rocksdb/file/file_util.cc +25 -4
- package/vendor/librocksdb/vendor/rocksdb/file/file_util.h +15 -0
- package/vendor/librocksdb/vendor/rocksdb/file/sequence_file_reader.cc +1 -0
- package/vendor/librocksdb/vendor/rocksdb/file/sequence_file_reader.h +9 -4
- package/vendor/librocksdb/vendor/rocksdb/file/sst_file_manager_impl.cc +18 -0
- package/vendor/librocksdb/vendor/rocksdb/file/sst_file_manager_impl.h +31 -4
- package/vendor/librocksdb/vendor/rocksdb/file/writable_file_writer.cc +40 -38
- package/vendor/librocksdb/vendor/rocksdb/file/writable_file_writer.h +48 -15
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/advanced_options.h +12 -3
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/attribute_groups.h +114 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/c.h +90 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/cache.h +5 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/comparator.h +27 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/db.h +71 -12
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/env.h +9 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/experimental.h +5 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/file_system.h +14 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/iterator.h +9 -71
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/iterator_base.h +90 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/listener.h +21 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/options.h +125 -12
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/perf_context.h +1 -1
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/sst_file_reader.h +11 -1
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/table.h +6 -6
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/table_properties.h +19 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/transaction_log.h +12 -6
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/types.h +12 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/universal_compaction.h +31 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/user_write_callback.h +29 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/cache_dump_load.h +4 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/checkpoint.h +4 -2
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/customizable_util.h +0 -1
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/env_mirror.h +1 -1
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/ldb_cmd.h +24 -7
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/option_change_migration.h +4 -4
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/stackable_db.h +24 -5
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/table_properties_collectors.h +46 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/transaction.h +42 -17
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/transaction_db.h +5 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/types_util.h +36 -0
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +71 -3
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/version.h +2 -2
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/wide_columns.h +87 -72
- package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/write_batch_base.h +1 -1
- package/vendor/librocksdb/vendor/rocksdb/memory/memory_allocator.cc +1 -0
- package/vendor/librocksdb/vendor/rocksdb/options/cf_options.cc +13 -2
- package/vendor/librocksdb/vendor/rocksdb/options/cf_options.h +6 -2
- package/vendor/librocksdb/vendor/rocksdb/options/db_options.cc +27 -1
- package/vendor/librocksdb/vendor/rocksdb/options/db_options.h +10 -3
- package/vendor/librocksdb/vendor/rocksdb/options/options.cc +3 -0
- package/vendor/librocksdb/vendor/rocksdb/options/options_helper.cc +1 -0
- package/vendor/librocksdb/vendor/rocksdb/port/jemalloc_helper.h +2 -2
- package/vendor/librocksdb/vendor/rocksdb/port/stack_trace.cc +1 -0
- package/vendor/librocksdb/vendor/rocksdb/port/win/port_win.cc +3 -2
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/binary_search_index_reader.cc +1 -2
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_builder.cc +47 -31
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_factory.cc +15 -0
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_iterator.cc +37 -18
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_iterator.h +10 -3
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader.cc +102 -41
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader.h +15 -7
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader_impl.h +1 -3
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +5 -6
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_cache.h +31 -0
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_prefetcher.cc +6 -0
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/cachable_entry.h +10 -5
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block.h +34 -28
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block_reader_common.cc +17 -11
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block_reader_common.h +5 -2
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_policy.cc +12 -3
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/full_filter_block.cc +37 -30
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/full_filter_block.h +11 -13
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/hash_index_reader.cc +1 -2
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_builder.cc +62 -53
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_builder.h +60 -38
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_reader_common.cc +14 -9
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_reader_common.h +4 -1
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_filter_block.cc +135 -94
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_filter_block.h +52 -46
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_index_reader.cc +51 -13
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_index_reader.h +2 -0
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/uncompression_dict_reader.cc +3 -11
- package/vendor/librocksdb/vendor/rocksdb/table/block_based/uncompression_dict_reader.h +2 -3
- package/vendor/librocksdb/vendor/rocksdb/table/block_fetcher.cc +8 -10
- package/vendor/librocksdb/vendor/rocksdb/table/block_fetcher.h +2 -1
- package/vendor/librocksdb/vendor/rocksdb/table/compaction_merging_iterator.cc +9 -10
- package/vendor/librocksdb/vendor/rocksdb/table/compaction_merging_iterator.h +3 -2
- package/vendor/librocksdb/vendor/rocksdb/table/format.cc +1 -2
- package/vendor/librocksdb/vendor/rocksdb/table/iterator.cc +4 -0
- package/vendor/librocksdb/vendor/rocksdb/table/merging_iterator.cc +18 -13
- package/vendor/librocksdb/vendor/rocksdb/table/merging_iterator.h +5 -3
- package/vendor/librocksdb/vendor/rocksdb/table/meta_blocks.cc +18 -4
- package/vendor/librocksdb/vendor/rocksdb/table/meta_blocks.h +4 -0
- package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_builder.cc +2 -2
- package/vendor/librocksdb/vendor/rocksdb/table/sst_file_dumper.cc +6 -6
- package/vendor/librocksdb/vendor/rocksdb/table/sst_file_reader.cc +24 -2
- package/vendor/librocksdb/vendor/rocksdb/table/sst_file_writer_collectors.h +3 -1
- package/vendor/librocksdb/vendor/rocksdb/table/table_builder.h +8 -7
- package/vendor/librocksdb/vendor/rocksdb/table/table_iterator.h +69 -0
- package/vendor/librocksdb/vendor/rocksdb/table/table_reader.h +9 -0
- package/vendor/librocksdb/vendor/rocksdb/test_util/testutil.cc +25 -0
- package/vendor/librocksdb/vendor/rocksdb/test_util/testutil.h +12 -0
- package/vendor/librocksdb/vendor/rocksdb/tools/db_bench_tool.cc +32 -0
- package/vendor/librocksdb/vendor/rocksdb/tools/ldb_cmd.cc +618 -124
- package/vendor/librocksdb/vendor/rocksdb/tools/ldb_cmd_impl.h +19 -1
- package/vendor/librocksdb/vendor/rocksdb/tools/ldb_tool.cc +9 -0
- package/vendor/librocksdb/vendor/rocksdb/util/aligned_storage.h +24 -0
- package/vendor/librocksdb/vendor/rocksdb/util/autovector.h +4 -0
- package/vendor/librocksdb/vendor/rocksdb/util/comparator.cc +12 -0
- package/vendor/librocksdb/vendor/rocksdb/util/filter_bench.cc +1 -1
- package/vendor/librocksdb/vendor/rocksdb/util/random.cc +2 -1
- package/vendor/librocksdb/vendor/rocksdb/util/stderr_logger.cc +3 -4
- package/vendor/librocksdb/vendor/rocksdb/util/stderr_logger.h +1 -1
- package/vendor/librocksdb/vendor/rocksdb/util/udt_util.cc +33 -0
- package/vendor/librocksdb/vendor/rocksdb/util/udt_util.h +7 -0
- package/vendor/librocksdb/vendor/rocksdb/util/write_batch_util.h +5 -0
- package/vendor/librocksdb/vendor/rocksdb/util/xxhash.h +36 -29
- package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_impl.h +3 -0
- package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_impl_filesnapshot.cc +20 -0
- package/vendor/librocksdb/vendor/rocksdb/utilities/cache_dump_load_impl.cc +29 -9
- package/vendor/librocksdb/vendor/rocksdb/utilities/cache_dump_load_impl.h +14 -3
- package/vendor/librocksdb/vendor/rocksdb/utilities/debug.cc +16 -4
- package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_fs.cc +677 -248
- package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_fs.h +325 -158
- package/vendor/librocksdb/vendor/rocksdb/utilities/option_change_migration/option_change_migration.cc +1 -8
- package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.cc +144 -0
- package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.h +45 -0
- package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector.cc +12 -0
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +1 -1
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/growable_array.h +3 -3
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction.cc +116 -20
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction.h +33 -1
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction_db.cc +78 -13
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction_db.h +33 -1
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_base.cc +106 -7
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_base.h +68 -10
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_test.h +7 -3
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_util.cc +8 -5
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_util.h +7 -4
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn.cc +18 -12
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn_db.cc +4 -4
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn_db.h +17 -0
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_unprepared_txn.cc +11 -9
- package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +2 -1
- package/vendor/librocksdb/vendor/rocksdb/utilities/types_util.cc +88 -0
- package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +313 -14
- package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +7 -0
- package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +1 -1
- package/vendor/librocksdb/vendor/rocksdb/db/multi_cf_iterator.cc +0 -102
- package/vendor/librocksdb/vendor/rocksdb/db/multi_cf_iterator.h +0 -159
|
@@ -235,19 +235,19 @@ void MemTableListVersion::AddIterators(
|
|
|
235
235
|
SequenceNumber read_seq = options.snapshot != nullptr
|
|
236
236
|
? options.snapshot->GetSequenceNumber()
|
|
237
237
|
: kMaxSequenceNumber;
|
|
238
|
-
TruncatedRangeDelIterator
|
|
238
|
+
std::unique_ptr<TruncatedRangeDelIterator> mem_tombstone_iter;
|
|
239
239
|
auto range_del_iter = m->NewRangeTombstoneIterator(
|
|
240
240
|
options, read_seq, true /* immutale_memtable */);
|
|
241
241
|
if (range_del_iter == nullptr || range_del_iter->empty()) {
|
|
242
242
|
delete range_del_iter;
|
|
243
243
|
} else {
|
|
244
|
-
mem_tombstone_iter =
|
|
244
|
+
mem_tombstone_iter = std::make_unique<TruncatedRangeDelIterator>(
|
|
245
245
|
std::unique_ptr<FragmentedRangeTombstoneIterator>(range_del_iter),
|
|
246
246
|
&m->GetInternalKeyComparator(), nullptr /* smallest */,
|
|
247
247
|
nullptr /* largest */);
|
|
248
248
|
}
|
|
249
|
-
merge_iter_builder->AddPointAndTombstoneIterator(
|
|
250
|
-
|
|
249
|
+
merge_iter_builder->AddPointAndTombstoneIterator(
|
|
250
|
+
mem_iter, std::move(mem_tombstone_iter));
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
}
|
|
@@ -558,11 +558,12 @@ Status MemTableList::TryInstallMemtableFlushResults(
|
|
|
558
558
|
batch_file_number = m->file_number_;
|
|
559
559
|
if (m->edit_.GetBlobFileAdditions().empty()) {
|
|
560
560
|
ROCKS_LOG_BUFFER(log_buffer,
|
|
561
|
-
"[%s] Level-0 commit table #%" PRIu64
|
|
561
|
+
"[%s] Level-0 commit flush result of table #%" PRIu64
|
|
562
|
+
" started",
|
|
562
563
|
cfd->GetName().c_str(), m->file_number_);
|
|
563
564
|
} else {
|
|
564
565
|
ROCKS_LOG_BUFFER(log_buffer,
|
|
565
|
-
"[%s] Level-0 commit table #%" PRIu64
|
|
566
|
+
"[%s] Level-0 commit flush result of table #%" PRIu64
|
|
566
567
|
" (+%zu blob files) started",
|
|
567
568
|
cfd->GetName().c_str(), m->file_number_,
|
|
568
569
|
m->edit_.GetBlobFileAdditions().size());
|
|
@@ -757,12 +758,12 @@ void MemTableList::RemoveMemTablesOrRestoreFlags(
|
|
|
757
758
|
MemTable* m = current_->memlist_.back();
|
|
758
759
|
if (m->edit_.GetBlobFileAdditions().empty()) {
|
|
759
760
|
ROCKS_LOG_BUFFER(log_buffer,
|
|
760
|
-
"[%s] Level-0 commit table #%" PRIu64
|
|
761
|
+
"[%s] Level-0 commit flush result of table #%" PRIu64
|
|
761
762
|
": memtable #%" PRIu64 " done",
|
|
762
763
|
cfd->GetName().c_str(), m->file_number_, mem_id);
|
|
763
764
|
} else {
|
|
764
765
|
ROCKS_LOG_BUFFER(log_buffer,
|
|
765
|
-
"[%s] Level-0 commit table #%" PRIu64
|
|
766
|
+
"[%s] Level-0 commit flush result of table #%" PRIu64
|
|
766
767
|
" (+%zu blob files)"
|
|
767
768
|
": memtable #%" PRIu64 " done",
|
|
768
769
|
cfd->GetName().c_str(), m->file_number_,
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
// This source code is licensed under both the GPLv2 (found in the
|
|
3
|
+
// COPYING file in the root directory) and Apache 2.0 License
|
|
4
|
+
// (found in the LICENSE.Apache file in the root directory).
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include <functional>
|
|
9
|
+
#include <variant>
|
|
10
|
+
|
|
11
|
+
#include "rocksdb/comparator.h"
|
|
12
|
+
#include "rocksdb/iterator.h"
|
|
13
|
+
#include "rocksdb/options.h"
|
|
14
|
+
#include "util/heap.h"
|
|
15
|
+
|
|
16
|
+
namespace ROCKSDB_NAMESPACE {
|
|
17
|
+
|
|
18
|
+
struct MultiCfIteratorInfo {
|
|
19
|
+
ColumnFamilyHandle* cfh;
|
|
20
|
+
Iterator* iterator;
|
|
21
|
+
int order;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
class MultiCfIteratorImpl {
|
|
25
|
+
public:
|
|
26
|
+
MultiCfIteratorImpl(
|
|
27
|
+
const Comparator* comparator,
|
|
28
|
+
const std::vector<ColumnFamilyHandle*>& column_families,
|
|
29
|
+
const std::vector<Iterator*>& child_iterators,
|
|
30
|
+
std::function<void()> reset_func,
|
|
31
|
+
std::function<void(const autovector<MultiCfIteratorInfo>&)> populate_func)
|
|
32
|
+
: comparator_(comparator),
|
|
33
|
+
heap_(MultiCfMinHeap(
|
|
34
|
+
MultiCfHeapItemComparator<std::greater<int>>(comparator_))),
|
|
35
|
+
reset_func_(std::move(reset_func)),
|
|
36
|
+
populate_func_(std::move(populate_func)) {
|
|
37
|
+
assert(column_families.size() > 0 &&
|
|
38
|
+
column_families.size() == child_iterators.size());
|
|
39
|
+
cfh_iter_pairs_.reserve(column_families.size());
|
|
40
|
+
for (size_t i = 0; i < column_families.size(); ++i) {
|
|
41
|
+
cfh_iter_pairs_.emplace_back(
|
|
42
|
+
column_families[i], std::unique_ptr<Iterator>(child_iterators[i]));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
~MultiCfIteratorImpl() { status_.PermitUncheckedError(); }
|
|
46
|
+
|
|
47
|
+
// No copy allowed
|
|
48
|
+
MultiCfIteratorImpl(const MultiCfIteratorImpl&) = delete;
|
|
49
|
+
MultiCfIteratorImpl& operator=(const MultiCfIteratorImpl&) = delete;
|
|
50
|
+
|
|
51
|
+
Slice key() const {
|
|
52
|
+
assert(Valid());
|
|
53
|
+
return current()->key();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
bool Valid() const {
|
|
57
|
+
if (std::holds_alternative<MultiCfMaxHeap>(heap_)) {
|
|
58
|
+
auto& max_heap = std::get<MultiCfMaxHeap>(heap_);
|
|
59
|
+
return !max_heap.empty() && status_.ok();
|
|
60
|
+
}
|
|
61
|
+
auto& min_heap = std::get<MultiCfMinHeap>(heap_);
|
|
62
|
+
return !min_heap.empty() && status_.ok();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
Status status() const { return status_; }
|
|
66
|
+
|
|
67
|
+
void SeekToFirst() {
|
|
68
|
+
auto& min_heap = GetHeap<MultiCfMinHeap>([this]() { InitMinHeap(); });
|
|
69
|
+
SeekCommon(min_heap, [](Iterator* iter) { iter->SeekToFirst(); });
|
|
70
|
+
}
|
|
71
|
+
void Seek(const Slice& target) {
|
|
72
|
+
auto& min_heap = GetHeap<MultiCfMinHeap>([this]() { InitMinHeap(); });
|
|
73
|
+
SeekCommon(min_heap, [&target](Iterator* iter) { iter->Seek(target); });
|
|
74
|
+
}
|
|
75
|
+
void SeekToLast() {
|
|
76
|
+
auto& max_heap = GetHeap<MultiCfMaxHeap>([this]() { InitMaxHeap(); });
|
|
77
|
+
SeekCommon(max_heap, [](Iterator* iter) { iter->SeekToLast(); });
|
|
78
|
+
}
|
|
79
|
+
void SeekForPrev(const Slice& target) {
|
|
80
|
+
auto& max_heap = GetHeap<MultiCfMaxHeap>([this]() { InitMaxHeap(); });
|
|
81
|
+
SeekCommon(max_heap,
|
|
82
|
+
[&target](Iterator* iter) { iter->SeekForPrev(target); });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
void Next() {
|
|
86
|
+
assert(Valid());
|
|
87
|
+
auto& min_heap = GetHeap<MultiCfMinHeap>([this]() {
|
|
88
|
+
std::string target(key().data(), key().size());
|
|
89
|
+
InitMinHeap();
|
|
90
|
+
Seek(target);
|
|
91
|
+
});
|
|
92
|
+
AdvanceIterator(min_heap, [](Iterator* iter) { iter->Next(); });
|
|
93
|
+
}
|
|
94
|
+
void Prev() {
|
|
95
|
+
assert(Valid());
|
|
96
|
+
auto& max_heap = GetHeap<MultiCfMaxHeap>([this]() {
|
|
97
|
+
std::string target(key().data(), key().size());
|
|
98
|
+
InitMaxHeap();
|
|
99
|
+
SeekForPrev(target);
|
|
100
|
+
});
|
|
101
|
+
AdvanceIterator(max_heap, [](Iterator* iter) { iter->Prev(); });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private:
|
|
105
|
+
std::vector<std::pair<ColumnFamilyHandle*, std::unique_ptr<Iterator>>>
|
|
106
|
+
cfh_iter_pairs_;
|
|
107
|
+
Status status_;
|
|
108
|
+
|
|
109
|
+
template <typename CompareOp>
|
|
110
|
+
class MultiCfHeapItemComparator {
|
|
111
|
+
public:
|
|
112
|
+
explicit MultiCfHeapItemComparator(const Comparator* comparator)
|
|
113
|
+
: comparator_(comparator) {}
|
|
114
|
+
bool operator()(const MultiCfIteratorInfo& a,
|
|
115
|
+
const MultiCfIteratorInfo& b) const {
|
|
116
|
+
assert(a.iterator);
|
|
117
|
+
assert(b.iterator);
|
|
118
|
+
assert(a.iterator->Valid());
|
|
119
|
+
assert(b.iterator->Valid());
|
|
120
|
+
int c = comparator_->Compare(a.iterator->key(), b.iterator->key());
|
|
121
|
+
assert(c != 0 || a.order != b.order);
|
|
122
|
+
return c == 0 ? a.order - b.order > 0 : CompareOp()(c, 0);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private:
|
|
126
|
+
const Comparator* comparator_;
|
|
127
|
+
};
|
|
128
|
+
const Comparator* comparator_;
|
|
129
|
+
using MultiCfMinHeap =
|
|
130
|
+
BinaryHeap<MultiCfIteratorInfo,
|
|
131
|
+
MultiCfHeapItemComparator<std::greater<int>>>;
|
|
132
|
+
using MultiCfMaxHeap = BinaryHeap<MultiCfIteratorInfo,
|
|
133
|
+
MultiCfHeapItemComparator<std::less<int>>>;
|
|
134
|
+
|
|
135
|
+
using MultiCfIterHeap = std::variant<MultiCfMinHeap, MultiCfMaxHeap>;
|
|
136
|
+
|
|
137
|
+
MultiCfIterHeap heap_;
|
|
138
|
+
|
|
139
|
+
std::function<void()> reset_func_;
|
|
140
|
+
std::function<void(autovector<MultiCfIteratorInfo>)> populate_func_;
|
|
141
|
+
|
|
142
|
+
Iterator* current() const {
|
|
143
|
+
if (std::holds_alternative<MultiCfMaxHeap>(heap_)) {
|
|
144
|
+
auto& max_heap = std::get<MultiCfMaxHeap>(heap_);
|
|
145
|
+
return max_heap.top().iterator;
|
|
146
|
+
}
|
|
147
|
+
auto& min_heap = std::get<MultiCfMinHeap>(heap_);
|
|
148
|
+
return min_heap.top().iterator;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
void considerStatus(Status s) {
|
|
152
|
+
if (!s.ok() && status_.ok()) {
|
|
153
|
+
status_ = std::move(s);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
template <typename HeapType, typename InitFunc>
|
|
158
|
+
HeapType& GetHeap(InitFunc initFunc) {
|
|
159
|
+
if (!std::holds_alternative<HeapType>(heap_)) {
|
|
160
|
+
initFunc();
|
|
161
|
+
}
|
|
162
|
+
return std::get<HeapType>(heap_);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
void InitMinHeap() {
|
|
166
|
+
heap_.emplace<MultiCfMinHeap>(
|
|
167
|
+
MultiCfHeapItemComparator<std::greater<int>>(comparator_));
|
|
168
|
+
}
|
|
169
|
+
void InitMaxHeap() {
|
|
170
|
+
heap_.emplace<MultiCfMaxHeap>(
|
|
171
|
+
MultiCfHeapItemComparator<std::less<int>>(comparator_));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
template <typename BinaryHeap, typename ChildSeekFuncType>
|
|
175
|
+
void SeekCommon(BinaryHeap& heap, ChildSeekFuncType child_seek_func) {
|
|
176
|
+
reset_func_();
|
|
177
|
+
heap.clear();
|
|
178
|
+
int i = 0;
|
|
179
|
+
for (auto& [cfh, iter] : cfh_iter_pairs_) {
|
|
180
|
+
child_seek_func(iter.get());
|
|
181
|
+
if (iter->Valid()) {
|
|
182
|
+
assert(iter->status().ok());
|
|
183
|
+
heap.push(MultiCfIteratorInfo{cfh, iter.get(), i});
|
|
184
|
+
} else {
|
|
185
|
+
considerStatus(iter->status());
|
|
186
|
+
if (!status_.ok()) {
|
|
187
|
+
// Non-OK status from the iterator. Bail out early
|
|
188
|
+
heap.clear();
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
++i;
|
|
193
|
+
}
|
|
194
|
+
if (!heap.empty()) {
|
|
195
|
+
PopulateIterator(heap);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
template <typename BinaryHeap, typename AdvanceFuncType>
|
|
200
|
+
void AdvanceIterator(BinaryHeap& heap, AdvanceFuncType advance_func) {
|
|
201
|
+
reset_func_();
|
|
202
|
+
// It is possible for one or more child iters are at invalid keys due to
|
|
203
|
+
// manual prefix iteration. For such cases, we consider the result of the
|
|
204
|
+
// multi-cf-iter is also undefined.
|
|
205
|
+
// https://github.com/facebook/rocksdb/wiki/Prefix-Seek#manual-prefix-iterating
|
|
206
|
+
// for details about manual prefix iteration
|
|
207
|
+
if (heap.empty()) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// 1. Keep the top iterator (by popping it from the heap)
|
|
212
|
+
// 2. Make sure all others have iterated past the top iterator key slice
|
|
213
|
+
// 3. Advance the top iterator, and add it back to the heap if valid
|
|
214
|
+
auto top = heap.top();
|
|
215
|
+
heap.pop();
|
|
216
|
+
if (!heap.empty()) {
|
|
217
|
+
auto current = heap.top();
|
|
218
|
+
assert(current.iterator);
|
|
219
|
+
while (current.iterator->Valid() &&
|
|
220
|
+
comparator_->Compare(top.iterator->key(),
|
|
221
|
+
current.iterator->key()) == 0) {
|
|
222
|
+
assert(current.iterator->status().ok());
|
|
223
|
+
advance_func(current.iterator);
|
|
224
|
+
if (current.iterator->Valid()) {
|
|
225
|
+
heap.replace_top(heap.top());
|
|
226
|
+
} else {
|
|
227
|
+
considerStatus(current.iterator->status());
|
|
228
|
+
if (!status_.ok()) {
|
|
229
|
+
heap.clear();
|
|
230
|
+
return;
|
|
231
|
+
} else {
|
|
232
|
+
heap.pop();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (!heap.empty()) {
|
|
236
|
+
current = heap.top();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
advance_func(top.iterator);
|
|
241
|
+
if (top.iterator->Valid()) {
|
|
242
|
+
assert(top.iterator->status().ok());
|
|
243
|
+
heap.push(top);
|
|
244
|
+
} else {
|
|
245
|
+
considerStatus(top.iterator->status());
|
|
246
|
+
if (!status_.ok()) {
|
|
247
|
+
heap.clear();
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (!heap.empty()) {
|
|
253
|
+
PopulateIterator(heap);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
template <typename BinaryHeap>
|
|
258
|
+
void PopulateIterator(BinaryHeap& heap) {
|
|
259
|
+
// 1. Keep the top iterator (by popping it from the heap) and add it to list
|
|
260
|
+
// to populate
|
|
261
|
+
// 2. For all non-top iterators having the same key as top iter popped
|
|
262
|
+
// from the previous step, add them to the same list and pop it
|
|
263
|
+
// temporarily from the heap
|
|
264
|
+
// 3. Once no other iters have the same key as the top iter from step 1,
|
|
265
|
+
// populate the value/columns and attribute_groups from the list
|
|
266
|
+
// collected in step 1 and 2 and add all the iters back to the heap
|
|
267
|
+
assert(!heap.empty());
|
|
268
|
+
auto top = heap.top();
|
|
269
|
+
heap.pop();
|
|
270
|
+
autovector<MultiCfIteratorInfo> to_populate;
|
|
271
|
+
to_populate.push_back(top);
|
|
272
|
+
if (!heap.empty()) {
|
|
273
|
+
auto current = heap.top();
|
|
274
|
+
assert(current.iterator);
|
|
275
|
+
while (current.iterator->Valid() &&
|
|
276
|
+
comparator_->Compare(top.iterator->key(),
|
|
277
|
+
current.iterator->key()) == 0) {
|
|
278
|
+
assert(current.iterator->status().ok());
|
|
279
|
+
to_populate.push_back(current);
|
|
280
|
+
heap.pop();
|
|
281
|
+
if (!heap.empty()) {
|
|
282
|
+
current = heap.top();
|
|
283
|
+
} else {
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// Add the items back to the heap
|
|
289
|
+
for (auto& item : to_populate) {
|
|
290
|
+
heap.push(item);
|
|
291
|
+
}
|
|
292
|
+
populate_func_(to_populate);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
} // namespace ROCKSDB_NAMESPACE
|
|
@@ -17,16 +17,6 @@
|
|
|
17
17
|
#include "table/internal_iterator.h"
|
|
18
18
|
|
|
19
19
|
namespace ROCKSDB_NAMESPACE {
|
|
20
|
-
struct FragmentedRangeTombstoneList;
|
|
21
|
-
|
|
22
|
-
struct FragmentedRangeTombstoneListCache {
|
|
23
|
-
// ensure only the first reader needs to initialize l
|
|
24
|
-
std::mutex reader_mutex;
|
|
25
|
-
std::unique_ptr<FragmentedRangeTombstoneList> tombstones = nullptr;
|
|
26
|
-
// readers will first check this bool to avoid
|
|
27
|
-
std::atomic<bool> initialized = false;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
20
|
struct FragmentedRangeTombstoneList {
|
|
31
21
|
public:
|
|
32
22
|
// A compact representation of a "stack" of range tombstone fragments, which
|
|
@@ -124,6 +114,14 @@ struct FragmentedRangeTombstoneList {
|
|
|
124
114
|
uint64_t total_tombstone_payload_bytes_;
|
|
125
115
|
};
|
|
126
116
|
|
|
117
|
+
struct FragmentedRangeTombstoneListCache {
|
|
118
|
+
// ensure only the first reader needs to initialize l
|
|
119
|
+
std::mutex reader_mutex;
|
|
120
|
+
std::unique_ptr<FragmentedRangeTombstoneList> tombstones = nullptr;
|
|
121
|
+
// readers will first check this bool to avoid
|
|
122
|
+
std::atomic<bool> initialized = false;
|
|
123
|
+
};
|
|
124
|
+
|
|
127
125
|
// FragmentedRangeTombstoneIterator converts an InternalIterator of a range-del
|
|
128
126
|
// meta block into an iterator over non-overlapping tombstone fragments. The
|
|
129
127
|
// tombstone fragmentation process should be more efficient than the range
|
|
@@ -480,9 +480,10 @@ class Repairer {
|
|
|
480
480
|
dbname_, /* versions */ nullptr, immutable_db_options_, tboptions,
|
|
481
481
|
file_options_, table_cache_.get(), iter.get(),
|
|
482
482
|
std::move(range_del_iters), &meta, nullptr /* blob_file_additions */,
|
|
483
|
-
{}, kMaxSequenceNumber, kMaxSequenceNumber,
|
|
484
|
-
false /* paranoid_file_checks*/,
|
|
485
|
-
nullptr /*
|
|
483
|
+
{}, kMaxSequenceNumber, kMaxSequenceNumber, kMaxSequenceNumber,
|
|
484
|
+
snapshot_checker, false /* paranoid_file_checks*/,
|
|
485
|
+
nullptr /* internal_stats */, &io_s, nullptr /*IOTracer*/,
|
|
486
|
+
BlobFileCreationReason::kRecovery,
|
|
486
487
|
nullptr /* seqno_to_time_mapping */, nullptr /* event_logger */,
|
|
487
488
|
0 /* job_id */, nullptr /* table_properties */, write_hint);
|
|
488
489
|
ROCKS_LOG_INFO(db_options_.info_log,
|
|
@@ -69,6 +69,36 @@ SequenceNumber SeqnoToTimeMapping::GetProximalSeqnoBeforeTime(
|
|
|
69
69
|
return it->seqno;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
void SeqnoToTimeMapping::GetCurrentTieringCutoffSeqnos(
|
|
73
|
+
uint64_t current_time, uint64_t preserve_internal_time_seconds,
|
|
74
|
+
uint64_t preclude_last_level_data_seconds,
|
|
75
|
+
SequenceNumber* preserve_time_min_seqno,
|
|
76
|
+
SequenceNumber* preclude_last_level_min_seqno) const {
|
|
77
|
+
uint64_t preserve_time_duration = std::max(preserve_internal_time_seconds,
|
|
78
|
+
preclude_last_level_data_seconds);
|
|
79
|
+
if (preserve_time_duration <= 0) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
uint64_t preserve_time = current_time > preserve_time_duration
|
|
83
|
+
? current_time - preserve_time_duration
|
|
84
|
+
: 0;
|
|
85
|
+
// GetProximalSeqnoBeforeTime tells us the last seqno known to have been
|
|
86
|
+
// written at or before the given time. + 1 to get the minimum we should
|
|
87
|
+
// preserve without excluding anything that might have been written on or
|
|
88
|
+
// after the given time.
|
|
89
|
+
if (preserve_time_min_seqno) {
|
|
90
|
+
*preserve_time_min_seqno = GetProximalSeqnoBeforeTime(preserve_time) + 1;
|
|
91
|
+
}
|
|
92
|
+
if (preclude_last_level_data_seconds > 0 && preclude_last_level_min_seqno) {
|
|
93
|
+
uint64_t preclude_last_level_time =
|
|
94
|
+
current_time > preclude_last_level_data_seconds
|
|
95
|
+
? current_time - preclude_last_level_data_seconds
|
|
96
|
+
: 0;
|
|
97
|
+
*preclude_last_level_min_seqno =
|
|
98
|
+
GetProximalSeqnoBeforeTime(preclude_last_level_time) + 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
72
102
|
void SeqnoToTimeMapping::EnforceMaxTimeSpan(uint64_t now) {
|
|
73
103
|
assert(enforced_); // at least sorted
|
|
74
104
|
uint64_t cutoff_time;
|
|
@@ -213,6 +213,15 @@ class SeqnoToTimeMapping {
|
|
|
213
213
|
// must be in enforced state as a precondition.
|
|
214
214
|
SequenceNumber GetProximalSeqnoBeforeTime(uint64_t time) const;
|
|
215
215
|
|
|
216
|
+
// Given current time, the configured `preserve_internal_time_seconds`, and
|
|
217
|
+
// `preclude_last_level_data_seconds`, find the relevant cutoff sequence
|
|
218
|
+
// numbers for tiering.
|
|
219
|
+
void GetCurrentTieringCutoffSeqnos(
|
|
220
|
+
uint64_t current_time, uint64_t preserve_internal_time_seconds,
|
|
221
|
+
uint64_t preclude_last_level_data_seconds,
|
|
222
|
+
SequenceNumber* preserve_time_min_seqno,
|
|
223
|
+
SequenceNumber* preclude_last_level_min_seqno) const;
|
|
224
|
+
|
|
216
225
|
// Encode to a binary string by appending to `dest`.
|
|
217
226
|
// Because this is a const operation depending on sortedness, the structure
|
|
218
227
|
// must be in enforced state as a precondition.
|
|
@@ -163,6 +163,11 @@ Status TableCache::GetTableReader(
|
|
|
163
163
|
return s;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
Cache::Handle* TableCache::Lookup(Cache* cache, uint64_t file_number) {
|
|
167
|
+
Slice key = GetSliceForFileNumber(&file_number);
|
|
168
|
+
return cache->Lookup(key);
|
|
169
|
+
}
|
|
170
|
+
|
|
166
171
|
Status TableCache::FindTable(
|
|
167
172
|
const ReadOptions& ro, const FileOptions& file_options,
|
|
168
173
|
const InternalKeyComparator& internal_comparator,
|
|
@@ -225,7 +230,7 @@ InternalIterator* TableCache::NewIterator(
|
|
|
225
230
|
const InternalKey* smallest_compaction_key,
|
|
226
231
|
const InternalKey* largest_compaction_key, bool allow_unprepared_value,
|
|
227
232
|
uint8_t block_protection_bytes_per_key, const SequenceNumber* read_seqno,
|
|
228
|
-
TruncatedRangeDelIterator
|
|
233
|
+
std::unique_ptr<TruncatedRangeDelIterator>* range_del_iter) {
|
|
229
234
|
PERF_TIMER_GUARD(new_table_iterator_nanos);
|
|
230
235
|
|
|
231
236
|
Status s;
|
|
@@ -280,7 +285,7 @@ InternalIterator* TableCache::NewIterator(
|
|
|
280
285
|
delete new_range_del_iter;
|
|
281
286
|
*range_del_iter = nullptr;
|
|
282
287
|
} else {
|
|
283
|
-
*range_del_iter =
|
|
288
|
+
*range_del_iter = std::make_unique<TruncatedRangeDelIterator>(
|
|
284
289
|
std::unique_ptr<FragmentedRangeTombstoneIterator>(
|
|
285
290
|
new_range_del_iter),
|
|
286
291
|
&icomparator, &file_meta.smallest, &file_meta.largest);
|
|
@@ -727,4 +732,14 @@ uint64_t TableCache::ApproximateSize(
|
|
|
727
732
|
|
|
728
733
|
return result;
|
|
729
734
|
}
|
|
735
|
+
|
|
736
|
+
void TableCache::ReleaseObsolete(Cache* cache, Cache::Handle* h,
|
|
737
|
+
uint32_t uncache_aggressiveness) {
|
|
738
|
+
CacheInterface typed_cache(cache);
|
|
739
|
+
TypedHandle* table_handle = reinterpret_cast<TypedHandle*>(h);
|
|
740
|
+
TableReader* table_reader = typed_cache.Value(table_handle);
|
|
741
|
+
table_reader->MarkObsolete(uncache_aggressiveness);
|
|
742
|
+
typed_cache.ReleaseAndEraseIfLastRef(table_handle);
|
|
743
|
+
}
|
|
744
|
+
|
|
730
745
|
} // namespace ROCKSDB_NAMESPACE
|
|
@@ -100,7 +100,7 @@ class TableCache {
|
|
|
100
100
|
const InternalKey* largest_compaction_key, bool allow_unprepared_value,
|
|
101
101
|
uint8_t protection_bytes_per_key,
|
|
102
102
|
const SequenceNumber* range_del_read_seqno = nullptr,
|
|
103
|
-
TruncatedRangeDelIterator
|
|
103
|
+
std::unique_ptr<TruncatedRangeDelIterator>* range_del_iter = nullptr);
|
|
104
104
|
|
|
105
105
|
// If a seek to internal key "k" in specified file finds an entry,
|
|
106
106
|
// call get_context->SaveValue() repeatedly until
|
|
@@ -165,6 +165,14 @@ class TableCache {
|
|
|
165
165
|
// Evict any entry for the specified file number
|
|
166
166
|
static void Evict(Cache* cache, uint64_t file_number);
|
|
167
167
|
|
|
168
|
+
// Handles releasing, erasing, etc. of what should be the last reference
|
|
169
|
+
// to an obsolete file.
|
|
170
|
+
static void ReleaseObsolete(Cache* cache, Cache::Handle* handle,
|
|
171
|
+
uint32_t uncache_aggressiveness);
|
|
172
|
+
|
|
173
|
+
// Return handle to an existing cache entry if there is one
|
|
174
|
+
static Cache::Handle* Lookup(Cache* cache, uint64_t file_number);
|
|
175
|
+
|
|
168
176
|
// Find table reader
|
|
169
177
|
// @param skip_filters Disables loading/accessing the filter block
|
|
170
178
|
// @param level == -1 means not specified
|
|
@@ -44,7 +44,9 @@ class InternalTblPropCollFactory {
|
|
|
44
44
|
virtual ~InternalTblPropCollFactory() {}
|
|
45
45
|
// has to be thread-safe
|
|
46
46
|
virtual InternalTblPropColl* CreateInternalTblPropColl(
|
|
47
|
-
uint32_t column_family_id, int level_at_creation
|
|
47
|
+
uint32_t column_family_id, int level_at_creation, int num_levels,
|
|
48
|
+
SequenceNumber last_level_inclusive_max_seqno_threshold =
|
|
49
|
+
kMaxSequenceNumber) = 0;
|
|
48
50
|
|
|
49
51
|
// The name of the properties collector can be used for debugging purpose.
|
|
50
52
|
virtual const char* Name() const = 0;
|
|
@@ -92,10 +94,15 @@ class UserKeyTablePropertiesCollectorFactory
|
|
|
92
94
|
std::shared_ptr<TablePropertiesCollectorFactory> user_collector_factory)
|
|
93
95
|
: user_collector_factory_(user_collector_factory) {}
|
|
94
96
|
InternalTblPropColl* CreateInternalTblPropColl(
|
|
95
|
-
uint32_t column_family_id, int level_at_creation
|
|
97
|
+
uint32_t column_family_id, int level_at_creation, int num_levels,
|
|
98
|
+
SequenceNumber last_level_inclusive_max_seqno_threshold =
|
|
99
|
+
kMaxSequenceNumber) override {
|
|
96
100
|
TablePropertiesCollectorFactory::Context context;
|
|
97
101
|
context.column_family_id = column_family_id;
|
|
98
102
|
context.level_at_creation = level_at_creation;
|
|
103
|
+
context.num_levels = num_levels;
|
|
104
|
+
context.last_level_inclusive_max_seqno_threshold =
|
|
105
|
+
last_level_inclusive_max_seqno_threshold;
|
|
99
106
|
TablePropertiesCollector* collector =
|
|
100
107
|
user_collector_factory_->CreateTablePropertiesCollector(context);
|
|
101
108
|
if (collector) {
|
|
@@ -18,7 +18,7 @@ TransactionLogIteratorImpl::TransactionLogIteratorImpl(
|
|
|
18
18
|
const std::string& dir, const ImmutableDBOptions* options,
|
|
19
19
|
const TransactionLogIterator::ReadOptions& read_options,
|
|
20
20
|
const EnvOptions& soptions, const SequenceNumber seq,
|
|
21
|
-
std::unique_ptr<
|
|
21
|
+
std::unique_ptr<VectorWalPtr> files, VersionSet const* const versions,
|
|
22
22
|
const bool seq_per_batch, const std::shared_ptr<IOTracer>& io_tracer)
|
|
23
23
|
: dir_(dir),
|
|
24
24
|
options_(options),
|
|
@@ -44,7 +44,7 @@ TransactionLogIteratorImpl::TransactionLogIteratorImpl(
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
Status TransactionLogIteratorImpl::OpenLogFile(
|
|
47
|
-
const
|
|
47
|
+
const WalFile* log_file,
|
|
48
48
|
std::unique_ptr<SequentialFileReader>* file_reader) {
|
|
49
49
|
FileSystemPtr fs(options_->fs, io_tracer_);
|
|
50
50
|
std::unique_ptr<FSSequentialFile> file;
|
|
@@ -281,7 +281,7 @@ void TransactionLogIteratorImpl::UpdateCurrentWriteBatch(const Slice& record) {
|
|
|
281
281
|
current_status_ = Status::OK();
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
Status TransactionLogIteratorImpl::OpenLogReader(const
|
|
284
|
+
Status TransactionLogIteratorImpl::OpenLogReader(const WalFile* log_file) {
|
|
285
285
|
std::unique_ptr<SequentialFileReader> file;
|
|
286
286
|
Status s = OpenLogFile(log_file, &file);
|
|
287
287
|
if (!s.ok()) {
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
|
|
20
20
|
namespace ROCKSDB_NAMESPACE {
|
|
21
21
|
|
|
22
|
-
class
|
|
22
|
+
class WalFileImpl : public WalFile {
|
|
23
23
|
public:
|
|
24
|
-
|
|
24
|
+
WalFileImpl(uint64_t logNum, WalFileType logType, SequenceNumber startSeq,
|
|
25
25
|
uint64_t sizeBytes)
|
|
26
26
|
: logNumber_(logNum),
|
|
27
27
|
type_(logType),
|
|
@@ -43,7 +43,7 @@ class LogFileImpl : public LogFile {
|
|
|
43
43
|
|
|
44
44
|
uint64_t SizeFileBytes() const override { return sizeFileBytes_; }
|
|
45
45
|
|
|
46
|
-
bool operator<(const
|
|
46
|
+
bool operator<(const WalFile& that) const {
|
|
47
47
|
return LogNumber() < that.LogNumber();
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -60,7 +60,7 @@ class TransactionLogIteratorImpl : public TransactionLogIterator {
|
|
|
60
60
|
const std::string& dir, const ImmutableDBOptions* options,
|
|
61
61
|
const TransactionLogIterator::ReadOptions& read_options,
|
|
62
62
|
const EnvOptions& soptions, const SequenceNumber seqNum,
|
|
63
|
-
std::unique_ptr<
|
|
63
|
+
std::unique_ptr<VectorWalPtr> files, VersionSet const* const versions,
|
|
64
64
|
const bool seq_per_batch, const std::shared_ptr<IOTracer>& io_tracer);
|
|
65
65
|
|
|
66
66
|
bool Valid() override;
|
|
@@ -77,7 +77,7 @@ class TransactionLogIteratorImpl : public TransactionLogIterator {
|
|
|
77
77
|
const TransactionLogIterator::ReadOptions read_options_;
|
|
78
78
|
const EnvOptions& soptions_;
|
|
79
79
|
SequenceNumber starting_sequence_number_;
|
|
80
|
-
std::unique_ptr<
|
|
80
|
+
std::unique_ptr<VectorWalPtr> files_;
|
|
81
81
|
// Used only to get latest seq. num
|
|
82
82
|
// TODO(icanadi) can this be just a callback?
|
|
83
83
|
VersionSet const* const versions_;
|
|
@@ -92,7 +92,7 @@ class TransactionLogIteratorImpl : public TransactionLogIterator {
|
|
|
92
92
|
std::unique_ptr<WriteBatch> current_batch_;
|
|
93
93
|
std::unique_ptr<log::Reader> current_log_reader_;
|
|
94
94
|
std::string scratch_;
|
|
95
|
-
Status OpenLogFile(const
|
|
95
|
+
Status OpenLogFile(const WalFile* log_file,
|
|
96
96
|
std::unique_ptr<SequentialFileReader>* file);
|
|
97
97
|
|
|
98
98
|
struct LogReporter : public log::Reader::Reporter {
|
|
@@ -123,6 +123,6 @@ class TransactionLogIteratorImpl : public TransactionLogIterator {
|
|
|
123
123
|
bool IsBatchExpected(const WriteBatch* batch, SequenceNumber expected_seq);
|
|
124
124
|
// Update current batch if a continuous batch is found.
|
|
125
125
|
void UpdateCurrentWriteBatch(const Slice& record);
|
|
126
|
-
Status OpenLogReader(const
|
|
126
|
+
Status OpenLogReader(const WalFile* file);
|
|
127
127
|
};
|
|
128
128
|
} // namespace ROCKSDB_NAMESPACE
|