@nxtedition/rocksdb 10.1.5 → 10.1.6
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.cc +5 -7
- package/deps/rocksdb/rocksdb/CMakeLists.txt +16 -5
- package/deps/rocksdb/rocksdb/Makefile +38 -15
- package/deps/rocksdb/rocksdb/TARGETS +10 -0
- package/deps/rocksdb/rocksdb/cache/cache_test.cc +58 -0
- package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.cc +4 -4
- package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.h +4 -2
- package/deps/rocksdb/rocksdb/db/builder.cc +2 -2
- package/deps/rocksdb/rocksdb/db/builder.h +1 -1
- package/deps/rocksdb/rocksdb/db/c.cc +205 -6
- package/deps/rocksdb/rocksdb/db/c_test.c +189 -1
- package/deps/rocksdb/rocksdb/db/column_family.cc +28 -0
- package/deps/rocksdb/rocksdb/db/column_family.h +17 -0
- package/deps/rocksdb/rocksdb/db/column_family_test.cc +234 -60
- package/deps/rocksdb/rocksdb/db/compaction/compaction.cc +8 -1
- package/deps/rocksdb/rocksdb/db/compaction/compaction.h +11 -9
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.cc +4 -4
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.h +2 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator_test.cc +1 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +22 -25
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +2 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +112 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.cc +72 -21
- package/deps/rocksdb/rocksdb/db/compaction/compaction_service_job.cc +2 -0
- package/deps/rocksdb/rocksdb/db/compaction/tiered_compaction_test.cc +77 -0
- package/deps/rocksdb/rocksdb/db/convenience.cc +3 -0
- package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +269 -112
- package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +107 -43
- package/deps/rocksdb/rocksdb/db/db_filesnapshot.cc +93 -24
- package/deps/rocksdb/rocksdb/db/db_flush_test.cc +5 -5
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +157 -68
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +56 -15
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +78 -105
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +39 -9
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_follower.cc +1 -0
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +21 -14
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +107 -63
- package/deps/rocksdb/rocksdb/db/db_properties_test.cc +43 -2
- package/deps/rocksdb/rocksdb/db/db_range_del_test.cc +4 -0
- package/deps/rocksdb/rocksdb/db/db_rate_limiter_test.cc +6 -0
- package/deps/rocksdb/rocksdb/db/db_test.cc +10 -2
- package/deps/rocksdb/rocksdb/db/db_test2.cc +1 -1
- package/deps/rocksdb/rocksdb/db/db_test_util.cc +5 -0
- package/deps/rocksdb/rocksdb/db/db_test_util.h +7 -6
- package/deps/rocksdb/rocksdb/db/db_wal_test.cc +92 -2
- package/deps/rocksdb/rocksdb/db/error_handler.cc +34 -39
- package/deps/rocksdb/rocksdb/db/error_handler.h +3 -4
- package/deps/rocksdb/rocksdb/db/error_handler_fs_test.cc +8 -4
- package/deps/rocksdb/rocksdb/db/event_helpers.cc +6 -3
- package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc +71 -15
- package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.h +11 -0
- package/deps/rocksdb/rocksdb/db/external_sst_file_test.cc +383 -4
- package/deps/rocksdb/rocksdb/db/fault_injection_test.cc +88 -72
- package/deps/rocksdb/rocksdb/db/flush_job.cc +30 -3
- package/deps/rocksdb/rocksdb/db/flush_job.h +14 -0
- package/deps/rocksdb/rocksdb/db/internal_stats.cc +60 -1
- package/deps/rocksdb/rocksdb/db/internal_stats.h +20 -1
- package/deps/rocksdb/rocksdb/db/log_writer.cc +24 -0
- package/deps/rocksdb/rocksdb/db/log_writer.h +5 -0
- package/deps/rocksdb/rocksdb/db/memtable.cc +6 -4
- package/deps/rocksdb/rocksdb/db/memtable.h +10 -10
- package/deps/rocksdb/rocksdb/db/memtable_list.cc +4 -4
- package/deps/rocksdb/rocksdb/db/multi_cf_iterator_impl.h +10 -3
- package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.h +8 -10
- package/deps/rocksdb/rocksdb/db/repair.cc +4 -3
- package/deps/rocksdb/rocksdb/db/seqno_to_time_mapping.cc +30 -0
- package/deps/rocksdb/rocksdb/db/seqno_to_time_mapping.h +9 -0
- package/deps/rocksdb/rocksdb/db/table_cache.cc +17 -2
- package/deps/rocksdb/rocksdb/db/table_cache.h +9 -1
- package/deps/rocksdb/rocksdb/db/table_properties_collector.h +9 -2
- package/deps/rocksdb/rocksdb/db/table_properties_collector_test.cc +3 -1
- package/deps/rocksdb/rocksdb/db/transaction_log_impl.cc +3 -3
- package/deps/rocksdb/rocksdb/db/transaction_log_impl.h +7 -7
- package/deps/rocksdb/rocksdb/db/version_edit.cc +0 -1
- package/deps/rocksdb/rocksdb/db/version_edit_handler.h +7 -6
- package/deps/rocksdb/rocksdb/db/version_set.cc +54 -31
- package/deps/rocksdb/rocksdb/db/version_set.h +14 -7
- package/deps/rocksdb/rocksdb/db/wal_manager.cc +37 -29
- package/deps/rocksdb/rocksdb/db/wal_manager.h +6 -5
- package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper.cc +6 -0
- package/deps/rocksdb/rocksdb/db/write_batch.cc +54 -23
- package/deps/rocksdb/rocksdb/db/write_callback_test.cc +46 -5
- package/deps/rocksdb/rocksdb/db/write_thread.cc +53 -5
- package/deps/rocksdb/rocksdb/db/write_thread.h +36 -4
- package/deps/rocksdb/rocksdb/db_stress_tool/CMakeLists.txt +1 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/batched_ops_stress.cc +5 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/cf_consistency_stress.cc +57 -17
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.cc +11 -3
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +8 -4
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.cc +10 -25
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_env_wrapper.h +25 -88
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_filters.cc +93 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_filters.h +16 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +43 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_listener.h +109 -21
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_shared_state.h +8 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +666 -205
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.h +55 -10
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +18 -16
- package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.cc +19 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.h +5 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +782 -494
- package/deps/rocksdb/rocksdb/env/composite_env_wrapper.h +21 -0
- package/deps/rocksdb/rocksdb/env/env.cc +6 -0
- package/deps/rocksdb/rocksdb/env/io_posix.cc +0 -1
- package/deps/rocksdb/rocksdb/file/file_util.cc +8 -2
- package/deps/rocksdb/rocksdb/file/prefetch_test.cc +34 -19
- package/deps/rocksdb/rocksdb/file/writable_file_writer.cc +29 -32
- package/deps/rocksdb/rocksdb/file/writable_file_writer.h +41 -15
- package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +4 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/c.h +63 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/db.h +16 -5
- package/deps/rocksdb/rocksdb/include/rocksdb/env.h +5 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/iterator.h +0 -16
- package/deps/rocksdb/rocksdb/include/rocksdb/iterator_base.h +16 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/listener.h +21 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/options.h +76 -3
- package/deps/rocksdb/rocksdb/include/rocksdb/table_properties.h +17 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/transaction_log.h +12 -6
- package/deps/rocksdb/rocksdb/include/rocksdb/universal_compaction.h +31 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/user_write_callback.h +29 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/checkpoint.h +4 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/customizable_util.h +0 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/ldb_cmd.h +17 -8
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/stackable_db.h +2 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/table_properties_collectors.h +46 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction.h +7 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/version.h +2 -2
- package/deps/rocksdb/rocksdb/options/cf_options.cc +13 -2
- package/deps/rocksdb/rocksdb/options/cf_options.h +6 -2
- package/deps/rocksdb/rocksdb/options/db_options.cc +8 -0
- package/deps/rocksdb/rocksdb/options/db_options.h +9 -5
- package/deps/rocksdb/rocksdb/options/options.cc +3 -0
- package/deps/rocksdb/rocksdb/options/options_helper.cc +1 -0
- package/deps/rocksdb/rocksdb/options/options_settable_test.cc +3 -1
- package/deps/rocksdb/rocksdb/port/jemalloc_helper.h +2 -2
- package/deps/rocksdb/rocksdb/port/stack_trace.cc +1 -0
- package/deps/rocksdb/rocksdb/port/win/port_win.cc +3 -2
- package/deps/rocksdb/rocksdb/src.mk +4 -0
- package/deps/rocksdb/rocksdb/table/block_based/binary_search_index_reader.cc +1 -2
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +4 -2
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.cc +15 -0
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +102 -41
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +15 -7
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_impl.h +1 -3
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +5 -6
- package/deps/rocksdb/rocksdb/table/block_based/block_cache.h +31 -0
- package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.cc +6 -0
- package/deps/rocksdb/rocksdb/table/block_based/cachable_entry.h +10 -5
- package/deps/rocksdb/rocksdb/table/block_based/filter_block.h +11 -15
- package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.cc +17 -11
- package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.h +5 -2
- package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.cc +28 -21
- package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.h +9 -11
- package/deps/rocksdb/rocksdb/table/block_based/full_filter_block_test.cc +16 -16
- package/deps/rocksdb/rocksdb/table/block_based/hash_index_reader.cc +1 -2
- package/deps/rocksdb/rocksdb/table/block_based/index_reader_common.cc +14 -9
- package/deps/rocksdb/rocksdb/table/block_based/index_reader_common.h +4 -1
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.cc +82 -41
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.h +13 -14
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block_test.cc +18 -22
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_reader.cc +51 -13
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_reader.h +2 -0
- package/deps/rocksdb/rocksdb/table/block_based/uncompression_dict_reader.cc +3 -11
- package/deps/rocksdb/rocksdb/table/block_based/uncompression_dict_reader.h +2 -3
- package/deps/rocksdb/rocksdb/table/compaction_merging_iterator.cc +9 -10
- package/deps/rocksdb/rocksdb/table/compaction_merging_iterator.h +3 -2
- package/deps/rocksdb/rocksdb/table/format.cc +1 -2
- package/deps/rocksdb/rocksdb/table/merging_iterator.cc +18 -13
- package/deps/rocksdb/rocksdb/table/merging_iterator.h +5 -3
- package/deps/rocksdb/rocksdb/table/plain/plain_table_builder.cc +2 -2
- package/deps/rocksdb/rocksdb/table/sst_file_reader.cc +1 -1
- package/deps/rocksdb/rocksdb/table/sst_file_writer_collectors.h +3 -1
- package/deps/rocksdb/rocksdb/table/table_builder.h +8 -7
- package/deps/rocksdb/rocksdb/table/table_reader.h +9 -0
- package/deps/rocksdb/rocksdb/test_util/testutil.cc +1 -0
- package/deps/rocksdb/rocksdb/test_util/testutil.h +6 -0
- package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +19 -0
- package/deps/rocksdb/rocksdb/tools/ldb_cmd.cc +434 -110
- package/deps/rocksdb/rocksdb/tools/ldb_cmd_impl.h +3 -1
- package/deps/rocksdb/rocksdb/tools/ldb_tool.cc +3 -0
- package/deps/rocksdb/rocksdb/util/aligned_storage.h +24 -0
- package/deps/rocksdb/rocksdb/util/filter_bench.cc +1 -1
- package/deps/rocksdb/rocksdb/util/random.cc +2 -1
- package/deps/rocksdb/rocksdb/util/stderr_logger.h +1 -1
- package/deps/rocksdb/rocksdb/util/udt_util.cc +33 -0
- package/deps/rocksdb/rocksdb/util/udt_util.h +7 -0
- package/deps/rocksdb/rocksdb/util/udt_util_test.cc +33 -0
- package/deps/rocksdb/rocksdb/util/write_batch_util.h +5 -0
- package/deps/rocksdb/rocksdb/util/xxhash.h +10 -3
- package/deps/rocksdb/rocksdb/utilities/backup/backup_engine_test.cc +13 -13
- package/deps/rocksdb/rocksdb/utilities/checkpoint/checkpoint_test.cc +104 -48
- package/deps/rocksdb/rocksdb/utilities/debug.cc +16 -4
- package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.cc +647 -235
- package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.h +274 -157
- package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.cc +144 -0
- package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.h +45 -0
- package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector_test.cc +139 -0
- package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector.cc +12 -0
- package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc +3 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_test.cc +105 -6
- package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.cc +64 -8
- package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.h +5 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.cc +43 -5
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.h +5 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.cc +154 -6
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.h +1 -1
- package/deps/rocksdb/rocksdb/utilities/transactions/write_committed_transaction_ts_test.cc +158 -2
- package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.cc +16 -11
- package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn_db.cc +4 -4
- package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn.cc +9 -8
- package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +2 -1
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +43 -7
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +2 -0
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +1 -1
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@nxtedition+rocksdb.node +0 -0
- package/.tap/test-results/node_modules/abstract-level/test/chained-batch-test.js.tap +0 -0
- package/.tap/test-results/node_modules/abstract-level/test/get-test.js.tap +0 -0
- package/.tap/test-results/test/abstract-level-test.js.tap +0 -1077
- package/.tap/test-results/test/batch-test.js.tap +0 -12
- package/.tap/test-results/test/chained-batch-gc-test.js.tap +0 -11
- package/.tap/test-results/test/cleanup-hanging-iterators-test.js.tap +0 -135
- package/.tap/test-results/test/clear-gc-test.js.tap +0 -13
- package/.tap/test-results/test/column-test.js.tap +0 -55
- package/.tap/test-results/test/common.js.tap +0 -0
- package/.tap/test-results/test/compression-test.js.tap +0 -30
- package/.tap/test-results/test/db-identity.js.tap +0 -12
- package/.tap/test-results/test/electron.js.tap +0 -0
- package/.tap/test-results/test/env-cleanup-hook-test.js.tap +0 -40
- package/.tap/test-results/test/env-cleanup-hook.js.tap +0 -0
- package/.tap/test-results/test/gc.js.tap +0 -0
- package/.tap/test-results/test/getproperty-test.js.tap +0 -29
- package/.tap/test-results/test/iterator-gc-test.js.tap +0 -15
- package/.tap/test-results/test/iterator-hwm-test.js.tap +0 -131
- package/.tap/test-results/test/iterator-recursion-test.js.tap +0 -12
- package/.tap/test-results/test/iterator-starvation-test.js.tap +0 -73
- package/.tap/test-results/test/iterator-test.js.tap +0 -6
- package/.tap/test-results/test/leak-tester-batch.js.tap +0 -0
- package/.tap/test-results/test/leak-tester-iterator.js.tap +0 -0
- package/.tap/test-results/test/leak-tester.js.tap +0 -0
- package/.tap/test-results/test/lock-test.js.tap +0 -18
- package/.tap/test-results/test/lock.js.tap +0 -0
- package/.tap/test-results/test/make.js.tap +0 -0
- package/.tap/test-results/test/max-rev-merge.js.tap +0 -0
- package/.tap/test-results/test/merge-operator-test.js.tap +0 -12
- package/.tap/test-results/test/mkdir-test.js.tap +0 -15
- package/.tap/test-results/test/segfault-test.js.tap +0 -76
- package/.tap/test-results/test/stack-blower.js.tap +0 -0
- package/deps/rocksdb/rocksdb/README.md +0 -29
- package/deps/rocksdb/rocksdb/microbench/README.md +0 -60
- package/deps/rocksdb/rocksdb/plugin/README.md +0 -43
- package/deps/rocksdb/rocksdb/port/README +0 -10
- package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/README +0 -13
|
@@ -18,6 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
namespace ROCKSDB_NAMESPACE {
|
|
20
20
|
|
|
21
|
+
// This class supports abstracting different types of an `Env`'s functionality
|
|
22
|
+
// into separate interfaces. It is constructed with a `FileSystem` and a
|
|
23
|
+
// `SystemClock` and delegates:
|
|
24
|
+
// * File system operations to member `file_system_`.
|
|
25
|
+
// * Time related misc operations to member `clock_`.
|
|
26
|
+
// A subclass needs to inherit `CompositeEnv` and provide implementations for
|
|
27
|
+
// the thread management related APIs.
|
|
21
28
|
class CompositeEnv : public Env {
|
|
22
29
|
public:
|
|
23
30
|
// Initialize a CompositeEnvWrapper that delegates all thread/time related
|
|
@@ -250,6 +257,20 @@ class CompositeEnv : public Env {
|
|
|
250
257
|
}
|
|
251
258
|
};
|
|
252
259
|
|
|
260
|
+
// A `CompositeEnvWrapper` is constructed with a target `Env` object, an
|
|
261
|
+
// optional `FileSystem` object and an optional `SystemClock` object.
|
|
262
|
+
// `Env::GetFileSystem()` is a fallback file system if no such object is
|
|
263
|
+
// explicitly provided. Similarly, `Env::GetSystemClock()` is a fallback system
|
|
264
|
+
// clock.
|
|
265
|
+
// Besides delegating corresponding functionality to `file_system_` and `clock_`
|
|
266
|
+
// which is inherited from `CompositeEnv`, it also implements the thread
|
|
267
|
+
// management APIs by delegating them to the target `Env` object.
|
|
268
|
+
//
|
|
269
|
+
// Effectively, this class helps to support using customized file system
|
|
270
|
+
// implementations such as a remote file system instead of the default file
|
|
271
|
+
// system provided by the operating system.
|
|
272
|
+
//
|
|
273
|
+
// Also see public API `NewCompositeEnv` in rocksdb/include/env.h
|
|
253
274
|
class CompositeEnvWrapper : public CompositeEnv {
|
|
254
275
|
public:
|
|
255
276
|
// Initialize a CompositeEnvWrapper that delegates all thread/time related
|
|
@@ -355,6 +355,12 @@ class LegacyDirectoryWrapper : public FSDirectory {
|
|
|
355
355
|
std::unique_ptr<Directory> target_;
|
|
356
356
|
};
|
|
357
357
|
|
|
358
|
+
// A helper class to make legacy `Env` implementations be backward compatible
|
|
359
|
+
// now that all `Env` implementations are expected to have a `FileSystem` type
|
|
360
|
+
// member `file_system_` and a `SystemClock` type member `clock_`.
|
|
361
|
+
// This class wraps a legacy `Env` object and expose its file system related
|
|
362
|
+
// APIs as a `FileSystem` interface. Also check `LegacySystemClock` that does
|
|
363
|
+
// the same thing for the clock related APIs.
|
|
358
364
|
class LegacyFileSystemWrapper : public FileSystem {
|
|
359
365
|
public:
|
|
360
366
|
// Initialize an EnvWrapper that delegates all calls to *t
|
|
@@ -457,7 +457,6 @@ Status PosixHelper::GetLogicalBlockSizeOfDirectory(const std::string& directory,
|
|
|
457
457
|
size_t* size) {
|
|
458
458
|
int fd = open(directory.c_str(), O_DIRECTORY | O_RDONLY);
|
|
459
459
|
if (fd == -1) {
|
|
460
|
-
close(fd);
|
|
461
460
|
return Status::IOError("Cannot open directory " + directory);
|
|
462
461
|
}
|
|
463
462
|
*size = PosixHelper::GetLogicalBlockSizeOfFd(fd);
|
|
@@ -59,7 +59,10 @@ IOStatus CopyFile(FileSystem* fs, const std::string& source,
|
|
|
59
59
|
return io_s;
|
|
60
60
|
}
|
|
61
61
|
if (slice.size() == 0) {
|
|
62
|
-
return IOStatus::Corruption(
|
|
62
|
+
return IOStatus::Corruption(
|
|
63
|
+
"File smaller than expected for copy: " + source + " expecting " +
|
|
64
|
+
std::to_string(size) + " more bytes after " +
|
|
65
|
+
std::to_string(dest_writer->GetFileSize()));
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
io_s = dest_writer->Append(opts, slice);
|
|
@@ -226,7 +229,10 @@ IOStatus GenerateOneFileChecksum(
|
|
|
226
229
|
io_s.ToString());
|
|
227
230
|
}
|
|
228
231
|
if (slice.size() == 0) {
|
|
229
|
-
return IOStatus::Corruption(
|
|
232
|
+
return IOStatus::Corruption(
|
|
233
|
+
"File smaller than expected for checksum: " + file_path +
|
|
234
|
+
" expecting " + std::to_string(size) + " more bytes after " +
|
|
235
|
+
std::to_string(offset));
|
|
230
236
|
}
|
|
231
237
|
checksum_generator->Update(slice.data(), slice.size());
|
|
232
238
|
size -= slice.size();
|
|
@@ -99,7 +99,10 @@ class PrefetchTest
|
|
|
99
99
|
|
|
100
100
|
virtual void SetGenericOptions(Env* env, bool use_direct_io,
|
|
101
101
|
Options& options) {
|
|
102
|
-
|
|
102
|
+
anon::OptionsOverride options_override;
|
|
103
|
+
// for !disable_io in PrefetchTest.Basic
|
|
104
|
+
options_override.full_block_cache = true;
|
|
105
|
+
options = CurrentOptions(options_override);
|
|
103
106
|
options.write_buffer_size = 1024;
|
|
104
107
|
options.create_if_missing = true;
|
|
105
108
|
options.compression = kNoCompression;
|
|
@@ -254,26 +257,38 @@ TEST_P(PrefetchTest, Basic) {
|
|
|
254
257
|
prev_table_open_prefetch_tail_miss);
|
|
255
258
|
}
|
|
256
259
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
for (bool disable_io : {false, true}) {
|
|
261
|
+
SCOPED_TRACE("disable_io: " + std::to_string(disable_io));
|
|
262
|
+
ReadOptions ro;
|
|
263
|
+
if (disable_io) {
|
|
264
|
+
// When this is set on the second iteration, all blocks should be in
|
|
265
|
+
// block cache
|
|
266
|
+
ro.read_tier = ReadTier::kBlockCacheTier;
|
|
267
|
+
}
|
|
268
|
+
// count the keys
|
|
269
|
+
{
|
|
270
|
+
auto iter = std::unique_ptr<Iterator>(db_->NewIterator(ro));
|
|
271
|
+
int num_keys = 0;
|
|
272
|
+
for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
|
|
273
|
+
num_keys++;
|
|
274
|
+
}
|
|
275
|
+
ASSERT_OK(iter->status());
|
|
276
|
+
ASSERT_EQ(num_keys, kNumKeys);
|
|
263
277
|
}
|
|
264
|
-
ASSERT_OK(iter->status());
|
|
265
|
-
(void)num_keys;
|
|
266
|
-
}
|
|
267
278
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
279
|
+
// To verify prefetch during user scan, when IO allowed
|
|
280
|
+
if (disable_io) {
|
|
281
|
+
ASSERT_FALSE(fs->IsPrefetchCalled());
|
|
282
|
+
ASSERT_EQ(0, buff_prefetch_count);
|
|
283
|
+
} else if (support_prefetch && !use_direct_io) {
|
|
284
|
+
ASSERT_TRUE(fs->IsPrefetchCalled());
|
|
285
|
+
fs->ClearPrefetchCount();
|
|
286
|
+
ASSERT_EQ(0, buff_prefetch_count);
|
|
287
|
+
} else {
|
|
288
|
+
ASSERT_FALSE(fs->IsPrefetchCalled());
|
|
289
|
+
ASSERT_GT(buff_prefetch_count, 0);
|
|
290
|
+
buff_prefetch_count = 0;
|
|
291
|
+
}
|
|
277
292
|
}
|
|
278
293
|
Close();
|
|
279
294
|
}
|
|
@@ -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,7 +199,7 @@ 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);
|
|
@@ -226,7 +226,7 @@ IOStatus WritableFileWriter::Pad(const IOOptions& opts,
|
|
|
226
226
|
if (left > 0) {
|
|
227
227
|
IOStatus s = Flush(io_options);
|
|
228
228
|
if (!s.ok()) {
|
|
229
|
-
set_seen_error();
|
|
229
|
+
set_seen_error(s);
|
|
230
230
|
return s;
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -338,7 +338,7 @@ IOStatus WritableFileWriter::Close(const IOOptions& opts) {
|
|
|
338
338
|
checksum_finalized_ = true;
|
|
339
339
|
}
|
|
340
340
|
} else {
|
|
341
|
-
set_seen_error();
|
|
341
|
+
set_seen_error(s);
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
return s;
|
|
@@ -348,7 +348,7 @@ IOStatus WritableFileWriter::Close(const IOOptions& opts) {
|
|
|
348
348
|
// enabled
|
|
349
349
|
IOStatus WritableFileWriter::Flush(const IOOptions& opts) {
|
|
350
350
|
if (seen_error()) {
|
|
351
|
-
return
|
|
351
|
+
return GetWriterHasPreviousErrorStatus();
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
const IOOptions io_options = FinalizeIOOptions(opts);
|
|
@@ -374,7 +374,7 @@ IOStatus WritableFileWriter::Flush(const IOOptions& opts) {
|
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
if (!s.ok()) {
|
|
377
|
-
set_seen_error();
|
|
377
|
+
set_seen_error(s);
|
|
378
378
|
return s;
|
|
379
379
|
}
|
|
380
380
|
}
|
|
@@ -395,7 +395,7 @@ IOStatus WritableFileWriter::Flush(const IOOptions& opts) {
|
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
if (!s.ok()) {
|
|
398
|
-
set_seen_error();
|
|
398
|
+
set_seen_error(s);
|
|
399
399
|
return s;
|
|
400
400
|
}
|
|
401
401
|
|
|
@@ -424,7 +424,7 @@ IOStatus WritableFileWriter::Flush(const IOOptions& opts) {
|
|
|
424
424
|
s = RangeSync(io_options, last_sync_size_,
|
|
425
425
|
offset_sync_to - last_sync_size_);
|
|
426
426
|
if (!s.ok()) {
|
|
427
|
-
set_seen_error();
|
|
427
|
+
set_seen_error(s);
|
|
428
428
|
}
|
|
429
429
|
last_sync_size_ = offset_sync_to;
|
|
430
430
|
}
|
|
@@ -458,20 +458,20 @@ IOStatus WritableFileWriter::PrepareIOOptions(const WriteOptions& wo,
|
|
|
458
458
|
|
|
459
459
|
IOStatus WritableFileWriter::Sync(const IOOptions& opts, bool use_fsync) {
|
|
460
460
|
if (seen_error()) {
|
|
461
|
-
return
|
|
461
|
+
return GetWriterHasPreviousErrorStatus();
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
IOOptions io_options = FinalizeIOOptions(opts);
|
|
465
465
|
IOStatus s = Flush(io_options);
|
|
466
466
|
if (!s.ok()) {
|
|
467
|
-
set_seen_error();
|
|
467
|
+
set_seen_error(s);
|
|
468
468
|
return s;
|
|
469
469
|
}
|
|
470
470
|
TEST_KILL_RANDOM("WritableFileWriter::Sync:0");
|
|
471
471
|
if (!use_direct_io() && pending_sync_) {
|
|
472
472
|
s = SyncInternal(io_options, use_fsync);
|
|
473
473
|
if (!s.ok()) {
|
|
474
|
-
set_seen_error();
|
|
474
|
+
set_seen_error(s);
|
|
475
475
|
return s;
|
|
476
476
|
}
|
|
477
477
|
}
|
|
@@ -483,7 +483,7 @@ IOStatus WritableFileWriter::Sync(const IOOptions& opts, bool use_fsync) {
|
|
|
483
483
|
IOStatus WritableFileWriter::SyncWithoutFlush(const IOOptions& opts,
|
|
484
484
|
bool use_fsync) {
|
|
485
485
|
if (seen_error()) {
|
|
486
|
-
return
|
|
486
|
+
return GetWriterHasPreviousErrorStatus();
|
|
487
487
|
}
|
|
488
488
|
IOOptions io_options = FinalizeIOOptions(opts);
|
|
489
489
|
if (!writable_file_->IsSyncThreadSafe()) {
|
|
@@ -495,10 +495,7 @@ IOStatus WritableFileWriter::SyncWithoutFlush(const IOOptions& opts,
|
|
|
495
495
|
IOStatus s = SyncInternal(io_options, use_fsync);
|
|
496
496
|
TEST_SYNC_POINT("WritableFileWriter::SyncWithoutFlush:2");
|
|
497
497
|
if (!s.ok()) {
|
|
498
|
-
|
|
499
|
-
sync_without_flush_called_ = true;
|
|
500
|
-
#endif // NDEBUG
|
|
501
|
-
set_seen_error();
|
|
498
|
+
set_seen_error(s);
|
|
502
499
|
}
|
|
503
500
|
return s;
|
|
504
501
|
}
|
|
@@ -536,14 +533,14 @@ IOStatus WritableFileWriter::SyncInternal(const IOOptions& opts,
|
|
|
536
533
|
}
|
|
537
534
|
SetPerfLevel(prev_perf_level);
|
|
538
535
|
|
|
539
|
-
// 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.
|
|
540
537
|
return s;
|
|
541
538
|
}
|
|
542
539
|
|
|
543
540
|
IOStatus WritableFileWriter::RangeSync(const IOOptions& opts, uint64_t offset,
|
|
544
541
|
uint64_t nbytes) {
|
|
545
542
|
if (seen_error()) {
|
|
546
|
-
return
|
|
543
|
+
return GetWriterHasPreviousErrorStatus();
|
|
547
544
|
}
|
|
548
545
|
|
|
549
546
|
IOSTATS_TIMER_GUARD(range_sync_nanos);
|
|
@@ -554,7 +551,7 @@ IOStatus WritableFileWriter::RangeSync(const IOOptions& opts, uint64_t offset,
|
|
|
554
551
|
}
|
|
555
552
|
IOStatus s = writable_file_->RangeSync(offset, nbytes, opts, nullptr);
|
|
556
553
|
if (!s.ok()) {
|
|
557
|
-
set_seen_error();
|
|
554
|
+
set_seen_error(s);
|
|
558
555
|
}
|
|
559
556
|
if (ShouldNotifyListeners()) {
|
|
560
557
|
auto finish_ts = std::chrono::steady_clock::now();
|
|
@@ -572,7 +569,7 @@ IOStatus WritableFileWriter::RangeSync(const IOOptions& opts, uint64_t offset,
|
|
|
572
569
|
IOStatus WritableFileWriter::WriteBuffered(const IOOptions& opts,
|
|
573
570
|
const char* data, size_t size) {
|
|
574
571
|
if (seen_error()) {
|
|
575
|
-
return
|
|
572
|
+
return GetWriterHasPreviousErrorStatus();
|
|
576
573
|
}
|
|
577
574
|
|
|
578
575
|
IOStatus s;
|
|
@@ -638,7 +635,7 @@ IOStatus WritableFileWriter::WriteBuffered(const IOOptions& opts,
|
|
|
638
635
|
}
|
|
639
636
|
}
|
|
640
637
|
if (!s.ok()) {
|
|
641
|
-
set_seen_error();
|
|
638
|
+
set_seen_error(s);
|
|
642
639
|
return s;
|
|
643
640
|
}
|
|
644
641
|
}
|
|
@@ -654,7 +651,7 @@ IOStatus WritableFileWriter::WriteBuffered(const IOOptions& opts,
|
|
|
654
651
|
buf_.Size(0);
|
|
655
652
|
buffered_data_crc32c_checksum_ = 0;
|
|
656
653
|
if (!s.ok()) {
|
|
657
|
-
set_seen_error();
|
|
654
|
+
set_seen_error(s);
|
|
658
655
|
}
|
|
659
656
|
return s;
|
|
660
657
|
}
|
|
@@ -663,7 +660,7 @@ IOStatus WritableFileWriter::WriteBufferedWithChecksum(const IOOptions& opts,
|
|
|
663
660
|
const char* data,
|
|
664
661
|
size_t size) {
|
|
665
662
|
if (seen_error()) {
|
|
666
|
-
return
|
|
663
|
+
return GetWriterHasPreviousErrorStatus();
|
|
667
664
|
}
|
|
668
665
|
|
|
669
666
|
IOStatus s;
|
|
@@ -729,7 +726,7 @@ IOStatus WritableFileWriter::WriteBufferedWithChecksum(const IOOptions& opts,
|
|
|
729
726
|
// and let caller determine error handling.
|
|
730
727
|
buf_.Size(0);
|
|
731
728
|
buffered_data_crc32c_checksum_ = 0;
|
|
732
|
-
set_seen_error();
|
|
729
|
+
set_seen_error(s);
|
|
733
730
|
return s;
|
|
734
731
|
}
|
|
735
732
|
}
|
|
@@ -744,7 +741,7 @@ IOStatus WritableFileWriter::WriteBufferedWithChecksum(const IOOptions& opts,
|
|
|
744
741
|
uint64_t cur_size = flushed_size_.load(std::memory_order_acquire);
|
|
745
742
|
flushed_size_.store(cur_size + left, std::memory_order_release);
|
|
746
743
|
if (!s.ok()) {
|
|
747
|
-
set_seen_error();
|
|
744
|
+
set_seen_error(s);
|
|
748
745
|
}
|
|
749
746
|
return s;
|
|
750
747
|
}
|
|
@@ -845,7 +842,7 @@ IOStatus WritableFileWriter::WriteDirect(const IOOptions& opts) {
|
|
|
845
842
|
}
|
|
846
843
|
if (!s.ok()) {
|
|
847
844
|
buf_.Size(file_advance + leftover_tail);
|
|
848
|
-
set_seen_error();
|
|
845
|
+
set_seen_error(s);
|
|
849
846
|
return s;
|
|
850
847
|
}
|
|
851
848
|
}
|
|
@@ -870,14 +867,14 @@ IOStatus WritableFileWriter::WriteDirect(const IOOptions& opts) {
|
|
|
870
867
|
// behind
|
|
871
868
|
next_write_offset_ += file_advance;
|
|
872
869
|
} else {
|
|
873
|
-
set_seen_error();
|
|
870
|
+
set_seen_error(s);
|
|
874
871
|
}
|
|
875
872
|
return s;
|
|
876
873
|
}
|
|
877
874
|
|
|
878
875
|
IOStatus WritableFileWriter::WriteDirectWithChecksum(const IOOptions& opts) {
|
|
879
876
|
if (seen_error()) {
|
|
880
|
-
return
|
|
877
|
+
return GetWriterHasPreviousErrorStatus();
|
|
881
878
|
}
|
|
882
879
|
|
|
883
880
|
assert(use_direct_io());
|
|
@@ -953,7 +950,7 @@ IOStatus WritableFileWriter::WriteDirectWithChecksum(const IOOptions& opts) {
|
|
|
953
950
|
buf_.Size(file_advance + leftover_tail);
|
|
954
951
|
buffered_data_crc32c_checksum_ =
|
|
955
952
|
crc32c::Value(buf_.BufferStart(), buf_.CurrentSize());
|
|
956
|
-
set_seen_error();
|
|
953
|
+
set_seen_error(s);
|
|
957
954
|
return s;
|
|
958
955
|
}
|
|
959
956
|
}
|
|
@@ -978,7 +975,7 @@ IOStatus WritableFileWriter::WriteDirectWithChecksum(const IOOptions& opts) {
|
|
|
978
975
|
// behind
|
|
979
976
|
next_write_offset_ += file_advance;
|
|
980
977
|
} else {
|
|
981
|
-
set_seen_error();
|
|
978
|
+
set_seen_error(s);
|
|
982
979
|
}
|
|
983
980
|
return s;
|
|
984
981
|
}
|
|
@@ -150,11 +150,7 @@ class WritableFileWriter {
|
|
|
150
150
|
bool pending_sync_;
|
|
151
151
|
std::atomic<bool> seen_error_;
|
|
152
152
|
#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;
|
|
153
|
+
std::atomic<bool> seen_injected_error_;
|
|
158
154
|
#endif // NDEBUG
|
|
159
155
|
uint64_t last_sync_size_;
|
|
160
156
|
uint64_t bytes_per_sync_;
|
|
@@ -190,6 +186,9 @@ class WritableFileWriter {
|
|
|
190
186
|
next_write_offset_(0),
|
|
191
187
|
pending_sync_(false),
|
|
192
188
|
seen_error_(false),
|
|
189
|
+
#ifndef NDEBUG
|
|
190
|
+
seen_injected_error_(false),
|
|
191
|
+
#endif // NDEBUG
|
|
193
192
|
last_sync_size_(0),
|
|
194
193
|
bytes_per_sync_(options.bytes_per_sync),
|
|
195
194
|
rate_limiter_(options.rate_limiter),
|
|
@@ -234,13 +233,17 @@ class WritableFileWriter {
|
|
|
234
233
|
WritableFileWriter& operator=(const WritableFileWriter&) = delete;
|
|
235
234
|
|
|
236
235
|
~WritableFileWriter() {
|
|
237
|
-
|
|
236
|
+
IOOptions io_options;
|
|
237
|
+
#ifndef NDEBUG
|
|
238
|
+
// This is needed to pass the IOActivity related checks in stress test.
|
|
239
|
+
// See DbStressWritableFileWrapper.
|
|
240
|
+
ThreadStatus::OperationType op_type =
|
|
238
241
|
ThreadStatusUtil::GetThreadOperation();
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
+
io_options.io_activity =
|
|
243
|
+
ThreadStatusUtil::TEST_GetExpectedIOActivity(op_type);
|
|
244
|
+
#endif
|
|
245
|
+
auto s = Close(io_options);
|
|
242
246
|
s.PermitUncheckedError();
|
|
243
|
-
ThreadStatusUtil::SetThreadOperation(cur_op_type);
|
|
244
247
|
}
|
|
245
248
|
|
|
246
249
|
std::string file_name() const { return file_name_; }
|
|
@@ -263,6 +266,8 @@ class WritableFileWriter {
|
|
|
263
266
|
// returns NotSupported status.
|
|
264
267
|
IOStatus SyncWithoutFlush(const IOOptions& opts, bool use_fsync);
|
|
265
268
|
|
|
269
|
+
// Size including unflushed data written to this writer. If the next op is
|
|
270
|
+
// a successful Close, the file size will be this.
|
|
266
271
|
uint64_t GetFileSize() const {
|
|
267
272
|
return filesize_.load(std::memory_order_acquire);
|
|
268
273
|
}
|
|
@@ -283,7 +288,9 @@ class WritableFileWriter {
|
|
|
283
288
|
|
|
284
289
|
bool use_direct_io() { return writable_file_->use_direct_io(); }
|
|
285
290
|
|
|
286
|
-
bool BufferIsEmpty() { return buf_.CurrentSize() == 0; }
|
|
291
|
+
bool BufferIsEmpty() const { return buf_.CurrentSize() == 0; }
|
|
292
|
+
|
|
293
|
+
bool IsClosed() const { return writable_file_.get() == nullptr; }
|
|
287
294
|
|
|
288
295
|
void TEST_SetFileChecksumGenerator(
|
|
289
296
|
FileChecksumGenerator* checksum_generator) {
|
|
@@ -301,12 +308,31 @@ class WritableFileWriter {
|
|
|
301
308
|
// operating on the file after an error happens.
|
|
302
309
|
void reset_seen_error() {
|
|
303
310
|
seen_error_.store(false, std::memory_order_relaxed);
|
|
311
|
+
#ifndef NDEBUG
|
|
312
|
+
seen_injected_error_.store(false, std::memory_order_relaxed);
|
|
313
|
+
#endif // NDEBUG
|
|
314
|
+
}
|
|
315
|
+
void set_seen_error(const Status& s) {
|
|
316
|
+
seen_error_.store(true, std::memory_order_relaxed);
|
|
317
|
+
(void)s;
|
|
318
|
+
#ifndef NDEBUG
|
|
319
|
+
if (s.getState() && std::strstr(s.getState(), "inject")) {
|
|
320
|
+
seen_injected_error_.store(true, std::memory_order_relaxed);
|
|
321
|
+
}
|
|
322
|
+
#endif // NDEBUG
|
|
323
|
+
}
|
|
324
|
+
#ifndef NDEBUG
|
|
325
|
+
bool seen_injected_error() const {
|
|
326
|
+
return seen_injected_error_.load(std::memory_order_relaxed);
|
|
304
327
|
}
|
|
305
|
-
|
|
328
|
+
#endif // NDEBUG
|
|
306
329
|
|
|
307
|
-
IOStatus
|
|
308
|
-
|
|
309
|
-
|
|
330
|
+
IOStatus GetWriterHasPreviousErrorStatus() {
|
|
331
|
+
#ifndef NDEBUG
|
|
332
|
+
if (seen_injected_error_.load(std::memory_order_relaxed)) {
|
|
333
|
+
return IOStatus::IOError("Writer has previous injected error.");
|
|
334
|
+
}
|
|
335
|
+
#endif // NDEBUG
|
|
310
336
|
return IOStatus::IOError("Writer has previous error.");
|
|
311
337
|
}
|
|
312
338
|
|
|
@@ -1037,8 +1037,10 @@ struct AdvancedColumnFamilyOptions {
|
|
|
1037
1037
|
// When setting this flag to `false`, users should also call
|
|
1038
1038
|
// `DB::IncreaseFullHistoryTsLow` to set a cutoff timestamp for flush. RocksDB
|
|
1039
1039
|
// refrains from flushing a memtable with data still above
|
|
1040
|
-
// the cutoff timestamp with best effort.
|
|
1041
|
-
//
|
|
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.
|
|
1042
1044
|
//
|
|
1043
1045
|
// Users can do user-defined
|
|
1044
1046
|
// multi-versioned read above the cutoff timestamp. When users try to read
|
|
@@ -434,6 +434,9 @@ rocksdb_create_column_family_with_ttl(
|
|
|
434
434
|
extern ROCKSDB_LIBRARY_API void rocksdb_drop_column_family(
|
|
435
435
|
rocksdb_t* db, rocksdb_column_family_handle_t* handle, char** errptr);
|
|
436
436
|
|
|
437
|
+
extern ROCKSDB_LIBRARY_API rocksdb_column_family_handle_t*
|
|
438
|
+
rocksdb_get_default_column_family_handle(rocksdb_t* db);
|
|
439
|
+
|
|
437
440
|
extern ROCKSDB_LIBRARY_API void rocksdb_column_family_handle_destroy(
|
|
438
441
|
rocksdb_column_family_handle_t*);
|
|
439
442
|
|
|
@@ -502,6 +505,13 @@ extern ROCKSDB_LIBRARY_API char* rocksdb_get_cf_with_ts(
|
|
|
502
505
|
rocksdb_column_family_handle_t* column_family, const char* key,
|
|
503
506
|
size_t keylen, size_t* vallen, char** ts, size_t* tslen, char** errptr);
|
|
504
507
|
|
|
508
|
+
/**
|
|
509
|
+
* Returns a malloc() buffer with the DB identity, assigning the length to
|
|
510
|
+
* *id_len. Returns NULL if an error occurred.
|
|
511
|
+
*/
|
|
512
|
+
extern ROCKSDB_LIBRARY_API char* rocksdb_get_db_identity(rocksdb_t* db,
|
|
513
|
+
size_t* id_len);
|
|
514
|
+
|
|
505
515
|
// if values_list[i] == NULL and errs[i] == NULL,
|
|
506
516
|
// then we got status.IsNotFound(), which we will not return.
|
|
507
517
|
// all errors except status status.ok() and status.IsNotFound() are returned.
|
|
@@ -640,6 +650,19 @@ extern ROCKSDB_LIBRARY_API void rocksdb_approximate_sizes_cf(
|
|
|
640
650
|
const size_t* range_start_key_len, const char* const* range_limit_key,
|
|
641
651
|
const size_t* range_limit_key_len, uint64_t* sizes, char** errptr);
|
|
642
652
|
|
|
653
|
+
enum {
|
|
654
|
+
rocksdb_size_approximation_flags_none = 0,
|
|
655
|
+
rocksdb_size_approximation_flags_include_memtable = 1 << 0,
|
|
656
|
+
rocksdb_size_approximation_flags_include_files = 1 << 1,
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
extern ROCKSDB_LIBRARY_API void rocksdb_approximate_sizes_cf_with_flags(
|
|
660
|
+
rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
|
|
661
|
+
int num_ranges, const char* const* range_start_key,
|
|
662
|
+
const size_t* range_start_key_len, const char* const* range_limit_key,
|
|
663
|
+
const size_t* range_limit_key_len, uint8_t include_flags, uint64_t* sizes,
|
|
664
|
+
char** errptr);
|
|
665
|
+
|
|
643
666
|
extern ROCKSDB_LIBRARY_API void rocksdb_compact_range(rocksdb_t* db,
|
|
644
667
|
const char* start_key,
|
|
645
668
|
size_t start_key_len,
|
|
@@ -727,6 +750,8 @@ extern ROCKSDB_LIBRARY_API const char* rocksdb_iter_timestamp(
|
|
|
727
750
|
const rocksdb_iterator_t*, size_t* tslen);
|
|
728
751
|
extern ROCKSDB_LIBRARY_API void rocksdb_iter_get_error(
|
|
729
752
|
const rocksdb_iterator_t*, char** errptr);
|
|
753
|
+
extern ROCKSDB_LIBRARY_API void rocksdb_iter_refresh(
|
|
754
|
+
const rocksdb_iterator_t* iter, char** errptr);
|
|
730
755
|
|
|
731
756
|
extern ROCKSDB_LIBRARY_API void rocksdb_wal_iter_next(
|
|
732
757
|
rocksdb_wal_iterator_t* iter);
|
|
@@ -747,6 +772,10 @@ extern ROCKSDB_LIBRARY_API rocksdb_writebatch_t* rocksdb_writebatch_create(
|
|
|
747
772
|
void);
|
|
748
773
|
extern ROCKSDB_LIBRARY_API rocksdb_writebatch_t* rocksdb_writebatch_create_from(
|
|
749
774
|
const char* rep, size_t size);
|
|
775
|
+
extern ROCKSDB_LIBRARY_API rocksdb_writebatch_t*
|
|
776
|
+
rocksdb_writebatch_create_with_params(size_t reserved_bytes, size_t max_bytes,
|
|
777
|
+
size_t protection_bytes_per_key,
|
|
778
|
+
size_t default_cf_ts_sz);
|
|
750
779
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_destroy(
|
|
751
780
|
rocksdb_writebatch_t*);
|
|
752
781
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_clear(rocksdb_writebatch_t*);
|
|
@@ -834,6 +863,13 @@ extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_iterate(
|
|
|
834
863
|
rocksdb_writebatch_t*, void* state,
|
|
835
864
|
void (*put)(void*, const char* k, size_t klen, const char* v, size_t vlen),
|
|
836
865
|
void (*deleted)(void*, const char* k, size_t klen));
|
|
866
|
+
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_iterate_cf(
|
|
867
|
+
rocksdb_writebatch_t*, void* state,
|
|
868
|
+
void (*put_cf)(void*, uint32_t cfid, const char* k, size_t klen,
|
|
869
|
+
const char* v, size_t vlen),
|
|
870
|
+
void (*deleted_cf)(void*, uint32_t cfid, const char* k, size_t klen),
|
|
871
|
+
void (*merge_cf)(void*, uint32_t cfid, const char* k, size_t klen,
|
|
872
|
+
const char* v, size_t vlen));
|
|
837
873
|
extern ROCKSDB_LIBRARY_API const char* rocksdb_writebatch_data(
|
|
838
874
|
rocksdb_writebatch_t*, size_t* size);
|
|
839
875
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_set_save_point(
|
|
@@ -842,6 +878,9 @@ extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_rollback_to_save_point(
|
|
|
842
878
|
rocksdb_writebatch_t*, char** errptr);
|
|
843
879
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_pop_save_point(
|
|
844
880
|
rocksdb_writebatch_t*, char** errptr);
|
|
881
|
+
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_update_timestamps(
|
|
882
|
+
rocksdb_writebatch_t* wb, const char* ts, size_t tslen, void* state,
|
|
883
|
+
size_t (*get_ts_size)(void*, uint32_t), char** errptr);
|
|
845
884
|
|
|
846
885
|
/* Write batch with index */
|
|
847
886
|
|
|
@@ -850,6 +889,11 @@ rocksdb_writebatch_wi_create(size_t reserved_bytes,
|
|
|
850
889
|
unsigned char overwrite_keys);
|
|
851
890
|
extern ROCKSDB_LIBRARY_API rocksdb_writebatch_wi_t*
|
|
852
891
|
rocksdb_writebatch_wi_create_from(const char* rep, size_t size);
|
|
892
|
+
extern ROCKSDB_LIBRARY_API rocksdb_writebatch_wi_t*
|
|
893
|
+
rocksdb_writebatch_wi_create_with_params(
|
|
894
|
+
rocksdb_comparator_t* backup_index_comparator, size_t reserved_bytes,
|
|
895
|
+
unsigned char overwrite_key, size_t max_bytes,
|
|
896
|
+
size_t protection_bytes_per_key);
|
|
853
897
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_wi_destroy(
|
|
854
898
|
rocksdb_writebatch_wi_t*);
|
|
855
899
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_wi_clear(
|
|
@@ -960,6 +1004,9 @@ extern ROCKSDB_LIBRARY_API rocksdb_iterator_t*
|
|
|
960
1004
|
rocksdb_writebatch_wi_create_iterator_with_base_cf(
|
|
961
1005
|
rocksdb_writebatch_wi_t* wbwi, rocksdb_iterator_t* base_iterator,
|
|
962
1006
|
rocksdb_column_family_handle_t* cf);
|
|
1007
|
+
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_wi_update_timestamps(
|
|
1008
|
+
rocksdb_writebatch_wi_t* wbwi, const char* ts, size_t tslen, void* state,
|
|
1009
|
+
size_t (*get_ts_size)(void*, uint32_t), char** errptr);
|
|
963
1010
|
|
|
964
1011
|
/* Options utils */
|
|
965
1012
|
|
|
@@ -1178,6 +1225,11 @@ extern ROCKSDB_LIBRARY_API int rocksdb_options_get_info_log_level(
|
|
|
1178
1225
|
rocksdb_options_t*);
|
|
1179
1226
|
extern ROCKSDB_LIBRARY_API rocksdb_logger_t*
|
|
1180
1227
|
rocksdb_logger_create_stderr_logger(int log_level, const char* prefix);
|
|
1228
|
+
extern ROCKSDB_LIBRARY_API rocksdb_logger_t*
|
|
1229
|
+
rocksdb_logger_create_callback_logger(int log_level,
|
|
1230
|
+
void (*)(void* priv, unsigned lev,
|
|
1231
|
+
char* msg, size_t len),
|
|
1232
|
+
void* priv);
|
|
1181
1233
|
extern ROCKSDB_LIBRARY_API void rocksdb_logger_destroy(
|
|
1182
1234
|
rocksdb_logger_t* logger);
|
|
1183
1235
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_buffer_size(
|
|
@@ -1588,6 +1640,17 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_plain_table_factory(
|
|
|
1588
1640
|
rocksdb_options_t*, uint32_t, int, double, size_t, size_t, char,
|
|
1589
1641
|
unsigned char, unsigned char);
|
|
1590
1642
|
|
|
1643
|
+
extern ROCKSDB_LIBRARY_API unsigned char
|
|
1644
|
+
rocksdb_options_get_write_dbid_to_manifest(rocksdb_options_t*);
|
|
1645
|
+
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_dbid_to_manifest(
|
|
1646
|
+
rocksdb_options_t*, unsigned char);
|
|
1647
|
+
|
|
1648
|
+
extern ROCKSDB_LIBRARY_API unsigned char
|
|
1649
|
+
rocksdb_options_get_track_and_verify_wals_in_manifest(rocksdb_options_t*);
|
|
1650
|
+
extern ROCKSDB_LIBRARY_API void
|
|
1651
|
+
rocksdb_options_set_track_and_verify_wals_in_manifest(rocksdb_options_t*,
|
|
1652
|
+
unsigned char);
|
|
1653
|
+
|
|
1591
1654
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_min_level_to_compress(
|
|
1592
1655
|
rocksdb_options_t* opt, int level);
|
|
1593
1656
|
|