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
|
@@ -175,15 +175,6 @@ DBOptions SanitizeOptions(const std::string& dbname, const DBOptions& src,
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
// When the DB is stopped, it's possible that there are some .trash files that
|
|
179
|
-
// were not deleted yet, when we open the DB we will find these .trash files
|
|
180
|
-
// and schedule them to be deleted (or delete immediately if SstFileManager
|
|
181
|
-
// was not used)
|
|
182
|
-
auto sfm = static_cast<SstFileManagerImpl*>(result.sst_file_manager.get());
|
|
183
|
-
for (size_t i = 0; i < result.db_paths.size(); i++) {
|
|
184
|
-
DeleteScheduler::CleanupDirectory(result.env, sfm, result.db_paths[i].path)
|
|
185
|
-
.PermitUncheckedError();
|
|
186
|
-
}
|
|
187
178
|
|
|
188
179
|
// Create a default SstFileManager for purposes of tracking compaction size
|
|
189
180
|
// and facilitating recovery from out of space errors.
|
|
@@ -310,7 +301,10 @@ Status DBImpl::NewDB(std::vector<std::string>* new_filenames) {
|
|
|
310
301
|
}
|
|
311
302
|
if (immutable_db_options_.write_dbid_to_manifest) {
|
|
312
303
|
std::string temp_db_id;
|
|
313
|
-
GetDbIdentityFromIdentityFile(&temp_db_id);
|
|
304
|
+
s = GetDbIdentityFromIdentityFile(&temp_db_id);
|
|
305
|
+
if (!s.ok()) {
|
|
306
|
+
return s;
|
|
307
|
+
}
|
|
314
308
|
new_db.SetDBId(temp_db_id);
|
|
315
309
|
}
|
|
316
310
|
new_db.SetLogNumber(0);
|
|
@@ -413,7 +407,8 @@ IOStatus Directories::SetDirectories(FileSystem* fs, const std::string& dbname,
|
|
|
413
407
|
Status DBImpl::Recover(
|
|
414
408
|
const std::vector<ColumnFamilyDescriptor>& column_families, bool read_only,
|
|
415
409
|
bool error_if_wal_file_exists, bool error_if_data_exists_in_wals,
|
|
416
|
-
uint64_t* recovered_seq, RecoveryContext* recovery_ctx
|
|
410
|
+
bool is_retry, uint64_t* recovered_seq, RecoveryContext* recovery_ctx,
|
|
411
|
+
bool* can_retry) {
|
|
417
412
|
mutex_.AssertHeld();
|
|
418
413
|
|
|
419
414
|
const WriteOptions write_options(Env::IOActivity::kDBOpen);
|
|
@@ -529,7 +524,31 @@ Status DBImpl::Recover(
|
|
|
529
524
|
Status s;
|
|
530
525
|
bool missing_table_file = false;
|
|
531
526
|
if (!immutable_db_options_.best_efforts_recovery) {
|
|
532
|
-
|
|
527
|
+
// Status of reading the descriptor file
|
|
528
|
+
Status desc_status;
|
|
529
|
+
s = versions_->Recover(column_families, read_only, &db_id_,
|
|
530
|
+
/*no_error_if_files_missing=*/false, is_retry,
|
|
531
|
+
&desc_status);
|
|
532
|
+
desc_status.PermitUncheckedError();
|
|
533
|
+
if (can_retry) {
|
|
534
|
+
// If we're opening for the first time and the failure is likely due to
|
|
535
|
+
// a corrupt MANIFEST file (could result in either the log::Reader
|
|
536
|
+
// detecting a corrupt record, or SST files not found error due to
|
|
537
|
+
// discarding badly formed tail records)
|
|
538
|
+
if (!is_retry &&
|
|
539
|
+
(desc_status.IsCorruption() || s.IsNotFound() || s.IsCorruption()) &&
|
|
540
|
+
CheckFSFeatureSupport(fs_.get(),
|
|
541
|
+
FSSupportedOps::kVerifyAndReconstructRead)) {
|
|
542
|
+
*can_retry = true;
|
|
543
|
+
ROCKS_LOG_ERROR(
|
|
544
|
+
immutable_db_options_.info_log,
|
|
545
|
+
"Possible corruption detected while replaying MANIFEST %s, %s. "
|
|
546
|
+
"Will be retried.",
|
|
547
|
+
desc_status.ToString().c_str(), s.ToString().c_str());
|
|
548
|
+
} else {
|
|
549
|
+
*can_retry = false;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
533
552
|
} else {
|
|
534
553
|
assert(!files_in_dbname.empty());
|
|
535
554
|
s = versions_->TryRecover(column_families, read_only, files_in_dbname,
|
|
@@ -621,7 +640,7 @@ Status DBImpl::Recover(
|
|
|
621
640
|
f->fd.smallest_seqno, f->fd.largest_seqno,
|
|
622
641
|
f->marked_for_compaction,
|
|
623
642
|
f->temperature, // this can be different from
|
|
624
|
-
|
|
643
|
+
// `last_level_temperature`
|
|
625
644
|
f->oldest_blob_file_number, f->oldest_ancester_time,
|
|
626
645
|
f->file_creation_time, f->epoch_number,
|
|
627
646
|
f->file_checksum, f->file_checksum_func_name,
|
|
@@ -644,7 +663,7 @@ Status DBImpl::Recover(
|
|
|
644
663
|
s = SetupDBId(write_options, read_only, recovery_ctx);
|
|
645
664
|
ROCKS_LOG_INFO(immutable_db_options_.info_log, "DB ID: %s\n", db_id_.c_str());
|
|
646
665
|
if (s.ok() && !read_only) {
|
|
647
|
-
s =
|
|
666
|
+
s = MaybeUpdateNextFileNumber(recovery_ctx);
|
|
648
667
|
}
|
|
649
668
|
|
|
650
669
|
if (immutable_db_options_.paranoid_checks && s.ok()) {
|
|
@@ -767,8 +786,8 @@ Status DBImpl::Recover(
|
|
|
767
786
|
std::sort(wals.begin(), wals.end());
|
|
768
787
|
|
|
769
788
|
bool corrupted_wal_found = false;
|
|
770
|
-
s = RecoverLogFiles(wals, &next_sequence, read_only,
|
|
771
|
-
recovery_ctx);
|
|
789
|
+
s = RecoverLogFiles(wals, &next_sequence, read_only, is_retry,
|
|
790
|
+
&corrupted_wal_found, recovery_ctx);
|
|
772
791
|
if (corrupted_wal_found && recovered_seq != nullptr) {
|
|
773
792
|
*recovered_seq = next_sequence;
|
|
774
793
|
}
|
|
@@ -946,19 +965,6 @@ Status DBImpl::LogAndApplyForRecovery(const RecoveryContext& recovery_ctx) {
|
|
|
946
965
|
recovery_ctx.mutable_cf_opts_, read_options,
|
|
947
966
|
write_options, recovery_ctx.edit_lists_,
|
|
948
967
|
&mutex_, directories_.GetDbDir());
|
|
949
|
-
if (s.ok() && !(recovery_ctx.files_to_delete_.empty())) {
|
|
950
|
-
mutex_.Unlock();
|
|
951
|
-
for (const auto& stale_sst_file : recovery_ctx.files_to_delete_) {
|
|
952
|
-
s = DeleteDBFile(&immutable_db_options_, stale_sst_file.first,
|
|
953
|
-
stale_sst_file.second,
|
|
954
|
-
/*force_bg=*/false,
|
|
955
|
-
/*force_fg=*/false);
|
|
956
|
-
if (!s.ok()) {
|
|
957
|
-
break;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
mutex_.Lock();
|
|
961
|
-
}
|
|
962
968
|
return s;
|
|
963
969
|
}
|
|
964
970
|
|
|
@@ -1078,7 +1084,7 @@ bool DBImpl::InvokeWalFilterIfNeededOnWalRecord(uint64_t wal_number,
|
|
|
1078
1084
|
// REQUIRES: wal_numbers are sorted in ascending order
|
|
1079
1085
|
Status DBImpl::RecoverLogFiles(const std::vector<uint64_t>& wal_numbers,
|
|
1080
1086
|
SequenceNumber* next_sequence, bool read_only,
|
|
1081
|
-
bool* corrupted_wal_found,
|
|
1087
|
+
bool is_retry, bool* corrupted_wal_found,
|
|
1082
1088
|
RecoveryContext* recovery_ctx) {
|
|
1083
1089
|
struct LogReporter : public log::Reader::Reporter {
|
|
1084
1090
|
Env* env;
|
|
@@ -1189,7 +1195,7 @@ Status DBImpl::RecoverLogFiles(const std::vector<uint64_t>& wal_numbers,
|
|
|
1189
1195
|
}
|
|
1190
1196
|
file_reader.reset(new SequentialFileReader(
|
|
1191
1197
|
std::move(file), fname, immutable_db_options_.log_readahead_size,
|
|
1192
|
-
io_tracer_));
|
|
1198
|
+
io_tracer_, /*listeners=*/{}, /*rate_limiter=*/nullptr, is_retry));
|
|
1193
1199
|
}
|
|
1194
1200
|
|
|
1195
1201
|
// Create the log reader.
|
|
@@ -1667,6 +1673,8 @@ Status DBImpl::WriteLevel0TableForRecovery(int job_id, ColumnFamilyData* cfd,
|
|
|
1667
1673
|
SequenceNumber earliest_write_conflict_snapshot;
|
|
1668
1674
|
std::vector<SequenceNumber> snapshot_seqs =
|
|
1669
1675
|
snapshots_.GetAll(&earliest_write_conflict_snapshot);
|
|
1676
|
+
SequenceNumber earliest_snapshot =
|
|
1677
|
+
(snapshot_seqs.empty() ? kMaxSequenceNumber : snapshot_seqs.at(0));
|
|
1670
1678
|
auto snapshot_checker = snapshot_checker_.get();
|
|
1671
1679
|
if (use_custom_gc_ && snapshot_checker == nullptr) {
|
|
1672
1680
|
snapshot_checker = DisableGCSnapshotChecker::Instance();
|
|
@@ -1686,6 +1694,7 @@ Status DBImpl::WriteLevel0TableForRecovery(int job_id, ColumnFamilyData* cfd,
|
|
|
1686
1694
|
IOStatus io_s;
|
|
1687
1695
|
const ReadOptions read_option(Env::IOActivity::kDBOpen);
|
|
1688
1696
|
const WriteOptions write_option(Env::IO_HIGH, Env::IOActivity::kDBOpen);
|
|
1697
|
+
|
|
1689
1698
|
TableBuilderOptions tboptions(
|
|
1690
1699
|
*cfd->ioptions(), mutable_cf_options, read_option, write_option,
|
|
1691
1700
|
cfd->internal_comparator(), cfd->internal_tbl_prop_coll_factories(),
|
|
@@ -1694,21 +1703,22 @@ Status DBImpl::WriteLevel0TableForRecovery(int job_id, ColumnFamilyData* cfd,
|
|
|
1694
1703
|
0 /* level */, false /* is_bottommost */,
|
|
1695
1704
|
TableFileCreationReason::kRecovery, 0 /* oldest_key_time */,
|
|
1696
1705
|
0 /* file_creation_time */, db_id_, db_session_id_,
|
|
1697
|
-
0 /* target_file_size */, meta.fd.GetNumber());
|
|
1706
|
+
0 /* target_file_size */, meta.fd.GetNumber(), kMaxSequenceNumber);
|
|
1698
1707
|
Version* version = cfd->current();
|
|
1699
1708
|
version->Ref();
|
|
1700
1709
|
uint64_t num_input_entries = 0;
|
|
1701
|
-
s = BuildTable(
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1710
|
+
s = BuildTable(dbname_, versions_.get(), immutable_db_options_, tboptions,
|
|
1711
|
+
file_options_for_compaction_, cfd->table_cache(),
|
|
1712
|
+
iter.get(), std::move(range_del_iters), &meta,
|
|
1713
|
+
&blob_file_additions, snapshot_seqs, earliest_snapshot,
|
|
1714
|
+
earliest_write_conflict_snapshot, kMaxSequenceNumber,
|
|
1715
|
+
snapshot_checker, paranoid_file_checks,
|
|
1716
|
+
cfd->internal_stats(), &io_s, io_tracer_,
|
|
1717
|
+
BlobFileCreationReason::kRecovery,
|
|
1718
|
+
nullptr /* seqno_to_time_mapping */, &event_logger_,
|
|
1719
|
+
job_id, nullptr /* table_properties */, write_hint,
|
|
1720
|
+
nullptr /*full_history_ts_low*/, &blob_callback_, version,
|
|
1721
|
+
&num_input_entries);
|
|
1712
1722
|
version->Unref();
|
|
1713
1723
|
LogFlush(immutable_db_options_.info_log);
|
|
1714
1724
|
ROCKS_LOG_DEBUG(immutable_db_options_.info_log,
|
|
@@ -1833,8 +1843,12 @@ Status DB::Open(const DBOptions& db_options, const std::string& dbname,
|
|
|
1833
1843
|
const bool kBatchPerTxn = true;
|
|
1834
1844
|
ThreadStatusUtil::SetEnableTracking(db_options.enable_thread_tracking);
|
|
1835
1845
|
ThreadStatusUtil::SetThreadOperation(ThreadStatus::OperationType::OP_DBOPEN);
|
|
1836
|
-
|
|
1837
|
-
|
|
1846
|
+
bool can_retry = false;
|
|
1847
|
+
Status s;
|
|
1848
|
+
do {
|
|
1849
|
+
s = DBImpl::Open(db_options, dbname, column_families, handles, dbptr,
|
|
1850
|
+
!kSeqPerBatch, kBatchPerTxn, can_retry, &can_retry);
|
|
1851
|
+
} while (!s.ok() && can_retry);
|
|
1838
1852
|
ThreadStatusUtil::ResetThreadStatus();
|
|
1839
1853
|
return s;
|
|
1840
1854
|
}
|
|
@@ -1953,10 +1967,55 @@ IOStatus DBImpl::CreateWAL(const WriteOptions& write_options,
|
|
|
1953
1967
|
return io_s;
|
|
1954
1968
|
}
|
|
1955
1969
|
|
|
1970
|
+
void DBImpl::TrackExistingDataFiles(
|
|
1971
|
+
const std::vector<std::string>& existing_data_files) {
|
|
1972
|
+
auto sfm = static_cast<SstFileManagerImpl*>(
|
|
1973
|
+
immutable_db_options_.sst_file_manager.get());
|
|
1974
|
+
assert(sfm);
|
|
1975
|
+
std::vector<ColumnFamilyMetaData> metadata;
|
|
1976
|
+
GetAllColumnFamilyMetaData(&metadata);
|
|
1977
|
+
|
|
1978
|
+
std::unordered_set<std::string> referenced_files;
|
|
1979
|
+
for (const auto& md : metadata) {
|
|
1980
|
+
for (const auto& lmd : md.levels) {
|
|
1981
|
+
for (const auto& fmd : lmd.files) {
|
|
1982
|
+
// We're assuming that each sst file name exists in at most one of
|
|
1983
|
+
// the paths.
|
|
1984
|
+
std::string file_path =
|
|
1985
|
+
fmd.directory + kFilePathSeparator + fmd.relative_filename;
|
|
1986
|
+
sfm->OnAddFile(file_path, fmd.size).PermitUncheckedError();
|
|
1987
|
+
referenced_files.insert(file_path);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
for (const auto& bmd : md.blob_files) {
|
|
1991
|
+
std::string name = bmd.blob_file_name;
|
|
1992
|
+
// The BlobMetaData.blob_file_name may start with "/".
|
|
1993
|
+
if (!name.empty() && name[0] == kFilePathSeparator) {
|
|
1994
|
+
name = name.substr(1);
|
|
1995
|
+
}
|
|
1996
|
+
// We're assuming that each blob file name exists in at most one of
|
|
1997
|
+
// the paths.
|
|
1998
|
+
std::string file_path = bmd.blob_file_path + kFilePathSeparator + name;
|
|
1999
|
+
sfm->OnAddFile(file_path, bmd.blob_file_size).PermitUncheckedError();
|
|
2000
|
+
referenced_files.insert(file_path);
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
for (const auto& file_path : existing_data_files) {
|
|
2005
|
+
if (referenced_files.find(file_path) != referenced_files.end()) {
|
|
2006
|
+
continue;
|
|
2007
|
+
}
|
|
2008
|
+
// There shouldn't be any duplicated files. In case there is, SstFileManager
|
|
2009
|
+
// will take care of deduping it.
|
|
2010
|
+
sfm->OnAddFile(file_path).PermitUncheckedError();
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
|
|
1956
2014
|
Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname,
|
|
1957
2015
|
const std::vector<ColumnFamilyDescriptor>& column_families,
|
|
1958
2016
|
std::vector<ColumnFamilyHandle*>* handles, DB** dbptr,
|
|
1959
|
-
const bool seq_per_batch, const bool batch_per_txn
|
|
2017
|
+
const bool seq_per_batch, const bool batch_per_txn,
|
|
2018
|
+
const bool is_retry, bool* can_retry) {
|
|
1960
2019
|
const WriteOptions write_options(Env::IOActivity::kDBOpen);
|
|
1961
2020
|
const ReadOptions read_options(Env::IOActivity::kDBOpen);
|
|
1962
2021
|
|
|
@@ -1999,7 +2058,7 @@ Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname,
|
|
|
1999
2058
|
paths.emplace_back(cf_path.path);
|
|
2000
2059
|
}
|
|
2001
2060
|
}
|
|
2002
|
-
for (auto& path : paths) {
|
|
2061
|
+
for (const auto& path : paths) {
|
|
2003
2062
|
s = impl->env_->CreateDirIfMissing(path);
|
|
2004
2063
|
if (!s.ok()) {
|
|
2005
2064
|
break;
|
|
@@ -2029,8 +2088,8 @@ Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname,
|
|
|
2029
2088
|
uint64_t recovered_seq(kMaxSequenceNumber);
|
|
2030
2089
|
s = impl->Recover(column_families, false /* read_only */,
|
|
2031
2090
|
false /* error_if_wal_file_exists */,
|
|
2032
|
-
false /* error_if_data_exists_in_wals */,
|
|
2033
|
-
&recovery_ctx);
|
|
2091
|
+
false /* error_if_data_exists_in_wals */, is_retry,
|
|
2092
|
+
&recovered_seq, &recovery_ctx, can_retry);
|
|
2034
2093
|
if (s.ok()) {
|
|
2035
2094
|
uint64_t new_log_number = impl->versions_->NewFileNumber();
|
|
2036
2095
|
log::Writer* new_log = nullptr;
|
|
@@ -2038,6 +2097,11 @@ Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname,
|
|
|
2038
2097
|
impl->GetWalPreallocateBlockSize(max_write_buffer_size);
|
|
2039
2098
|
s = impl->CreateWAL(write_options, new_log_number, 0 /*recycle_log_number*/,
|
|
2040
2099
|
preallocate_block_size, &new_log);
|
|
2100
|
+
if (s.ok()) {
|
|
2101
|
+
// Prevent log files created by previous instance from being recycled.
|
|
2102
|
+
// They might be in alive_log_file_, and might get recycled otherwise.
|
|
2103
|
+
impl->min_log_number_to_recycle_ = new_log_number;
|
|
2104
|
+
}
|
|
2041
2105
|
if (s.ok()) {
|
|
2042
2106
|
InstrumentedMutexLock wl(&impl->log_write_mutex_);
|
|
2043
2107
|
impl->logfile_number_ = new_log_number;
|
|
@@ -2165,9 +2229,6 @@ Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname,
|
|
|
2165
2229
|
impl->WriteOptionsFile(write_options, true /*db_mutex_already_held*/);
|
|
2166
2230
|
*dbptr = impl;
|
|
2167
2231
|
impl->opened_successfully_ = true;
|
|
2168
|
-
impl->DeleteObsoleteFiles();
|
|
2169
|
-
TEST_SYNC_POINT("DBImpl::Open:AfterDeleteFiles");
|
|
2170
|
-
impl->MaybeScheduleFlushOrCompaction();
|
|
2171
2232
|
} else {
|
|
2172
2233
|
persist_options_status.PermitUncheckedError();
|
|
2173
2234
|
}
|
|
@@ -2182,73 +2243,10 @@ Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname,
|
|
|
2182
2243
|
ROCKS_LOG_INFO(impl->immutable_db_options_.info_log,
|
|
2183
2244
|
"SstFileManager instance %p", sfm);
|
|
2184
2245
|
|
|
2185
|
-
|
|
2186
|
-
// db_paths[0] and cf_paths[0] when the DB is opened.
|
|
2187
|
-
|
|
2188
|
-
// SstFileManagerImpl needs to know sizes of the files. For files whose size
|
|
2189
|
-
// we already know (sst files that appear in manifest - typically that's the
|
|
2190
|
-
// vast majority of all files), we'll pass the size to SstFileManager.
|
|
2191
|
-
// For all other files SstFileManager will query the size from filesystem.
|
|
2192
|
-
|
|
2193
|
-
std::vector<ColumnFamilyMetaData> metadata;
|
|
2194
|
-
impl->GetAllColumnFamilyMetaData(&metadata);
|
|
2195
|
-
|
|
2196
|
-
std::unordered_map<std::string, uint64_t> known_file_sizes;
|
|
2197
|
-
for (const auto& md : metadata) {
|
|
2198
|
-
for (const auto& lmd : md.levels) {
|
|
2199
|
-
for (const auto& fmd : lmd.files) {
|
|
2200
|
-
known_file_sizes[fmd.relative_filename] = fmd.size;
|
|
2201
|
-
}
|
|
2202
|
-
}
|
|
2203
|
-
for (const auto& bmd : md.blob_files) {
|
|
2204
|
-
std::string name = bmd.blob_file_name;
|
|
2205
|
-
// The BlobMetaData.blob_file_name may start with "/".
|
|
2206
|
-
if (!name.empty() && name[0] == '/') {
|
|
2207
|
-
name = name.substr(1);
|
|
2208
|
-
}
|
|
2209
|
-
known_file_sizes[name] = bmd.blob_file_size;
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
|
|
2213
|
-
std::vector<std::string> paths;
|
|
2214
|
-
paths.emplace_back(impl->immutable_db_options_.db_paths[0].path);
|
|
2215
|
-
for (auto& cf : column_families) {
|
|
2216
|
-
if (!cf.options.cf_paths.empty()) {
|
|
2217
|
-
paths.emplace_back(cf.options.cf_paths[0].path);
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
// Remove duplicate paths.
|
|
2221
|
-
std::sort(paths.begin(), paths.end());
|
|
2222
|
-
paths.erase(std::unique(paths.begin(), paths.end()), paths.end());
|
|
2223
|
-
IOOptions io_opts;
|
|
2224
|
-
io_opts.do_not_recurse = true;
|
|
2225
|
-
for (auto& path : paths) {
|
|
2226
|
-
std::vector<std::string> existing_files;
|
|
2227
|
-
impl->immutable_db_options_.fs
|
|
2228
|
-
->GetChildren(path, io_opts, &existing_files,
|
|
2229
|
-
/*IODebugContext*=*/nullptr)
|
|
2230
|
-
.PermitUncheckedError(); //**TODO: What do to on error?
|
|
2231
|
-
for (auto& file_name : existing_files) {
|
|
2232
|
-
uint64_t file_number;
|
|
2233
|
-
FileType file_type;
|
|
2234
|
-
std::string file_path = path + "/" + file_name;
|
|
2235
|
-
if (ParseFileName(file_name, &file_number, &file_type) &&
|
|
2236
|
-
(file_type == kTableFile || file_type == kBlobFile)) {
|
|
2237
|
-
// TODO: Check for errors from OnAddFile?
|
|
2238
|
-
if (known_file_sizes.count(file_name)) {
|
|
2239
|
-
// We're assuming that each sst file name exists in at most one of
|
|
2240
|
-
// the paths.
|
|
2241
|
-
sfm->OnAddFile(file_path, known_file_sizes.at(file_name))
|
|
2242
|
-
.PermitUncheckedError();
|
|
2243
|
-
} else {
|
|
2244
|
-
sfm->OnAddFile(file_path).PermitUncheckedError();
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2246
|
+
impl->TrackExistingDataFiles(recovery_ctx.existing_data_files_);
|
|
2249
2247
|
|
|
2250
2248
|
// Reserve some disk buffer space. This is a heuristic - when we run out
|
|
2251
|
-
// of disk space, this ensures that there is
|
|
2249
|
+
// of disk space, this ensures that there is at least write_buffer_size
|
|
2252
2250
|
// amount of free space before we resume DB writes. In low disk space
|
|
2253
2251
|
// conditions, we want to avoid a lot of small L0 files due to frequent
|
|
2254
2252
|
// WAL write failures and resultant forced flushes
|
|
@@ -2256,6 +2254,27 @@ Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname,
|
|
|
2256
2254
|
impl->immutable_db_options_.db_paths[0].path);
|
|
2257
2255
|
}
|
|
2258
2256
|
|
|
2257
|
+
if (s.ok()) {
|
|
2258
|
+
// When the DB is stopped, it's possible that there are some .trash files
|
|
2259
|
+
// that were not deleted yet, when we open the DB we will find these .trash
|
|
2260
|
+
// files and schedule them to be deleted (or delete immediately if
|
|
2261
|
+
// SstFileManager was not used).
|
|
2262
|
+
// Note that we only start doing this and below delete obsolete file after
|
|
2263
|
+
// `TrackExistingDataFiles` are called, the `max_trash_db_ratio` is
|
|
2264
|
+
// ineffective otherwise and these files' deletion won't be rate limited
|
|
2265
|
+
// which can cause discard stall.
|
|
2266
|
+
for (const auto& path : impl->CollectAllDBPaths()) {
|
|
2267
|
+
DeleteScheduler::CleanupDirectory(impl->immutable_db_options_.env, sfm,
|
|
2268
|
+
path)
|
|
2269
|
+
.PermitUncheckedError();
|
|
2270
|
+
}
|
|
2271
|
+
impl->mutex_.Lock();
|
|
2272
|
+
// This will do a full scan.
|
|
2273
|
+
impl->DeleteObsoleteFiles();
|
|
2274
|
+
TEST_SYNC_POINT("DBImpl::Open:AfterDeleteFiles");
|
|
2275
|
+
impl->MaybeScheduleFlushOrCompaction();
|
|
2276
|
+
impl->mutex_.Unlock();
|
|
2277
|
+
}
|
|
2259
2278
|
|
|
2260
2279
|
if (s.ok()) {
|
|
2261
2280
|
ROCKS_LOG_HEADER(impl->immutable_db_options_.info_log, "DB pointer %p",
|
|
@@ -33,8 +33,8 @@ DBImplSecondary::~DBImplSecondary() = default;
|
|
|
33
33
|
Status DBImplSecondary::Recover(
|
|
34
34
|
const std::vector<ColumnFamilyDescriptor>& column_families,
|
|
35
35
|
bool /*readonly*/, bool /*error_if_wal_file_exists*/,
|
|
36
|
-
bool /*error_if_data_exists_in_wals*/, uint64_t*,
|
|
37
|
-
RecoveryContext* /*recovery_ctx*/) {
|
|
36
|
+
bool /*error_if_data_exists_in_wals*/, bool /*is_retry*/, uint64_t*,
|
|
37
|
+
RecoveryContext* /*recovery_ctx*/, bool* /*can_retry*/) {
|
|
38
38
|
mutex_.AssertHeld();
|
|
39
39
|
|
|
40
40
|
JobContext job_context(0);
|
|
@@ -680,7 +680,8 @@ Status DBImplSecondary::TryCatchUpWithPrimary() {
|
|
|
680
680
|
InstrumentedMutexLock lock_guard(&mutex_);
|
|
681
681
|
s = static_cast_with_check<ReactiveVersionSet>(versions_.get())
|
|
682
682
|
->ReadAndApply(&mutex_, &manifest_reader_,
|
|
683
|
-
manifest_reader_status_.get(), &cfds_changed
|
|
683
|
+
manifest_reader_status_.get(), &cfds_changed,
|
|
684
|
+
/*files_to_delete=*/nullptr);
|
|
684
685
|
|
|
685
686
|
ROCKS_LOG_INFO(immutable_db_options_.info_log, "Last sequence is %" PRIu64,
|
|
686
687
|
static_cast<uint64_t>(versions_->LastSequence()));
|
|
@@ -82,8 +82,9 @@ class DBImplSecondary : public DBImpl {
|
|
|
82
82
|
// and log_readers_ to facilitate future operations.
|
|
83
83
|
Status Recover(const std::vector<ColumnFamilyDescriptor>& column_families,
|
|
84
84
|
bool read_only, bool error_if_wal_file_exists,
|
|
85
|
-
bool error_if_data_exists_in_wals,
|
|
86
|
-
RecoveryContext* recovery_ctx = nullptr
|
|
85
|
+
bool error_if_data_exists_in_wals, bool is_retry = false,
|
|
86
|
+
uint64_t* = nullptr, RecoveryContext* recovery_ctx = nullptr,
|
|
87
|
+
bool* can_retry = nullptr) override;
|
|
87
88
|
|
|
88
89
|
// Can return IOError due to files being deleted by the primary. To avoid
|
|
89
90
|
// IOError in this case, application can coordinate between primary and
|
|
@@ -276,6 +277,10 @@ class DBImplSecondary : public DBImpl {
|
|
|
276
277
|
return false;
|
|
277
278
|
}
|
|
278
279
|
|
|
280
|
+
std::unique_ptr<log::FragmentBufferedReader> manifest_reader_;
|
|
281
|
+
std::unique_ptr<log::Reader::Reporter> manifest_reporter_;
|
|
282
|
+
std::unique_ptr<Status> manifest_reader_status_;
|
|
283
|
+
|
|
279
284
|
private:
|
|
280
285
|
friend class DB;
|
|
281
286
|
|
|
@@ -304,10 +309,6 @@ class DBImplSecondary : public DBImpl {
|
|
|
304
309
|
const CompactionServiceInput& input,
|
|
305
310
|
CompactionServiceResult* result);
|
|
306
311
|
|
|
307
|
-
std::unique_ptr<log::FragmentBufferedReader> manifest_reader_;
|
|
308
|
-
std::unique_ptr<log::Reader::Reporter> manifest_reporter_;
|
|
309
|
-
std::unique_ptr<Status> manifest_reader_status_;
|
|
310
|
-
|
|
311
312
|
// Cache log readers for each log number, used for continue WAL replay
|
|
312
313
|
// after recovery
|
|
313
314
|
std::map<uint64_t, std::unique_ptr<LogReaderContainer>> log_readers_;
|