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
|
@@ -46,10 +46,25 @@ inline IOStatus CreateFile(const std::shared_ptr<FileSystem>& fs,
|
|
|
46
46
|
return CreateFile(fs.get(), destination, contents, use_fsync);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
// Delete a DB file, if this file is a SST file or Blob file and SstFileManager
|
|
50
|
+
// is used, it should have already been tracked by SstFileManager via its
|
|
51
|
+
// `OnFileAdd` API before passing to this API to be deleted, to ensure
|
|
52
|
+
// SstFileManager and its DeleteScheduler are tracking DB size and trash size
|
|
53
|
+
// properly.
|
|
49
54
|
Status DeleteDBFile(const ImmutableDBOptions* db_options,
|
|
50
55
|
const std::string& fname, const std::string& path_to_sync,
|
|
51
56
|
const bool force_bg, const bool force_fg);
|
|
52
57
|
|
|
58
|
+
// Delete an unaccounted DB file that is not tracked by SstFileManager and will
|
|
59
|
+
// not be tracked by its DeleteScheduler when getting deleted.
|
|
60
|
+
// If a legitimate bucket is provided and this file is scheduled for slow
|
|
61
|
+
// deletion, it will be assigned to the specified trash bucket.
|
|
62
|
+
Status DeleteUnaccountedDBFile(const ImmutableDBOptions* db_options,
|
|
63
|
+
const std::string& fname,
|
|
64
|
+
const std::string& dir_to_sync,
|
|
65
|
+
const bool force_bg, const bool force_fg,
|
|
66
|
+
std::optional<int32_t> bucket);
|
|
67
|
+
|
|
53
68
|
// TODO(hx235): pass the whole DBOptions intead of its individual fields
|
|
54
69
|
IOStatus GenerateOneFileChecksum(
|
|
55
70
|
FileSystem* fs, const std::string& file_path,
|
|
@@ -41,6 +41,7 @@ IOStatus SequentialFileReader::Read(size_t n, Slice* result, char* scratch,
|
|
|
41
41
|
IOStatus io_s;
|
|
42
42
|
IOOptions io_opts;
|
|
43
43
|
io_opts.rate_limiter_priority = rate_limiter_priority;
|
|
44
|
+
io_opts.verify_and_reconstruct_read = verify_and_reconstruct_read_;
|
|
44
45
|
if (use_direct_io()) {
|
|
45
46
|
//
|
|
46
47
|
// |-offset_advance-|---bytes returned--|
|
|
@@ -56,6 +56,7 @@ class SequentialFileReader {
|
|
|
56
56
|
std::atomic<size_t> offset_{0}; // read offset
|
|
57
57
|
std::vector<std::shared_ptr<EventListener>> listeners_{};
|
|
58
58
|
RateLimiter* rate_limiter_;
|
|
59
|
+
bool verify_and_reconstruct_read_;
|
|
59
60
|
|
|
60
61
|
public:
|
|
61
62
|
explicit SequentialFileReader(
|
|
@@ -63,11 +64,13 @@ class SequentialFileReader {
|
|
|
63
64
|
const std::shared_ptr<IOTracer>& io_tracer = nullptr,
|
|
64
65
|
const std::vector<std::shared_ptr<EventListener>>& listeners = {},
|
|
65
66
|
RateLimiter* rate_limiter =
|
|
66
|
-
nullptr
|
|
67
|
+
nullptr, // TODO: migrate call sites to provide rate limiter
|
|
68
|
+
bool verify_and_reconstruct_read = false)
|
|
67
69
|
: file_name_(_file_name),
|
|
68
70
|
file_(std::move(_file), io_tracer, _file_name),
|
|
69
71
|
listeners_(),
|
|
70
|
-
rate_limiter_(rate_limiter)
|
|
72
|
+
rate_limiter_(rate_limiter),
|
|
73
|
+
verify_and_reconstruct_read_(verify_and_reconstruct_read) {
|
|
71
74
|
AddFileIOListeners(listeners);
|
|
72
75
|
}
|
|
73
76
|
|
|
@@ -77,12 +80,14 @@ class SequentialFileReader {
|
|
|
77
80
|
const std::shared_ptr<IOTracer>& io_tracer = nullptr,
|
|
78
81
|
const std::vector<std::shared_ptr<EventListener>>& listeners = {},
|
|
79
82
|
RateLimiter* rate_limiter =
|
|
80
|
-
nullptr
|
|
83
|
+
nullptr, // TODO: migrate call sites to provide rate limiter
|
|
84
|
+
bool verify_and_reconstruct_read = false)
|
|
81
85
|
: file_name_(_file_name),
|
|
82
86
|
file_(NewReadaheadSequentialFile(std::move(_file), _readahead_size),
|
|
83
87
|
io_tracer, _file_name),
|
|
84
88
|
listeners_(),
|
|
85
|
-
rate_limiter_(rate_limiter)
|
|
89
|
+
rate_limiter_(rate_limiter),
|
|
90
|
+
verify_and_reconstruct_read_(verify_and_reconstruct_read) {
|
|
86
91
|
AddFileIOListeners(listeners);
|
|
87
92
|
}
|
|
88
93
|
static IOStatus Create(const std::shared_ptr<FileSystem>& fs,
|
|
@@ -421,10 +421,28 @@ Status SstFileManagerImpl::ScheduleFileDeletion(const std::string& file_path,
|
|
|
421
421
|
return delete_scheduler_.DeleteFile(file_path, path_to_sync, force_bg);
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
+
Status SstFileManagerImpl::ScheduleUnaccountedFileDeletion(
|
|
425
|
+
const std::string& file_path, const std::string& dir_to_sync,
|
|
426
|
+
const bool force_bg, std::optional<int32_t> bucket) {
|
|
427
|
+
TEST_SYNC_POINT_CALLBACK(
|
|
428
|
+
"SstFileManagerImpl::ScheduleUnaccountedFileDeletion",
|
|
429
|
+
const_cast<std::string*>(&file_path));
|
|
430
|
+
return delete_scheduler_.DeleteUnaccountedFile(file_path, dir_to_sync,
|
|
431
|
+
force_bg, bucket);
|
|
432
|
+
}
|
|
433
|
+
|
|
424
434
|
void SstFileManagerImpl::WaitForEmptyTrash() {
|
|
425
435
|
delete_scheduler_.WaitForEmptyTrash();
|
|
426
436
|
}
|
|
427
437
|
|
|
438
|
+
std::optional<int32_t> SstFileManagerImpl::NewTrashBucket() {
|
|
439
|
+
return delete_scheduler_.NewTrashBucket();
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
void SstFileManagerImpl::WaitForEmptyTrashBucket(int32_t bucket) {
|
|
443
|
+
delete_scheduler_.WaitForEmptyTrashBucket(bucket);
|
|
444
|
+
}
|
|
445
|
+
|
|
428
446
|
void SstFileManagerImpl::OnAddFileImpl(const std::string& file_path,
|
|
429
447
|
uint64_t file_size) {
|
|
430
448
|
auto tracked_file = tracked_files_.find(file_path);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#pragma once
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
#include <optional>
|
|
9
9
|
#include <string>
|
|
10
10
|
|
|
11
11
|
#include "db/compaction/compaction.h"
|
|
@@ -30,6 +30,10 @@ class SstFileManagerImpl : public SstFileManager {
|
|
|
30
30
|
double max_trash_db_ratio,
|
|
31
31
|
uint64_t bytes_max_delete_chunk);
|
|
32
32
|
|
|
33
|
+
// No copy
|
|
34
|
+
SstFileManagerImpl(const SstFileManagerImpl& sfm) = delete;
|
|
35
|
+
SstFileManagerImpl& operator=(const SstFileManagerImpl& sfm) = delete;
|
|
36
|
+
|
|
33
37
|
~SstFileManagerImpl();
|
|
34
38
|
|
|
35
39
|
// DB will call OnAddFile whenever a new sst/blob file is added.
|
|
@@ -114,17 +118,40 @@ class SstFileManagerImpl : public SstFileManager {
|
|
|
114
118
|
// not guaranteed
|
|
115
119
|
bool CancelErrorRecovery(ErrorHandler* db);
|
|
116
120
|
|
|
117
|
-
// Mark file as trash and schedule
|
|
121
|
+
// Mark a file as trash and schedule its deletion. If force_bg is set, it
|
|
118
122
|
// forces the file to be deleting in the background regardless of DB size,
|
|
119
|
-
// except when rate limited delete is disabled
|
|
123
|
+
// except when rate limited delete is disabled.
|
|
120
124
|
virtual Status ScheduleFileDeletion(const std::string& file_path,
|
|
121
125
|
const std::string& dir_to_sync,
|
|
122
126
|
const bool force_bg = false);
|
|
123
127
|
|
|
124
|
-
//
|
|
128
|
+
// Delete an unaccounted file. The file is deleted immediately if slow
|
|
129
|
+
// deletion is disabled. A file with more than 1 hard links will be deleted
|
|
130
|
+
// immediately unless force_bg is set. In other cases, files will be scheduled
|
|
131
|
+
// for slow deletion, and assigned to the specified bucket if a legitimate one
|
|
132
|
+
// is provided. A legitimate bucket is one that is created with the
|
|
133
|
+
// `NewTrashBucket` API, and for which `WaitForEmptyTrashBucket` hasn't been
|
|
134
|
+
// called yet.
|
|
135
|
+
virtual Status ScheduleUnaccountedFileDeletion(
|
|
136
|
+
const std::string& file_path, const std::string& dir_to_sync,
|
|
137
|
+
const bool force_bg = false,
|
|
138
|
+
std::optional<int32_t> bucket = std::nullopt);
|
|
139
|
+
|
|
140
|
+
// Wait for all files being deleted in the background to finish or for
|
|
125
141
|
// destructor to be called.
|
|
126
142
|
virtual void WaitForEmptyTrash();
|
|
127
143
|
|
|
144
|
+
// Creates a new trash bucket. A legitimate bucket is only created and
|
|
145
|
+
// returned when slow deletion is enabled.
|
|
146
|
+
// For each bucket that is created and used, the user should also call
|
|
147
|
+
// `WaitForEmptyTrashBucket` after scheduling file deletions to make sure all
|
|
148
|
+
// the trash files are cleared.
|
|
149
|
+
std::optional<int32_t> NewTrashBucket();
|
|
150
|
+
|
|
151
|
+
// Wait for all the files in the specified bucket to be deleted in the
|
|
152
|
+
// background or for destructor to be called.
|
|
153
|
+
virtual void WaitForEmptyTrashBucket(int32_t bucket);
|
|
154
|
+
|
|
128
155
|
DeleteScheduler* delete_scheduler() { return &delete_scheduler_; }
|
|
129
156
|
|
|
130
157
|
// Stop the error recovery background thread. This should be called only
|
|
@@ -64,7 +64,7 @@ IOStatus WritableFileWriter::Create(const std::shared_ptr<FileSystem>& fs,
|
|
|
64
64
|
IOStatus WritableFileWriter::Append(const IOOptions& opts, const Slice& data,
|
|
65
65
|
uint32_t crc32c_checksum) {
|
|
66
66
|
if (seen_error()) {
|
|
67
|
-
return
|
|
67
|
+
return GetWriterHasPreviousErrorStatus();
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
StopWatch sw(clock_, stats_, hist_type_,
|
|
@@ -109,7 +109,7 @@ IOStatus WritableFileWriter::Append(const IOOptions& opts, const Slice& data,
|
|
|
109
109
|
if (buf_.CurrentSize() > 0) {
|
|
110
110
|
s = Flush(io_options);
|
|
111
111
|
if (!s.ok()) {
|
|
112
|
-
set_seen_error();
|
|
112
|
+
set_seen_error(s);
|
|
113
113
|
return s;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -191,7 +191,7 @@ IOStatus WritableFileWriter::Append(const IOOptions& opts, const Slice& data,
|
|
|
191
191
|
uint64_t cur_size = filesize_.load(std::memory_order_acquire);
|
|
192
192
|
filesize_.store(cur_size + data.size(), std::memory_order_release);
|
|
193
193
|
} else {
|
|
194
|
-
set_seen_error();
|
|
194
|
+
set_seen_error(s);
|
|
195
195
|
}
|
|
196
196
|
return s;
|
|
197
197
|
}
|
|
@@ -199,13 +199,12 @@ IOStatus WritableFileWriter::Append(const IOOptions& opts, const Slice& data,
|
|
|
199
199
|
IOStatus WritableFileWriter::Pad(const IOOptions& opts,
|
|
200
200
|
const size_t pad_bytes) {
|
|
201
201
|
if (seen_error()) {
|
|
202
|
-
return
|
|
202
|
+
return GetWriterHasPreviousErrorStatus();
|
|
203
203
|
}
|
|
204
204
|
const IOOptions io_options = FinalizeIOOptions(opts);
|
|
205
205
|
assert(pad_bytes < kDefaultPageSize);
|
|
206
206
|
size_t left = pad_bytes;
|
|
207
207
|
size_t cap = buf_.Capacity() - buf_.CurrentSize();
|
|
208
|
-
size_t pad_start = buf_.CurrentSize();
|
|
209
208
|
|
|
210
209
|
// Assume pad_bytes is small compared to buf_ capacity. So we always
|
|
211
210
|
// use buf_ rather than write directly to file in certain cases like
|
|
@@ -214,10 +213,20 @@ IOStatus WritableFileWriter::Pad(const IOOptions& opts,
|
|
|
214
213
|
size_t append_bytes = std::min(cap, left);
|
|
215
214
|
buf_.PadWith(append_bytes, 0);
|
|
216
215
|
left -= append_bytes;
|
|
216
|
+
|
|
217
|
+
Slice data(buf_.BufferStart() + buf_.CurrentSize() - append_bytes,
|
|
218
|
+
append_bytes);
|
|
219
|
+
UpdateFileChecksum(data);
|
|
220
|
+
if (perform_data_verification_) {
|
|
221
|
+
buffered_data_crc32c_checksum_ = crc32c::Extend(
|
|
222
|
+
buffered_data_crc32c_checksum_,
|
|
223
|
+
buf_.BufferStart() + buf_.CurrentSize() - append_bytes, append_bytes);
|
|
224
|
+
}
|
|
225
|
+
|
|
217
226
|
if (left > 0) {
|
|
218
227
|
IOStatus s = Flush(io_options);
|
|
219
228
|
if (!s.ok()) {
|
|
220
|
-
set_seen_error();
|
|
229
|
+
set_seen_error(s);
|
|
221
230
|
return s;
|
|
222
231
|
}
|
|
223
232
|
}
|
|
@@ -226,11 +235,7 @@ IOStatus WritableFileWriter::Pad(const IOOptions& opts,
|
|
|
226
235
|
pending_sync_ = true;
|
|
227
236
|
uint64_t cur_size = filesize_.load(std::memory_order_acquire);
|
|
228
237
|
filesize_.store(cur_size + pad_bytes, std::memory_order_release);
|
|
229
|
-
|
|
230
|
-
buffered_data_crc32c_checksum_ =
|
|
231
|
-
crc32c::Extend(buffered_data_crc32c_checksum_,
|
|
232
|
-
buf_.BufferStart() + pad_start, pad_bytes);
|
|
233
|
-
}
|
|
238
|
+
|
|
234
239
|
return IOStatus::OK();
|
|
235
240
|
}
|
|
236
241
|
|
|
@@ -333,7 +338,7 @@ IOStatus WritableFileWriter::Close(const IOOptions& opts) {
|
|
|
333
338
|
checksum_finalized_ = true;
|
|
334
339
|
}
|
|
335
340
|
} else {
|
|
336
|
-
set_seen_error();
|
|
341
|
+
set_seen_error(s);
|
|
337
342
|
}
|
|
338
343
|
|
|
339
344
|
return s;
|
|
@@ -343,7 +348,7 @@ IOStatus WritableFileWriter::Close(const IOOptions& opts) {
|
|
|
343
348
|
// enabled
|
|
344
349
|
IOStatus WritableFileWriter::Flush(const IOOptions& opts) {
|
|
345
350
|
if (seen_error()) {
|
|
346
|
-
return
|
|
351
|
+
return GetWriterHasPreviousErrorStatus();
|
|
347
352
|
}
|
|
348
353
|
|
|
349
354
|
const IOOptions io_options = FinalizeIOOptions(opts);
|
|
@@ -369,7 +374,7 @@ IOStatus WritableFileWriter::Flush(const IOOptions& opts) {
|
|
|
369
374
|
}
|
|
370
375
|
}
|
|
371
376
|
if (!s.ok()) {
|
|
372
|
-
set_seen_error();
|
|
377
|
+
set_seen_error(s);
|
|
373
378
|
return s;
|
|
374
379
|
}
|
|
375
380
|
}
|
|
@@ -390,7 +395,7 @@ IOStatus WritableFileWriter::Flush(const IOOptions& opts) {
|
|
|
390
395
|
}
|
|
391
396
|
|
|
392
397
|
if (!s.ok()) {
|
|
393
|
-
set_seen_error();
|
|
398
|
+
set_seen_error(s);
|
|
394
399
|
return s;
|
|
395
400
|
}
|
|
396
401
|
|
|
@@ -419,7 +424,7 @@ IOStatus WritableFileWriter::Flush(const IOOptions& opts) {
|
|
|
419
424
|
s = RangeSync(io_options, last_sync_size_,
|
|
420
425
|
offset_sync_to - last_sync_size_);
|
|
421
426
|
if (!s.ok()) {
|
|
422
|
-
set_seen_error();
|
|
427
|
+
set_seen_error(s);
|
|
423
428
|
}
|
|
424
429
|
last_sync_size_ = offset_sync_to;
|
|
425
430
|
}
|
|
@@ -453,20 +458,20 @@ IOStatus WritableFileWriter::PrepareIOOptions(const WriteOptions& wo,
|
|
|
453
458
|
|
|
454
459
|
IOStatus WritableFileWriter::Sync(const IOOptions& opts, bool use_fsync) {
|
|
455
460
|
if (seen_error()) {
|
|
456
|
-
return
|
|
461
|
+
return GetWriterHasPreviousErrorStatus();
|
|
457
462
|
}
|
|
458
463
|
|
|
459
464
|
IOOptions io_options = FinalizeIOOptions(opts);
|
|
460
465
|
IOStatus s = Flush(io_options);
|
|
461
466
|
if (!s.ok()) {
|
|
462
|
-
set_seen_error();
|
|
467
|
+
set_seen_error(s);
|
|
463
468
|
return s;
|
|
464
469
|
}
|
|
465
470
|
TEST_KILL_RANDOM("WritableFileWriter::Sync:0");
|
|
466
471
|
if (!use_direct_io() && pending_sync_) {
|
|
467
472
|
s = SyncInternal(io_options, use_fsync);
|
|
468
473
|
if (!s.ok()) {
|
|
469
|
-
set_seen_error();
|
|
474
|
+
set_seen_error(s);
|
|
470
475
|
return s;
|
|
471
476
|
}
|
|
472
477
|
}
|
|
@@ -478,7 +483,7 @@ IOStatus WritableFileWriter::Sync(const IOOptions& opts, bool use_fsync) {
|
|
|
478
483
|
IOStatus WritableFileWriter::SyncWithoutFlush(const IOOptions& opts,
|
|
479
484
|
bool use_fsync) {
|
|
480
485
|
if (seen_error()) {
|
|
481
|
-
return
|
|
486
|
+
return GetWriterHasPreviousErrorStatus();
|
|
482
487
|
}
|
|
483
488
|
IOOptions io_options = FinalizeIOOptions(opts);
|
|
484
489
|
if (!writable_file_->IsSyncThreadSafe()) {
|
|
@@ -490,10 +495,7 @@ IOStatus WritableFileWriter::SyncWithoutFlush(const IOOptions& opts,
|
|
|
490
495
|
IOStatus s = SyncInternal(io_options, use_fsync);
|
|
491
496
|
TEST_SYNC_POINT("WritableFileWriter::SyncWithoutFlush:2");
|
|
492
497
|
if (!s.ok()) {
|
|
493
|
-
|
|
494
|
-
sync_without_flush_called_ = true;
|
|
495
|
-
#endif // NDEBUG
|
|
496
|
-
set_seen_error();
|
|
498
|
+
set_seen_error(s);
|
|
497
499
|
}
|
|
498
500
|
return s;
|
|
499
501
|
}
|
|
@@ -531,14 +533,14 @@ IOStatus WritableFileWriter::SyncInternal(const IOOptions& opts,
|
|
|
531
533
|
}
|
|
532
534
|
SetPerfLevel(prev_perf_level);
|
|
533
535
|
|
|
534
|
-
// The caller will be responsible to call set_seen_error() if s is not OK.
|
|
536
|
+
// The caller will be responsible to call set_seen_error(s) if s is not OK.
|
|
535
537
|
return s;
|
|
536
538
|
}
|
|
537
539
|
|
|
538
540
|
IOStatus WritableFileWriter::RangeSync(const IOOptions& opts, uint64_t offset,
|
|
539
541
|
uint64_t nbytes) {
|
|
540
542
|
if (seen_error()) {
|
|
541
|
-
return
|
|
543
|
+
return GetWriterHasPreviousErrorStatus();
|
|
542
544
|
}
|
|
543
545
|
|
|
544
546
|
IOSTATS_TIMER_GUARD(range_sync_nanos);
|
|
@@ -549,7 +551,7 @@ IOStatus WritableFileWriter::RangeSync(const IOOptions& opts, uint64_t offset,
|
|
|
549
551
|
}
|
|
550
552
|
IOStatus s = writable_file_->RangeSync(offset, nbytes, opts, nullptr);
|
|
551
553
|
if (!s.ok()) {
|
|
552
|
-
set_seen_error();
|
|
554
|
+
set_seen_error(s);
|
|
553
555
|
}
|
|
554
556
|
if (ShouldNotifyListeners()) {
|
|
555
557
|
auto finish_ts = std::chrono::steady_clock::now();
|
|
@@ -567,7 +569,7 @@ IOStatus WritableFileWriter::RangeSync(const IOOptions& opts, uint64_t offset,
|
|
|
567
569
|
IOStatus WritableFileWriter::WriteBuffered(const IOOptions& opts,
|
|
568
570
|
const char* data, size_t size) {
|
|
569
571
|
if (seen_error()) {
|
|
570
|
-
return
|
|
572
|
+
return GetWriterHasPreviousErrorStatus();
|
|
571
573
|
}
|
|
572
574
|
|
|
573
575
|
IOStatus s;
|
|
@@ -633,7 +635,7 @@ IOStatus WritableFileWriter::WriteBuffered(const IOOptions& opts,
|
|
|
633
635
|
}
|
|
634
636
|
}
|
|
635
637
|
if (!s.ok()) {
|
|
636
|
-
set_seen_error();
|
|
638
|
+
set_seen_error(s);
|
|
637
639
|
return s;
|
|
638
640
|
}
|
|
639
641
|
}
|
|
@@ -649,7 +651,7 @@ IOStatus WritableFileWriter::WriteBuffered(const IOOptions& opts,
|
|
|
649
651
|
buf_.Size(0);
|
|
650
652
|
buffered_data_crc32c_checksum_ = 0;
|
|
651
653
|
if (!s.ok()) {
|
|
652
|
-
set_seen_error();
|
|
654
|
+
set_seen_error(s);
|
|
653
655
|
}
|
|
654
656
|
return s;
|
|
655
657
|
}
|
|
@@ -658,7 +660,7 @@ IOStatus WritableFileWriter::WriteBufferedWithChecksum(const IOOptions& opts,
|
|
|
658
660
|
const char* data,
|
|
659
661
|
size_t size) {
|
|
660
662
|
if (seen_error()) {
|
|
661
|
-
return
|
|
663
|
+
return GetWriterHasPreviousErrorStatus();
|
|
662
664
|
}
|
|
663
665
|
|
|
664
666
|
IOStatus s;
|
|
@@ -724,7 +726,7 @@ IOStatus WritableFileWriter::WriteBufferedWithChecksum(const IOOptions& opts,
|
|
|
724
726
|
// and let caller determine error handling.
|
|
725
727
|
buf_.Size(0);
|
|
726
728
|
buffered_data_crc32c_checksum_ = 0;
|
|
727
|
-
set_seen_error();
|
|
729
|
+
set_seen_error(s);
|
|
728
730
|
return s;
|
|
729
731
|
}
|
|
730
732
|
}
|
|
@@ -739,7 +741,7 @@ IOStatus WritableFileWriter::WriteBufferedWithChecksum(const IOOptions& opts,
|
|
|
739
741
|
uint64_t cur_size = flushed_size_.load(std::memory_order_acquire);
|
|
740
742
|
flushed_size_.store(cur_size + left, std::memory_order_release);
|
|
741
743
|
if (!s.ok()) {
|
|
742
|
-
set_seen_error();
|
|
744
|
+
set_seen_error(s);
|
|
743
745
|
}
|
|
744
746
|
return s;
|
|
745
747
|
}
|
|
@@ -840,7 +842,7 @@ IOStatus WritableFileWriter::WriteDirect(const IOOptions& opts) {
|
|
|
840
842
|
}
|
|
841
843
|
if (!s.ok()) {
|
|
842
844
|
buf_.Size(file_advance + leftover_tail);
|
|
843
|
-
set_seen_error();
|
|
845
|
+
set_seen_error(s);
|
|
844
846
|
return s;
|
|
845
847
|
}
|
|
846
848
|
}
|
|
@@ -865,14 +867,14 @@ IOStatus WritableFileWriter::WriteDirect(const IOOptions& opts) {
|
|
|
865
867
|
// behind
|
|
866
868
|
next_write_offset_ += file_advance;
|
|
867
869
|
} else {
|
|
868
|
-
set_seen_error();
|
|
870
|
+
set_seen_error(s);
|
|
869
871
|
}
|
|
870
872
|
return s;
|
|
871
873
|
}
|
|
872
874
|
|
|
873
875
|
IOStatus WritableFileWriter::WriteDirectWithChecksum(const IOOptions& opts) {
|
|
874
876
|
if (seen_error()) {
|
|
875
|
-
return
|
|
877
|
+
return GetWriterHasPreviousErrorStatus();
|
|
876
878
|
}
|
|
877
879
|
|
|
878
880
|
assert(use_direct_io());
|
|
@@ -948,7 +950,7 @@ IOStatus WritableFileWriter::WriteDirectWithChecksum(const IOOptions& opts) {
|
|
|
948
950
|
buf_.Size(file_advance + leftover_tail);
|
|
949
951
|
buffered_data_crc32c_checksum_ =
|
|
950
952
|
crc32c::Value(buf_.BufferStart(), buf_.CurrentSize());
|
|
951
|
-
set_seen_error();
|
|
953
|
+
set_seen_error(s);
|
|
952
954
|
return s;
|
|
953
955
|
}
|
|
954
956
|
}
|
|
@@ -973,7 +975,7 @@ IOStatus WritableFileWriter::WriteDirectWithChecksum(const IOOptions& opts) {
|
|
|
973
975
|
// behind
|
|
974
976
|
next_write_offset_ += file_advance;
|
|
975
977
|
} else {
|
|
976
|
-
set_seen_error();
|
|
978
|
+
set_seen_error(s);
|
|
977
979
|
}
|
|
978
980
|
return s;
|
|
979
981
|
}
|
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
#include "rocksdb/rate_limiter.h"
|
|
23
23
|
#include "test_util/sync_point.h"
|
|
24
24
|
#include "util/aligned_buffer.h"
|
|
25
|
+
#ifndef NDEBUG
|
|
26
|
+
#include "utilities/fault_injection_fs.h"
|
|
27
|
+
#endif // NDEBUG
|
|
25
28
|
|
|
26
29
|
namespace ROCKSDB_NAMESPACE {
|
|
27
30
|
class Statistics;
|
|
@@ -150,11 +153,7 @@ class WritableFileWriter {
|
|
|
150
153
|
bool pending_sync_;
|
|
151
154
|
std::atomic<bool> seen_error_;
|
|
152
155
|
#ifndef NDEBUG
|
|
153
|
-
|
|
154
|
-
// concurrently with other function. One of the concurrent call
|
|
155
|
-
// could set seen_error_, and the other one would hit assertion
|
|
156
|
-
// in debug mode.
|
|
157
|
-
std::atomic<bool> sync_without_flush_called_ = false;
|
|
156
|
+
std::atomic<bool> seen_injected_error_;
|
|
158
157
|
#endif // NDEBUG
|
|
159
158
|
uint64_t last_sync_size_;
|
|
160
159
|
uint64_t bytes_per_sync_;
|
|
@@ -190,6 +189,9 @@ class WritableFileWriter {
|
|
|
190
189
|
next_write_offset_(0),
|
|
191
190
|
pending_sync_(false),
|
|
192
191
|
seen_error_(false),
|
|
192
|
+
#ifndef NDEBUG
|
|
193
|
+
seen_injected_error_(false),
|
|
194
|
+
#endif // NDEBUG
|
|
193
195
|
last_sync_size_(0),
|
|
194
196
|
bytes_per_sync_(options.bytes_per_sync),
|
|
195
197
|
rate_limiter_(options.rate_limiter),
|
|
@@ -234,13 +236,17 @@ class WritableFileWriter {
|
|
|
234
236
|
WritableFileWriter& operator=(const WritableFileWriter&) = delete;
|
|
235
237
|
|
|
236
238
|
~WritableFileWriter() {
|
|
237
|
-
|
|
239
|
+
IOOptions io_options;
|
|
240
|
+
#ifndef NDEBUG
|
|
241
|
+
// This is needed to pass the IOActivity related checks in stress test.
|
|
242
|
+
// See DbStressWritableFileWrapper.
|
|
243
|
+
ThreadStatus::OperationType op_type =
|
|
238
244
|
ThreadStatusUtil::GetThreadOperation();
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
245
|
+
io_options.io_activity =
|
|
246
|
+
ThreadStatusUtil::TEST_GetExpectedIOActivity(op_type);
|
|
247
|
+
#endif
|
|
248
|
+
auto s = Close(io_options);
|
|
242
249
|
s.PermitUncheckedError();
|
|
243
|
-
ThreadStatusUtil::SetThreadOperation(cur_op_type);
|
|
244
250
|
}
|
|
245
251
|
|
|
246
252
|
std::string file_name() const { return file_name_; }
|
|
@@ -263,6 +269,8 @@ class WritableFileWriter {
|
|
|
263
269
|
// returns NotSupported status.
|
|
264
270
|
IOStatus SyncWithoutFlush(const IOOptions& opts, bool use_fsync);
|
|
265
271
|
|
|
272
|
+
// Size including unflushed data written to this writer. If the next op is
|
|
273
|
+
// a successful Close, the file size will be this.
|
|
266
274
|
uint64_t GetFileSize() const {
|
|
267
275
|
return filesize_.load(std::memory_order_acquire);
|
|
268
276
|
}
|
|
@@ -283,7 +291,9 @@ class WritableFileWriter {
|
|
|
283
291
|
|
|
284
292
|
bool use_direct_io() { return writable_file_->use_direct_io(); }
|
|
285
293
|
|
|
286
|
-
bool BufferIsEmpty() { return buf_.CurrentSize() == 0; }
|
|
294
|
+
bool BufferIsEmpty() const { return buf_.CurrentSize() == 0; }
|
|
295
|
+
|
|
296
|
+
bool IsClosed() const { return writable_file_.get() == nullptr; }
|
|
287
297
|
|
|
288
298
|
void TEST_SetFileChecksumGenerator(
|
|
289
299
|
FileChecksumGenerator* checksum_generator) {
|
|
@@ -301,12 +311,35 @@ class WritableFileWriter {
|
|
|
301
311
|
// operating on the file after an error happens.
|
|
302
312
|
void reset_seen_error() {
|
|
303
313
|
seen_error_.store(false, std::memory_order_relaxed);
|
|
314
|
+
#ifndef NDEBUG
|
|
315
|
+
seen_injected_error_.store(false, std::memory_order_relaxed);
|
|
316
|
+
#endif // NDEBUG
|
|
317
|
+
}
|
|
318
|
+
void set_seen_error(const Status& s) {
|
|
319
|
+
seen_error_.store(true, std::memory_order_relaxed);
|
|
320
|
+
(void)s;
|
|
321
|
+
#ifndef NDEBUG
|
|
322
|
+
if (s.getState() && std::strstr(s.getState(), "inject")) {
|
|
323
|
+
seen_injected_error_.store(true, std::memory_order_relaxed);
|
|
324
|
+
}
|
|
325
|
+
#endif // NDEBUG
|
|
326
|
+
}
|
|
327
|
+
#ifndef NDEBUG
|
|
328
|
+
bool seen_injected_error() const {
|
|
329
|
+
return seen_injected_error_.load(std::memory_order_relaxed);
|
|
304
330
|
}
|
|
305
|
-
|
|
331
|
+
#endif // NDEBUG
|
|
306
332
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
333
|
+
// TODO(hx235): store the actual previous error status and return it here
|
|
334
|
+
IOStatus GetWriterHasPreviousErrorStatus() {
|
|
335
|
+
#ifndef NDEBUG
|
|
336
|
+
if (seen_injected_error_.load(std::memory_order_relaxed)) {
|
|
337
|
+
std::stringstream msg;
|
|
338
|
+
msg << "Writer has previous " << FaultInjectionTestFS::kInjected
|
|
339
|
+
<< " error.";
|
|
340
|
+
return IOStatus::IOError(msg.str());
|
|
341
|
+
}
|
|
342
|
+
#endif // NDEBUG
|
|
310
343
|
return IOStatus::IOError("Writer has previous error.");
|
|
311
344
|
}
|
|
312
345
|
|
|
@@ -229,11 +229,18 @@ struct AdvancedColumnFamilyOptions {
|
|
|
229
229
|
// if it is not explicitly set by the user. Otherwise, the default is 0.
|
|
230
230
|
int64_t max_write_buffer_size_to_maintain = 0;
|
|
231
231
|
|
|
232
|
-
// Allows thread-safe inplace updates.
|
|
232
|
+
// Allows thread-safe inplace updates.
|
|
233
|
+
//
|
|
234
|
+
// If this is true, there is no way to
|
|
233
235
|
// achieve point-in-time consistency using snapshot or iterator (assuming
|
|
234
236
|
// concurrent updates). Hence iterator and multi-get will return results
|
|
235
237
|
// which are not consistent as of any point-in-time.
|
|
238
|
+
//
|
|
236
239
|
// Backward iteration on memtables will not work either.
|
|
240
|
+
//
|
|
241
|
+
// It is intended to work or be compatible with a limited set of features:
|
|
242
|
+
// (1) Non-snapshot Get()
|
|
243
|
+
//
|
|
237
244
|
// If inplace_callback function is not set,
|
|
238
245
|
// Put(key, new_value) will update inplace the existing_value iff
|
|
239
246
|
// * key exists in current memtable
|
|
@@ -1030,8 +1037,10 @@ struct AdvancedColumnFamilyOptions {
|
|
|
1030
1037
|
// When setting this flag to `false`, users should also call
|
|
1031
1038
|
// `DB::IncreaseFullHistoryTsLow` to set a cutoff timestamp for flush. RocksDB
|
|
1032
1039
|
// refrains from flushing a memtable with data still above
|
|
1033
|
-
// the cutoff timestamp with best effort.
|
|
1034
|
-
//
|
|
1040
|
+
// the cutoff timestamp with best effort. One limitation of this best effort
|
|
1041
|
+
// is that when `max_write_buffer_number` is equal to or smaller than 2,
|
|
1042
|
+
// RocksDB will not attempt to retain user-defined timestamps, all flush jobs
|
|
1043
|
+
// continue normally.
|
|
1035
1044
|
//
|
|
1036
1045
|
// Users can do user-defined
|
|
1037
1046
|
// multi-versioned read above the cutoff timestamp. When users try to read
|