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
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#pragma once
|
|
10
10
|
|
|
11
11
|
#include <atomic>
|
|
12
|
+
#include <cstdint>
|
|
12
13
|
#include <deque>
|
|
13
14
|
#include <functional>
|
|
14
15
|
#include <limits>
|
|
@@ -50,12 +51,14 @@
|
|
|
50
51
|
#include "monitoring/instrumented_mutex.h"
|
|
51
52
|
#include "options/db_options.h"
|
|
52
53
|
#include "port/port.h"
|
|
54
|
+
#include "rocksdb/attribute_groups.h"
|
|
53
55
|
#include "rocksdb/db.h"
|
|
54
56
|
#include "rocksdb/env.h"
|
|
55
57
|
#include "rocksdb/memtablerep.h"
|
|
56
58
|
#include "rocksdb/status.h"
|
|
57
59
|
#include "rocksdb/trace_reader_writer.h"
|
|
58
60
|
#include "rocksdb/transaction_log.h"
|
|
61
|
+
#include "rocksdb/user_write_callback.h"
|
|
59
62
|
#include "rocksdb/utilities/replayer.h"
|
|
60
63
|
#include "rocksdb/write_buffer_manager.h"
|
|
61
64
|
#include "table/merging_iterator.h"
|
|
@@ -230,6 +233,10 @@ class DBImpl : public DB {
|
|
|
230
233
|
using DB::Write;
|
|
231
234
|
Status Write(const WriteOptions& options, WriteBatch* updates) override;
|
|
232
235
|
|
|
236
|
+
using DB::WriteWithCallback;
|
|
237
|
+
Status WriteWithCallback(const WriteOptions& options, WriteBatch* updates,
|
|
238
|
+
UserWriteCallback* user_write_cb) override;
|
|
239
|
+
|
|
233
240
|
using DB::Get;
|
|
234
241
|
Status Get(const ReadOptions& _read_options,
|
|
235
242
|
ColumnFamilyHandle* column_family, const Slice& key,
|
|
@@ -290,6 +297,11 @@ class DBImpl : public DB {
|
|
|
290
297
|
const Slice* keys,
|
|
291
298
|
PinnableAttributeGroups* results) override;
|
|
292
299
|
|
|
300
|
+
void MultiGetEntityWithCallback(
|
|
301
|
+
const ReadOptions& read_options, ColumnFamilyHandle* column_family,
|
|
302
|
+
ReadCallback* callback,
|
|
303
|
+
autovector<KeyContext*, MultiGetContext::MAX_BATCH_SIZE>* sorted_keys);
|
|
304
|
+
|
|
293
305
|
Status CreateColumnFamily(const ColumnFamilyOptions& cf_options,
|
|
294
306
|
const std::string& column_family,
|
|
295
307
|
ColumnFamilyHandle** handle) override {
|
|
@@ -351,9 +363,13 @@ class DBImpl : public DB {
|
|
|
351
363
|
const Snapshot* GetSnapshot() override;
|
|
352
364
|
void ReleaseSnapshot(const Snapshot* snapshot) override;
|
|
353
365
|
|
|
354
|
-
//
|
|
355
|
-
|
|
356
|
-
|
|
366
|
+
// EXPERIMENTAL
|
|
367
|
+
std::unique_ptr<Iterator> NewCoalescingIterator(
|
|
368
|
+
const ReadOptions& options,
|
|
369
|
+
const std::vector<ColumnFamilyHandle*>& column_families) override;
|
|
370
|
+
|
|
371
|
+
// EXPERIMENTAL
|
|
372
|
+
std::unique_ptr<AttributeGroupIterator> NewAttributeGroupIterator(
|
|
357
373
|
const ReadOptions& options,
|
|
358
374
|
const std::vector<ColumnFamilyHandle*>& column_families) override;
|
|
359
375
|
|
|
@@ -491,8 +507,16 @@ class DBImpl : public DB {
|
|
|
491
507
|
// All the returned filenames start with "/"
|
|
492
508
|
Status GetLiveFiles(std::vector<std::string>&, uint64_t* manifest_file_size,
|
|
493
509
|
bool flush_memtable = true) override;
|
|
494
|
-
Status GetSortedWalFiles(
|
|
495
|
-
Status
|
|
510
|
+
Status GetSortedWalFiles(VectorWalPtr& files) override;
|
|
511
|
+
Status GetSortedWalFilesImpl(VectorWalPtr& files, bool need_seqnos);
|
|
512
|
+
|
|
513
|
+
// Get the known flushed sizes of WALs that might still be written to
|
|
514
|
+
// or have pending sync.
|
|
515
|
+
// NOTE: unlike alive_log_files_, this function includes WALs that might
|
|
516
|
+
// be obsolete (but not obsolete to a pending Checkpoint) and not yet fully
|
|
517
|
+
// synced.
|
|
518
|
+
Status GetOpenWalSizes(std::map<uint64_t, uint64_t>& number_to_size);
|
|
519
|
+
Status GetCurrentWalFile(std::unique_ptr<WalFile>* current_log_file) override;
|
|
496
520
|
Status GetCreationTimeOfOldestFile(uint64_t* creation_time) override;
|
|
497
521
|
|
|
498
522
|
Status GetUpdatesSince(
|
|
@@ -678,7 +702,8 @@ class DBImpl : public DB {
|
|
|
678
702
|
// thread to determine whether it is safe to perform the write.
|
|
679
703
|
virtual Status WriteWithCallback(const WriteOptions& write_options,
|
|
680
704
|
WriteBatch* my_batch,
|
|
681
|
-
WriteCallback* callback
|
|
705
|
+
WriteCallback* callback,
|
|
706
|
+
UserWriteCallback* user_write_cb = nullptr);
|
|
682
707
|
|
|
683
708
|
// Returns the sequence number that is guaranteed to be smaller than or equal
|
|
684
709
|
// to the sequence number of any key that could be inserted into the current
|
|
@@ -816,6 +841,8 @@ class DBImpl : public DB {
|
|
|
816
841
|
|
|
817
842
|
uint64_t MinLogNumberToKeep();
|
|
818
843
|
|
|
844
|
+
uint64_t MinLogNumberToRecycle();
|
|
845
|
+
|
|
819
846
|
// Returns the lower bound file number for SSTs that won't be deleted, even if
|
|
820
847
|
// they're obsolete. This lower bound is used internally to prevent newly
|
|
821
848
|
// created flush/compaction output files from being deleted before they're
|
|
@@ -1052,7 +1079,8 @@ class DBImpl : public DB {
|
|
|
1052
1079
|
static Status Open(const DBOptions& db_options, const std::string& name,
|
|
1053
1080
|
const std::vector<ColumnFamilyDescriptor>& column_families,
|
|
1054
1081
|
std::vector<ColumnFamilyHandle*>* handles, DB** dbptr,
|
|
1055
|
-
const bool seq_per_batch, const bool batch_per_txn
|
|
1082
|
+
const bool seq_per_batch, const bool batch_per_txn,
|
|
1083
|
+
const bool is_retry, bool* can_retry);
|
|
1056
1084
|
|
|
1057
1085
|
static IOStatus CreateAndNewDirectory(
|
|
1058
1086
|
FileSystem* fs, const std::string& dirname,
|
|
@@ -1198,6 +1226,8 @@ class DBImpl : public DB {
|
|
|
1198
1226
|
return logs_.back().number;
|
|
1199
1227
|
}
|
|
1200
1228
|
|
|
1229
|
+
void TEST_DeleteObsoleteFiles();
|
|
1230
|
+
|
|
1201
1231
|
const std::unordered_set<uint64_t>& TEST_GetFilesGrabbedForPurge() const {
|
|
1202
1232
|
return files_grabbed_for_purge_;
|
|
1203
1233
|
}
|
|
@@ -1413,9 +1443,8 @@ class DBImpl : public DB {
|
|
|
1413
1443
|
autovector<ColumnFamilyData*> cfds_;
|
|
1414
1444
|
autovector<const MutableCFOptions*> mutable_cf_opts_;
|
|
1415
1445
|
autovector<autovector<VersionEdit*>> edit_lists_;
|
|
1416
|
-
//
|
|
1417
|
-
|
|
1418
|
-
std::unordered_map<std::string, std::string> files_to_delete_;
|
|
1446
|
+
// All existing data files (SST files and Blob files) found during DB::Open.
|
|
1447
|
+
std::vector<std::string> existing_data_files_;
|
|
1419
1448
|
bool is_new_db_ = false;
|
|
1420
1449
|
};
|
|
1421
1450
|
|
|
@@ -1435,6 +1464,9 @@ class DBImpl : public DB {
|
|
|
1435
1464
|
Status RenameTempFileToOptionsFile(const std::string& file_name);
|
|
1436
1465
|
Status DeleteObsoleteOptionsFiles();
|
|
1437
1466
|
|
|
1467
|
+
void NotifyOnManualFlushScheduled(autovector<ColumnFamilyData*> cfds,
|
|
1468
|
+
FlushReason flush_reason);
|
|
1469
|
+
|
|
1438
1470
|
void NotifyOnFlushBegin(ColumnFamilyData* cfd, FileMetaData* file_meta,
|
|
1439
1471
|
const MutableCFOptions& mutable_cf_options,
|
|
1440
1472
|
int job_id, FlushReason flush_reason);
|
|
@@ -1485,6 +1517,7 @@ class DBImpl : public DB {
|
|
|
1485
1517
|
// batch that does not have duplicate keys.
|
|
1486
1518
|
Status WriteImpl(const WriteOptions& options, WriteBatch* updates,
|
|
1487
1519
|
WriteCallback* callback = nullptr,
|
|
1520
|
+
UserWriteCallback* user_write_cb = nullptr,
|
|
1488
1521
|
uint64_t* log_used = nullptr, uint64_t log_ref = 0,
|
|
1489
1522
|
bool disable_memtable = false, uint64_t* seq_used = nullptr,
|
|
1490
1523
|
size_t batch_cnt = 0,
|
|
@@ -1493,6 +1526,7 @@ class DBImpl : public DB {
|
|
|
1493
1526
|
|
|
1494
1527
|
Status PipelinedWriteImpl(const WriteOptions& options, WriteBatch* updates,
|
|
1495
1528
|
WriteCallback* callback = nullptr,
|
|
1529
|
+
UserWriteCallback* user_write_cb = nullptr,
|
|
1496
1530
|
uint64_t* log_used = nullptr, uint64_t log_ref = 0,
|
|
1497
1531
|
bool disable_memtable = false,
|
|
1498
1532
|
uint64_t* seq_used = nullptr);
|
|
@@ -1519,7 +1553,8 @@ class DBImpl : public DB {
|
|
|
1519
1553
|
// marks start of a new sub-batch.
|
|
1520
1554
|
Status WriteImplWALOnly(
|
|
1521
1555
|
WriteThread* write_thread, const WriteOptions& options,
|
|
1522
|
-
WriteBatch* updates, WriteCallback* callback,
|
|
1556
|
+
WriteBatch* updates, WriteCallback* callback,
|
|
1557
|
+
UserWriteCallback* user_write_cb, uint64_t* log_used,
|
|
1523
1558
|
const uint64_t log_ref, uint64_t* seq_used, const size_t sub_batch_cnt,
|
|
1524
1559
|
PreReleaseCallback* pre_release_callback, const AssignOrder assign_order,
|
|
1525
1560
|
const PublishLastSeq publish_last_seq, const bool disable_memtable);
|
|
@@ -1529,7 +1564,7 @@ class DBImpl : public DB {
|
|
|
1529
1564
|
Status WriteRecoverableState();
|
|
1530
1565
|
|
|
1531
1566
|
// Actual implementation of Close()
|
|
1532
|
-
Status CloseImpl();
|
|
1567
|
+
virtual Status CloseImpl();
|
|
1533
1568
|
|
|
1534
1569
|
// Recover the descriptor from persistent storage. May do a significant
|
|
1535
1570
|
// amount of work to recover recently logged updates. Any changes to
|
|
@@ -1541,9 +1576,9 @@ class DBImpl : public DB {
|
|
|
1541
1576
|
virtual Status Recover(
|
|
1542
1577
|
const std::vector<ColumnFamilyDescriptor>& column_families,
|
|
1543
1578
|
bool read_only = false, bool error_if_wal_file_exists = false,
|
|
1544
|
-
bool error_if_data_exists_in_wals = false,
|
|
1579
|
+
bool error_if_data_exists_in_wals = false, bool is_retry = false,
|
|
1545
1580
|
uint64_t* recovered_seq = nullptr,
|
|
1546
|
-
RecoveryContext* recovery_ctx = nullptr);
|
|
1581
|
+
RecoveryContext* recovery_ctx = nullptr, bool* can_retry = nullptr);
|
|
1547
1582
|
|
|
1548
1583
|
virtual bool OwnTablesAndLogs() const { return true; }
|
|
1549
1584
|
|
|
@@ -1553,22 +1588,36 @@ class DBImpl : public DB {
|
|
|
1553
1588
|
// Assign db_id_ and write DB ID to manifest if necessary.
|
|
1554
1589
|
void SetDBId(std::string&& id, bool read_only, RecoveryContext* recovery_ctx);
|
|
1555
1590
|
|
|
1591
|
+
// Collect a deduplicated collection of paths used by this DB, including
|
|
1592
|
+
// dbname_, DBOptions.db_paths, ColumnFamilyOptions.cf_paths.
|
|
1593
|
+
std::set<std::string> CollectAllDBPaths();
|
|
1594
|
+
|
|
1556
1595
|
// REQUIRES: db mutex held when calling this function, but the db mutex can
|
|
1557
1596
|
// be released and re-acquired. Db mutex will be held when the function
|
|
1558
1597
|
// returns.
|
|
1559
|
-
//
|
|
1560
|
-
//
|
|
1598
|
+
// It stores all existing data files (SST and Blob) in RecoveryContext. In
|
|
1599
|
+
// the meantime, we find out the largest file number present in the paths, and
|
|
1600
|
+
// bump up the version set's next_file_number_ to be 1 + largest_file_number.
|
|
1601
|
+
// recovery_ctx stores the context about version edits. All those edits are
|
|
1602
|
+
// persisted to new Manifest after successfully syncing the new WAL.
|
|
1603
|
+
Status MaybeUpdateNextFileNumber(RecoveryContext* recovery_ctx);
|
|
1604
|
+
|
|
1605
|
+
// Track existing data files, including both referenced and unreferenced SST
|
|
1606
|
+
// and Blob files in SstFileManager. This is only called during DB::Open and
|
|
1607
|
+
// it's called before any file deletion start so that their deletion can be
|
|
1608
|
+
// properly rate limited.
|
|
1609
|
+
// Files may not be referenced in the MANIFEST because (e.g.
|
|
1561
1610
|
// 1. It's best effort recovery;
|
|
1562
1611
|
// 2. The VersionEdits referencing the SST files are appended to
|
|
1563
1612
|
// RecoveryContext, DB crashes when syncing the MANIFEST, the VersionEdits are
|
|
1564
1613
|
// still not synced to MANIFEST during recovery.)
|
|
1565
|
-
//
|
|
1566
|
-
//
|
|
1567
|
-
//
|
|
1568
|
-
//
|
|
1569
|
-
//
|
|
1570
|
-
|
|
1571
|
-
|
|
1614
|
+
//
|
|
1615
|
+
// If the file is referenced in Manifest (typically that's the
|
|
1616
|
+
// vast majority of all files), since it already has the file size
|
|
1617
|
+
// on record, we don't need to query the file system. Otherwise, we query the
|
|
1618
|
+
// file system for the size of an unreferenced file.
|
|
1619
|
+
void TrackExistingDataFiles(
|
|
1620
|
+
const std::vector<std::string>& existing_data_files);
|
|
1572
1621
|
|
|
1573
1622
|
// SetDbSessionId() should be called in the constuctor DBImpl()
|
|
1574
1623
|
// to ensure that db_session_id_ gets updated every time the DB is opened
|
|
@@ -1622,6 +1671,7 @@ class DBImpl : public DB {
|
|
|
1622
1671
|
friend class ForwardIterator;
|
|
1623
1672
|
friend struct SuperVersion;
|
|
1624
1673
|
friend class CompactedDBImpl;
|
|
1674
|
+
friend class DBImplFollower;
|
|
1625
1675
|
#ifndef NDEBUG
|
|
1626
1676
|
friend class DBTest_ConcurrentFlushWAL_Test;
|
|
1627
1677
|
friend class DBTest_MixedSlowdownOptionsStop_Test;
|
|
@@ -1676,8 +1726,11 @@ class DBImpl : public DB {
|
|
|
1676
1726
|
return w;
|
|
1677
1727
|
}
|
|
1678
1728
|
Status ClearWriter() {
|
|
1679
|
-
|
|
1680
|
-
|
|
1729
|
+
Status s;
|
|
1730
|
+
if (writer->file()) {
|
|
1731
|
+
// TODO: plumb Env::IOActivity, Env::IOPriority
|
|
1732
|
+
s = writer->WriteBuffer(WriteOptions());
|
|
1733
|
+
}
|
|
1681
1734
|
delete writer;
|
|
1682
1735
|
writer = nullptr;
|
|
1683
1736
|
return s;
|
|
@@ -1692,10 +1745,16 @@ class DBImpl : public DB {
|
|
|
1692
1745
|
|
|
1693
1746
|
void PrepareForSync() {
|
|
1694
1747
|
assert(!getting_synced);
|
|
1695
|
-
//
|
|
1696
|
-
assert(writer->file()->GetFlushedSize() >= pre_sync_size);
|
|
1748
|
+
// Ensure the head of logs_ is marked as getting_synced if any is.
|
|
1697
1749
|
getting_synced = true;
|
|
1698
|
-
|
|
1750
|
+
// If last sync failed on a later WAL, this could be a fully synced
|
|
1751
|
+
// and closed WAL that just needs to be recorded as synced in the
|
|
1752
|
+
// manifest.
|
|
1753
|
+
if (writer->file()) {
|
|
1754
|
+
// Size is expected to be monotonically increasing.
|
|
1755
|
+
assert(writer->file()->GetFlushedSize() >= pre_sync_size);
|
|
1756
|
+
pre_sync_size = writer->file()->GetFlushedSize();
|
|
1757
|
+
}
|
|
1699
1758
|
}
|
|
1700
1759
|
|
|
1701
1760
|
void FinishSync() {
|
|
@@ -1831,6 +1890,10 @@ class DBImpl : public DB {
|
|
|
1831
1890
|
Env::Priority compaction_pri_;
|
|
1832
1891
|
};
|
|
1833
1892
|
|
|
1893
|
+
static bool IsRecoveryFlush(FlushReason flush_reason) {
|
|
1894
|
+
return flush_reason == FlushReason::kErrorRecoveryRetryFlush ||
|
|
1895
|
+
flush_reason == FlushReason::kErrorRecovery;
|
|
1896
|
+
}
|
|
1834
1897
|
// Initialize the built-in column family for persistent stats. Depending on
|
|
1835
1898
|
// whether on-disk persistent stats have been enabled before, it may either
|
|
1836
1899
|
// create a new column family and column family handle or just a column family
|
|
@@ -1893,7 +1956,7 @@ class DBImpl : public DB {
|
|
|
1893
1956
|
void ReleaseFileNumberFromPendingOutputs(
|
|
1894
1957
|
std::unique_ptr<std::list<uint64_t>::iterator>& v);
|
|
1895
1958
|
|
|
1896
|
-
IOStatus
|
|
1959
|
+
IOStatus SyncClosedWals(const WriteOptions& write_options,
|
|
1897
1960
|
JobContext* job_context, VersionEdit* synced_wals,
|
|
1898
1961
|
bool error_recovery_in_prog);
|
|
1899
1962
|
|
|
@@ -1923,7 +1986,7 @@ class DBImpl : public DB {
|
|
|
1923
1986
|
// corrupted_log_found is set to true if we recover from a corrupted log file.
|
|
1924
1987
|
Status RecoverLogFiles(const std::vector<uint64_t>& log_numbers,
|
|
1925
1988
|
SequenceNumber* next_sequence, bool read_only,
|
|
1926
|
-
bool* corrupted_log_found,
|
|
1989
|
+
bool is_retry, bool* corrupted_log_found,
|
|
1927
1990
|
RecoveryContext* recovery_ctx);
|
|
1928
1991
|
|
|
1929
1992
|
// The following two methods are used to flush a memtable to
|
|
@@ -1975,7 +2038,8 @@ class DBImpl : public DB {
|
|
|
1975
2038
|
// REQUIRES: mutex held
|
|
1976
2039
|
void SelectColumnFamiliesForAtomicFlush(
|
|
1977
2040
|
autovector<ColumnFamilyData*>* selected_cfds,
|
|
1978
|
-
const autovector<ColumnFamilyData*>& provided_candidate_cfds = {}
|
|
2041
|
+
const autovector<ColumnFamilyData*>& provided_candidate_cfds = {},
|
|
2042
|
+
FlushReason flush_reason = FlushReason::kOthers);
|
|
1979
2043
|
|
|
1980
2044
|
// Force current memtable contents to be flushed.
|
|
1981
2045
|
Status FlushMemTable(ColumnFamilyData* cfd, const FlushOptions& options,
|
|
@@ -2027,17 +2091,22 @@ class DBImpl : public DB {
|
|
|
2027
2091
|
mutex_.Lock();
|
|
2028
2092
|
}
|
|
2029
2093
|
|
|
2030
|
-
if (
|
|
2031
|
-
//
|
|
2032
|
-
|
|
2094
|
+
if (immutable_db_options_.unordered_write) {
|
|
2095
|
+
// Wait for the ones who already wrote to the WAL to finish their
|
|
2096
|
+
// memtable write.
|
|
2097
|
+
if (pending_memtable_writes_.load() != 0) {
|
|
2098
|
+
// XXX: suspicious wait while holding DB mutex?
|
|
2099
|
+
std::unique_lock<std::mutex> guard(switch_mutex_);
|
|
2100
|
+
switch_cv_.wait(guard,
|
|
2101
|
+
[&] { return pending_memtable_writes_.load() == 0; });
|
|
2102
|
+
}
|
|
2103
|
+
} else {
|
|
2104
|
+
// (Writes are finished before the next write group starts.)
|
|
2033
2105
|
}
|
|
2034
2106
|
|
|
2035
|
-
// Wait for
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
std::unique_lock<std::mutex> guard(switch_mutex_);
|
|
2039
|
-
switch_cv_.wait(guard,
|
|
2040
|
-
[&] { return pending_memtable_writes_.load() == 0; });
|
|
2107
|
+
// Wait for any LockWAL to clear
|
|
2108
|
+
while (lock_wal_count_ > 0) {
|
|
2109
|
+
bg_cv_.Wait();
|
|
2041
2110
|
}
|
|
2042
2111
|
}
|
|
2043
2112
|
|
|
@@ -2147,7 +2216,8 @@ class DBImpl : public DB {
|
|
|
2147
2216
|
void GenerateFlushRequest(const autovector<ColumnFamilyData*>& cfds,
|
|
2148
2217
|
FlushReason flush_reason, FlushRequest* req);
|
|
2149
2218
|
|
|
2150
|
-
|
|
2219
|
+
// Returns true if `req` is successfully enqueued.
|
|
2220
|
+
bool SchedulePendingFlush(const FlushRequest& req);
|
|
2151
2221
|
|
|
2152
2222
|
void SchedulePendingCompaction(ColumnFamilyData* cfd);
|
|
2153
2223
|
void SchedulePendingPurge(std::string fname, std::string dir_to_sync,
|
|
@@ -2223,6 +2293,11 @@ class DBImpl : public DB {
|
|
|
2223
2293
|
ColumnFamilyData* PickCompactionFromQueue(
|
|
2224
2294
|
std::unique_ptr<TaskLimiterToken>* token, LogBuffer* log_buffer);
|
|
2225
2295
|
|
|
2296
|
+
IOStatus SyncWalImpl(bool include_current_wal,
|
|
2297
|
+
const WriteOptions& write_options,
|
|
2298
|
+
JobContext* job_context, VersionEdit* synced_wals,
|
|
2299
|
+
bool error_recovery_in_prog);
|
|
2300
|
+
|
|
2226
2301
|
// helper function to call after some of the logs_ were synced
|
|
2227
2302
|
void MarkLogsSynced(uint64_t up_to, bool synced_dir, VersionEdit* edit);
|
|
2228
2303
|
Status ApplyWALToManifest(const ReadOptions& read_options,
|
|
@@ -2280,6 +2355,9 @@ class DBImpl : public DB {
|
|
|
2280
2355
|
bool HaveManualCompaction(ColumnFamilyData* cfd);
|
|
2281
2356
|
bool MCOverlap(ManualCompactionState* m, ManualCompactionState* m1);
|
|
2282
2357
|
void UpdateDeletionCompactionStats(const std::unique_ptr<Compaction>& c);
|
|
2358
|
+
|
|
2359
|
+
// May open and read table files for table property.
|
|
2360
|
+
// Should not be called while holding mutex_.
|
|
2283
2361
|
void BuildCompactionJobInfo(const ColumnFamilyData* cfd, Compaction* c,
|
|
2284
2362
|
const Status& st,
|
|
2285
2363
|
const CompactionJobStats& compaction_job_stats,
|
|
@@ -2331,10 +2409,7 @@ class DBImpl : public DB {
|
|
|
2331
2409
|
// A structure to hold the information required to process MultiGet of keys
|
|
2332
2410
|
// belonging to one column family. For a multi column family MultiGet, there
|
|
2333
2411
|
// will be a container of these objects.
|
|
2334
|
-
struct
|
|
2335
|
-
ColumnFamilyHandle* cf;
|
|
2336
|
-
ColumnFamilyData* cfd;
|
|
2337
|
-
|
|
2412
|
+
struct MultiGetKeyRangePerCf {
|
|
2338
2413
|
// For the batched MultiGet which relies on sorted keys, start specifies
|
|
2339
2414
|
// the index of first key belonging to this column family in the sorted
|
|
2340
2415
|
// list.
|
|
@@ -2344,31 +2419,33 @@ class DBImpl : public DB {
|
|
|
2344
2419
|
// belonging to this column family in the sorted list
|
|
2345
2420
|
size_t num_keys;
|
|
2346
2421
|
|
|
2422
|
+
MultiGetKeyRangePerCf() : start(0), num_keys(0) {}
|
|
2423
|
+
|
|
2424
|
+
MultiGetKeyRangePerCf(size_t first, size_t count)
|
|
2425
|
+
: start(first), num_keys(count) {}
|
|
2426
|
+
};
|
|
2427
|
+
|
|
2428
|
+
// A structure to contain ColumnFamilyData and the SuperVersion obtained for
|
|
2429
|
+
// the consistent view of DB
|
|
2430
|
+
struct ColumnFamilySuperVersionPair {
|
|
2431
|
+
ColumnFamilyHandleImpl* cfh;
|
|
2432
|
+
ColumnFamilyData* cfd;
|
|
2433
|
+
|
|
2347
2434
|
// SuperVersion for the column family obtained in a manner that ensures a
|
|
2348
2435
|
// consistent view across all column families in the DB
|
|
2349
2436
|
SuperVersion* super_version;
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
:
|
|
2353
|
-
cfd(
|
|
2354
|
-
start(0),
|
|
2355
|
-
num_keys(0),
|
|
2356
|
-
super_version(sv) {}
|
|
2357
|
-
|
|
2358
|
-
MultiGetColumnFamilyData(ColumnFamilyHandle* column_family, size_t first,
|
|
2359
|
-
size_t count, SuperVersion* sv)
|
|
2360
|
-
: cf(column_family),
|
|
2361
|
-
cfd(static_cast<ColumnFamilyHandleImpl*>(cf)->cfd()),
|
|
2362
|
-
start(first),
|
|
2363
|
-
num_keys(count),
|
|
2437
|
+
ColumnFamilySuperVersionPair(ColumnFamilyHandle* column_family,
|
|
2438
|
+
SuperVersion* sv)
|
|
2439
|
+
: cfh(static_cast<ColumnFamilyHandleImpl*>(column_family)),
|
|
2440
|
+
cfd(cfh->cfd()),
|
|
2364
2441
|
super_version(sv) {}
|
|
2365
2442
|
|
|
2366
|
-
|
|
2443
|
+
ColumnFamilySuperVersionPair() = default;
|
|
2367
2444
|
};
|
|
2368
2445
|
|
|
2369
2446
|
// A common function to obtain a consistent snapshot, which can be implicit
|
|
2370
2447
|
// if the user doesn't specify a snapshot in read_options, across
|
|
2371
|
-
// multiple column families
|
|
2448
|
+
// multiple column families. It will attempt to get an implicit
|
|
2372
2449
|
// snapshot without acquiring the db_mutes, but will give up after a few
|
|
2373
2450
|
// tries and acquire the mutex if a memtable flush happens. The template
|
|
2374
2451
|
// allows both the batched and non-batched MultiGet to call this with
|
|
@@ -2377,18 +2454,26 @@ class DBImpl : public DB {
|
|
|
2377
2454
|
// If callback is non-null, the callback is refreshed with the snapshot
|
|
2378
2455
|
// sequence number
|
|
2379
2456
|
//
|
|
2457
|
+
// `extra_sv_ref` is used to indicate whether thread-local SuperVersion
|
|
2458
|
+
// should be obtained with an extra ref (by GetReferencedSuperVersion()) or
|
|
2459
|
+
// not (by GetAndRefSuperVersion()). For instance, point lookup like MultiGet
|
|
2460
|
+
// does not require SuperVersion to be re-acquired throughout the entire
|
|
2461
|
+
// invocation (no need extra ref), while MultiCfIterators may need the
|
|
2462
|
+
// SuperVersion to be updated during Refresh() (requires extra ref).
|
|
2463
|
+
//
|
|
2380
2464
|
// `sv_from_thread_local` being set to false indicates that the SuperVersion
|
|
2381
2465
|
// obtained from the ColumnFamilyData, whereas true indicates they are thread
|
|
2382
2466
|
// local.
|
|
2467
|
+
//
|
|
2383
2468
|
// A non-OK status will be returned if for a column family that enables
|
|
2384
2469
|
// user-defined timestamp feature, the specified `ReadOptions.timestamp`
|
|
2385
2470
|
// attemps to read collapsed history.
|
|
2386
|
-
template <class T>
|
|
2387
|
-
Status MultiCFSnapshot(
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2471
|
+
template <class T, typename IterDerefFuncType>
|
|
2472
|
+
Status MultiCFSnapshot(const ReadOptions& read_options,
|
|
2473
|
+
ReadCallback* callback,
|
|
2474
|
+
IterDerefFuncType iter_deref_func, T* cf_list,
|
|
2475
|
+
bool extra_sv_ref, SequenceNumber* snapshot,
|
|
2476
|
+
bool* sv_from_thread_local);
|
|
2392
2477
|
|
|
2393
2478
|
// The actual implementation of the batching MultiGet. The caller is expected
|
|
2394
2479
|
// to have acquired the SuperVersion and pass in a snapshot sequence number
|
|
@@ -2411,6 +2496,13 @@ class DBImpl : public DB {
|
|
|
2411
2496
|
|
|
2412
2497
|
bool ShouldReferenceSuperVersion(const MergeContext& merge_context);
|
|
2413
2498
|
|
|
2499
|
+
template <typename IterType, typename ImplType,
|
|
2500
|
+
typename ErrorIteratorFuncType>
|
|
2501
|
+
std::unique_ptr<IterType> NewMultiCfIterator(
|
|
2502
|
+
const ReadOptions& _read_options,
|
|
2503
|
+
const std::vector<ColumnFamilyHandle*>& column_families,
|
|
2504
|
+
ErrorIteratorFuncType error_iterator_func);
|
|
2505
|
+
|
|
2414
2506
|
// Lock over the persistent DB state. Non-nullptr iff successfully acquired.
|
|
2415
2507
|
FileLock* db_lock_;
|
|
2416
2508
|
|
|
@@ -2462,6 +2554,11 @@ class DBImpl : public DB {
|
|
|
2462
2554
|
uint64_t logfile_number_;
|
|
2463
2555
|
// Log files that we can recycle. Must be protected by db mutex_.
|
|
2464
2556
|
std::deque<uint64_t> log_recycle_files_;
|
|
2557
|
+
// The minimum log file number taht can be recycled, if log recycling is
|
|
2558
|
+
// enabled. This is used to ensure that log files created by previous
|
|
2559
|
+
// instances of the database are not recycled, as we cannot be sure they
|
|
2560
|
+
// were created in the recyclable format.
|
|
2561
|
+
uint64_t min_log_number_to_recycle_;
|
|
2465
2562
|
// Protected by log_write_mutex_.
|
|
2466
2563
|
bool log_dir_synced_;
|
|
2467
2564
|
// Without two_write_queues, read and writes to log_empty_ are protected by
|
|
@@ -2476,8 +2573,10 @@ class DBImpl : public DB {
|
|
|
2476
2573
|
|
|
2477
2574
|
bool persistent_stats_cfd_exists_ = true;
|
|
2478
2575
|
|
|
2479
|
-
//
|
|
2480
|
-
//
|
|
2576
|
+
// The current WAL file and those that have not been found obsolete from
|
|
2577
|
+
// memtable flushes. A WAL not on this list might still be pending writer
|
|
2578
|
+
// flush and/or sync and close and might still be in logs_. alive_log_files_
|
|
2579
|
+
// is protected by mutex_ and log_write_mutex_ with details as follows:
|
|
2481
2580
|
// 1. read by FindObsoleteFiles() which can be called in either application
|
|
2482
2581
|
// thread or RocksDB bg threads, both mutex_ and log_write_mutex_ are
|
|
2483
2582
|
// held.
|
|
@@ -2528,7 +2627,7 @@ class DBImpl : public DB {
|
|
|
2528
2627
|
// 8. read by MarkLogsNotSynced() and MarkLogsSynced() are protected by
|
|
2529
2628
|
// log_write_mutex_.
|
|
2530
2629
|
// 9. erase() by MarkLogsSynced() protected by log_write_mutex_.
|
|
2531
|
-
// 10. read by
|
|
2630
|
+
// 10. read by SyncClosedWals() protected by only log_write_mutex_. This can
|
|
2532
2631
|
// happen in bg flush threads after DB::Open() returns success to
|
|
2533
2632
|
// applications.
|
|
2534
2633
|
// 11. reads, e.g. front(), iteration, and back() called by PreprocessWrite()
|
|
@@ -2541,7 +2640,7 @@ class DBImpl : public DB {
|
|
|
2541
2640
|
// 13. emplace_back() by SwitchMemtable() hold both mutex_ and
|
|
2542
2641
|
// log_write_mutex_. This happens in the write group leader. Can conflict
|
|
2543
2642
|
// with bg threads calling FindObsoleteFiles(), MarkLogsSynced(),
|
|
2544
|
-
//
|
|
2643
|
+
// SyncClosedWals(), etc. as well as application threads calling
|
|
2545
2644
|
// FlushWAL(), SyncWAL(), LockWAL(). This is fine because all parties
|
|
2546
2645
|
// require at least log_write_mutex_.
|
|
2547
2646
|
// 14. iteration called in WriteToWAL(write_group) protected by
|
|
@@ -2947,9 +3046,9 @@ inline Status DBImpl::FailIfReadCollapsedHistory(const ColumnFamilyData* cfd,
|
|
|
2947
3046
|
if (!full_history_ts_low.empty() &&
|
|
2948
3047
|
ucmp->CompareTimestamp(ts, full_history_ts_low) < 0) {
|
|
2949
3048
|
std::stringstream oss;
|
|
2950
|
-
oss << "Read timestamp: " << ts
|
|
3049
|
+
oss << "Read timestamp: " << ucmp->TimestampToString(ts)
|
|
2951
3050
|
<< " is smaller than full_history_ts_low: "
|
|
2952
|
-
<<
|
|
3051
|
+
<< ucmp->TimestampToString(full_history_ts_low) << std::endl;
|
|
2953
3052
|
return Status::InvalidArgument(oss.str());
|
|
2954
3053
|
}
|
|
2955
3054
|
return Status::OK();
|