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
|
@@ -227,6 +227,7 @@ class UniversalCompactionBuilder {
|
|
|
227
227
|
const InternalKeyComparator* icmp_;
|
|
228
228
|
double score_;
|
|
229
229
|
std::vector<SortedRun> sorted_runs_;
|
|
230
|
+
uint64_t max_run_size_;
|
|
230
231
|
const std::string& cf_name_;
|
|
231
232
|
const MutableCFOptions& mutable_cf_options_;
|
|
232
233
|
const MutableDBOptions& mutable_db_options_;
|
|
@@ -235,7 +236,8 @@ class UniversalCompactionBuilder {
|
|
|
235
236
|
LogBuffer* log_buffer_;
|
|
236
237
|
|
|
237
238
|
static std::vector<UniversalCompactionBuilder::SortedRun> CalculateSortedRuns(
|
|
238
|
-
const VersionStorageInfo& vstorage, int last_level
|
|
239
|
+
const VersionStorageInfo& vstorage, int last_level,
|
|
240
|
+
uint64_t* max_run_size);
|
|
239
241
|
|
|
240
242
|
// Pick a path ID to place a newly generated file, with its estimated file
|
|
241
243
|
// size.
|
|
@@ -440,11 +442,15 @@ void UniversalCompactionBuilder::SortedRun::DumpSizeInfo(
|
|
|
440
442
|
|
|
441
443
|
std::vector<UniversalCompactionBuilder::SortedRun>
|
|
442
444
|
UniversalCompactionBuilder::CalculateSortedRuns(
|
|
443
|
-
const VersionStorageInfo& vstorage, int last_level
|
|
445
|
+
const VersionStorageInfo& vstorage, int last_level,
|
|
446
|
+
uint64_t* max_run_size) {
|
|
447
|
+
assert(max_run_size);
|
|
448
|
+
*max_run_size = 0;
|
|
444
449
|
std::vector<UniversalCompactionBuilder::SortedRun> ret;
|
|
445
450
|
for (FileMetaData* f : vstorage.LevelFiles(0)) {
|
|
446
451
|
ret.emplace_back(0, f, f->fd.GetFileSize(), f->compensated_file_size,
|
|
447
452
|
f->being_compacted);
|
|
453
|
+
*max_run_size = std::max(*max_run_size, f->fd.GetFileSize());
|
|
448
454
|
}
|
|
449
455
|
for (int level = 1; level <= last_level; level++) {
|
|
450
456
|
uint64_t total_compensated_size = 0U;
|
|
@@ -466,6 +472,7 @@ UniversalCompactionBuilder::CalculateSortedRuns(
|
|
|
466
472
|
ret.emplace_back(level, nullptr, total_size, total_compensated_size,
|
|
467
473
|
being_compacted);
|
|
468
474
|
}
|
|
475
|
+
*max_run_size = std::max(*max_run_size, total_size);
|
|
469
476
|
}
|
|
470
477
|
return ret;
|
|
471
478
|
}
|
|
@@ -477,13 +484,16 @@ Compaction* UniversalCompactionBuilder::PickCompaction() {
|
|
|
477
484
|
score_ = vstorage_->CompactionScore(kLevel0);
|
|
478
485
|
int max_output_level =
|
|
479
486
|
vstorage_->MaxOutputLevel(ioptions_.allow_ingest_behind);
|
|
480
|
-
|
|
487
|
+
max_run_size_ = 0;
|
|
488
|
+
sorted_runs_ =
|
|
489
|
+
CalculateSortedRuns(*vstorage_, max_output_level, &max_run_size_);
|
|
490
|
+
int file_num_compaction_trigger =
|
|
491
|
+
mutable_cf_options_.level0_file_num_compaction_trigger;
|
|
481
492
|
|
|
482
493
|
if (sorted_runs_.size() == 0 ||
|
|
483
494
|
(vstorage_->FilesMarkedForPeriodicCompaction().empty() &&
|
|
484
495
|
vstorage_->FilesMarkedForCompaction().empty() &&
|
|
485
|
-
sorted_runs_.size() < (unsigned int)
|
|
486
|
-
.level0_file_num_compaction_trigger)) {
|
|
496
|
+
sorted_runs_.size() < (unsigned int)file_num_compaction_trigger)) {
|
|
487
497
|
ROCKS_LOG_BUFFER(log_buffer_, "[%s] Universal: nothing to do\n",
|
|
488
498
|
cf_name_.c_str());
|
|
489
499
|
TEST_SYNC_POINT_CALLBACK(
|
|
@@ -505,11 +515,9 @@ Compaction* UniversalCompactionBuilder::PickCompaction() {
|
|
|
505
515
|
TEST_SYNC_POINT_CALLBACK("PostPickPeriodicCompaction", c);
|
|
506
516
|
}
|
|
507
517
|
|
|
508
|
-
// Check for size amplification.
|
|
509
518
|
if (c == nullptr &&
|
|
510
|
-
sorted_runs_.size() >=
|
|
511
|
-
|
|
512
|
-
mutable_cf_options_.level0_file_num_compaction_trigger)) {
|
|
519
|
+
sorted_runs_.size() >= static_cast<size_t>(file_num_compaction_trigger)) {
|
|
520
|
+
// Check for size amplification.
|
|
513
521
|
if ((c = PickCompactionToReduceSizeAmp()) != nullptr) {
|
|
514
522
|
TEST_SYNC_POINT("PickCompactionToReduceSizeAmpReturnNonnullptr");
|
|
515
523
|
ROCKS_LOG_BUFFER(log_buffer_, "[%s] Universal: compacting for size amp\n",
|
|
@@ -527,13 +535,48 @@ Compaction* UniversalCompactionBuilder::PickCompaction() {
|
|
|
527
535
|
cf_name_.c_str());
|
|
528
536
|
} else {
|
|
529
537
|
// Size amplification and file size ratios are within configured limits.
|
|
530
|
-
// If max read amplification
|
|
531
|
-
// compaction
|
|
532
|
-
//
|
|
538
|
+
// If max read amplification exceeds configured limits, then force
|
|
539
|
+
// compaction to reduce the number sorted runs without looking at file
|
|
540
|
+
// size ratios.
|
|
541
|
+
|
|
533
542
|
// This is guaranteed by NeedsCompaction()
|
|
534
543
|
assert(sorted_runs_.size() >=
|
|
535
|
-
static_cast<size_t>(
|
|
536
|
-
|
|
544
|
+
static_cast<size_t>(file_num_compaction_trigger));
|
|
545
|
+
int max_num_runs =
|
|
546
|
+
mutable_cf_options_.compaction_options_universal.max_read_amp;
|
|
547
|
+
if (max_num_runs < 0) {
|
|
548
|
+
// any value < -1 is not valid
|
|
549
|
+
assert(max_num_runs == -1);
|
|
550
|
+
// By default, fall back to `level0_file_num_compaction_trigger`
|
|
551
|
+
max_num_runs = file_num_compaction_trigger;
|
|
552
|
+
} else if (max_num_runs == 0) {
|
|
553
|
+
if (mutable_cf_options_.compaction_options_universal.stop_style ==
|
|
554
|
+
kCompactionStopStyleTotalSize) {
|
|
555
|
+
// 0 means auto-tuning by RocksDB. We estimate max num run based on
|
|
556
|
+
// max_run_size, size_ratio and write buffer size:
|
|
557
|
+
// Assume the size of the lowest level size is equal to
|
|
558
|
+
// write_buffer_size. Each subsequent level is the max size without
|
|
559
|
+
// triggering size_ratio compaction. `max_num_runs` is the minimum
|
|
560
|
+
// number of levels required such that the target size of the
|
|
561
|
+
// largest level is at least `max_run_size_`.
|
|
562
|
+
max_num_runs = 1;
|
|
563
|
+
double cur_level_max_size =
|
|
564
|
+
static_cast<double>(mutable_cf_options_.write_buffer_size);
|
|
565
|
+
double total_run_size = 0;
|
|
566
|
+
while (cur_level_max_size < static_cast<double>(max_run_size_)) {
|
|
567
|
+
// This loop should not take too many iterations since
|
|
568
|
+
// cur_level_max_size at least doubles each iteration.
|
|
569
|
+
total_run_size += cur_level_max_size;
|
|
570
|
+
cur_level_max_size = (100.0 + ratio) / 100.0 * total_run_size;
|
|
571
|
+
++max_num_runs;
|
|
572
|
+
}
|
|
573
|
+
} else {
|
|
574
|
+
// TODO: implement the auto-tune logic for this stop style
|
|
575
|
+
max_num_runs = file_num_compaction_trigger;
|
|
576
|
+
}
|
|
577
|
+
} else {
|
|
578
|
+
// max_num_runs > 0, it's the limit on the number of sorted run
|
|
579
|
+
}
|
|
537
580
|
// Get the total number of sorted runs that are not being compacted
|
|
538
581
|
int num_sr_not_compacted = 0;
|
|
539
582
|
for (size_t i = 0; i < sorted_runs_.size(); i++) {
|
|
@@ -544,17 +587,25 @@ Compaction* UniversalCompactionBuilder::PickCompaction() {
|
|
|
544
587
|
|
|
545
588
|
// The number of sorted runs that are not being compacted is greater
|
|
546
589
|
// than the maximum allowed number of sorted runs
|
|
547
|
-
if (num_sr_not_compacted >
|
|
548
|
-
|
|
549
|
-
unsigned int num_files =
|
|
550
|
-
num_sr_not_compacted -
|
|
551
|
-
mutable_cf_options_.level0_file_num_compaction_trigger + 1;
|
|
590
|
+
if (num_sr_not_compacted > max_num_runs) {
|
|
591
|
+
unsigned int num_files = num_sr_not_compacted - max_num_runs + 1;
|
|
552
592
|
if ((c = PickCompactionToReduceSortedRuns(UINT_MAX, num_files)) !=
|
|
553
593
|
nullptr) {
|
|
554
594
|
ROCKS_LOG_BUFFER(log_buffer_,
|
|
555
|
-
"[%s] Universal: compacting for file num
|
|
556
|
-
|
|
595
|
+
"[%s] Universal: compacting for file num, to "
|
|
596
|
+
"compact file num -- %u, max num runs allowed"
|
|
597
|
+
"-- %d, max_run_size -- %" PRIu64 "\n",
|
|
598
|
+
cf_name_.c_str(), num_files, max_num_runs,
|
|
599
|
+
max_run_size_);
|
|
557
600
|
}
|
|
601
|
+
} else {
|
|
602
|
+
ROCKS_LOG_BUFFER(
|
|
603
|
+
log_buffer_,
|
|
604
|
+
"[%s] Universal: skipping compaction for file num, num runs not "
|
|
605
|
+
"being compacted -- %u, max num runs allowed -- %d, max_run_size "
|
|
606
|
+
"-- %" PRIu64 "\n",
|
|
607
|
+
cf_name_.c_str(), num_sr_not_compacted, max_num_runs,
|
|
608
|
+
max_run_size_);
|
|
558
609
|
}
|
|
559
610
|
}
|
|
560
611
|
}
|
|
@@ -1139,7 +1190,8 @@ Compaction* UniversalCompactionBuilder::PickIncrementalForReduceSizeAmp(
|
|
|
1139
1190
|
// from bottom_start_idx and bottom_end_idx, but for now, we use
|
|
1140
1191
|
// SetupOtherInputs() for simplicity.
|
|
1141
1192
|
int parent_index = -1; // Create and use bottom_start_idx?
|
|
1142
|
-
if (!picker_->SetupOtherInputs(cf_name_,
|
|
1193
|
+
if (!picker_->SetupOtherInputs(cf_name_, mutable_cf_options_, vstorage_,
|
|
1194
|
+
&second_last_level_inputs,
|
|
1143
1195
|
&bottom_level_inputs, &parent_index,
|
|
1144
1196
|
/*base_index=*/-1)) {
|
|
1145
1197
|
return nullptr;
|
|
@@ -1310,8 +1362,9 @@ Compaction* UniversalCompactionBuilder::PickDeleteTriggeredCompaction() {
|
|
|
1310
1362
|
int parent_index = -1;
|
|
1311
1363
|
|
|
1312
1364
|
output_level_inputs.level = output_level;
|
|
1313
|
-
if (!picker_->SetupOtherInputs(cf_name_,
|
|
1314
|
-
&
|
|
1365
|
+
if (!picker_->SetupOtherInputs(cf_name_, mutable_cf_options_, vstorage_,
|
|
1366
|
+
&start_level_inputs, &output_level_inputs,
|
|
1367
|
+
&parent_index, -1)) {
|
|
1315
1368
|
return nullptr;
|
|
1316
1369
|
}
|
|
1317
1370
|
inputs.push_back(start_level_inputs);
|
|
@@ -275,6 +275,8 @@ Status CompactionServiceCompactionJob::Run() {
|
|
|
275
275
|
log_buffer_->FlushBufferToLog();
|
|
276
276
|
LogCompaction();
|
|
277
277
|
const uint64_t start_micros = db_options_.clock->NowMicros();
|
|
278
|
+
c->GetOrInitInputTableProperties();
|
|
279
|
+
|
|
278
280
|
// Pick the only sub-compaction we should have
|
|
279
281
|
assert(compact_->sub_compact_states.size() == 1);
|
|
280
282
|
SubcompactionState* sub_compact = compact_->sub_compact_states.data();
|
|
@@ -71,6 +71,9 @@ Status VerifySstFileChecksumInternal(const Options& options,
|
|
|
71
71
|
} else {
|
|
72
72
|
return s;
|
|
73
73
|
}
|
|
74
|
+
if (!s.ok()) {
|
|
75
|
+
return s;
|
|
76
|
+
}
|
|
74
77
|
std::unique_ptr<TableReader> table_reader;
|
|
75
78
|
std::unique_ptr<RandomAccessFileReader> file_reader(
|
|
76
79
|
new RandomAccessFileReader(
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
#include "rocksdb/db.h"
|
|
22
22
|
#include "rocksdb/env.h"
|
|
23
23
|
#include "rocksdb/metadata.h"
|
|
24
|
+
#include "rocksdb/transaction_log.h"
|
|
24
25
|
#include "rocksdb/types.h"
|
|
25
26
|
#include "test_util/sync_point.h"
|
|
26
27
|
#include "util/file_checksum_helper.h"
|
|
@@ -91,7 +92,12 @@ Status DBImpl::GetLiveFiles(std::vector<std::string>& ret,
|
|
|
91
92
|
return Status::OK();
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
Status DBImpl::GetSortedWalFiles(
|
|
95
|
+
Status DBImpl::GetSortedWalFiles(VectorWalPtr& files) {
|
|
96
|
+
return GetSortedWalFilesImpl(files,
|
|
97
|
+
/*need_seqnos*/ true);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
Status DBImpl::GetSortedWalFilesImpl(VectorWalPtr& files, bool need_seqnos) {
|
|
95
101
|
// Record tracked WALs as a (minimum) cross-check for directory scan
|
|
96
102
|
std::vector<uint64_t> required_by_manifest;
|
|
97
103
|
|
|
@@ -117,7 +123,10 @@ Status DBImpl::GetSortedWalFiles(VectorLogPtr& files) {
|
|
|
117
123
|
}
|
|
118
124
|
}
|
|
119
125
|
|
|
120
|
-
|
|
126
|
+
// NOTE: need to include archived WALs because needed WALs might have been
|
|
127
|
+
// archived since getting required_by_manifest set
|
|
128
|
+
Status s = wal_manager_.GetSortedWalFiles(files, need_seqnos,
|
|
129
|
+
/*include_archived*/ true);
|
|
121
130
|
|
|
122
131
|
// DisableFileDeletions / EnableFileDeletions not supported in read-only DB
|
|
123
132
|
if (deletions_disabled.ok()) {
|
|
@@ -151,10 +160,33 @@ Status DBImpl::GetSortedWalFiles(VectorLogPtr& files) {
|
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
162
|
|
|
163
|
+
if (s.ok()) {
|
|
164
|
+
size_t wal_count = files.size();
|
|
165
|
+
ROCKS_LOG_INFO(immutable_db_options_.info_log,
|
|
166
|
+
"Number of WAL files %" ROCKSDB_PRIszt " (%" ROCKSDB_PRIszt
|
|
167
|
+
" required by manifest)",
|
|
168
|
+
wal_count, required_by_manifest.size());
|
|
169
|
+
#ifndef NDEBUG
|
|
170
|
+
std::ostringstream wal_names;
|
|
171
|
+
for (const auto& wal : files) {
|
|
172
|
+
wal_names << wal->PathName() << " ";
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
std::ostringstream wal_required_by_manifest_names;
|
|
176
|
+
for (const auto& wal : required_by_manifest) {
|
|
177
|
+
wal_required_by_manifest_names << wal << ".log ";
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
ROCKS_LOG_INFO(immutable_db_options_.info_log,
|
|
181
|
+
"Log files : %s .Log files required by manifest: %s.",
|
|
182
|
+
wal_names.str().c_str(),
|
|
183
|
+
wal_required_by_manifest_names.str().c_str());
|
|
184
|
+
#endif // NDEBUG
|
|
185
|
+
}
|
|
154
186
|
return s;
|
|
155
187
|
}
|
|
156
188
|
|
|
157
|
-
Status DBImpl::GetCurrentWalFile(std::unique_ptr<
|
|
189
|
+
Status DBImpl::GetCurrentWalFile(std::unique_ptr<WalFile>* current_log_file) {
|
|
158
190
|
uint64_t current_logfile_number;
|
|
159
191
|
{
|
|
160
192
|
InstrumentedMutexLock l(&mutex_);
|
|
@@ -175,14 +207,20 @@ Status DBImpl::GetLiveFilesStorageInfo(
|
|
|
175
207
|
// NOTE: This implementation was largely migrated from Checkpoint.
|
|
176
208
|
|
|
177
209
|
Status s;
|
|
178
|
-
|
|
210
|
+
VectorWalPtr live_wal_files;
|
|
179
211
|
bool flush_memtable = true;
|
|
180
212
|
if (!immutable_db_options_.allow_2pc) {
|
|
181
213
|
if (opts.wal_size_for_flush == std::numeric_limits<uint64_t>::max()) {
|
|
182
214
|
flush_memtable = false;
|
|
183
215
|
} else if (opts.wal_size_for_flush > 0) {
|
|
184
|
-
//
|
|
185
|
-
|
|
216
|
+
// FIXME: avoid querying the filesystem for current WAL state
|
|
217
|
+
// If the outstanding WAL files are small, we skip the flush.
|
|
218
|
+
// Don't take archived log size into account when calculating wal
|
|
219
|
+
// size for flush, and don't need to verify consistency with manifest
|
|
220
|
+
// here & now.
|
|
221
|
+
s = wal_manager_.GetSortedWalFiles(live_wal_files,
|
|
222
|
+
/* need_seqnos */ false,
|
|
223
|
+
/*include_archived*/ false);
|
|
186
224
|
|
|
187
225
|
if (!s.ok()) {
|
|
188
226
|
return s;
|
|
@@ -193,6 +231,7 @@ Status DBImpl::GetLiveFilesStorageInfo(
|
|
|
193
231
|
// We may be able to cover 2PC case too.
|
|
194
232
|
uint64_t total_wal_size = 0;
|
|
195
233
|
for (auto& wal : live_wal_files) {
|
|
234
|
+
assert(wal->Type() == kAliveLogFile);
|
|
196
235
|
total_wal_size += wal->SizeFileBytes();
|
|
197
236
|
}
|
|
198
237
|
if (total_wal_size < opts.wal_size_for_flush) {
|
|
@@ -206,12 +245,18 @@ Status DBImpl::GetLiveFilesStorageInfo(
|
|
|
206
245
|
// metadata.
|
|
207
246
|
mutex_.Lock();
|
|
208
247
|
if (flush_memtable) {
|
|
209
|
-
|
|
210
|
-
if (
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
248
|
+
bool wal_locked = lock_wal_count_ > 0;
|
|
249
|
+
if (wal_locked) {
|
|
250
|
+
ROCKS_LOG_INFO(immutable_db_options_.info_log,
|
|
251
|
+
"Can't FlushForGetLiveFiles while WAL is locked");
|
|
252
|
+
} else {
|
|
253
|
+
Status status = FlushForGetLiveFiles();
|
|
254
|
+
if (!status.ok()) {
|
|
255
|
+
mutex_.Unlock();
|
|
256
|
+
ROCKS_LOG_ERROR(immutable_db_options_.info_log,
|
|
257
|
+
"Cannot Flush data %s\n", status.ToString().c_str());
|
|
258
|
+
return status;
|
|
259
|
+
}
|
|
215
260
|
}
|
|
216
261
|
}
|
|
217
262
|
|
|
@@ -287,6 +332,8 @@ Status DBImpl::GetLiveFilesStorageInfo(
|
|
|
287
332
|
const uint64_t options_number = versions_->options_file_number();
|
|
288
333
|
const uint64_t options_size = versions_->options_file_size_;
|
|
289
334
|
const uint64_t min_log_num = MinLogNumberToKeep();
|
|
335
|
+
// Ensure consistency with manifest for track_and_verify_wals_in_manifest
|
|
336
|
+
const uint64_t max_log_num = logfile_number_;
|
|
290
337
|
|
|
291
338
|
mutex_.Unlock();
|
|
292
339
|
|
|
@@ -350,10 +397,13 @@ Status DBImpl::GetLiveFilesStorageInfo(
|
|
|
350
397
|
TEST_SYNC_POINT("CheckpointImpl::CreateCheckpoint:SavedLiveFiles2");
|
|
351
398
|
|
|
352
399
|
if (s.ok()) {
|
|
353
|
-
//
|
|
354
|
-
//
|
|
355
|
-
|
|
356
|
-
|
|
400
|
+
// FlushWAL is required to ensure we can physically copy everything
|
|
401
|
+
// logically written to the WAL. (Sync not strictly required for
|
|
402
|
+
// active WAL to be copied rather than hard linked, even when
|
|
403
|
+
// Checkpoint guarantees that the copied-to file is sync-ed. Plus we can't
|
|
404
|
+
// help track_and_verify_wals_in_manifest after manifest_size is
|
|
405
|
+
// already determined.)
|
|
406
|
+
s = FlushWAL(/*sync=*/false);
|
|
357
407
|
if (s.IsNotSupported()) { // read-only DB or similar
|
|
358
408
|
s = Status::OK();
|
|
359
409
|
}
|
|
@@ -362,25 +412,52 @@ Status DBImpl::GetLiveFilesStorageInfo(
|
|
|
362
412
|
TEST_SYNC_POINT("CheckpointImpl::CreateCustomCheckpoint:AfterGetLive1");
|
|
363
413
|
TEST_SYNC_POINT("CheckpointImpl::CreateCustomCheckpoint:AfterGetLive2");
|
|
364
414
|
|
|
365
|
-
//
|
|
415
|
+
// Even after WAL flush, there could be multiple WALs that are not
|
|
416
|
+
// fully synced. Although the output DB of a Checkpoint or Backup needs
|
|
417
|
+
// to be fully synced on return, we don't strictly need to sync this
|
|
418
|
+
// DB (the input DB). If we allow Checkpoint to hard link an inactive
|
|
419
|
+
// WAL that isn't fully synced, that could result in an insufficiently
|
|
420
|
+
// sync-ed Checkpoint. Here we get the set of WALs that are potentially
|
|
421
|
+
// unsynced or still being written to, to prevent them from being hard
|
|
422
|
+
// linked. Enforcing max_log_num from above ensures any new WALs after
|
|
423
|
+
// GetOpenWalSizes() and before GetSortedWalFiles() are not included in
|
|
424
|
+
// the results.
|
|
425
|
+
// NOTE: we might still hard link a file that is open for writing, even
|
|
426
|
+
// if we don't do any more writes to it.
|
|
427
|
+
//
|
|
428
|
+
// In a step toward reducing unnecessary file metadata queries, we also
|
|
429
|
+
// get and use our known flushed sizes for those WALs.
|
|
430
|
+
// FIXME: eventually we should not be using filesystem queries at all for
|
|
431
|
+
// the required set of WAL files.
|
|
432
|
+
//
|
|
433
|
+
// However for recycled log files, we just copy the whole file,
|
|
434
|
+
// for better or worse.
|
|
435
|
+
//
|
|
436
|
+
std::map<uint64_t, uint64_t> open_wal_number_to_size;
|
|
437
|
+
bool recycling_log_files = immutable_db_options_.recycle_log_file_num > 0;
|
|
438
|
+
if (s.ok() && !recycling_log_files) {
|
|
439
|
+
s = GetOpenWalSizes(open_wal_number_to_size);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// [old comment] If we have more than one column family, we also need to get
|
|
443
|
+
// WAL files.
|
|
366
444
|
if (s.ok()) {
|
|
367
|
-
|
|
445
|
+
// FIXME: avoid querying the filesystem for current WAL state
|
|
446
|
+
s = GetSortedWalFilesImpl(live_wal_files,
|
|
447
|
+
/* need_seqnos */ false);
|
|
368
448
|
}
|
|
369
449
|
if (!s.ok()) {
|
|
370
450
|
return s;
|
|
371
451
|
}
|
|
372
452
|
|
|
373
|
-
size_t
|
|
374
|
-
|
|
375
|
-
ROCKS_LOG_INFO(immutable_db_options_.info_log,
|
|
376
|
-
"Number of log files %" ROCKSDB_PRIszt, live_wal_files.size());
|
|
377
|
-
|
|
453
|
+
size_t wal_count = live_wal_files.size();
|
|
378
454
|
// Link WAL files. Copy exact size of last one because it is the only one
|
|
379
455
|
// that has changes after the last flush.
|
|
380
456
|
auto wal_dir = immutable_db_options_.GetWalDir();
|
|
381
|
-
for (size_t i = 0; s.ok() && i <
|
|
457
|
+
for (size_t i = 0; s.ok() && i < wal_count; ++i) {
|
|
382
458
|
if ((live_wal_files[i]->Type() == kAliveLogFile) &&
|
|
383
|
-
(!flush_memtable || live_wal_files[i]->LogNumber() >= min_log_num)
|
|
459
|
+
(!flush_memtable || live_wal_files[i]->LogNumber() >= min_log_num) &&
|
|
460
|
+
live_wal_files[i]->LogNumber() <= max_log_num) {
|
|
384
461
|
results.emplace_back();
|
|
385
462
|
LiveFileStorageInfo& info = results.back();
|
|
386
463
|
auto f = live_wal_files[i]->PathName();
|
|
@@ -389,12 +466,29 @@ Status DBImpl::GetLiveFilesStorageInfo(
|
|
|
389
466
|
info.directory = wal_dir;
|
|
390
467
|
info.file_number = live_wal_files[i]->LogNumber();
|
|
391
468
|
info.file_type = kWalFile;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
469
|
+
if (recycling_log_files) {
|
|
470
|
+
info.size = live_wal_files[i]->SizeFileBytes();
|
|
471
|
+
// Recyclable WAL files must be copied instead of hard linked
|
|
472
|
+
info.trim_to_size = true;
|
|
473
|
+
} else {
|
|
474
|
+
auto it = open_wal_number_to_size.find(info.file_number);
|
|
475
|
+
if (it == open_wal_number_to_size.end()) {
|
|
476
|
+
// Known fully synced and no future writes (in part from
|
|
477
|
+
// max_log_num check). Ok to hard link
|
|
478
|
+
info.size = live_wal_files[i]->SizeFileBytes();
|
|
479
|
+
assert(!info.trim_to_size);
|
|
480
|
+
} else {
|
|
481
|
+
// Marked as (possibly) still open -> use our known flushed size
|
|
482
|
+
// and force file copy instead of hard link
|
|
483
|
+
info.size = it->second;
|
|
484
|
+
info.trim_to_size = true;
|
|
485
|
+
// FIXME: this is needed as long as db_stress uses
|
|
486
|
+
// SetReadUnsyncedData(false), because it will only be able to
|
|
487
|
+
// copy the synced portion of the WAL, which under
|
|
488
|
+
// SetReadUnsyncedData(false) is given by the reported file size.
|
|
489
|
+
info.size = std::min(info.size, live_wal_files[i]->SizeFileBytes());
|
|
490
|
+
}
|
|
491
|
+
}
|
|
398
492
|
if (opts.include_checksum_info) {
|
|
399
493
|
info.file_checksum_func_name = kUnknownFileChecksumFuncName;
|
|
400
494
|
info.file_checksum = kUnknownFileChecksum;
|