@nxtedition/rocksdb 13.1.5 → 13.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.cc +62 -15
- package/deps/rocksdb/rocksdb/{TARGETS → BUCK} +27 -0
- package/deps/rocksdb/rocksdb/CMakeLists.txt +3 -1
- package/deps/rocksdb/rocksdb/Makefile +2 -2
- package/deps/rocksdb/rocksdb/cache/cache.cc +3 -1
- package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.h +2 -0
- package/deps/rocksdb/rocksdb/db/attribute_group_iterator_impl.h +34 -9
- package/deps/rocksdb/rocksdb/db/blob/blob_source.cc +7 -6
- package/deps/rocksdb/rocksdb/db/blob/blob_source.h +5 -1
- package/deps/rocksdb/rocksdb/db/blob/blob_source_test.cc +22 -14
- package/deps/rocksdb/rocksdb/db/blob/db_blob_basic_test.cc +149 -0
- package/deps/rocksdb/rocksdb/db/builder.cc +13 -24
- package/deps/rocksdb/rocksdb/db/coalescing_iterator.h +35 -10
- package/deps/rocksdb/rocksdb/db/column_family.cc +21 -10
- package/deps/rocksdb/rocksdb/db/column_family.h +15 -8
- package/deps/rocksdb/rocksdb/db/column_family_test.cc +98 -7
- package/deps/rocksdb/rocksdb/db/compaction/compaction.cc +126 -16
- package/deps/rocksdb/rocksdb/db/compaction/compaction.h +51 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.cc +2 -2
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.h +2 -8
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator_test.cc +24 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +52 -22
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +9 -7
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +36 -9
- package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.h +6 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.cc +30 -17
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.h +26 -23
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.cc +43 -33
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.h +6 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.cc +19 -9
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.h +6 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +632 -411
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.cc +171 -51
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.h +7 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_service_job.cc +37 -10
- package/deps/rocksdb/rocksdb/db/compaction/compaction_service_test.cc +51 -11
- package/deps/rocksdb/rocksdb/db/compaction/subcompaction_state.cc +10 -3
- package/deps/rocksdb/rocksdb/db/compaction/tiered_compaction_test.cc +350 -154
- package/deps/rocksdb/rocksdb/db/convenience.cc +1 -1
- package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +62 -27
- package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +68 -1
- package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +91 -0
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +134 -70
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +71 -23
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +43 -16
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_debug.cc +47 -33
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +27 -19
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +38 -25
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.cc +3 -3
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +7 -4
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +258 -42
- package/deps/rocksdb/rocksdb/db/db_io_failure_test.cc +161 -9
- package/deps/rocksdb/rocksdb/db/db_iter.cc +118 -86
- package/deps/rocksdb/rocksdb/db/db_iter.h +44 -17
- package/deps/rocksdb/rocksdb/db/db_options_test.cc +27 -6
- package/deps/rocksdb/rocksdb/db/db_test.cc +48 -16
- package/deps/rocksdb/rocksdb/db/db_test2.cc +60 -15
- package/deps/rocksdb/rocksdb/db/db_test_util.cc +97 -44
- package/deps/rocksdb/rocksdb/db/db_test_util.h +7 -1
- package/deps/rocksdb/rocksdb/db/dbformat.cc +15 -5
- package/deps/rocksdb/rocksdb/db/dbformat.h +137 -55
- package/deps/rocksdb/rocksdb/db/event_helpers.cc +1 -0
- package/deps/rocksdb/rocksdb/db/experimental.cc +54 -0
- package/deps/rocksdb/rocksdb/db/external_sst_file_basic_test.cc +663 -8
- package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc +152 -91
- package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.h +134 -11
- package/deps/rocksdb/rocksdb/db/external_sst_file_test.cc +55 -9
- package/deps/rocksdb/rocksdb/db/flush_job.cc +52 -29
- package/deps/rocksdb/rocksdb/db/flush_job.h +5 -3
- package/deps/rocksdb/rocksdb/db/flush_job_test.cc +18 -12
- package/deps/rocksdb/rocksdb/db/forward_iterator.cc +23 -29
- package/deps/rocksdb/rocksdb/db/import_column_family_job.cc +3 -2
- package/deps/rocksdb/rocksdb/db/import_column_family_test.cc +2 -0
- package/deps/rocksdb/rocksdb/db/internal_stats.cc +9 -6
- package/deps/rocksdb/rocksdb/db/internal_stats.h +54 -0
- package/deps/rocksdb/rocksdb/db/job_context.h +1 -1
- package/deps/rocksdb/rocksdb/db/log_reader.cc +6 -7
- package/deps/rocksdb/rocksdb/db/manifest_ops.cc +47 -0
- package/deps/rocksdb/rocksdb/db/manifest_ops.h +20 -0
- package/deps/rocksdb/rocksdb/db/memtable.cc +165 -64
- package/deps/rocksdb/rocksdb/db/memtable.h +422 -243
- package/deps/rocksdb/rocksdb/db/memtable_list.cc +99 -68
- package/deps/rocksdb/rocksdb/db/memtable_list.h +63 -38
- package/deps/rocksdb/rocksdb/db/memtable_list_test.cc +28 -25
- package/deps/rocksdb/rocksdb/db/multi_cf_iterator_impl.h +118 -60
- package/deps/rocksdb/rocksdb/db/multi_cf_iterator_test.cc +344 -89
- package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.h +2 -3
- package/deps/rocksdb/rocksdb/db/repair.cc +15 -14
- package/deps/rocksdb/rocksdb/db/repair_test.cc +0 -13
- package/deps/rocksdb/rocksdb/db/snapshot_checker.h +7 -0
- package/deps/rocksdb/rocksdb/db/table_cache.cc +62 -65
- package/deps/rocksdb/rocksdb/db/table_cache.h +70 -76
- package/deps/rocksdb/rocksdb/db/table_cache_sync_and_async.h +5 -6
- package/deps/rocksdb/rocksdb/db/table_properties_collector_test.cc +1 -1
- package/deps/rocksdb/rocksdb/db/transaction_log_impl.cc +8 -7
- package/deps/rocksdb/rocksdb/db/version_builder.cc +17 -19
- package/deps/rocksdb/rocksdb/db/version_builder.h +13 -12
- package/deps/rocksdb/rocksdb/db/version_edit.h +30 -0
- package/deps/rocksdb/rocksdb/db/version_edit_handler.cc +3 -5
- package/deps/rocksdb/rocksdb/db/version_set.cc +89 -129
- package/deps/rocksdb/rocksdb/db/version_set.h +12 -4
- package/deps/rocksdb/rocksdb/db/version_set_sync_and_async.h +1 -2
- package/deps/rocksdb/rocksdb/db/version_set_test.cc +12 -8
- package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.cc +0 -15
- package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.h +0 -2
- package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization_test.cc +9 -7
- package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper.cc +0 -8
- package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper.h +28 -2
- package/deps/rocksdb/rocksdb/db/write_batch.cc +32 -10
- package/deps/rocksdb/rocksdb/db/write_batch_internal.h +9 -0
- package/deps/rocksdb/rocksdb/db/write_batch_test.cc +2 -1
- package/deps/rocksdb/rocksdb/db/write_thread.cc +3 -1
- package/deps/rocksdb/rocksdb/db/write_thread.h +6 -2
- package/deps/rocksdb/rocksdb/db_stress_tool/batched_ops_stress.cc +15 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/cf_consistency_stress.cc +7 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +4 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +18 -2
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +100 -22
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.h +15 -4
- package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.cc +34 -8
- package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +223 -78
- package/deps/rocksdb/rocksdb/env/file_system.cc +6 -1
- package/deps/rocksdb/rocksdb/env/fs_posix.cc +53 -0
- package/deps/rocksdb/rocksdb/env/io_posix.cc +63 -17
- package/deps/rocksdb/rocksdb/env/io_posix.h +30 -1
- package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.cc +132 -48
- package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.h +92 -24
- package/deps/rocksdb/rocksdb/file/prefetch_test.cc +727 -109
- package/deps/rocksdb/rocksdb/file/random_access_file_reader.cc +3 -4
- package/deps/rocksdb/rocksdb/file/random_access_file_reader.h +1 -1
- package/deps/rocksdb/rocksdb/file/writable_file_writer.cc +8 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/attribute_groups.h +20 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/compaction_job_stats.h +9 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/configurable.h +9 -5
- package/deps/rocksdb/rocksdb/include/rocksdb/convenience.h +2 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/db.h +10 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/env.h +1 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/experimental.h +7 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +34 -37
- package/deps/rocksdb/rocksdb/include/rocksdb/iterator_base.h +21 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/options.h +56 -28
- package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_writer.h +3 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/table.h +36 -28
- package/deps/rocksdb/rocksdb/include/rocksdb/table_properties.h +11 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/thread_status.h +1 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/options_type.h +84 -60
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/secondary_index.h +102 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/table_properties_collectors.h +89 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction.h +32 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction_db.h +30 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +23 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/version.h +2 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/write_batch.h +2 -0
- package/deps/rocksdb/rocksdb/memtable/inlineskiplist.h +79 -21
- package/deps/rocksdb/rocksdb/memtable/skiplist.h +41 -18
- package/deps/rocksdb/rocksdb/memtable/skiplistrep.cc +1 -5
- package/deps/rocksdb/rocksdb/memtable/wbwi_memtable.cc +169 -0
- package/deps/rocksdb/rocksdb/memtable/wbwi_memtable.h +400 -0
- package/deps/rocksdb/rocksdb/monitoring/thread_status_util_debug.cc +2 -0
- package/deps/rocksdb/rocksdb/options/cf_options.cc +137 -82
- package/deps/rocksdb/rocksdb/options/cf_options.h +18 -6
- package/deps/rocksdb/rocksdb/options/configurable.cc +31 -17
- package/deps/rocksdb/rocksdb/options/configurable_helper.h +7 -6
- package/deps/rocksdb/rocksdb/options/options_helper.cc +10 -8
- package/deps/rocksdb/rocksdb/options/options_parser.cc +74 -54
- package/deps/rocksdb/rocksdb/options/options_settable_test.cc +89 -0
- package/deps/rocksdb/rocksdb/options/options_test.cc +112 -26
- package/deps/rocksdb/rocksdb/port/port.h +5 -9
- package/deps/rocksdb/rocksdb/src.mk +8 -0
- package/deps/rocksdb/rocksdb/table/adaptive/adaptive_table_factory.h +4 -0
- package/deps/rocksdb/rocksdb/table/block_based/block.h +1 -7
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +2 -0
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.cc +62 -80
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.h +13 -3
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.cc +16 -5
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.h +38 -7
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +12 -4
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +4 -1
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +4 -1
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_test.cc +204 -1
- package/deps/rocksdb/rocksdb/table/block_based/data_block_hash_index_test.cc +3 -3
- package/deps/rocksdb/rocksdb/table/block_fetcher_test.cc +2 -1
- package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_factory.h +4 -0
- package/deps/rocksdb/rocksdb/table/format.cc +3 -3
- package/deps/rocksdb/rocksdb/table/meta_blocks.cc +4 -1
- package/deps/rocksdb/rocksdb/table/mock_table.cc +0 -50
- package/deps/rocksdb/rocksdb/table/mock_table.h +53 -0
- package/deps/rocksdb/rocksdb/table/plain/plain_table_factory.h +4 -0
- package/deps/rocksdb/rocksdb/table/sst_file_dumper.cc +1 -1
- package/deps/rocksdb/rocksdb/table/sst_file_writer.cc +10 -5
- package/deps/rocksdb/rocksdb/table/table_builder.h +3 -1
- package/deps/rocksdb/rocksdb/table/table_properties.cc +181 -0
- package/deps/rocksdb/rocksdb/table/table_reader_bench.cc +5 -5
- package/deps/rocksdb/rocksdb/table/table_test.cc +71 -64
- package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_pysim.py +45 -45
- package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_pysim_test.py +35 -35
- package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_plot.py +43 -43
- package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +41 -4
- package/deps/rocksdb/rocksdb/tools/ldb_cmd.cc +1 -0
- package/deps/rocksdb/rocksdb/tools/sst_dump_test.cc +1 -1
- package/deps/rocksdb/rocksdb/unreleased_history/add.sh +13 -0
- package/deps/rocksdb/rocksdb/util/aligned_buffer.h +24 -5
- package/deps/rocksdb/rocksdb/util/compaction_job_stats_impl.cc +7 -0
- package/deps/rocksdb/rocksdb/util/file_checksum_helper.cc +0 -52
- package/deps/rocksdb/rocksdb/util/file_checksum_helper.h +1 -10
- package/deps/rocksdb/rocksdb/util/file_reader_writer_test.cc +92 -0
- package/deps/rocksdb/rocksdb/util/thread_operation.h +1 -0
- package/deps/rocksdb/rocksdb/util/udt_util.cc +50 -4
- package/deps/rocksdb/rocksdb/util/udt_util.h +24 -11
- package/deps/rocksdb/rocksdb/util/udt_util_test.cc +26 -13
- package/deps/rocksdb/rocksdb/utilities/memory/memory_test.cc +1 -16
- package/deps/rocksdb/rocksdb/utilities/options/options_util_test.cc +2 -0
- package/deps/rocksdb/rocksdb/utilities/secondary_index/faiss_ivf_index.cc +214 -0
- package/deps/rocksdb/rocksdb/utilities/secondary_index/faiss_ivf_index.h +60 -0
- package/deps/rocksdb/rocksdb/utilities/secondary_index/faiss_ivf_index_test.cc +124 -0
- package/deps/rocksdb/rocksdb/utilities/secondary_index/secondary_index_mixin.h +441 -0
- package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.cc +34 -3
- package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.h +7 -2
- package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_test.cc +437 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.cc +34 -11
- package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.h +14 -7
- package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction_db.cc +7 -1
- package/deps/rocksdb/rocksdb/utilities/transactions/snapshot_checker.cc +17 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.cc +69 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.h +20 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.cc +1290 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/write_committed_transaction_ts_test.cc +324 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.cc +18 -1
- package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.h +8 -1
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +57 -12
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +32 -3
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +33 -2
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_test.cc +721 -9
- package/deps/rocksdb/rocksdb.gyp +2 -0
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@nxtedition+rocksdb.node +0 -0
- package/prebuilds/linux-x64/@nxtedition+rocksdb.node +0 -0
|
@@ -58,6 +58,7 @@ enum class OptionType {
|
|
|
58
58
|
kEncodedString,
|
|
59
59
|
kTemperature,
|
|
60
60
|
kArray,
|
|
61
|
+
kStringMap, // Map of <std::string, std::string>
|
|
61
62
|
kUnknown,
|
|
62
63
|
};
|
|
63
64
|
|
|
@@ -241,42 +242,13 @@ using ValidateFunc = std::function<Status(
|
|
|
241
242
|
// option type, and offset.
|
|
242
243
|
class OptionTypeInfo {
|
|
243
244
|
public:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
verification_(OptionVerificationType::kNormal),
|
|
252
|
-
flags_(OptionTypeFlags::kNone) {}
|
|
253
|
-
|
|
254
|
-
OptionTypeInfo(int offset, OptionType type,
|
|
255
|
-
OptionVerificationType verification, OptionTypeFlags flags)
|
|
256
|
-
: offset_(offset),
|
|
257
|
-
parse_func_(nullptr),
|
|
258
|
-
serialize_func_(nullptr),
|
|
259
|
-
equals_func_(nullptr),
|
|
260
|
-
type_(type),
|
|
261
|
-
verification_(verification),
|
|
262
|
-
flags_(flags) {}
|
|
263
|
-
|
|
264
|
-
OptionTypeInfo(int offset, OptionType type,
|
|
265
|
-
OptionVerificationType verification, OptionTypeFlags flags,
|
|
266
|
-
const ParseFunc& parse_func)
|
|
267
|
-
: offset_(offset),
|
|
268
|
-
parse_func_(parse_func),
|
|
269
|
-
serialize_func_(nullptr),
|
|
270
|
-
equals_func_(nullptr),
|
|
271
|
-
type_(type),
|
|
272
|
-
verification_(verification),
|
|
273
|
-
flags_(flags) {}
|
|
274
|
-
|
|
275
|
-
OptionTypeInfo(int offset, OptionType type,
|
|
276
|
-
OptionVerificationType verification, OptionTypeFlags flags,
|
|
277
|
-
const ParseFunc& parse_func,
|
|
278
|
-
const SerializeFunc& serialize_func,
|
|
279
|
-
const EqualsFunc& equals_func)
|
|
245
|
+
OptionTypeInfo(
|
|
246
|
+
int offset, OptionType type,
|
|
247
|
+
OptionVerificationType verification = OptionVerificationType::kNormal,
|
|
248
|
+
OptionTypeFlags flags = OptionTypeFlags::kNone,
|
|
249
|
+
const ParseFunc& parse_func = {},
|
|
250
|
+
const SerializeFunc& serialize_func = {},
|
|
251
|
+
const EqualsFunc& equals_func = {})
|
|
280
252
|
: offset_(offset),
|
|
281
253
|
parse_func_(parse_func),
|
|
282
254
|
serialize_func_(serialize_func),
|
|
@@ -470,24 +442,80 @@ class OptionTypeInfo {
|
|
|
470
442
|
return info;
|
|
471
443
|
}
|
|
472
444
|
|
|
445
|
+
static OptionTypeInfo StringMap(int _offset,
|
|
446
|
+
OptionVerificationType _verification,
|
|
447
|
+
OptionTypeFlags _flags,
|
|
448
|
+
char kv_separator = '=',
|
|
449
|
+
char item_separator = ';') {
|
|
450
|
+
OptionTypeInfo info(_offset, OptionType::kStringMap, _verification, _flags);
|
|
451
|
+
info.SetParseFunc(
|
|
452
|
+
[kv_separator, item_separator](const ConfigOptions&, const std::string&,
|
|
453
|
+
const std::string& value, void* addr) {
|
|
454
|
+
std::map<std::string, std::string> map;
|
|
455
|
+
Status s;
|
|
456
|
+
for (size_t start = 0, end = 0;
|
|
457
|
+
s.ok() && start < value.size() && end != std::string::npos;
|
|
458
|
+
start = end + 1) {
|
|
459
|
+
std::string token;
|
|
460
|
+
s = OptionTypeInfo::NextToken(value, item_separator, start, &end,
|
|
461
|
+
&token);
|
|
462
|
+
if (s.ok() && !token.empty()) {
|
|
463
|
+
size_t pos = token.find(kv_separator);
|
|
464
|
+
assert(pos != std::string::npos);
|
|
465
|
+
std::string k = token.substr(0, pos);
|
|
466
|
+
std::string v = token.substr(pos + 1);
|
|
467
|
+
std::string decoded_key;
|
|
468
|
+
std::string decoded_value;
|
|
469
|
+
(Slice(k)).DecodeHex(&decoded_key);
|
|
470
|
+
(Slice(v)).DecodeHex(&decoded_value);
|
|
471
|
+
map.emplace(std::move(decoded_key), std::move(decoded_value));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (s.ok()) {
|
|
475
|
+
*(static_cast<std::map<std::string, std::string>*>(addr)) = map;
|
|
476
|
+
}
|
|
477
|
+
return s;
|
|
478
|
+
});
|
|
479
|
+
info.SetSerializeFunc(
|
|
480
|
+
[kv_separator, item_separator](const ConfigOptions&, const std::string&,
|
|
481
|
+
const void* addr, std::string* value) {
|
|
482
|
+
const auto map =
|
|
483
|
+
static_cast<const std::map<std::string, std::string>*>(addr);
|
|
484
|
+
value->append("{");
|
|
485
|
+
for (const auto& entry : *map) {
|
|
486
|
+
value->append(Slice(entry.first).ToString(true));
|
|
487
|
+
*value += kv_separator;
|
|
488
|
+
value->append(Slice(entry.second).ToString(true));
|
|
489
|
+
*value += item_separator;
|
|
490
|
+
}
|
|
491
|
+
value->append("}");
|
|
492
|
+
return Status::OK();
|
|
493
|
+
});
|
|
494
|
+
info.SetEqualsFunc([](const ConfigOptions&, const std::string&,
|
|
495
|
+
const void* addr1, const void* addr2, std::string*) {
|
|
496
|
+
return (*static_cast<const std::map<std::string, std::string>*>(addr1) ==
|
|
497
|
+
*static_cast<const std::map<std::string, std::string>*>(addr2));
|
|
498
|
+
});
|
|
499
|
+
return info;
|
|
500
|
+
}
|
|
501
|
+
|
|
473
502
|
// Create a new std::shared_ptr<Customizable> OptionTypeInfo
|
|
474
503
|
// This function will call the T::CreateFromString method to create a new
|
|
475
504
|
// std::shared_ptr<T> object.
|
|
476
505
|
//
|
|
477
506
|
// @param offset The offset for the Customizable from the base pointer
|
|
478
507
|
// @param ovt How to verify this option
|
|
479
|
-
// @param flags
|
|
480
|
-
// @param
|
|
481
|
-
// @param
|
|
508
|
+
// @param flags Extra flags specifying the behavior of this option
|
|
509
|
+
// @param serialize_func Optional function for serializing this option
|
|
510
|
+
// @param equals_func Optional function for comparing this option
|
|
482
511
|
template <typename T>
|
|
483
|
-
static OptionTypeInfo AsCustomSharedPtr(
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
const std::string& value, void* addr) {
|
|
512
|
+
static OptionTypeInfo AsCustomSharedPtr(
|
|
513
|
+
int offset, OptionVerificationType ovt,
|
|
514
|
+
OptionTypeFlags flags = OptionTypeFlags::kNone,
|
|
515
|
+
const SerializeFunc& serialize_func = {},
|
|
516
|
+
const EqualsFunc& equals_func = {}) {
|
|
517
|
+
auto parse_func = [](const ConfigOptions& opts, const std::string& name,
|
|
518
|
+
const std::string& value, void* addr) {
|
|
491
519
|
auto* shared = static_cast<std::shared_ptr<T>*>(addr);
|
|
492
520
|
if (name == kIdPropName() && value.empty()) {
|
|
493
521
|
shared->reset();
|
|
@@ -495,19 +523,10 @@ class OptionTypeInfo {
|
|
|
495
523
|
} else {
|
|
496
524
|
return T::CreateFromString(opts, value, shared);
|
|
497
525
|
}
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
static OptionTypeInfo AsCustomSharedPtr(int offset,
|
|
503
|
-
OptionVerificationType ovt,
|
|
504
|
-
OptionTypeFlags flags,
|
|
505
|
-
const SerializeFunc& serialize_func,
|
|
506
|
-
const EqualsFunc& equals_func) {
|
|
507
|
-
OptionTypeInfo info(AsCustomSharedPtr<T>(offset, ovt, flags));
|
|
508
|
-
info.SetSerializeFunc(serialize_func);
|
|
509
|
-
info.SetEqualsFunc(equals_func);
|
|
510
|
-
return info;
|
|
526
|
+
};
|
|
527
|
+
return OptionTypeInfo(offset, OptionType::kCustomizable, ovt,
|
|
528
|
+
flags | OptionTypeFlags::kShared, parse_func,
|
|
529
|
+
serialize_func, equals_func);
|
|
511
530
|
}
|
|
512
531
|
|
|
513
532
|
// Create a new std::unique_ptr<Customizable> OptionTypeInfo
|
|
@@ -612,6 +631,9 @@ class OptionTypeInfo {
|
|
|
612
631
|
return *this;
|
|
613
632
|
}
|
|
614
633
|
|
|
634
|
+
OptionTypeFlags GetFlags() const { return flags_; }
|
|
635
|
+
void SetFlags(OptionTypeFlags flags) { flags_ = flags; }
|
|
636
|
+
|
|
615
637
|
bool IsEnabled(OptionTypeFlags otf) const { return (flags_ & otf) == otf; }
|
|
616
638
|
|
|
617
639
|
bool IsEditable(const ConfigOptions& opts) const {
|
|
@@ -714,6 +736,8 @@ class OptionTypeInfo {
|
|
|
714
736
|
|
|
715
737
|
bool IsCustomizable() const { return (type_ == OptionType::kCustomizable); }
|
|
716
738
|
|
|
739
|
+
OptionType GetType() const { return type_; }
|
|
740
|
+
|
|
717
741
|
inline const void* GetOffset(const void* base) const {
|
|
718
742
|
return static_cast<const char*>(base) + offset_;
|
|
719
743
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
//
|
|
3
|
+
// This source code is licensed under both the GPLv2 (found in the
|
|
4
|
+
// COPYING file in the root directory) and Apache 2.0 License
|
|
5
|
+
// (found in the LICENSE.Apache file in the root directory).
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include <optional>
|
|
10
|
+
#include <string>
|
|
11
|
+
#include <variant>
|
|
12
|
+
|
|
13
|
+
#include "rocksdb/rocksdb_namespace.h"
|
|
14
|
+
#include "rocksdb/slice.h"
|
|
15
|
+
#include "rocksdb/status.h"
|
|
16
|
+
|
|
17
|
+
namespace ROCKSDB_NAMESPACE {
|
|
18
|
+
|
|
19
|
+
class ColumnFamilyHandle;
|
|
20
|
+
|
|
21
|
+
// / \ UNDER CONSTRUCTION
|
|
22
|
+
// / ! \ UNDER CONSTRUCTION
|
|
23
|
+
// /-----\ UNDER CONSTRUCTION
|
|
24
|
+
|
|
25
|
+
// A secondary index is an additional data structure built over a set of primary
|
|
26
|
+
// key-values that enables efficiently querying key-values by value instead of
|
|
27
|
+
// key. Both plain and wide-column key-values can be indexed, the latter on a
|
|
28
|
+
// per-column basis. The secondary index then maintains a mapping from (column)
|
|
29
|
+
// value to the list of primary keys that have the corresponding value (in the
|
|
30
|
+
// given column).
|
|
31
|
+
//
|
|
32
|
+
// The primary and secondary key-value pairs can be stored in either the same
|
|
33
|
+
// column family or different ones. It is the application's responsibility to
|
|
34
|
+
// avoid conflicts and ambiguities (for example, by using prefixes to create
|
|
35
|
+
// separate key spaces or using a dedicated column family for each secondary
|
|
36
|
+
// index). Also, note that applications are not expected to manipulate secondary
|
|
37
|
+
// index entries directly.
|
|
38
|
+
//
|
|
39
|
+
// In the general case where there are concurrent writers, maintaining a
|
|
40
|
+
// secondary index requires transactional semantics and concurrency control.
|
|
41
|
+
// Because of this, secondary indices are only supported via the transaction
|
|
42
|
+
// layer. With secondary indices, whenever a (primary) key-value is inserted,
|
|
43
|
+
// updated, or deleted via a transaction (regardless of whether it is an
|
|
44
|
+
// explicit or implicit one), RocksDB will invoke any applicable SecondaryIndex
|
|
45
|
+
// objects based on primary column family and column name, and it will
|
|
46
|
+
// automatically add or remove any secondary index entries as needed (using
|
|
47
|
+
// the same transaction).
|
|
48
|
+
//
|
|
49
|
+
// Note: the methods of SecondaryIndex implementations are expected to be
|
|
50
|
+
// thread-safe with the exception of Set{Primary,Secondary}ColumnFamily (which
|
|
51
|
+
// are not expected to be called after initialization).
|
|
52
|
+
class SecondaryIndex {
|
|
53
|
+
public:
|
|
54
|
+
virtual ~SecondaryIndex() = default;
|
|
55
|
+
|
|
56
|
+
virtual void SetPrimaryColumnFamily(ColumnFamilyHandle* column_family) = 0;
|
|
57
|
+
virtual void SetSecondaryColumnFamily(ColumnFamilyHandle* column_family) = 0;
|
|
58
|
+
|
|
59
|
+
virtual ColumnFamilyHandle* GetPrimaryColumnFamily() const = 0;
|
|
60
|
+
virtual ColumnFamilyHandle* GetSecondaryColumnFamily() const = 0;
|
|
61
|
+
|
|
62
|
+
// The name of the primary column to index. Plain key-values can be indexed by
|
|
63
|
+
// specifying kDefaultWideColumnName.
|
|
64
|
+
virtual Slice GetPrimaryColumnName() const = 0;
|
|
65
|
+
|
|
66
|
+
// Optionally update the primary column value during an insert or update of a
|
|
67
|
+
// primary key-value. Called by the transaction layer before the primary
|
|
68
|
+
// key-value write is added to the transaction. Returning a non-OK status
|
|
69
|
+
// rolls back all operations in the transaction related to this primary
|
|
70
|
+
// key-value.
|
|
71
|
+
virtual Status UpdatePrimaryColumnValue(
|
|
72
|
+
const Slice& primary_key, const Slice& primary_column_value,
|
|
73
|
+
std::optional<std::variant<Slice, std::string>>* updated_column_value)
|
|
74
|
+
const = 0;
|
|
75
|
+
|
|
76
|
+
// Get the secondary key prefix for a given primary key-value. This method is
|
|
77
|
+
// called by the transaction layer when adding or removing secondary index
|
|
78
|
+
// entries (which have the form <secondary_key_prefix><primary_key> ->
|
|
79
|
+
// <secondary_value>) and should be deterministic. The output parameter
|
|
80
|
+
// secondary_key_prefix is expected to be based on primary_column_value,
|
|
81
|
+
// potentially with some additional metadata to prevent ambiguities (e.g.
|
|
82
|
+
// index id or length indicator). Returning a non-OK status rolls back all
|
|
83
|
+
// operations in the transaction related to this primary key-value.
|
|
84
|
+
virtual Status GetSecondaryKeyPrefix(
|
|
85
|
+
const Slice& primary_key, const Slice& primary_column_value,
|
|
86
|
+
std::variant<Slice, std::string>* secondary_key_prefix) const = 0;
|
|
87
|
+
|
|
88
|
+
// Get the optional secondary value for a given primary key-value. This method
|
|
89
|
+
// is called by the transaction layer when adding secondary index
|
|
90
|
+
// entries (which have the form <secondary_key_prefix><primary_key> ->
|
|
91
|
+
// <secondary_value>). previous_column_value contains the previous value of
|
|
92
|
+
// the primary column in case it was changed by UpdatePrimaryColumnValue.
|
|
93
|
+
// Returning a non-OK status rolls back all operations in the transaction
|
|
94
|
+
// related to this primary key-value.
|
|
95
|
+
virtual Status GetSecondaryValue(
|
|
96
|
+
const Slice& primary_key, const Slice& primary_column_value,
|
|
97
|
+
const Slice& previous_column_value,
|
|
98
|
+
std::optional<std::variant<Slice, std::string>>* secondary_value)
|
|
99
|
+
const = 0;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
} // namespace ROCKSDB_NAMESPACE
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
#include <atomic>
|
|
8
8
|
#include <memory>
|
|
9
9
|
|
|
10
|
+
#include "rocksdb/status.h"
|
|
11
|
+
#include "rocksdb/system_clock.h"
|
|
10
12
|
#include "rocksdb/table_properties.h"
|
|
11
13
|
|
|
12
14
|
namespace ROCKSDB_NAMESPACE {
|
|
@@ -31,7 +33,7 @@ class CompactOnDeletionCollectorFactory
|
|
|
31
33
|
size_t deletion_trigger,
|
|
32
34
|
double deletion_ratio);
|
|
33
35
|
|
|
34
|
-
~CompactOnDeletionCollectorFactory() {}
|
|
36
|
+
~CompactOnDeletionCollectorFactory() override {}
|
|
35
37
|
|
|
36
38
|
TablePropertiesCollector* CreateTablePropertiesCollector(
|
|
37
39
|
TablePropertiesCollectorFactory::Context context) override;
|
|
@@ -106,7 +108,7 @@ class CompactForTieringCollectorFactory
|
|
|
106
108
|
// for what entry is eligible.
|
|
107
109
|
CompactForTieringCollectorFactory(double compaction_trigger_ratio);
|
|
108
110
|
|
|
109
|
-
~CompactForTieringCollectorFactory() {}
|
|
111
|
+
~CompactForTieringCollectorFactory() override {}
|
|
110
112
|
|
|
111
113
|
TablePropertiesCollector* CreateTablePropertiesCollector(
|
|
112
114
|
TablePropertiesCollectorFactory::Context context) override;
|
|
@@ -130,4 +132,89 @@ class CompactForTieringCollectorFactory
|
|
|
130
132
|
|
|
131
133
|
std::shared_ptr<CompactForTieringCollectorFactory>
|
|
132
134
|
NewCompactForTieringCollectorFactory(double compaction_trigger_ratio);
|
|
135
|
+
|
|
136
|
+
// Information for the unix write time of a collection of data. Combined with
|
|
137
|
+
// the current unix time, these stats give an overview of how long the data
|
|
138
|
+
// have been written to the DB.
|
|
139
|
+
// Check `DataCollectionIsEmpty` and `TrackedDataRatio` before interpreting
|
|
140
|
+
// the stats.
|
|
141
|
+
struct DataCollectionUnixWriteTimeInfo {
|
|
142
|
+
// The minimum write time, a.k.a. the write time of the oldest key.
|
|
143
|
+
uint64_t min_write_time = 0;
|
|
144
|
+
// The maximum write time, a.k.a. the write time of the newest key.
|
|
145
|
+
uint64_t max_write_time = 0;
|
|
146
|
+
// The average write time.
|
|
147
|
+
uint64_t average_write_time = 0;
|
|
148
|
+
|
|
149
|
+
// The number of entries that can be considered infinitely old because their
|
|
150
|
+
// sequence number are zeroed out. We know they are old entries but do not
|
|
151
|
+
// know how old exactly. These entries are separately counted and not
|
|
152
|
+
// aggregated in above stats.
|
|
153
|
+
uint64_t num_entries_infinitely_old = 0;
|
|
154
|
+
|
|
155
|
+
// The number of entries used to create above min, max, average stats.
|
|
156
|
+
uint64_t num_entries_write_time_aggregated = 0;
|
|
157
|
+
|
|
158
|
+
// The number of entries for which write time is untracked.
|
|
159
|
+
uint64_t num_entries_write_time_untracked = 0;
|
|
160
|
+
|
|
161
|
+
DataCollectionUnixWriteTimeInfo() {}
|
|
162
|
+
|
|
163
|
+
DataCollectionUnixWriteTimeInfo(uint64_t _min_write_time,
|
|
164
|
+
uint64_t _max_write_time,
|
|
165
|
+
uint64_t _average_write_time,
|
|
166
|
+
uint64_t _num_entries_infinitely_old,
|
|
167
|
+
uint64_t _num_entries_write_time_aggregated,
|
|
168
|
+
uint64_t _num_entries_write_time_untracked)
|
|
169
|
+
: min_write_time(_min_write_time),
|
|
170
|
+
max_write_time(_max_write_time),
|
|
171
|
+
average_write_time(_average_write_time),
|
|
172
|
+
num_entries_infinitely_old(_num_entries_infinitely_old),
|
|
173
|
+
num_entries_write_time_aggregated(_num_entries_write_time_aggregated),
|
|
174
|
+
num_entries_write_time_untracked(_num_entries_write_time_untracked) {}
|
|
175
|
+
|
|
176
|
+
// Returns true if the data collection for which this
|
|
177
|
+
// `DataCollectionUnixWriteTimeInfo` is for is empty.
|
|
178
|
+
bool DataCollectionIsEmpty() const {
|
|
179
|
+
return num_entries_infinitely_old == 0 &&
|
|
180
|
+
num_entries_write_time_aggregated == 0 &&
|
|
181
|
+
num_entries_write_time_untracked == 0;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// The closer the ratio is to 1, the more accurate the stats reflect the
|
|
185
|
+
// actual write time of this collection of data. If this ratio is 0, there is
|
|
186
|
+
// no write time information available. It could be either the data collection
|
|
187
|
+
// is empty, or none of its data has write time info tracked.
|
|
188
|
+
//
|
|
189
|
+
// For a single file, its data either has write time info tracked or not
|
|
190
|
+
// tracked, this ratio would be either 0 or 1. For a level, this ratio
|
|
191
|
+
// reflects what portion of the data has its write time info tracked in this
|
|
192
|
+
// struct. 0 is returned if the level is empty.
|
|
193
|
+
double TrackedDataRatio() const {
|
|
194
|
+
if (DataCollectionIsEmpty()) {
|
|
195
|
+
return 0;
|
|
196
|
+
}
|
|
197
|
+
uint64_t num_entries_write_time_tracked =
|
|
198
|
+
num_entries_infinitely_old + num_entries_write_time_aggregated;
|
|
199
|
+
return num_entries_write_time_tracked /
|
|
200
|
+
static_cast<double>(num_entries_write_time_tracked +
|
|
201
|
+
num_entries_write_time_untracked);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Whether the file or the level has infinitely old data.
|
|
205
|
+
bool HasInfinitelyOldData() const { return num_entries_infinitely_old > 0; }
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// Given the table properties of a file, return data's unix write time stats
|
|
209
|
+
// if available.
|
|
210
|
+
Status GetDataCollectionUnixWriteTimeInfoForFile(
|
|
211
|
+
const std::shared_ptr<const TableProperties>& table_properties,
|
|
212
|
+
std::unique_ptr<DataCollectionUnixWriteTimeInfo>* file_info);
|
|
213
|
+
|
|
214
|
+
// Given the collection of table properties per level, return data unix write
|
|
215
|
+
// time stats if available.
|
|
216
|
+
Status GetDataCollectionUnixWriteTimeInfoForLevels(
|
|
217
|
+
const std::vector<std::unique_ptr<TablePropertiesCollection>>&
|
|
218
|
+
levels_table_properties,
|
|
219
|
+
std::vector<std::unique_ptr<DataCollectionUnixWriteTimeInfo>>* levels_info);
|
|
133
220
|
} // namespace ROCKSDB_NAMESPACE
|
|
@@ -477,6 +477,36 @@ class Transaction {
|
|
|
477
477
|
virtual Iterator* GetIterator(const ReadOptions& read_options,
|
|
478
478
|
ColumnFamilyHandle* column_family) = 0;
|
|
479
479
|
|
|
480
|
+
// Returns a multi-column-family coalescing iterator for the given column
|
|
481
|
+
// families that includes both keys in the DB and uncommitted keys in this
|
|
482
|
+
// transaction.
|
|
483
|
+
//
|
|
484
|
+
// Setting read_options.snapshot will affect what is read from the
|
|
485
|
+
// DB but will NOT change which keys are read from this transaction (the keys
|
|
486
|
+
// in this transaction do not yet belong to any snapshot and will be fetched
|
|
487
|
+
// regardless).
|
|
488
|
+
//
|
|
489
|
+
// The returned iterator is only valid until Commit(), Rollback(), or
|
|
490
|
+
// RollbackToSavePoint() is called.
|
|
491
|
+
virtual std::unique_ptr<Iterator> GetCoalescingIterator(
|
|
492
|
+
const ReadOptions& read_options,
|
|
493
|
+
const std::vector<ColumnFamilyHandle*>& column_families) = 0;
|
|
494
|
+
|
|
495
|
+
// Returns a multi-column-family attribute group iterator for the given column
|
|
496
|
+
// families that includes both keys in the DB and uncommitted keys in this
|
|
497
|
+
// transaction.
|
|
498
|
+
//
|
|
499
|
+
// Setting read_options.snapshot will affect what is read from the
|
|
500
|
+
// DB but will NOT change which keys are read from this transaction (the keys
|
|
501
|
+
// in this transaction do not yet belong to any snapshot and will be fetched
|
|
502
|
+
// regardless).
|
|
503
|
+
//
|
|
504
|
+
// The returned iterator is only valid until Commit(), Rollback(), or
|
|
505
|
+
// RollbackToSavePoint() is called.
|
|
506
|
+
virtual std::unique_ptr<AttributeGroupIterator> GetAttributeGroupIterator(
|
|
507
|
+
const ReadOptions& read_options,
|
|
508
|
+
const std::vector<ColumnFamilyHandle*>& column_families) = 0;
|
|
509
|
+
|
|
480
510
|
// Put, PutEntity, Merge, Delete, and SingleDelete behave similarly to the
|
|
481
511
|
// corresponding functions in WriteBatch, but will also do conflict checking
|
|
482
512
|
// on the keys being written.
|
|
@@ -720,6 +750,8 @@ class Transaction {
|
|
|
720
750
|
|
|
721
751
|
virtual TxnTimestamp GetCommitTimestamp() const { return kMaxTxnTimestamp; }
|
|
722
752
|
|
|
753
|
+
virtual bool GetCommitBypassMemTable() const { return false; }
|
|
754
|
+
|
|
723
755
|
protected:
|
|
724
756
|
explicit Transaction(const TransactionDB* /*db*/) {}
|
|
725
757
|
Transaction() : log_number_(0), txn_state_(STARTED) {}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
namespace ROCKSDB_NAMESPACE {
|
|
22
22
|
|
|
23
|
+
class SecondaryIndex;
|
|
23
24
|
class TransactionDBMutexFactory;
|
|
24
25
|
|
|
25
26
|
enum TxnDBWritePolicy {
|
|
@@ -240,6 +241,14 @@ struct TransactionDBOptions {
|
|
|
240
241
|
// user-defined timestamps so this option only applies in this case.
|
|
241
242
|
bool enable_udt_validation = true;
|
|
242
243
|
|
|
244
|
+
// / \ UNDER CONSTRUCTION
|
|
245
|
+
// / ! \ UNDER CONSTRUCTION
|
|
246
|
+
// /-----\ UNDER CONSTRUCTION
|
|
247
|
+
//
|
|
248
|
+
// The secondary indices to be maintained. See the SecondaryIndex interface
|
|
249
|
+
// for more details.
|
|
250
|
+
std::vector<std::shared_ptr<SecondaryIndex>> secondary_indices;
|
|
251
|
+
|
|
243
252
|
private:
|
|
244
253
|
// 128 entries
|
|
245
254
|
// Should the default value change, please also update wp_snapshot_cache_bits
|
|
@@ -339,6 +348,23 @@ struct TransactionOptions {
|
|
|
339
348
|
// size in APIs that MyRocks currently are using, including Put, Merge, Delete
|
|
340
349
|
// DeleteRange, SingleDelete.
|
|
341
350
|
bool write_batch_track_timestamp_size = false;
|
|
351
|
+
|
|
352
|
+
// EXPERIMENTAL
|
|
353
|
+
// Only supports write-committed policy. If set to true, the transaction will
|
|
354
|
+
// skip memtable write and ingest into the DB directly during Commit(). This
|
|
355
|
+
// makes Commit() much faster for transactions with many operations.
|
|
356
|
+
// Transactions with Merge() or PutEntity() is not supported yet.
|
|
357
|
+
//
|
|
358
|
+
// Note that the transaction will be ingested as an immutable memtable for
|
|
359
|
+
// CFs it updates, and the current memtable will be switched to a new one.
|
|
360
|
+
// So ingesting many transactions in a short period of time may cause stall
|
|
361
|
+
// due to too many memtables.
|
|
362
|
+
// Note that the ingestion relies on the transaction's underlying index,
|
|
363
|
+
// (WriteBatchWithIndex), so updates that are added to the transaction
|
|
364
|
+
// without indexing (e.g. added directly to the transaction underlying
|
|
365
|
+
// write batch through Transaction::GetWriteBatch()->GetWriteBatch())
|
|
366
|
+
// are not supported. They will not be applied to the DB.
|
|
367
|
+
bool commit_bypass_memtable = false;
|
|
342
368
|
};
|
|
343
369
|
|
|
344
370
|
// The per-write optimizations that do not involve transactions. TransactionDB
|
|
@@ -460,7 +486,10 @@ class TransactionDB : public StackableDB {
|
|
|
460
486
|
//
|
|
461
487
|
// If old_txn is not null, BeginTransaction will reuse this Transaction
|
|
462
488
|
// handle instead of allocating a new one. This is an optimization to avoid
|
|
463
|
-
// extra allocations when repeatedly creating transactions.
|
|
489
|
+
// extra allocations when repeatedly creating transactions. **Note that this
|
|
490
|
+
// may not free all the allocated memory by the previous transaction (see
|
|
491
|
+
// WriteBatch::Clear()). To ensure that all allocated memory is freed, users
|
|
492
|
+
// must destruct the transaction object.
|
|
464
493
|
virtual Transaction* BeginTransaction(
|
|
465
494
|
const WriteOptions& write_options,
|
|
466
495
|
const TransactionOptions& txn_options = TransactionOptions(),
|
|
@@ -74,6 +74,10 @@ class WBWIIterator {
|
|
|
74
74
|
// WriteBatchWithIndex
|
|
75
75
|
virtual WriteEntry Entry() const = 0;
|
|
76
76
|
|
|
77
|
+
// For this user key, there is a single delete in this write batch,
|
|
78
|
+
// and it was overwritten by another update.
|
|
79
|
+
virtual bool HasOverWrittenSingleDel() const { return false; }
|
|
80
|
+
|
|
77
81
|
virtual Status status() const = 0;
|
|
78
82
|
};
|
|
79
83
|
|
|
@@ -188,8 +192,10 @@ class WriteBatchWithIndex : public WriteBatchBase {
|
|
|
188
192
|
// Create an iterator of a column family. User can call iterator.Seek() to
|
|
189
193
|
// search to the next entry of or after a key. Keys will be iterated in the
|
|
190
194
|
// order given by index_comparator. For multiple updates on the same key,
|
|
191
|
-
// each update will be returned as a separate
|
|
192
|
-
// time.
|
|
195
|
+
// if overwrite_key=false, then each update will be returned as a separate
|
|
196
|
+
// entry, in the order of update time.
|
|
197
|
+
// if overwrite_key=true, then one entry per key will be returned. Merge
|
|
198
|
+
// updates on the same key will be returned as separate entries.
|
|
193
199
|
//
|
|
194
200
|
// The returned iterator should be deleted by the caller.
|
|
195
201
|
WBWIIterator* NewIterator(ColumnFamilyHandle* column_family);
|
|
@@ -348,12 +354,27 @@ class WriteBatchWithIndex : public WriteBatchBase {
|
|
|
348
354
|
void SetMaxBytes(size_t max_bytes) override;
|
|
349
355
|
size_t GetDataSize() const;
|
|
350
356
|
|
|
357
|
+
struct CFStat {
|
|
358
|
+
uint32_t entry_count = 0;
|
|
359
|
+
uint32_t overwritten_sd_count = 0;
|
|
360
|
+
};
|
|
361
|
+
// Will track CF ID, per CF entry count and overwritten sd count.
|
|
362
|
+
// Should be enabled when WBWI is empty for correct tracking.
|
|
363
|
+
void SetTrackPerCFStat(bool track);
|
|
364
|
+
const std::unordered_map<uint32_t, CFStat>& GetCFStats() const;
|
|
365
|
+
|
|
366
|
+
bool GetOverwriteKey() const;
|
|
367
|
+
|
|
351
368
|
private:
|
|
352
369
|
friend class PessimisticTransactionDB;
|
|
353
370
|
friend class WritePreparedTxn;
|
|
354
371
|
friend class WriteUnpreparedTxn;
|
|
355
372
|
friend class WriteBatchWithIndex_SubBatchCnt_Test;
|
|
356
373
|
friend class WriteBatchWithIndexInternal;
|
|
374
|
+
friend class WBWIMemTable;
|
|
375
|
+
|
|
376
|
+
WBWIIterator* NewIterator(uint32_t cf_id) const;
|
|
377
|
+
|
|
357
378
|
// Returns the number of sub-batches inside the write batch. A sub-batch
|
|
358
379
|
// starts right before inserting a key that is a duplicate of a key in the
|
|
359
380
|
// last sub-batch.
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
// NOTE: in 'main' development branch, this should be the *next*
|
|
13
13
|
// minor or major version number planned for release.
|
|
14
14
|
#define ROCKSDB_MAJOR 9
|
|
15
|
-
#define ROCKSDB_MINOR
|
|
16
|
-
#define ROCKSDB_PATCH
|
|
15
|
+
#define ROCKSDB_MINOR 10
|
|
16
|
+
#define ROCKSDB_PATCH 0
|
|
17
17
|
|
|
18
18
|
// Do not use these. We made the mistake of declaring macros starting with
|
|
19
19
|
// double underscore. Now we have to live with our choice. We'll deprecate these
|
|
@@ -209,6 +209,8 @@ class WriteBatch : public WriteBatchBase {
|
|
|
209
209
|
|
|
210
210
|
using WriteBatchBase::Clear;
|
|
211
211
|
// Clear all updates buffered in this batch.
|
|
212
|
+
// Internally, it calls resize() on the string buffer. So allocated memory
|
|
213
|
+
// capacity may not be freed.
|
|
212
214
|
void Clear() override;
|
|
213
215
|
|
|
214
216
|
// Records the state of the batch for future calls to RollbackToSavePoint().
|