@nxtedition/rocksdb 8.1.2 → 8.1.4
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/deps/rocksdb/rocksdb/CMakeLists.txt +0 -9
- package/deps/rocksdb/rocksdb/Makefile +1 -13
- package/deps/rocksdb/rocksdb/TARGETS +0 -4
- package/deps/rocksdb/rocksdb/db/blob/blob_counting_iterator.h +0 -11
- package/deps/rocksdb/rocksdb/db/builder.cc +4 -13
- package/deps/rocksdb/rocksdb/db/builder.h +1 -2
- package/deps/rocksdb/rocksdb/db/c.cc +0 -15
- package/deps/rocksdb/rocksdb/db/c_test.c +0 -3
- package/deps/rocksdb/rocksdb/db/column_family.cc +5 -11
- package/deps/rocksdb/rocksdb/db/column_family.h +0 -20
- package/deps/rocksdb/rocksdb/db/compaction/clipping_iterator.h +0 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction.cc +37 -31
- package/deps/rocksdb/rocksdb/db/compaction/compaction.h +0 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.cc +7 -24
- package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.h +1 -17
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +1 -4
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +2 -4
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +6 -9
- package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.cc +26 -104
- package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.h +0 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.cc +18 -11
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.h +16 -17
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.cc +6 -19
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.h +5 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.cc +22 -22
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.h +5 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +52 -81
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.cc +1 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.h +5 -5
- package/deps/rocksdb/rocksdb/db/compaction/compaction_service_job.cc +2 -8
- package/deps/rocksdb/rocksdb/db/compaction/subcompaction_state.h +0 -8
- package/deps/rocksdb/rocksdb/db/compaction/tiered_compaction_test.cc +138 -266
- package/deps/rocksdb/rocksdb/db/corruption_test.cc +1 -86
- package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +3 -2
- package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +123 -897
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +20 -31
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +9 -5
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +28 -121
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_debug.cc +1 -1
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_experimental.cc +2 -3
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +0 -3
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +4 -8
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +0 -10
- package/deps/rocksdb/rocksdb/db/db_range_del_test.cc +4 -325
- package/deps/rocksdb/rocksdb/db/db_test.cc +0 -3
- package/deps/rocksdb/rocksdb/db/db_test2.cc +8 -233
- package/deps/rocksdb/rocksdb/db/db_test_util.h +0 -3
- package/deps/rocksdb/rocksdb/db/db_wal_test.cc +0 -129
- package/deps/rocksdb/rocksdb/db/db_with_timestamp_compaction_test.cc +0 -21
- package/deps/rocksdb/rocksdb/db/dbformat.cc +0 -25
- package/deps/rocksdb/rocksdb/db/dbformat.h +0 -2
- package/deps/rocksdb/rocksdb/db/experimental.cc +2 -3
- package/deps/rocksdb/rocksdb/db/external_sst_file_basic_test.cc +0 -3
- package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc +13 -92
- package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.h +1 -38
- package/deps/rocksdb/rocksdb/db/external_sst_file_test.cc +110 -14
- package/deps/rocksdb/rocksdb/db/flush_job.cc +4 -6
- package/deps/rocksdb/rocksdb/db/history_trimming_iterator.h +0 -4
- package/deps/rocksdb/rocksdb/db/import_column_family_job.cc +53 -56
- package/deps/rocksdb/rocksdb/db/import_column_family_test.cc +4 -3
- package/deps/rocksdb/rocksdb/db/memtable.cc +1 -1
- package/deps/rocksdb/rocksdb/db/merge_helper.cc +0 -4
- package/deps/rocksdb/rocksdb/db/periodic_task_scheduler_test.cc +10 -10
- package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter_test.cc +1 -1
- package/deps/rocksdb/rocksdb/db/repair.cc +22 -65
- package/deps/rocksdb/rocksdb/db/repair_test.cc +0 -54
- package/deps/rocksdb/rocksdb/db/seqno_time_test.cc +26 -26
- package/deps/rocksdb/rocksdb/db/table_properties_collector.h +1 -3
- package/deps/rocksdb/rocksdb/db/version_builder.cc +43 -90
- package/deps/rocksdb/rocksdb/db/version_builder.h +0 -20
- package/deps/rocksdb/rocksdb/db/version_builder_test.cc +93 -218
- package/deps/rocksdb/rocksdb/db/version_edit.cc +1 -27
- package/deps/rocksdb/rocksdb/db/version_edit.h +9 -33
- package/deps/rocksdb/rocksdb/db/version_edit_handler.cc +6 -13
- package/deps/rocksdb/rocksdb/db/version_edit_handler.h +6 -17
- package/deps/rocksdb/rocksdb/db/version_edit_test.cc +17 -19
- package/deps/rocksdb/rocksdb/db/version_set.cc +26 -166
- package/deps/rocksdb/rocksdb/db/version_set.h +2 -32
- package/deps/rocksdb/rocksdb/db/version_set_test.cc +31 -65
- package/deps/rocksdb/rocksdb/db/write_thread.cc +2 -5
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +0 -1
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.cc +32 -31
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.h +1 -2
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_env_wrapper.h +6 -8
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +0 -4
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +4 -11
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +15 -16
- package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +1 -13
- package/deps/rocksdb/rocksdb/file/prefetch_test.cc +75 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/c.h +0 -8
- package/deps/rocksdb/rocksdb/include/rocksdb/db.h +0 -6
- package/deps/rocksdb/rocksdb/include/rocksdb/listener.h +1 -7
- package/deps/rocksdb/rocksdb/include/rocksdb/metadata.h +3 -9
- package/deps/rocksdb/rocksdb/include/rocksdb/options.h +1 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/status.h +0 -3
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/backup_engine.h +9 -69
- package/deps/rocksdb/rocksdb/include/rocksdb/version.h +2 -2
- package/deps/rocksdb/rocksdb/memory/arena.cc +87 -23
- package/deps/rocksdb/rocksdb/memory/arena.h +31 -25
- package/deps/rocksdb/rocksdb/memory/arena_test.cc +0 -90
- package/deps/rocksdb/rocksdb/monitoring/stats_history_test.cc +26 -26
- package/deps/rocksdb/rocksdb/src.mk +0 -2
- package/deps/rocksdb/rocksdb/table/adaptive/adaptive_table_factory.cc +2 -3
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +2 -3
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_impl.h +2 -6
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_test.cc +1 -1
- package/deps/rocksdb/rocksdb/table/block_fetcher_test.cc +3 -3
- package/deps/rocksdb/rocksdb/table/format.cc +20 -24
- package/deps/rocksdb/rocksdb/table/format.h +2 -5
- package/deps/rocksdb/rocksdb/table/merging_iterator.cc +105 -54
- package/deps/rocksdb/rocksdb/table/merging_iterator.h +0 -80
- package/deps/rocksdb/rocksdb/table/meta_blocks.cc +2 -2
- package/deps/rocksdb/rocksdb/table/sst_file_dumper.cc +1 -1
- package/deps/rocksdb/rocksdb/table/table_test.cc +6 -7
- package/deps/rocksdb/rocksdb/test_util/testutil.h +0 -10
- package/deps/rocksdb/rocksdb/trace_replay/block_cache_tracer.h +2 -2
- package/deps/rocksdb/rocksdb/util/bloom_test.cc +1 -1
- package/deps/rocksdb/rocksdb/util/status.cc +0 -7
- package/deps/rocksdb/rocksdb/utilities/backup/backup_engine.cc +74 -250
- package/deps/rocksdb/rocksdb/utilities/backup/backup_engine_test.cc +4 -199
- package/deps/rocksdb/rocksdb/utilities/checkpoint/checkpoint_impl.cc +0 -1
- package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.cc +0 -39
- package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.h +0 -9
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.cc +0 -59
- package/deps/rocksdb/rocksdb.gyp +0 -3
- package/index.js +2 -2
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
- package/deps/rocksdb/rocksdb/port/mmap.cc +0 -98
- package/deps/rocksdb/rocksdb/port/mmap.h +0 -70
- package/deps/rocksdb/rocksdb/table/compaction_merging_iterator.cc +0 -142
- package/deps/rocksdb/rocksdb/table/compaction_merging_iterator.h +0 -241
|
@@ -796,7 +796,6 @@ set(SOURCES
|
|
|
796
796
|
options/options.cc
|
|
797
797
|
options/options_helper.cc
|
|
798
798
|
options/options_parser.cc
|
|
799
|
-
port/mmap.cc
|
|
800
799
|
port/stack_trace.cc
|
|
801
800
|
table/adaptive/adaptive_table_factory.cc
|
|
802
801
|
table/block_based/binary_search_index_reader.cc
|
|
@@ -831,7 +830,6 @@ set(SOURCES
|
|
|
831
830
|
table/get_context.cc
|
|
832
831
|
table/iterator.cc
|
|
833
832
|
table/merging_iterator.cc
|
|
834
|
-
table/compaction_merging_iterator.cc
|
|
835
833
|
table/meta_blocks.cc
|
|
836
834
|
table/persistent_cache_helper.cc
|
|
837
835
|
table/plain/plain_table_bloom.cc
|
|
@@ -980,12 +978,6 @@ if ( ROCKSDB_PLUGINS )
|
|
|
980
978
|
plugin/${plugin}/${src}
|
|
981
979
|
PROPERTIES COMPILE_FLAGS "${${plugin}_COMPILE_FLAGS}")
|
|
982
980
|
endforeach()
|
|
983
|
-
foreach (test ${${plugin}_TESTS})
|
|
984
|
-
list(APPEND PLUGIN_TESTS plugin/${plugin}/${test})
|
|
985
|
-
set_source_files_properties(
|
|
986
|
-
plugin/${plugin}/${test}
|
|
987
|
-
PROPERTIES COMPILE_FLAGS "${${plugin}_COMPILE_FLAGS}")
|
|
988
|
-
endforeach()
|
|
989
981
|
foreach (path ${${plugin}_INCLUDE_PATHS})
|
|
990
982
|
include_directories(${path})
|
|
991
983
|
endforeach()
|
|
@@ -1477,7 +1469,6 @@ if(WITH_TESTS)
|
|
|
1477
1469
|
utilities/ttl/ttl_test.cc
|
|
1478
1470
|
utilities/util_merge_operators_test.cc
|
|
1479
1471
|
utilities/write_batch_with_index/write_batch_with_index_test.cc
|
|
1480
|
-
${PLUGIN_TESTS}
|
|
1481
1472
|
)
|
|
1482
1473
|
endif()
|
|
1483
1474
|
|
|
@@ -266,7 +266,6 @@ ROCKSDB_PLUGIN_EXTERNS = $(foreach p, $(ROCKSDB_PLUGIN_W_FUNCS), int $($(p)_FUNC
|
|
|
266
266
|
ROCKSDB_PLUGIN_BUILTINS = $(foreach p, $(ROCKSDB_PLUGIN_W_FUNCS), {\"$(p)\"\, $($(p)_FUNC)}\,)
|
|
267
267
|
ROCKSDB_PLUGIN_LDFLAGS = $(foreach plugin, $(ROCKSDB_PLUGINS), $($(plugin)_LDFLAGS))
|
|
268
268
|
ROCKSDB_PLUGIN_PKGCONFIG_REQUIRES = $(foreach plugin, $(ROCKSDB_PLUGINS), $($(plugin)_PKGCONFIG_REQUIRES))
|
|
269
|
-
ROCKSDB_PLUGIN_TESTS = $(foreach p, $(ROCKSDB_PLUGINS), $(foreach test, $($(p)_TESTS), plugin/$(p)/$(test)))
|
|
270
269
|
|
|
271
270
|
CXXFLAGS += $(foreach plugin, $(ROCKSDB_PLUGINS), $($(plugin)_CXXFLAGS))
|
|
272
271
|
PLATFORM_LDFLAGS += $(ROCKSDB_PLUGIN_LDFLAGS)
|
|
@@ -648,12 +647,10 @@ STRESS_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(STRESS_LIB_SOURCES))
|
|
|
648
647
|
ALL_SOURCES = $(filter-out util/build_version.cc, $(LIB_SOURCES)) $(TEST_LIB_SOURCES) $(MOCK_LIB_SOURCES) $(GTEST_DIR)/gtest/gtest-all.cc
|
|
649
648
|
ALL_SOURCES += $(TOOL_LIB_SOURCES) $(BENCH_LIB_SOURCES) $(CACHE_BENCH_LIB_SOURCES) $(ANALYZER_LIB_SOURCES) $(STRESS_LIB_SOURCES)
|
|
650
649
|
ALL_SOURCES += $(TEST_MAIN_SOURCES) $(TOOL_MAIN_SOURCES) $(BENCH_MAIN_SOURCES)
|
|
651
|
-
ALL_SOURCES += $(ROCKSDB_PLUGIN_SOURCES)
|
|
650
|
+
ALL_SOURCES += $(ROCKSDB_PLUGIN_SOURCES)
|
|
652
651
|
|
|
653
|
-
PLUGIN_TESTS = $(patsubst %.cc, %, $(notdir $(ROCKSDB_PLUGIN_TESTS)))
|
|
654
652
|
TESTS = $(patsubst %.cc, %, $(notdir $(TEST_MAIN_SOURCES)))
|
|
655
653
|
TESTS += $(patsubst %.c, %, $(notdir $(TEST_MAIN_SOURCES_C)))
|
|
656
|
-
TESTS += $(PLUGIN_TESTS)
|
|
657
654
|
|
|
658
655
|
# `make check-headers` to very that each header file includes its own
|
|
659
656
|
# dependencies
|
|
@@ -705,7 +702,6 @@ NON_PARALLEL_TEST = \
|
|
|
705
702
|
env_test \
|
|
706
703
|
deletefile_test \
|
|
707
704
|
db_bloom_filter_test \
|
|
708
|
-
$(PLUGIN_TESTS) \
|
|
709
705
|
|
|
710
706
|
PARALLEL_TEST = $(filter-out $(NON_PARALLEL_TEST), $(TESTS))
|
|
711
707
|
|
|
@@ -1359,14 +1355,6 @@ db_sanity_test: $(OBJ_DIR)/tools/db_sanity_test.o $(LIBRARY)
|
|
|
1359
1355
|
db_repl_stress: $(OBJ_DIR)/tools/db_repl_stress.o $(LIBRARY)
|
|
1360
1356
|
$(AM_LINK)
|
|
1361
1357
|
|
|
1362
|
-
define MakeTestRule
|
|
1363
|
-
$(notdir $(1:%.cc=%)): $(1:%.cc=$$(OBJ_DIR)/%.o) $$(TEST_LIBRARY) $$(LIBRARY)
|
|
1364
|
-
$$(AM_LINK)
|
|
1365
|
-
endef
|
|
1366
|
-
|
|
1367
|
-
# For each PLUGIN test, create a rule to generate the test executable
|
|
1368
|
-
$(foreach test, $(ROCKSDB_PLUGIN_TESTS), $(eval $(call MakeTestRule, $(test))))
|
|
1369
|
-
|
|
1370
1358
|
arena_test: $(OBJ_DIR)/memory/arena_test.o $(TEST_LIBRARY) $(LIBRARY)
|
|
1371
1359
|
$(AM_LINK)
|
|
1372
1360
|
|
|
@@ -163,7 +163,6 @@ cpp_library_wrapper(name="rocksdb_lib", srcs=[
|
|
|
163
163
|
"options/options.cc",
|
|
164
164
|
"options/options_helper.cc",
|
|
165
165
|
"options/options_parser.cc",
|
|
166
|
-
"port/mmap.cc",
|
|
167
166
|
"port/port_posix.cc",
|
|
168
167
|
"port/stack_trace.cc",
|
|
169
168
|
"port/win/env_default.cc",
|
|
@@ -198,7 +197,6 @@ cpp_library_wrapper(name="rocksdb_lib", srcs=[
|
|
|
198
197
|
"table/block_based/reader_common.cc",
|
|
199
198
|
"table/block_based/uncompression_dict_reader.cc",
|
|
200
199
|
"table/block_fetcher.cc",
|
|
201
|
-
"table/compaction_merging_iterator.cc",
|
|
202
200
|
"table/cuckoo/cuckoo_table_builder.cc",
|
|
203
201
|
"table/cuckoo/cuckoo_table_factory.cc",
|
|
204
202
|
"table/cuckoo/cuckoo_table_reader.cc",
|
|
@@ -504,7 +502,6 @@ cpp_library_wrapper(name="rocksdb_whole_archive_lib", srcs=[
|
|
|
504
502
|
"options/options.cc",
|
|
505
503
|
"options/options_helper.cc",
|
|
506
504
|
"options/options_parser.cc",
|
|
507
|
-
"port/mmap.cc",
|
|
508
505
|
"port/port_posix.cc",
|
|
509
506
|
"port/stack_trace.cc",
|
|
510
507
|
"port/win/env_default.cc",
|
|
@@ -539,7 +536,6 @@ cpp_library_wrapper(name="rocksdb_whole_archive_lib", srcs=[
|
|
|
539
536
|
"table/block_based/reader_common.cc",
|
|
540
537
|
"table/block_based/uncompression_dict_reader.cc",
|
|
541
538
|
"table/block_fetcher.cc",
|
|
542
|
-
"table/compaction_merging_iterator.cc",
|
|
543
539
|
"table/cuckoo/cuckoo_table_builder.cc",
|
|
544
540
|
"table/cuckoo/cuckoo_table_factory.cc",
|
|
545
541
|
"table/cuckoo/cuckoo_table_reader.cc",
|
|
@@ -123,10 +123,6 @@ class BlobCountingIterator : public InternalIterator {
|
|
|
123
123
|
return iter_->GetProperty(prop_name, prop);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
bool IsDeleteRangeSentinelKey() const override {
|
|
127
|
-
return iter_->IsDeleteRangeSentinelKey();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
126
|
private:
|
|
131
127
|
void UpdateAndCountBlobIfNeeded() {
|
|
132
128
|
assert(!iter_->Valid() || iter_->status().ok());
|
|
@@ -134,13 +130,6 @@ class BlobCountingIterator : public InternalIterator {
|
|
|
134
130
|
if (!iter_->Valid()) {
|
|
135
131
|
status_ = iter_->status();
|
|
136
132
|
return;
|
|
137
|
-
} else if (iter_->IsDeleteRangeSentinelKey()) {
|
|
138
|
-
// CompactionMergingIterator emits range tombstones, and range tombstone
|
|
139
|
-
// keys can be truncated at file boundaries. This means the range
|
|
140
|
-
// tombstone keys can have op_type kTypeBlobIndex.
|
|
141
|
-
// This could crash the ProcessInFlow() call below since
|
|
142
|
-
// value is empty for these keys.
|
|
143
|
-
return;
|
|
144
133
|
}
|
|
145
134
|
|
|
146
135
|
TEST_SYNC_POINT(
|
|
@@ -71,9 +71,8 @@ Status BuildTable(
|
|
|
71
71
|
int job_id, const Env::IOPriority io_priority,
|
|
72
72
|
TableProperties* table_properties, Env::WriteLifeTimeHint write_hint,
|
|
73
73
|
const std::string* full_history_ts_low,
|
|
74
|
-
BlobFileCompletionCallback* blob_callback,
|
|
75
|
-
uint64_t*
|
|
76
|
-
uint64_t* memtable_garbage_bytes) {
|
|
74
|
+
BlobFileCompletionCallback* blob_callback, uint64_t* num_input_entries,
|
|
75
|
+
uint64_t* memtable_payload_bytes, uint64_t* memtable_garbage_bytes) {
|
|
77
76
|
assert((tboptions.column_family_id ==
|
|
78
77
|
TablePropertiesCollectorFactory::Context::kUnknownColumnFamily) ==
|
|
79
78
|
tboptions.column_family_name.empty());
|
|
@@ -247,17 +246,9 @@ Status BuildTable(
|
|
|
247
246
|
auto tombstone = range_del_it->Tombstone();
|
|
248
247
|
auto kv = tombstone.Serialize();
|
|
249
248
|
builder->Add(kv.first.Encode(), kv.second);
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
meta->UpdateBoundariesForRange(kv.first, tombstone.SerializeEndKey(),
|
|
250
|
+
tombstone.seq_,
|
|
252
251
|
tboptions.internal_comparator);
|
|
253
|
-
if (version) {
|
|
254
|
-
SizeApproximationOptions approx_opts;
|
|
255
|
-
approx_opts.files_size_error_margin = 0.1;
|
|
256
|
-
meta->compensated_range_deletion_size += versions->ApproximateSize(
|
|
257
|
-
approx_opts, version, kv.first.Encode(), tombstone_end.Encode(),
|
|
258
|
-
0 /* start_level */, -1 /* end_level */,
|
|
259
|
-
TableReaderCaller::kFlush);
|
|
260
|
-
}
|
|
261
252
|
}
|
|
262
253
|
}
|
|
263
254
|
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
#include "db/range_tombstone_fragmenter.h"
|
|
14
14
|
#include "db/seqno_to_time_mapping.h"
|
|
15
15
|
#include "db/table_properties_collector.h"
|
|
16
|
-
#include "db/version_set.h"
|
|
17
16
|
#include "logging/event_logger.h"
|
|
18
17
|
#include "options/cf_options.h"
|
|
19
18
|
#include "rocksdb/comparator.h"
|
|
@@ -71,7 +70,7 @@ extern Status BuildTable(
|
|
|
71
70
|
Env::WriteLifeTimeHint write_hint = Env::WLTH_NOT_SET,
|
|
72
71
|
const std::string* full_history_ts_low = nullptr,
|
|
73
72
|
BlobFileCompletionCallback* blob_callback = nullptr,
|
|
74
|
-
|
|
73
|
+
uint64_t* num_input_entries = nullptr,
|
|
75
74
|
uint64_t* memtable_payload_bytes = nullptr,
|
|
76
75
|
uint64_t* memtable_garbage_bytes = nullptr);
|
|
77
76
|
|
|
@@ -2588,12 +2588,6 @@ void rocksdb_block_based_options_set_partition_filters(
|
|
|
2588
2588
|
options->rep.partition_filters = partition_filters;
|
|
2589
2589
|
}
|
|
2590
2590
|
|
|
2591
|
-
void rocksdb_block_based_options_set_optimize_filters_for_memory(
|
|
2592
|
-
rocksdb_block_based_table_options_t* options,
|
|
2593
|
-
unsigned char optimize_filters_for_memory) {
|
|
2594
|
-
options->rep.optimize_filters_for_memory = optimize_filters_for_memory;
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
2591
|
void rocksdb_block_based_options_set_use_delta_encoding(
|
|
2598
2592
|
rocksdb_block_based_table_options_t* options,
|
|
2599
2593
|
unsigned char use_delta_encoding) {
|
|
@@ -4449,15 +4443,6 @@ rocksdb_readoptions_get_io_timeout(rocksdb_readoptions_t* opt) {
|
|
|
4449
4443
|
return opt->rep.io_timeout.count();
|
|
4450
4444
|
}
|
|
4451
4445
|
|
|
4452
|
-
void rocksdb_readoptions_set_async_io(rocksdb_readoptions_t* opt,
|
|
4453
|
-
unsigned char v) {
|
|
4454
|
-
opt->rep.async_io = v;
|
|
4455
|
-
}
|
|
4456
|
-
|
|
4457
|
-
unsigned char rocksdb_readoptions_get_async_io(rocksdb_readoptions_t* opt) {
|
|
4458
|
-
return opt->rep.async_io;
|
|
4459
|
-
}
|
|
4460
|
-
|
|
4461
4446
|
void rocksdb_readoptions_set_timestamp(rocksdb_readoptions_t* opt,
|
|
4462
4447
|
const char* ts, size_t tslen) {
|
|
4463
4448
|
if (ts == nullptr) {
|
|
@@ -2572,9 +2572,6 @@ int main(int argc, char** argv) {
|
|
|
2572
2572
|
rocksdb_readoptions_set_io_timeout(ro, 400);
|
|
2573
2573
|
CheckCondition(400 == rocksdb_readoptions_get_io_timeout(ro));
|
|
2574
2574
|
|
|
2575
|
-
rocksdb_readoptions_set_async_io(ro, 1);
|
|
2576
|
-
CheckCondition(1 == rocksdb_readoptions_get_async_io(ro));
|
|
2577
|
-
|
|
2578
2575
|
rocksdb_readoptions_destroy(ro);
|
|
2579
2576
|
}
|
|
2580
2577
|
|
|
@@ -565,8 +565,7 @@ ColumnFamilyData::ColumnFamilyData(
|
|
|
565
565
|
allow_2pc_(db_options.allow_2pc),
|
|
566
566
|
last_memtable_id_(0),
|
|
567
567
|
db_paths_registered_(false),
|
|
568
|
-
mempurge_used_(false)
|
|
569
|
-
next_epoch_number_(1) {
|
|
568
|
+
mempurge_used_(false) {
|
|
570
569
|
if (id_ != kDummyColumnFamilyDataId) {
|
|
571
570
|
// TODO(cc): RegisterDbPaths can be expensive, considering moving it
|
|
572
571
|
// outside of this constructor which might be called with db mutex held.
|
|
@@ -1129,9 +1128,12 @@ bool ColumnFamilyData::NeedsCompaction() const {
|
|
|
1129
1128
|
Compaction* ColumnFamilyData::PickCompaction(
|
|
1130
1129
|
const MutableCFOptions& mutable_options,
|
|
1131
1130
|
const MutableDBOptions& mutable_db_options, LogBuffer* log_buffer) {
|
|
1131
|
+
SequenceNumber earliest_mem_seqno =
|
|
1132
|
+
std::min(mem_->GetEarliestSequenceNumber(),
|
|
1133
|
+
imm_.current()->GetEarliestSequenceNumber(false));
|
|
1132
1134
|
auto* result = compaction_picker_->PickCompaction(
|
|
1133
1135
|
GetName(), mutable_options, mutable_db_options, current_->storage_info(),
|
|
1134
|
-
log_buffer);
|
|
1136
|
+
log_buffer, earliest_mem_seqno);
|
|
1135
1137
|
if (result != nullptr) {
|
|
1136
1138
|
result->SetInputVersion(current_);
|
|
1137
1139
|
}
|
|
@@ -1218,7 +1220,6 @@ Compaction* ColumnFamilyData::CompactRange(
|
|
|
1218
1220
|
if (result != nullptr) {
|
|
1219
1221
|
result->SetInputVersion(current_);
|
|
1220
1222
|
}
|
|
1221
|
-
TEST_SYNC_POINT("ColumnFamilyData::CompactRange:Return");
|
|
1222
1223
|
return result;
|
|
1223
1224
|
}
|
|
1224
1225
|
|
|
@@ -1519,13 +1520,6 @@ FSDirectory* ColumnFamilyData::GetDataDir(size_t path_id) const {
|
|
|
1519
1520
|
return data_dirs_[path_id].get();
|
|
1520
1521
|
}
|
|
1521
1522
|
|
|
1522
|
-
void ColumnFamilyData::RecoverEpochNumbers() {
|
|
1523
|
-
assert(current_);
|
|
1524
|
-
auto* vstorage = current_->storage_info();
|
|
1525
|
-
assert(vstorage);
|
|
1526
|
-
vstorage->RecoverEpochNumbers(this);
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
1523
|
ColumnFamilySet::ColumnFamilySet(const std::string& dbname,
|
|
1530
1524
|
const ImmutableDBOptions* db_options,
|
|
1531
1525
|
const FileOptions& file_options,
|
|
@@ -533,24 +533,6 @@ class ColumnFamilyData {
|
|
|
533
533
|
void SetMempurgeUsed() { mempurge_used_ = true; }
|
|
534
534
|
bool GetMempurgeUsed() { return mempurge_used_; }
|
|
535
535
|
|
|
536
|
-
// Allocate and return a new epoch number
|
|
537
|
-
uint64_t NewEpochNumber() { return next_epoch_number_.fetch_add(1); }
|
|
538
|
-
|
|
539
|
-
// Get the next epoch number to be assigned
|
|
540
|
-
uint64_t GetNextEpochNumber() const { return next_epoch_number_.load(); }
|
|
541
|
-
|
|
542
|
-
// Set the next epoch number to be assigned
|
|
543
|
-
void SetNextEpochNumber(uint64_t next_epoch_number) {
|
|
544
|
-
next_epoch_number_.store(next_epoch_number);
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
// Reset the next epoch number to be assigned
|
|
548
|
-
void ResetNextEpochNumber() { next_epoch_number_.store(1); }
|
|
549
|
-
|
|
550
|
-
// Recover the next epoch number of this CF and epoch number
|
|
551
|
-
// of its files (if missing)
|
|
552
|
-
void RecoverEpochNumbers();
|
|
553
|
-
|
|
554
536
|
private:
|
|
555
537
|
friend class ColumnFamilySet;
|
|
556
538
|
ColumnFamilyData(uint32_t id, const std::string& name,
|
|
@@ -652,8 +634,6 @@ class ColumnFamilyData {
|
|
|
652
634
|
// a Version associated with this CFD
|
|
653
635
|
std::shared_ptr<CacheReservationManager> file_metadata_cache_res_mgr_;
|
|
654
636
|
bool mempurge_used_;
|
|
655
|
-
|
|
656
|
-
std::atomic<uint64_t> next_epoch_number_;
|
|
657
637
|
};
|
|
658
638
|
|
|
659
639
|
// ColumnFamilySet has interesting thread-safety requirements
|
|
@@ -188,11 +188,6 @@ class ClippingIterator : public InternalIterator {
|
|
|
188
188
|
return iter_->GetProperty(prop_name, prop);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
bool IsDeleteRangeSentinelKey() const override {
|
|
192
|
-
assert(valid_);
|
|
193
|
-
return iter_->IsDeleteRangeSentinelKey();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
191
|
private:
|
|
197
192
|
void UpdateValid() {
|
|
198
193
|
assert(!iter_->Valid() || iter_->status().ok());
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
|
|
21
21
|
namespace ROCKSDB_NAMESPACE {
|
|
22
22
|
|
|
23
|
+
const uint64_t kRangeTombstoneSentinel =
|
|
24
|
+
PackSequenceAndType(kMaxSequenceNumber, kTypeRangeDeletion);
|
|
25
|
+
|
|
23
26
|
int sstableKeyCompare(const Comparator* user_cmp, const InternalKey& a,
|
|
24
27
|
const InternalKey& b) {
|
|
25
28
|
auto c = user_cmp->CompareWithoutTimestamp(a.user_key(), b.user_key());
|
|
@@ -235,19 +238,12 @@ Compaction::Compaction(
|
|
|
235
238
|
inputs_(PopulateWithAtomicBoundaries(vstorage, std::move(_inputs))),
|
|
236
239
|
grandparents_(std::move(_grandparents)),
|
|
237
240
|
score_(_score),
|
|
238
|
-
bottommost_level_(
|
|
239
|
-
// For simplicity, we don't support the concept of "bottommost level"
|
|
240
|
-
// with
|
|
241
|
-
// `CompactionReason::kExternalSstIngestion` and
|
|
242
|
-
// `CompactionReason::kRefitLevel`
|
|
243
|
-
(_compaction_reason == CompactionReason::kExternalSstIngestion ||
|
|
244
|
-
_compaction_reason == CompactionReason::kRefitLevel)
|
|
245
|
-
? false
|
|
246
|
-
: IsBottommostLevel(output_level_, vstorage, inputs_)),
|
|
241
|
+
bottommost_level_(IsBottommostLevel(output_level_, vstorage, inputs_)),
|
|
247
242
|
is_full_compaction_(IsFullCompaction(vstorage, inputs_)),
|
|
248
243
|
is_manual_compaction_(_manual_compaction),
|
|
249
244
|
trim_ts_(_trim_ts),
|
|
250
245
|
is_trivial_move_(false),
|
|
246
|
+
|
|
251
247
|
compaction_reason_(_compaction_reason),
|
|
252
248
|
notify_on_compaction_completion_(false),
|
|
253
249
|
enable_blob_garbage_collection_(
|
|
@@ -262,15 +258,8 @@ Compaction::Compaction(
|
|
|
262
258
|
_blob_garbage_collection_age_cutoff > 1
|
|
263
259
|
? mutable_cf_options()->blob_garbage_collection_age_cutoff
|
|
264
260
|
: _blob_garbage_collection_age_cutoff),
|
|
265
|
-
penultimate_level_(
|
|
266
|
-
|
|
267
|
-
// with `CompactionReason::kExternalSstIngestion` and
|
|
268
|
-
// `CompactionReason::kRefitLevel`
|
|
269
|
-
_compaction_reason == CompactionReason::kExternalSstIngestion ||
|
|
270
|
-
_compaction_reason == CompactionReason::kRefitLevel
|
|
271
|
-
? Compaction::kInvalidLevel
|
|
272
|
-
: EvaluatePenultimateLevel(vstorage, immutable_options_,
|
|
273
|
-
start_level_, output_level_)) {
|
|
261
|
+
penultimate_level_(EvaluatePenultimateLevel(
|
|
262
|
+
vstorage, immutable_options_, start_level_, output_level_)) {
|
|
274
263
|
MarkFilesBeingCompacted(true);
|
|
275
264
|
if (is_manual_compaction_) {
|
|
276
265
|
compaction_reason_ = CompactionReason::kManualCompaction;
|
|
@@ -343,7 +332,6 @@ void Compaction::PopulatePenultimateLevelOutputRange() {
|
|
|
343
332
|
// the case that the penultimate level is empty).
|
|
344
333
|
if (immutable_options_.compaction_style == kCompactionStyleUniversal) {
|
|
345
334
|
exclude_level = kInvalidLevel;
|
|
346
|
-
penultimate_output_range_type_ = PenultimateOutputRangeType::kFullRange;
|
|
347
335
|
std::set<uint64_t> penultimate_inputs;
|
|
348
336
|
for (const auto& input_lvl : inputs_) {
|
|
349
337
|
if (input_lvl.level == penultimate_level_) {
|
|
@@ -357,8 +345,7 @@ void Compaction::PopulatePenultimateLevelOutputRange() {
|
|
|
357
345
|
if (penultimate_inputs.find(file->fd.GetNumber()) ==
|
|
358
346
|
penultimate_inputs.end()) {
|
|
359
347
|
exclude_level = number_levels_ - 1;
|
|
360
|
-
penultimate_output_range_type_ =
|
|
361
|
-
PenultimateOutputRangeType::kNonLastRange;
|
|
348
|
+
penultimate_output_range_type_ = PenultimateOutputRangeType::kFullRange;
|
|
362
349
|
break;
|
|
363
350
|
}
|
|
364
351
|
}
|
|
@@ -367,6 +354,35 @@ void Compaction::PopulatePenultimateLevelOutputRange() {
|
|
|
367
354
|
GetBoundaryKeys(input_vstorage_, inputs_,
|
|
368
355
|
&penultimate_level_smallest_user_key_,
|
|
369
356
|
&penultimate_level_largest_user_key_, exclude_level);
|
|
357
|
+
|
|
358
|
+
// If there's a case that the penultimate level output range is overlapping
|
|
359
|
+
// with the existing files, disable the penultimate level output by setting
|
|
360
|
+
// the range to empty. One example is the range delete could have overlap
|
|
361
|
+
// boundary with the next file. (which is actually a false overlap)
|
|
362
|
+
// TODO: Exclude such false overlap, so it won't disable the penultimate
|
|
363
|
+
// output.
|
|
364
|
+
std::set<uint64_t> penultimate_inputs;
|
|
365
|
+
for (const auto& input_lvl : inputs_) {
|
|
366
|
+
if (input_lvl.level == penultimate_level_) {
|
|
367
|
+
for (const auto& file : input_lvl.files) {
|
|
368
|
+
penultimate_inputs.emplace(file->fd.GetNumber());
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
auto penultimate_files = input_vstorage_->LevelFiles(penultimate_level_);
|
|
374
|
+
for (const auto& file : penultimate_files) {
|
|
375
|
+
if (penultimate_inputs.find(file->fd.GetNumber()) ==
|
|
376
|
+
penultimate_inputs.end() &&
|
|
377
|
+
OverlapPenultimateLevelOutputRange(file->smallest.user_key(),
|
|
378
|
+
file->largest.user_key())) {
|
|
379
|
+
// basically disable the penultimate range output. which should be rare
|
|
380
|
+
// or a false overlap caused by range del
|
|
381
|
+
penultimate_level_smallest_user_key_ = "";
|
|
382
|
+
penultimate_level_largest_user_key_ = "";
|
|
383
|
+
penultimate_output_range_type_ = PenultimateOutputRangeType::kDisabled;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
370
386
|
}
|
|
371
387
|
|
|
372
388
|
Compaction::~Compaction() {
|
|
@@ -791,16 +807,6 @@ uint64_t Compaction::MinInputFileOldestAncesterTime(
|
|
|
791
807
|
return min_oldest_ancester_time;
|
|
792
808
|
}
|
|
793
809
|
|
|
794
|
-
uint64_t Compaction::MinInputFileEpochNumber() const {
|
|
795
|
-
uint64_t min_epoch_number = std::numeric_limits<uint64_t>::max();
|
|
796
|
-
for (const auto& inputs_per_level : inputs_) {
|
|
797
|
-
for (const auto& file : inputs_per_level.files) {
|
|
798
|
-
min_epoch_number = std::min(min_epoch_number, file->epoch_number);
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
return min_epoch_number;
|
|
802
|
-
}
|
|
803
|
-
|
|
804
810
|
int Compaction::EvaluatePenultimateLevel(
|
|
805
811
|
const VersionStorageInfo* vstorage,
|
|
806
812
|
const ImmutableOptions& immutable_options, const int start_level,
|
|
@@ -18,8 +18,6 @@ namespace ROCKSDB_NAMESPACE {
|
|
|
18
18
|
// The file contains class Compaction, as well as some helper functions
|
|
19
19
|
// and data structures used by the class.
|
|
20
20
|
|
|
21
|
-
const uint64_t kRangeTombstoneSentinel =
|
|
22
|
-
PackSequenceAndType(kMaxSequenceNumber, kTypeRangeDeletion);
|
|
23
21
|
// Utility for comparing sstable boundary keys. Returns -1 if either a or b is
|
|
24
22
|
// null which provides the property that a==null indicates a key that is less
|
|
25
23
|
// than any key and b==null indicates a key that is greater than any key. Note
|
|
@@ -380,9 +378,6 @@ class Compaction {
|
|
|
380
378
|
// This is used to filter out some input files' ancester's time range.
|
|
381
379
|
uint64_t MinInputFileOldestAncesterTime(const InternalKey* start,
|
|
382
380
|
const InternalKey* end) const;
|
|
383
|
-
// Return the minimum epoch number among
|
|
384
|
-
// input files' associated with this compaction
|
|
385
|
-
uint64_t MinInputFileEpochNumber() const;
|
|
386
381
|
|
|
387
382
|
// Called by DBImpl::NotifyOnCompactionCompleted to make sure number of
|
|
388
383
|
// compaction begin and compaction completion callbacks match.
|
|
@@ -377,7 +377,6 @@ void CompactionIterator::NextFromInput() {
|
|
|
377
377
|
value_ = input_.value();
|
|
378
378
|
blob_value_.Reset();
|
|
379
379
|
iter_stats_.num_input_records++;
|
|
380
|
-
is_range_del_ = input_.IsDeleteRangeSentinelKey();
|
|
381
380
|
|
|
382
381
|
Status pik_status = ParseInternalKey(key_, &ikey_, allow_data_in_errors_);
|
|
383
382
|
if (!pik_status.ok()) {
|
|
@@ -397,10 +396,7 @@ void CompactionIterator::NextFromInput() {
|
|
|
397
396
|
break;
|
|
398
397
|
}
|
|
399
398
|
TEST_SYNC_POINT_CALLBACK("CompactionIterator:ProcessKV", &ikey_);
|
|
400
|
-
|
|
401
|
-
validity_info_.SetValid(kRangeDeletion);
|
|
402
|
-
break;
|
|
403
|
-
}
|
|
399
|
+
|
|
404
400
|
// Update input statistics
|
|
405
401
|
if (ikey_.type == kTypeDeletion || ikey_.type == kTypeSingleDeletion ||
|
|
406
402
|
ikey_.type == kTypeDeletionWithTimestamp) {
|
|
@@ -622,14 +618,6 @@ void CompactionIterator::NextFromInput() {
|
|
|
622
618
|
|
|
623
619
|
ParsedInternalKey next_ikey;
|
|
624
620
|
AdvanceInputIter();
|
|
625
|
-
while (input_.Valid() && input_.IsDeleteRangeSentinelKey() &&
|
|
626
|
-
ParseInternalKey(input_.key(), &next_ikey, allow_data_in_errors_)
|
|
627
|
-
.ok() &&
|
|
628
|
-
cmp_->EqualWithoutTimestamp(ikey_.user_key, next_ikey.user_key)) {
|
|
629
|
-
// skip range tombstone start keys with the same user key
|
|
630
|
-
// since they are not "real" point keys.
|
|
631
|
-
AdvanceInputIter();
|
|
632
|
-
}
|
|
633
621
|
|
|
634
622
|
// Check whether the next key exists, is not corrupt, and is the same key
|
|
635
623
|
// as the single delete.
|
|
@@ -637,7 +625,6 @@ void CompactionIterator::NextFromInput() {
|
|
|
637
625
|
ParseInternalKey(input_.key(), &next_ikey, allow_data_in_errors_)
|
|
638
626
|
.ok() &&
|
|
639
627
|
cmp_->EqualWithoutTimestamp(ikey_.user_key, next_ikey.user_key)) {
|
|
640
|
-
assert(!input_.IsDeleteRangeSentinelKey());
|
|
641
628
|
#ifndef NDEBUG
|
|
642
629
|
const Compaction* c =
|
|
643
630
|
compaction_ ? compaction_->real_compaction() : nullptr;
|
|
@@ -862,14 +849,12 @@ void CompactionIterator::NextFromInput() {
|
|
|
862
849
|
// Note that a deletion marker of type kTypeDeletionWithTimestamp will be
|
|
863
850
|
// considered to have a different user key unless the timestamp is older
|
|
864
851
|
// than *full_history_ts_low_.
|
|
865
|
-
//
|
|
866
|
-
// Range tombstone start keys are skipped as they are not "real" keys.
|
|
867
852
|
while (!IsPausingManualCompaction() && !IsShuttingDown() &&
|
|
868
853
|
input_.Valid() &&
|
|
869
854
|
(ParseInternalKey(input_.key(), &next_ikey, allow_data_in_errors_)
|
|
870
855
|
.ok()) &&
|
|
871
856
|
cmp_->EqualWithoutTimestamp(ikey_.user_key, next_ikey.user_key) &&
|
|
872
|
-
(prev_snapshot == 0 ||
|
|
857
|
+
(prev_snapshot == 0 ||
|
|
873
858
|
DefinitelyNotInSnapshot(next_ikey.sequence, prev_snapshot))) {
|
|
874
859
|
AdvanceInputIter();
|
|
875
860
|
}
|
|
@@ -1162,12 +1147,10 @@ void CompactionIterator::DecideOutputLevel() {
|
|
|
1162
1147
|
|
|
1163
1148
|
void CompactionIterator::PrepareOutput() {
|
|
1164
1149
|
if (Valid()) {
|
|
1165
|
-
if (
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
GarbageCollectBlobIfNeeded();
|
|
1170
|
-
}
|
|
1150
|
+
if (ikey_.type == kTypeValue) {
|
|
1151
|
+
ExtractLargeValueIfNeeded();
|
|
1152
|
+
} else if (ikey_.type == kTypeBlobIndex) {
|
|
1153
|
+
GarbageCollectBlobIfNeeded();
|
|
1171
1154
|
}
|
|
1172
1155
|
|
|
1173
1156
|
if (compaction_ != nullptr && compaction_->SupportsPerKeyPlacement()) {
|
|
@@ -1190,7 +1173,7 @@ void CompactionIterator::PrepareOutput() {
|
|
|
1190
1173
|
DefinitelyInSnapshot(ikey_.sequence, earliest_snapshot_) &&
|
|
1191
1174
|
ikey_.type != kTypeMerge && current_key_committed_ &&
|
|
1192
1175
|
!output_to_penultimate_level_ &&
|
|
1193
|
-
ikey_.sequence < preserve_time_min_seqno_
|
|
1176
|
+
ikey_.sequence < preserve_time_min_seqno_) {
|
|
1194
1177
|
if (ikey_.type == kTypeDeletion ||
|
|
1195
1178
|
(ikey_.type == kTypeSingleDeletion && timestamp_size_ == 0)) {
|
|
1196
1179
|
ROCKS_LOG_FATAL(
|
|
@@ -63,10 +63,6 @@ class SequenceIterWrapper : public InternalIterator {
|
|
|
63
63
|
void SeekToLast() override { assert(false); }
|
|
64
64
|
|
|
65
65
|
uint64_t num_itered() const { return num_itered_; }
|
|
66
|
-
bool IsDeleteRangeSentinelKey() const override {
|
|
67
|
-
assert(Valid());
|
|
68
|
-
return inner_iter_->IsDeleteRangeSentinelKey();
|
|
69
|
-
}
|
|
70
66
|
|
|
71
67
|
private:
|
|
72
68
|
InternalKeyComparator icmp_;
|
|
@@ -246,12 +242,7 @@ class CompactionIterator {
|
|
|
246
242
|
const Status& status() const { return status_; }
|
|
247
243
|
const ParsedInternalKey& ikey() const { return ikey_; }
|
|
248
244
|
inline bool Valid() const { return validity_info_.IsValid(); }
|
|
249
|
-
const Slice& user_key() const {
|
|
250
|
-
if (UNLIKELY(is_range_del_)) {
|
|
251
|
-
return ikey_.user_key;
|
|
252
|
-
}
|
|
253
|
-
return current_user_key_;
|
|
254
|
-
}
|
|
245
|
+
const Slice& user_key() const { return current_user_key_; }
|
|
255
246
|
const CompactionIterationStats& iter_stats() const { return iter_stats_; }
|
|
256
247
|
uint64_t num_input_entry_scanned() const { return input_.num_itered(); }
|
|
257
248
|
// If the current key should be placed on penultimate level, only valid if
|
|
@@ -261,8 +252,6 @@ class CompactionIterator {
|
|
|
261
252
|
}
|
|
262
253
|
Status InputStatus() const { return input_.status(); }
|
|
263
254
|
|
|
264
|
-
bool IsDeleteRangeSentinelKey() const { return is_range_del_; }
|
|
265
|
-
|
|
266
255
|
private:
|
|
267
256
|
// Processes the input stream to find the next output
|
|
268
257
|
void NextFromInput();
|
|
@@ -396,7 +385,6 @@ class CompactionIterator {
|
|
|
396
385
|
kKeepSD = 8,
|
|
397
386
|
kKeepDel = 9,
|
|
398
387
|
kNewUserKey = 10,
|
|
399
|
-
kRangeDeletion = 11,
|
|
400
388
|
};
|
|
401
389
|
|
|
402
390
|
struct ValidityInfo {
|
|
@@ -504,10 +492,6 @@ class CompactionIterator {
|
|
|
504
492
|
// This is a best-effort facility, so memory_order_relaxed is sufficient.
|
|
505
493
|
return manual_compaction_canceled_.load(std::memory_order_relaxed);
|
|
506
494
|
}
|
|
507
|
-
|
|
508
|
-
// Stores whether the current compaction iterator output
|
|
509
|
-
// is a range tombstone start key.
|
|
510
|
-
bool is_range_del_{false};
|
|
511
495
|
};
|
|
512
496
|
|
|
513
497
|
inline bool CompactionIterator::DefinitelyInSnapshot(SequenceNumber seq,
|
|
@@ -99,8 +99,6 @@ const char* GetCompactionReasonString(CompactionReason compaction_reason) {
|
|
|
99
99
|
return "ForcedBlobGC";
|
|
100
100
|
case CompactionReason::kRoundRobinTtl:
|
|
101
101
|
return "RoundRobinTtl";
|
|
102
|
-
case CompactionReason::kRefitLevel:
|
|
103
|
-
return "RefitLevel";
|
|
104
102
|
case CompactionReason::kNumOfReasons:
|
|
105
103
|
// fall through
|
|
106
104
|
default:
|
|
@@ -1288,6 +1286,7 @@ void CompactionJob::ProcessKeyValueCompaction(SubcompactionState* sub_compact) {
|
|
|
1288
1286
|
while (status.ok() && !cfd->IsDropped() && c_iter->Valid()) {
|
|
1289
1287
|
// Invariant: c_iter.status() is guaranteed to be OK if c_iter->Valid()
|
|
1290
1288
|
// returns true.
|
|
1289
|
+
|
|
1291
1290
|
assert(!end.has_value() || cfd->user_comparator()->Compare(
|
|
1292
1291
|
c_iter->user_key(), end.value()) < 0);
|
|
1293
1292
|
|
|
@@ -1835,14 +1834,12 @@ Status CompactionJob::OpenCompactionOutputFile(SubcompactionState* sub_compact,
|
|
|
1835
1834
|
}
|
|
1836
1835
|
|
|
1837
1836
|
// Initialize a SubcompactionState::Output and add it to sub_compact->outputs
|
|
1838
|
-
uint64_t epoch_number = sub_compact->compaction->MinInputFileEpochNumber();
|
|
1839
1837
|
{
|
|
1840
1838
|
FileMetaData meta;
|
|
1841
1839
|
meta.fd = FileDescriptor(file_number,
|
|
1842
1840
|
sub_compact->compaction->output_path_id(), 0);
|
|
1843
1841
|
meta.oldest_ancester_time = oldest_ancester_time;
|
|
1844
1842
|
meta.file_creation_time = current_time;
|
|
1845
|
-
meta.epoch_number = epoch_number;
|
|
1846
1843
|
meta.temperature = temperature;
|
|
1847
1844
|
assert(!db_id_.empty());
|
|
1848
1845
|
assert(!db_session_id_.empty());
|
|
@@ -402,7 +402,6 @@ struct CompactionServiceOutputFile {
|
|
|
402
402
|
std::string largest_internal_key;
|
|
403
403
|
uint64_t oldest_ancester_time;
|
|
404
404
|
uint64_t file_creation_time;
|
|
405
|
-
uint64_t epoch_number;
|
|
406
405
|
uint64_t paranoid_hash;
|
|
407
406
|
bool marked_for_compaction;
|
|
408
407
|
UniqueId64x2 unique_id;
|
|
@@ -412,8 +411,8 @@ struct CompactionServiceOutputFile {
|
|
|
412
411
|
const std::string& name, SequenceNumber smallest, SequenceNumber largest,
|
|
413
412
|
std::string _smallest_internal_key, std::string _largest_internal_key,
|
|
414
413
|
uint64_t _oldest_ancester_time, uint64_t _file_creation_time,
|
|
415
|
-
uint64_t
|
|
416
|
-
|
|
414
|
+
uint64_t _paranoid_hash, bool _marked_for_compaction,
|
|
415
|
+
UniqueId64x2 _unique_id)
|
|
417
416
|
: file_name(name),
|
|
418
417
|
smallest_seqno(smallest),
|
|
419
418
|
largest_seqno(largest),
|
|
@@ -421,7 +420,6 @@ struct CompactionServiceOutputFile {
|
|
|
421
420
|
largest_internal_key(std::move(_largest_internal_key)),
|
|
422
421
|
oldest_ancester_time(_oldest_ancester_time),
|
|
423
422
|
file_creation_time(_file_creation_time),
|
|
424
|
-
epoch_number(_epoch_number),
|
|
425
423
|
paranoid_hash(_paranoid_hash),
|
|
426
424
|
marked_for_compaction(_marked_for_compaction),
|
|
427
425
|
unique_id(std::move(_unique_id)) {}
|