rocksdb-native 0.0.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/.clang-format +15 -0
- package/.github/workflows/test-node.yml +23 -0
- package/.gitmodules +4 -0
- package/CMakeLists.txt +33 -0
- package/LICENSE +201 -0
- package/NOTICE +13 -0
- package/README.md +15 -0
- package/binding.c +470 -0
- package/binding.js +1 -0
- package/index.js +276 -0
- package/package.json +19 -0
- package/vendor/rocksdb/.circleci/config.yml +892 -0
- package/vendor/rocksdb/.circleci/ubsan_suppression_list.txt +6 -0
- package/vendor/rocksdb/.clang-format +5 -0
- package/vendor/rocksdb/.github/workflows/sanity_check.yml +47 -0
- package/vendor/rocksdb/.lgtm.yml +4 -0
- package/vendor/rocksdb/AUTHORS +12 -0
- package/vendor/rocksdb/CMakeLists.txt +1591 -0
- package/vendor/rocksdb/CODE_OF_CONDUCT.md +77 -0
- package/vendor/rocksdb/CONTRIBUTING.md +17 -0
- package/vendor/rocksdb/COPYING +339 -0
- package/vendor/rocksdb/DEFAULT_OPTIONS_HISTORY.md +24 -0
- package/vendor/rocksdb/DUMP_FORMAT.md +16 -0
- package/vendor/rocksdb/HISTORY.md +2399 -0
- package/vendor/rocksdb/INSTALL.md +220 -0
- package/vendor/rocksdb/LANGUAGE-BINDINGS.md +26 -0
- package/vendor/rocksdb/LICENSE.Apache +202 -0
- package/vendor/rocksdb/LICENSE.leveldb +29 -0
- package/vendor/rocksdb/Makefile +2579 -0
- package/vendor/rocksdb/PLUGINS.md +8 -0
- package/vendor/rocksdb/README.md +29 -0
- package/vendor/rocksdb/TARGETS +5599 -0
- package/vendor/rocksdb/USERS.md +165 -0
- package/vendor/rocksdb/Vagrantfile +39 -0
- package/vendor/rocksdb/WINDOWS_PORT.md +228 -0
- package/vendor/rocksdb/buckifier/bench-slow.json +6163 -0
- package/vendor/rocksdb/buckifier/bench.json +1594 -0
- package/vendor/rocksdb/buckifier/buckify_rocksdb.py +333 -0
- package/vendor/rocksdb/buckifier/check_buck_targets.sh +32 -0
- package/vendor/rocksdb/buckifier/rocks_test_runner.sh +6 -0
- package/vendor/rocksdb/buckifier/targets_builder.py +150 -0
- package/vendor/rocksdb/buckifier/targets_cfg.py +41 -0
- package/vendor/rocksdb/buckifier/util.py +118 -0
- package/vendor/rocksdb/build_tools/amalgamate.py +168 -0
- package/vendor/rocksdb/build_tools/benchmark_log_tool.py +238 -0
- package/vendor/rocksdb/build_tools/build_detect_platform +804 -0
- package/vendor/rocksdb/build_tools/check-sources.sh +48 -0
- package/vendor/rocksdb/build_tools/dependencies_platform010.sh +22 -0
- package/vendor/rocksdb/build_tools/dockerbuild.sh +3 -0
- package/vendor/rocksdb/build_tools/error_filter.py +181 -0
- package/vendor/rocksdb/build_tools/fb_compile_mongo.sh +55 -0
- package/vendor/rocksdb/build_tools/fbcode_config.sh +175 -0
- package/vendor/rocksdb/build_tools/fbcode_config_platform010.sh +175 -0
- package/vendor/rocksdb/build_tools/format-diff.sh +203 -0
- package/vendor/rocksdb/build_tools/gnu_parallel +7971 -0
- package/vendor/rocksdb/build_tools/make_package.sh +129 -0
- package/vendor/rocksdb/build_tools/ps_with_stack +38 -0
- package/vendor/rocksdb/build_tools/regression_build_test.sh +396 -0
- package/vendor/rocksdb/build_tools/run_ci_db_test.ps1 +493 -0
- package/vendor/rocksdb/build_tools/setup_centos7.sh +45 -0
- package/vendor/rocksdb/build_tools/ubuntu20_image/Dockerfile +57 -0
- package/vendor/rocksdb/build_tools/update_dependencies.sh +106 -0
- package/vendor/rocksdb/build_tools/version.sh +23 -0
- package/vendor/rocksdb/cache/cache.cc +158 -0
- package/vendor/rocksdb/cache/cache_bench.cc +20 -0
- package/vendor/rocksdb/cache/cache_bench_tool.cc +969 -0
- package/vendor/rocksdb/cache/cache_entry_roles.cc +104 -0
- package/vendor/rocksdb/cache/cache_entry_roles.h +20 -0
- package/vendor/rocksdb/cache/cache_entry_stats.h +182 -0
- package/vendor/rocksdb/cache/cache_helpers.cc +40 -0
- package/vendor/rocksdb/cache/cache_helpers.h +139 -0
- package/vendor/rocksdb/cache/cache_key.cc +364 -0
- package/vendor/rocksdb/cache/cache_key.h +143 -0
- package/vendor/rocksdb/cache/cache_reservation_manager.cc +184 -0
- package/vendor/rocksdb/cache/cache_reservation_manager.h +317 -0
- package/vendor/rocksdb/cache/cache_reservation_manager_test.cc +469 -0
- package/vendor/rocksdb/cache/cache_test.cc +1061 -0
- package/vendor/rocksdb/cache/charged_cache.cc +109 -0
- package/vendor/rocksdb/cache/charged_cache.h +59 -0
- package/vendor/rocksdb/cache/clock_cache.cc +1482 -0
- package/vendor/rocksdb/cache/clock_cache.h +707 -0
- package/vendor/rocksdb/cache/compressed_secondary_cache.cc +304 -0
- package/vendor/rocksdb/cache/compressed_secondary_cache.h +132 -0
- package/vendor/rocksdb/cache/compressed_secondary_cache_test.cc +983 -0
- package/vendor/rocksdb/cache/lru_cache.cc +723 -0
- package/vendor/rocksdb/cache/lru_cache.h +467 -0
- package/vendor/rocksdb/cache/lru_cache_test.cc +2559 -0
- package/vendor/rocksdb/cache/secondary_cache.cc +44 -0
- package/vendor/rocksdb/cache/secondary_cache_adapter.cc +295 -0
- package/vendor/rocksdb/cache/secondary_cache_adapter.h +52 -0
- package/vendor/rocksdb/cache/sharded_cache.cc +137 -0
- package/vendor/rocksdb/cache/sharded_cache.h +309 -0
- package/vendor/rocksdb/cache/typed_cache.h +375 -0
- package/vendor/rocksdb/cmake/RocksDBConfig.cmake.in +54 -0
- package/vendor/rocksdb/common.mk +30 -0
- package/vendor/rocksdb/crash_test.mk +107 -0
- package/vendor/rocksdb/db/arena_wrapped_db_iter.cc +163 -0
- package/vendor/rocksdb/db/arena_wrapped_db_iter.h +127 -0
- package/vendor/rocksdb/db/blob/blob_constants.h +16 -0
- package/vendor/rocksdb/db/blob/blob_contents.cc +42 -0
- package/vendor/rocksdb/db/blob/blob_contents.h +59 -0
- package/vendor/rocksdb/db/blob/blob_counting_iterator.h +150 -0
- package/vendor/rocksdb/db/blob/blob_counting_iterator_test.cc +327 -0
- package/vendor/rocksdb/db/blob/blob_fetcher.cc +34 -0
- package/vendor/rocksdb/db/blob/blob_fetcher.h +37 -0
- package/vendor/rocksdb/db/blob/blob_file_addition.cc +156 -0
- package/vendor/rocksdb/db/blob/blob_file_addition.h +67 -0
- package/vendor/rocksdb/db/blob/blob_file_addition_test.cc +211 -0
- package/vendor/rocksdb/db/blob/blob_file_builder.cc +426 -0
- package/vendor/rocksdb/db/blob/blob_file_builder.h +112 -0
- package/vendor/rocksdb/db/blob/blob_file_builder_test.cc +680 -0
- package/vendor/rocksdb/db/blob/blob_file_cache.cc +101 -0
- package/vendor/rocksdb/db/blob/blob_file_cache.h +56 -0
- package/vendor/rocksdb/db/blob/blob_file_cache_test.cc +278 -0
- package/vendor/rocksdb/db/blob/blob_file_completion_callback.h +84 -0
- package/vendor/rocksdb/db/blob/blob_file_garbage.cc +134 -0
- package/vendor/rocksdb/db/blob/blob_file_garbage.h +57 -0
- package/vendor/rocksdb/db/blob/blob_file_garbage_test.cc +174 -0
- package/vendor/rocksdb/db/blob/blob_file_meta.cc +62 -0
- package/vendor/rocksdb/db/blob/blob_file_meta.h +170 -0
- package/vendor/rocksdb/db/blob/blob_file_reader.cc +624 -0
- package/vendor/rocksdb/db/blob/blob_file_reader.h +112 -0
- package/vendor/rocksdb/db/blob/blob_file_reader_test.cc +1023 -0
- package/vendor/rocksdb/db/blob/blob_garbage_meter.cc +100 -0
- package/vendor/rocksdb/db/blob/blob_garbage_meter.h +102 -0
- package/vendor/rocksdb/db/blob/blob_garbage_meter_test.cc +197 -0
- package/vendor/rocksdb/db/blob/blob_index.h +187 -0
- package/vendor/rocksdb/db/blob/blob_log_format.cc +143 -0
- package/vendor/rocksdb/db/blob/blob_log_format.h +164 -0
- package/vendor/rocksdb/db/blob/blob_log_sequential_reader.cc +134 -0
- package/vendor/rocksdb/db/blob/blob_log_sequential_reader.h +83 -0
- package/vendor/rocksdb/db/blob/blob_log_writer.cc +178 -0
- package/vendor/rocksdb/db/blob/blob_log_writer.h +83 -0
- package/vendor/rocksdb/db/blob/blob_read_request.h +58 -0
- package/vendor/rocksdb/db/blob/blob_source.cc +459 -0
- package/vendor/rocksdb/db/blob/blob_source.h +161 -0
- package/vendor/rocksdb/db/blob/blob_source_test.cc +1611 -0
- package/vendor/rocksdb/db/blob/db_blob_basic_test.cc +2237 -0
- package/vendor/rocksdb/db/blob/db_blob_compaction_test.cc +899 -0
- package/vendor/rocksdb/db/blob/db_blob_corruption_test.cc +80 -0
- package/vendor/rocksdb/db/blob/db_blob_index_test.cc +596 -0
- package/vendor/rocksdb/db/blob/prefetch_buffer_collection.cc +21 -0
- package/vendor/rocksdb/db/blob/prefetch_buffer_collection.h +38 -0
- package/vendor/rocksdb/db/builder.cc +447 -0
- package/vendor/rocksdb/db/builder.h +78 -0
- package/vendor/rocksdb/db/c.cc +6559 -0
- package/vendor/rocksdb/db/c_test.c +3609 -0
- package/vendor/rocksdb/db/column_family.cc +1708 -0
- package/vendor/rocksdb/db/column_family.h +851 -0
- package/vendor/rocksdb/db/column_family_test.cc +3382 -0
- package/vendor/rocksdb/db/compact_files_test.cc +492 -0
- package/vendor/rocksdb/db/compaction/clipping_iterator.h +281 -0
- package/vendor/rocksdb/db/compaction/clipping_iterator_test.cc +259 -0
- package/vendor/rocksdb/db/compaction/compaction.cc +857 -0
- package/vendor/rocksdb/db/compaction/compaction.h +565 -0
- package/vendor/rocksdb/db/compaction/compaction_iteration_stats.h +49 -0
- package/vendor/rocksdb/db/compaction/compaction_iterator.cc +1445 -0
- package/vendor/rocksdb/db/compaction/compaction_iterator.h +530 -0
- package/vendor/rocksdb/db/compaction/compaction_iterator_test.cc +1618 -0
- package/vendor/rocksdb/db/compaction/compaction_job.cc +2054 -0
- package/vendor/rocksdb/db/compaction/compaction_job.h +504 -0
- package/vendor/rocksdb/db/compaction/compaction_job_stats_test.cc +965 -0
- package/vendor/rocksdb/db/compaction/compaction_job_test.cc +2444 -0
- package/vendor/rocksdb/db/compaction/compaction_outputs.cc +784 -0
- package/vendor/rocksdb/db/compaction/compaction_outputs.h +403 -0
- package/vendor/rocksdb/db/compaction/compaction_picker.cc +1225 -0
- package/vendor/rocksdb/db/compaction/compaction_picker.h +318 -0
- package/vendor/rocksdb/db/compaction/compaction_picker_fifo.cc +471 -0
- package/vendor/rocksdb/db/compaction/compaction_picker_fifo.h +60 -0
- package/vendor/rocksdb/db/compaction/compaction_picker_level.cc +888 -0
- package/vendor/rocksdb/db/compaction/compaction_picker_level.h +33 -0
- package/vendor/rocksdb/db/compaction/compaction_picker_test.cc +4074 -0
- package/vendor/rocksdb/db/compaction/compaction_picker_universal.cc +1452 -0
- package/vendor/rocksdb/db/compaction/compaction_picker_universal.h +30 -0
- package/vendor/rocksdb/db/compaction/compaction_service_job.cc +833 -0
- package/vendor/rocksdb/db/compaction/compaction_service_test.cc +954 -0
- package/vendor/rocksdb/db/compaction/compaction_state.cc +46 -0
- package/vendor/rocksdb/db/compaction/compaction_state.h +42 -0
- package/vendor/rocksdb/db/compaction/file_pri.h +92 -0
- package/vendor/rocksdb/db/compaction/sst_partitioner.cc +83 -0
- package/vendor/rocksdb/db/compaction/subcompaction_state.cc +106 -0
- package/vendor/rocksdb/db/compaction/subcompaction_state.h +220 -0
- package/vendor/rocksdb/db/compaction/tiered_compaction_test.cc +2149 -0
- package/vendor/rocksdb/db/comparator_db_test.cc +678 -0
- package/vendor/rocksdb/db/convenience.cc +81 -0
- package/vendor/rocksdb/db/corruption_test.cc +1670 -0
- package/vendor/rocksdb/db/cuckoo_table_db_test.cc +351 -0
- package/vendor/rocksdb/db/db_basic_test.cc +4777 -0
- package/vendor/rocksdb/db/db_block_cache_test.cc +1972 -0
- package/vendor/rocksdb/db/db_bloom_filter_test.cc +3513 -0
- package/vendor/rocksdb/db/db_clip_test.cc +142 -0
- package/vendor/rocksdb/db/db_compaction_filter_test.cc +1030 -0
- package/vendor/rocksdb/db/db_compaction_test.cc +9424 -0
- package/vendor/rocksdb/db/db_dynamic_level_test.cc +499 -0
- package/vendor/rocksdb/db/db_encryption_test.cc +126 -0
- package/vendor/rocksdb/db/db_filesnapshot.cc +436 -0
- package/vendor/rocksdb/db/db_flush_test.cc +3202 -0
- package/vendor/rocksdb/db/db_impl/compacted_db_impl.cc +260 -0
- package/vendor/rocksdb/db/db_impl/compacted_db_impl.h +157 -0
- package/vendor/rocksdb/db/db_impl/db_impl.cc +6132 -0
- package/vendor/rocksdb/db/db_impl/db_impl.h +2841 -0
- package/vendor/rocksdb/db/db_impl/db_impl_compaction_flush.cc +3980 -0
- package/vendor/rocksdb/db/db_impl/db_impl_debug.cc +314 -0
- package/vendor/rocksdb/db/db_impl/db_impl_experimental.cc +159 -0
- package/vendor/rocksdb/db/db_impl/db_impl_files.cc +1014 -0
- package/vendor/rocksdb/db/db_impl/db_impl_open.cc +2202 -0
- package/vendor/rocksdb/db/db_impl/db_impl_readonly.cc +334 -0
- package/vendor/rocksdb/db/db_impl/db_impl_readonly.h +173 -0
- package/vendor/rocksdb/db/db_impl/db_impl_secondary.cc +964 -0
- package/vendor/rocksdb/db/db_impl/db_impl_secondary.h +406 -0
- package/vendor/rocksdb/db/db_impl/db_impl_write.cc +2487 -0
- package/vendor/rocksdb/db/db_info_dumper.cc +147 -0
- package/vendor/rocksdb/db/db_info_dumper.h +15 -0
- package/vendor/rocksdb/db/db_inplace_update_test.cc +262 -0
- package/vendor/rocksdb/db/db_io_failure_test.cc +589 -0
- package/vendor/rocksdb/db/db_iter.cc +1708 -0
- package/vendor/rocksdb/db/db_iter.h +411 -0
- package/vendor/rocksdb/db/db_iter_stress_test.cc +658 -0
- package/vendor/rocksdb/db/db_iter_test.cc +3195 -0
- package/vendor/rocksdb/db/db_iterator_test.cc +3304 -0
- package/vendor/rocksdb/db/db_kv_checksum_test.cc +885 -0
- package/vendor/rocksdb/db/db_log_iter_test.cc +297 -0
- package/vendor/rocksdb/db/db_logical_block_size_cache_test.cc +505 -0
- package/vendor/rocksdb/db/db_memtable_test.cc +344 -0
- package/vendor/rocksdb/db/db_merge_operand_test.cc +488 -0
- package/vendor/rocksdb/db/db_merge_operator_test.cc +866 -0
- package/vendor/rocksdb/db/db_options_test.cc +1330 -0
- package/vendor/rocksdb/db/db_properties_test.cc +2377 -0
- package/vendor/rocksdb/db/db_range_del_test.cc +3414 -0
- package/vendor/rocksdb/db/db_rate_limiter_test.cc +437 -0
- package/vendor/rocksdb/db/db_readonly_with_timestamp_test.cc +956 -0
- package/vendor/rocksdb/db/db_secondary_test.cc +1691 -0
- package/vendor/rocksdb/db/db_sst_test.cc +1865 -0
- package/vendor/rocksdb/db/db_statistics_test.cc +292 -0
- package/vendor/rocksdb/db/db_table_properties_test.cc +623 -0
- package/vendor/rocksdb/db/db_tailing_iter_test.cc +595 -0
- package/vendor/rocksdb/db/db_test.cc +7359 -0
- package/vendor/rocksdb/db/db_test2.cc +7679 -0
- package/vendor/rocksdb/db/db_test_util.cc +1759 -0
- package/vendor/rocksdb/db/db_test_util.h +1340 -0
- package/vendor/rocksdb/db/db_universal_compaction_test.cc +2227 -0
- package/vendor/rocksdb/db/db_wal_test.cc +2433 -0
- package/vendor/rocksdb/db/db_with_timestamp_basic_test.cc +4016 -0
- package/vendor/rocksdb/db/db_with_timestamp_compaction_test.cc +353 -0
- package/vendor/rocksdb/db/db_with_timestamp_test_util.cc +96 -0
- package/vendor/rocksdb/db/db_with_timestamp_test_util.h +126 -0
- package/vendor/rocksdb/db/db_write_buffer_manager_test.cc +927 -0
- package/vendor/rocksdb/db/db_write_test.cc +795 -0
- package/vendor/rocksdb/db/dbformat.cc +213 -0
- package/vendor/rocksdb/db/dbformat.h +869 -0
- package/vendor/rocksdb/db/dbformat_test.cc +214 -0
- package/vendor/rocksdb/db/deletefile_test.cc +603 -0
- package/vendor/rocksdb/db/error_handler.cc +792 -0
- package/vendor/rocksdb/db/error_handler.h +124 -0
- package/vendor/rocksdb/db/error_handler_fs_test.cc +2862 -0
- package/vendor/rocksdb/db/event_helpers.cc +323 -0
- package/vendor/rocksdb/db/event_helpers.h +78 -0
- package/vendor/rocksdb/db/experimental.cc +144 -0
- package/vendor/rocksdb/db/external_sst_file_basic_test.cc +2084 -0
- package/vendor/rocksdb/db/external_sst_file_ingestion_job.cc +1104 -0
- package/vendor/rocksdb/db/external_sst_file_ingestion_job.h +238 -0
- package/vendor/rocksdb/db/external_sst_file_test.cc +2859 -0
- package/vendor/rocksdb/db/fault_injection_test.cc +637 -0
- package/vendor/rocksdb/db/file_indexer.cc +218 -0
- package/vendor/rocksdb/db/file_indexer.h +140 -0
- package/vendor/rocksdb/db/file_indexer_test.cc +352 -0
- package/vendor/rocksdb/db/filename_test.cc +241 -0
- package/vendor/rocksdb/db/flush_job.cc +1097 -0
- package/vendor/rocksdb/db/flush_job.h +200 -0
- package/vendor/rocksdb/db/flush_job_test.cc +743 -0
- package/vendor/rocksdb/db/flush_scheduler.cc +86 -0
- package/vendor/rocksdb/db/flush_scheduler.h +55 -0
- package/vendor/rocksdb/db/forward_iterator.cc +1070 -0
- package/vendor/rocksdb/db/forward_iterator.h +166 -0
- package/vendor/rocksdb/db/forward_iterator_bench.cc +378 -0
- package/vendor/rocksdb/db/history_trimming_iterator.h +95 -0
- package/vendor/rocksdb/db/import_column_family_job.cc +364 -0
- package/vendor/rocksdb/db/import_column_family_job.h +82 -0
- package/vendor/rocksdb/db/import_column_family_test.cc +748 -0
- package/vendor/rocksdb/db/internal_stats.cc +2121 -0
- package/vendor/rocksdb/db/internal_stats.h +875 -0
- package/vendor/rocksdb/db/job_context.h +237 -0
- package/vendor/rocksdb/db/kv_checksum.h +484 -0
- package/vendor/rocksdb/db/listener_test.cc +1598 -0
- package/vendor/rocksdb/db/log_format.h +55 -0
- package/vendor/rocksdb/db/log_reader.cc +934 -0
- package/vendor/rocksdb/db/log_reader.h +241 -0
- package/vendor/rocksdb/db/log_test.cc +1216 -0
- package/vendor/rocksdb/db/log_writer.cc +279 -0
- package/vendor/rocksdb/db/log_writer.h +144 -0
- package/vendor/rocksdb/db/logs_with_prep_tracker.cc +67 -0
- package/vendor/rocksdb/db/logs_with_prep_tracker.h +62 -0
- package/vendor/rocksdb/db/lookup_key.h +68 -0
- package/vendor/rocksdb/db/malloc_stats.cc +53 -0
- package/vendor/rocksdb/db/malloc_stats.h +22 -0
- package/vendor/rocksdb/db/manual_compaction_test.cc +308 -0
- package/vendor/rocksdb/db/memtable.cc +1675 -0
- package/vendor/rocksdb/db/memtable.h +660 -0
- package/vendor/rocksdb/db/memtable_list.cc +987 -0
- package/vendor/rocksdb/db/memtable_list.h +471 -0
- package/vendor/rocksdb/db/memtable_list_test.cc +1037 -0
- package/vendor/rocksdb/db/merge_context.h +147 -0
- package/vendor/rocksdb/db/merge_helper.cc +606 -0
- package/vendor/rocksdb/db/merge_helper.h +224 -0
- package/vendor/rocksdb/db/merge_helper_test.cc +298 -0
- package/vendor/rocksdb/db/merge_operator.cc +85 -0
- package/vendor/rocksdb/db/merge_test.cc +621 -0
- package/vendor/rocksdb/db/obsolete_files_test.cc +317 -0
- package/vendor/rocksdb/db/options_file_test.cc +110 -0
- package/vendor/rocksdb/db/output_validator.cc +33 -0
- package/vendor/rocksdb/db/output_validator.h +48 -0
- package/vendor/rocksdb/db/perf_context_test.cc +1158 -0
- package/vendor/rocksdb/db/periodic_task_scheduler.cc +111 -0
- package/vendor/rocksdb/db/periodic_task_scheduler.h +108 -0
- package/vendor/rocksdb/db/periodic_task_scheduler_test.cc +229 -0
- package/vendor/rocksdb/db/pinned_iterators_manager.h +92 -0
- package/vendor/rocksdb/db/plain_table_db_test.cc +1348 -0
- package/vendor/rocksdb/db/post_memtable_callback.h +25 -0
- package/vendor/rocksdb/db/pre_release_callback.h +37 -0
- package/vendor/rocksdb/db/prefix_test.cc +894 -0
- package/vendor/rocksdb/db/range_del_aggregator.cc +555 -0
- package/vendor/rocksdb/db/range_del_aggregator.h +478 -0
- package/vendor/rocksdb/db/range_del_aggregator_bench.cc +280 -0
- package/vendor/rocksdb/db/range_del_aggregator_test.cc +713 -0
- package/vendor/rocksdb/db/range_tombstone_fragmenter.cc +502 -0
- package/vendor/rocksdb/db/range_tombstone_fragmenter.h +356 -0
- package/vendor/rocksdb/db/range_tombstone_fragmenter_test.cc +555 -0
- package/vendor/rocksdb/db/read_callback.h +54 -0
- package/vendor/rocksdb/db/repair.cc +839 -0
- package/vendor/rocksdb/db/repair_test.cc +484 -0
- package/vendor/rocksdb/db/seqno_time_test.cc +994 -0
- package/vendor/rocksdb/db/seqno_to_time_mapping.cc +341 -0
- package/vendor/rocksdb/db/seqno_to_time_mapping.h +189 -0
- package/vendor/rocksdb/db/snapshot_checker.h +58 -0
- package/vendor/rocksdb/db/snapshot_impl.cc +25 -0
- package/vendor/rocksdb/db/snapshot_impl.h +239 -0
- package/vendor/rocksdb/db/table_cache.cc +710 -0
- package/vendor/rocksdb/db/table_cache.h +283 -0
- package/vendor/rocksdb/db/table_cache_sync_and_async.h +130 -0
- package/vendor/rocksdb/db/table_properties_collector.cc +74 -0
- package/vendor/rocksdb/db/table_properties_collector.h +177 -0
- package/vendor/rocksdb/db/table_properties_collector_test.cc +512 -0
- package/vendor/rocksdb/db/transaction_log_impl.cc +296 -0
- package/vendor/rocksdb/db/transaction_log_impl.h +128 -0
- package/vendor/rocksdb/db/trim_history_scheduler.cc +54 -0
- package/vendor/rocksdb/db/trim_history_scheduler.h +46 -0
- package/vendor/rocksdb/db/version_builder.cc +1426 -0
- package/vendor/rocksdb/db/version_builder.h +93 -0
- package/vendor/rocksdb/db/version_builder_test.cc +1840 -0
- package/vendor/rocksdb/db/version_edit.cc +1059 -0
- package/vendor/rocksdb/db/version_edit.h +702 -0
- package/vendor/rocksdb/db/version_edit_handler.cc +1017 -0
- package/vendor/rocksdb/db/version_edit_handler.h +334 -0
- package/vendor/rocksdb/db/version_edit_test.cc +732 -0
- package/vendor/rocksdb/db/version_set.cc +7286 -0
- package/vendor/rocksdb/db/version_set.h +1714 -0
- package/vendor/rocksdb/db/version_set_sync_and_async.h +172 -0
- package/vendor/rocksdb/db/version_set_test.cc +3659 -0
- package/vendor/rocksdb/db/version_util.h +72 -0
- package/vendor/rocksdb/db/wal_edit.cc +211 -0
- package/vendor/rocksdb/db/wal_edit.h +177 -0
- package/vendor/rocksdb/db/wal_edit_test.cc +213 -0
- package/vendor/rocksdb/db/wal_manager.cc +527 -0
- package/vendor/rocksdb/db/wal_manager.h +136 -0
- package/vendor/rocksdb/db/wal_manager_test.cc +336 -0
- package/vendor/rocksdb/db/wide/db_wide_basic_test.cc +1042 -0
- package/vendor/rocksdb/db/wide/wide_column_serialization.cc +182 -0
- package/vendor/rocksdb/db/wide/wide_column_serialization.h +77 -0
- package/vendor/rocksdb/db/wide/wide_column_serialization_test.cc +338 -0
- package/vendor/rocksdb/db/wide/wide_columns.cc +22 -0
- package/vendor/rocksdb/db/write_batch.cc +3142 -0
- package/vendor/rocksdb/db/write_batch_base.cc +94 -0
- package/vendor/rocksdb/db/write_batch_internal.h +401 -0
- package/vendor/rocksdb/db/write_batch_test.cc +1112 -0
- package/vendor/rocksdb/db/write_callback.h +27 -0
- package/vendor/rocksdb/db/write_callback_test.cc +454 -0
- package/vendor/rocksdb/db/write_controller.cc +121 -0
- package/vendor/rocksdb/db/write_controller.h +148 -0
- package/vendor/rocksdb/db/write_controller_test.cc +248 -0
- package/vendor/rocksdb/db/write_stall_stats.cc +179 -0
- package/vendor/rocksdb/db/write_stall_stats.h +47 -0
- package/vendor/rocksdb/db/write_thread.cc +844 -0
- package/vendor/rocksdb/db/write_thread.h +464 -0
- package/vendor/rocksdb/db_stress_tool/CMakeLists.txt +18 -0
- package/vendor/rocksdb/db_stress_tool/batched_ops_stress.cc +593 -0
- package/vendor/rocksdb/db_stress_tool/cf_consistency_stress.cc +892 -0
- package/vendor/rocksdb/db_stress_tool/db_stress.cc +25 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_common.cc +491 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_common.h +674 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_compaction_filter.h +96 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_driver.cc +216 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_driver.h +18 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_env_wrapper.h +78 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_gflags.cc +1094 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_listener.cc +189 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_listener.h +269 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_shared_state.cc +17 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_shared_state.h +437 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_stat.cc +17 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_stat.h +219 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_table_properties_collector.h +65 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_test_base.cc +3294 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_test_base.h +327 -0
- package/vendor/rocksdb/db_stress_tool/db_stress_tool.cc +371 -0
- package/vendor/rocksdb/db_stress_tool/expected_state.cc +780 -0
- package/vendor/rocksdb/db_stress_tool/expected_state.h +329 -0
- package/vendor/rocksdb/db_stress_tool/expected_value.cc +122 -0
- package/vendor/rocksdb/db_stress_tool/expected_value.h +206 -0
- package/vendor/rocksdb/db_stress_tool/multi_ops_txns_stress.cc +1761 -0
- package/vendor/rocksdb/db_stress_tool/multi_ops_txns_stress.h +446 -0
- package/vendor/rocksdb/db_stress_tool/no_batched_ops_stress.cc +1906 -0
- package/vendor/rocksdb/docs/CNAME +1 -0
- package/vendor/rocksdb/docs/CONTRIBUTING.md +115 -0
- package/vendor/rocksdb/docs/Gemfile +4 -0
- package/vendor/rocksdb/docs/LICENSE-DOCUMENTATION +385 -0
- package/vendor/rocksdb/docs/README.md +80 -0
- package/vendor/rocksdb/docs/TEMPLATE-INFORMATION.md +17 -0
- package/vendor/rocksdb/docs/_config.yml +85 -0
- package/vendor/rocksdb/docs/_data/authors.yml +81 -0
- package/vendor/rocksdb/docs/_data/features.yml +19 -0
- package/vendor/rocksdb/docs/_data/nav.yml +30 -0
- package/vendor/rocksdb/docs/_data/nav_docs.yml +3 -0
- package/vendor/rocksdb/docs/_data/powered_by.yml +1 -0
- package/vendor/rocksdb/docs/_data/powered_by_highlight.yml +1 -0
- package/vendor/rocksdb/docs/_data/promo.yml +6 -0
- package/vendor/rocksdb/docs/_docs/faq.md +48 -0
- package/vendor/rocksdb/docs/_docs/getting-started.md +78 -0
- package/vendor/rocksdb/docs/_includes/blog_pagination.html +28 -0
- package/vendor/rocksdb/docs/_includes/content/gridblocks.html +5 -0
- package/vendor/rocksdb/docs/_includes/content/items/gridblock.html +37 -0
- package/vendor/rocksdb/docs/_includes/doc.html +25 -0
- package/vendor/rocksdb/docs/_includes/doc_paging.html +0 -0
- package/vendor/rocksdb/docs/_includes/footer.html +34 -0
- package/vendor/rocksdb/docs/_includes/head.html +23 -0
- package/vendor/rocksdb/docs/_includes/header.html +19 -0
- package/vendor/rocksdb/docs/_includes/hero.html +0 -0
- package/vendor/rocksdb/docs/_includes/home_header.html +22 -0
- package/vendor/rocksdb/docs/_includes/katex_import.html +3 -0
- package/vendor/rocksdb/docs/_includes/katex_render.html +210 -0
- package/vendor/rocksdb/docs/_includes/nav/collection_nav.html +64 -0
- package/vendor/rocksdb/docs/_includes/nav/collection_nav_group.html +19 -0
- package/vendor/rocksdb/docs/_includes/nav/collection_nav_group_item.html +1 -0
- package/vendor/rocksdb/docs/_includes/nav/header_nav.html +30 -0
- package/vendor/rocksdb/docs/_includes/nav.html +37 -0
- package/vendor/rocksdb/docs/_includes/nav_search.html +15 -0
- package/vendor/rocksdb/docs/_includes/plugins/all_share.html +3 -0
- package/vendor/rocksdb/docs/_includes/plugins/ascii_cinema.html +2 -0
- package/vendor/rocksdb/docs/_includes/plugins/button.html +6 -0
- package/vendor/rocksdb/docs/_includes/plugins/github_star.html +4 -0
- package/vendor/rocksdb/docs/_includes/plugins/github_watch.html +4 -0
- package/vendor/rocksdb/docs/_includes/plugins/google_share.html +5 -0
- package/vendor/rocksdb/docs/_includes/plugins/iframe.html +6 -0
- package/vendor/rocksdb/docs/_includes/plugins/like_button.html +18 -0
- package/vendor/rocksdb/docs/_includes/plugins/plugin_row.html +5 -0
- package/vendor/rocksdb/docs/_includes/plugins/post_social_plugins.html +41 -0
- package/vendor/rocksdb/docs/_includes/plugins/slideshow.html +88 -0
- package/vendor/rocksdb/docs/_includes/plugins/twitter_follow.html +12 -0
- package/vendor/rocksdb/docs/_includes/plugins/twitter_share.html +11 -0
- package/vendor/rocksdb/docs/_includes/post.html +40 -0
- package/vendor/rocksdb/docs/_includes/powered_by.html +28 -0
- package/vendor/rocksdb/docs/_includes/social_plugins.html +31 -0
- package/vendor/rocksdb/docs/_includes/ui/button.html +1 -0
- package/vendor/rocksdb/docs/_layouts/basic.html +12 -0
- package/vendor/rocksdb/docs/_layouts/blog.html +11 -0
- package/vendor/rocksdb/docs/_layouts/blog_default.html +14 -0
- package/vendor/rocksdb/docs/_layouts/default.html +12 -0
- package/vendor/rocksdb/docs/_layouts/doc_default.html +14 -0
- package/vendor/rocksdb/docs/_layouts/doc_page.html +10 -0
- package/vendor/rocksdb/docs/_layouts/docs.html +5 -0
- package/vendor/rocksdb/docs/_layouts/home.html +26 -0
- package/vendor/rocksdb/docs/_layouts/page.html +3 -0
- package/vendor/rocksdb/docs/_layouts/plain.html +10 -0
- package/vendor/rocksdb/docs/_layouts/post.html +8 -0
- package/vendor/rocksdb/docs/_layouts/redirect.html +6 -0
- package/vendor/rocksdb/docs/_layouts/top-level.html +10 -0
- package/vendor/rocksdb/docs/_posts/2014-03-27-how-to-backup-rocksdb.markdown +135 -0
- package/vendor/rocksdb/docs/_posts/2014-03-27-how-to-persist-in-memory-rocksdb-database.markdown +54 -0
- package/vendor/rocksdb/docs/_posts/2014-04-02-the-1st-rocksdb-local-meetup-held-on-march-27-2014.markdown +53 -0
- package/vendor/rocksdb/docs/_posts/2014-04-07-rocksdb-2-8-release.markdown +40 -0
- package/vendor/rocksdb/docs/_posts/2014-04-21-indexing-sst-files-for-better-lookup-performance.markdown +28 -0
- package/vendor/rocksdb/docs/_posts/2014-05-14-lock.markdown +88 -0
- package/vendor/rocksdb/docs/_posts/2014-05-19-rocksdb-3-0-release.markdown +24 -0
- package/vendor/rocksdb/docs/_posts/2014-05-22-rocksdb-3-1-release.markdown +20 -0
- package/vendor/rocksdb/docs/_posts/2014-06-23-plaintable-a-new-file-format.markdown +47 -0
- package/vendor/rocksdb/docs/_posts/2014-06-27-avoid-expensive-locks-in-get.markdown +89 -0
- package/vendor/rocksdb/docs/_posts/2014-06-27-rocksdb-3-2-release.markdown +30 -0
- package/vendor/rocksdb/docs/_posts/2014-07-29-rocksdb-3-3-release.markdown +34 -0
- package/vendor/rocksdb/docs/_posts/2014-09-12-cuckoo.markdown +74 -0
- package/vendor/rocksdb/docs/_posts/2014-09-12-new-bloom-filter-format.markdown +52 -0
- package/vendor/rocksdb/docs/_posts/2014-09-15-rocksdb-3-5-release.markdown +38 -0
- package/vendor/rocksdb/docs/_posts/2015-01-16-migrating-from-leveldb-to-rocksdb-2.markdown +112 -0
- package/vendor/rocksdb/docs/_posts/2015-02-24-reading-rocksdb-options-from-a-file.markdown +41 -0
- package/vendor/rocksdb/docs/_posts/2015-02-27-write-batch-with-index.markdown +20 -0
- package/vendor/rocksdb/docs/_posts/2015-04-22-integrating-rocksdb-with-mongodb-2.markdown +16 -0
- package/vendor/rocksdb/docs/_posts/2015-06-12-rocksdb-in-osquery.markdown +10 -0
- package/vendor/rocksdb/docs/_posts/2015-07-15-rocksdb-2015-h2-roadmap.markdown +92 -0
- package/vendor/rocksdb/docs/_posts/2015-07-17-spatial-indexing-in-rocksdb.markdown +78 -0
- package/vendor/rocksdb/docs/_posts/2015-07-22-rocksdb-is-now-available-in-windows-platform.markdown +30 -0
- package/vendor/rocksdb/docs/_posts/2015-07-23-dynamic-level.markdown +29 -0
- package/vendor/rocksdb/docs/_posts/2015-10-27-getthreadlist.markdown +193 -0
- package/vendor/rocksdb/docs/_posts/2015-11-10-use-checkpoints-for-efficient-snapshots.markdown +45 -0
- package/vendor/rocksdb/docs/_posts/2015-11-16-analysis-file-read-latency-by-level.markdown +244 -0
- package/vendor/rocksdb/docs/_posts/2016-01-29-compaction_pri.markdown +51 -0
- package/vendor/rocksdb/docs/_posts/2016-02-24-rocksdb-4-2-release.markdown +41 -0
- package/vendor/rocksdb/docs/_posts/2016-02-25-rocksdb-ama.markdown +20 -0
- package/vendor/rocksdb/docs/_posts/2016-03-07-rocksdb-options-file.markdown +24 -0
- package/vendor/rocksdb/docs/_posts/2016-04-26-rocksdb-4-5-1-released.markdown +60 -0
- package/vendor/rocksdb/docs/_posts/2016-07-26-rocksdb-4-8-released.markdown +48 -0
- package/vendor/rocksdb/docs/_posts/2016-09-28-rocksdb-4-11-2-released.markdown +49 -0
- package/vendor/rocksdb/docs/_posts/2017-01-06-rocksdb-5-0-1-released.markdown +26 -0
- package/vendor/rocksdb/docs/_posts/2017-02-07-rocksdb-5-1-2-released.markdown +15 -0
- package/vendor/rocksdb/docs/_posts/2017-02-17-bulkoad-ingest-sst-file.markdown +50 -0
- package/vendor/rocksdb/docs/_posts/2017-03-02-rocksdb-5-2-1-released.markdown +22 -0
- package/vendor/rocksdb/docs/_posts/2017-05-12-partitioned-index-filter.markdown +34 -0
- package/vendor/rocksdb/docs/_posts/2017-05-14-core-local-stats.markdown +106 -0
- package/vendor/rocksdb/docs/_posts/2017-05-26-rocksdb-5-4-5-released.markdown +39 -0
- package/vendor/rocksdb/docs/_posts/2017-06-26-17-level-based-changes.markdown +60 -0
- package/vendor/rocksdb/docs/_posts/2017-06-29-rocksdb-5-5-1-released.markdown +22 -0
- package/vendor/rocksdb/docs/_posts/2017-07-25-rocksdb-5-6-1-released.markdown +22 -0
- package/vendor/rocksdb/docs/_posts/2017-08-24-pinnableslice.markdown +37 -0
- package/vendor/rocksdb/docs/_posts/2017-08-25-flushwal.markdown +26 -0
- package/vendor/rocksdb/docs/_posts/2017-09-28-rocksdb-5-8-released.markdown +25 -0
- package/vendor/rocksdb/docs/_posts/2017-12-18-17-auto-tuned-rate-limiter.markdown +28 -0
- package/vendor/rocksdb/docs/_posts/2017-12-19-write-prepared-txn.markdown +41 -0
- package/vendor/rocksdb/docs/_posts/2018-02-05-rocksdb-5-10-2-released.markdown +22 -0
- package/vendor/rocksdb/docs/_posts/2018-08-01-rocksdb-tuning-advisor.markdown +58 -0
- package/vendor/rocksdb/docs/_posts/2018-08-23-data-block-hash-index.markdown +118 -0
- package/vendor/rocksdb/docs/_posts/2018-11-21-delete-range.markdown +292 -0
- package/vendor/rocksdb/docs/_posts/2019-03-08-format-version-4.markdown +36 -0
- package/vendor/rocksdb/docs/_posts/2019-08-15-unordered-write.markdown +56 -0
- package/vendor/rocksdb/docs/_posts/2021-04-12-universal-improvements.markdown +46 -0
- package/vendor/rocksdb/docs/_posts/2021-05-26-integrated-blob-db.markdown +101 -0
- package/vendor/rocksdb/docs/_posts/2021-05-26-online-validation.markdown +17 -0
- package/vendor/rocksdb/docs/_posts/2021-05-27-rocksdb-secondary-cache.markdown +195 -0
- package/vendor/rocksdb/docs/_posts/2021-05-31-dictionary-compression.markdown +157 -0
- package/vendor/rocksdb/docs/_posts/2021-12-29-ribbon-filter.markdown +281 -0
- package/vendor/rocksdb/docs/_posts/2022-07-18-per-key-value-checksum.markdown +142 -0
- package/vendor/rocksdb/docs/_posts/2022-10-05-lost-buffered-write-recovery.markdown +123 -0
- package/vendor/rocksdb/docs/_posts/2022-10-07-asynchronous-io-in-rocksdb.markdown +133 -0
- package/vendor/rocksdb/docs/_posts/2022-10-31-align-compaction-output-file.markdown +107 -0
- package/vendor/rocksdb/docs/_posts/2022-11-09-time-aware-tiered-storage.markdown +121 -0
- package/vendor/rocksdb/docs/_sass/_base.scss +492 -0
- package/vendor/rocksdb/docs/_sass/_blog.scss +47 -0
- package/vendor/rocksdb/docs/_sass/_buttons.scss +47 -0
- package/vendor/rocksdb/docs/_sass/_footer.scss +82 -0
- package/vendor/rocksdb/docs/_sass/_gridBlock.scss +115 -0
- package/vendor/rocksdb/docs/_sass/_header.scss +139 -0
- package/vendor/rocksdb/docs/_sass/_poweredby.scss +69 -0
- package/vendor/rocksdb/docs/_sass/_promo.scss +55 -0
- package/vendor/rocksdb/docs/_sass/_react_docs_nav.scss +332 -0
- package/vendor/rocksdb/docs/_sass/_react_header_nav.scss +141 -0
- package/vendor/rocksdb/docs/_sass/_reset.scss +43 -0
- package/vendor/rocksdb/docs/_sass/_search.scss +142 -0
- package/vendor/rocksdb/docs/_sass/_slideshow.scss +48 -0
- package/vendor/rocksdb/docs/_sass/_syntax-highlighting.scss +129 -0
- package/vendor/rocksdb/docs/_sass/_tables.scss +47 -0
- package/vendor/rocksdb/docs/_top-level/support.md +22 -0
- package/vendor/rocksdb/docs/blog/all.html +20 -0
- package/vendor/rocksdb/docs/blog/index.html +12 -0
- package/vendor/rocksdb/docs/css/main.scss +159 -0
- package/vendor/rocksdb/docs/doc-type-examples/2016-04-07-blog-post-example.md +21 -0
- package/vendor/rocksdb/docs/doc-type-examples/docs-hello-world.md +12 -0
- package/vendor/rocksdb/docs/doc-type-examples/top-level-example.md +8 -0
- package/vendor/rocksdb/docs/docs/index.html +6 -0
- package/vendor/rocksdb/docs/feed.xml +30 -0
- package/vendor/rocksdb/docs/index.md +9 -0
- package/vendor/rocksdb/docs/static/favicon.png +0 -0
- package/vendor/rocksdb/docs/static/fonts/LatoLatin-Black.woff +0 -0
- package/vendor/rocksdb/docs/static/fonts/LatoLatin-Black.woff2 +0 -0
- package/vendor/rocksdb/docs/static/fonts/LatoLatin-BlackItalic.woff +0 -0
- package/vendor/rocksdb/docs/static/fonts/LatoLatin-BlackItalic.woff2 +0 -0
- package/vendor/rocksdb/docs/static/fonts/LatoLatin-Italic.woff +0 -0
- package/vendor/rocksdb/docs/static/fonts/LatoLatin-Italic.woff2 +0 -0
- package/vendor/rocksdb/docs/static/fonts/LatoLatin-Light.woff +0 -0
- package/vendor/rocksdb/docs/static/fonts/LatoLatin-Light.woff2 +0 -0
- package/vendor/rocksdb/docs/static/fonts/LatoLatin-Regular.woff +0 -0
- package/vendor/rocksdb/docs/static/fonts/LatoLatin-Regular.woff2 +0 -0
- package/vendor/rocksdb/docs/static/images/Resize-of-20140327_200754-300x225.jpg +0 -0
- package/vendor/rocksdb/docs/static/images/align-compaction-output/compaction_output_file_size_compare.png +0 -0
- package/vendor/rocksdb/docs/static/images/align-compaction-output/file_cut_align.png +0 -0
- package/vendor/rocksdb/docs/static/images/align-compaction-output/file_cut_normal.png +0 -0
- package/vendor/rocksdb/docs/static/images/align-compaction-output/file_cut_trival_move.png +0 -0
- package/vendor/rocksdb/docs/static/images/align-compaction-output/file_size_compare.png +0 -0
- package/vendor/rocksdb/docs/static/images/align-compaction-output/write_amp_compare.png +0 -0
- package/vendor/rocksdb/docs/static/images/asynchronous-io/mget_async.png +0 -0
- package/vendor/rocksdb/docs/static/images/asynchronous-io/scan_async.png +0 -0
- package/vendor/rocksdb/docs/static/images/binaryseek.png +0 -0
- package/vendor/rocksdb/docs/static/images/bloom_fp_vs_bpk.png +0 -0
- package/vendor/rocksdb/docs/static/images/compaction/full-range.png +0 -0
- package/vendor/rocksdb/docs/static/images/compaction/l0-l1-contend.png +0 -0
- package/vendor/rocksdb/docs/static/images/compaction/l1-l2-contend.png +0 -0
- package/vendor/rocksdb/docs/static/images/compaction/part-range-old.png +0 -0
- package/vendor/rocksdb/docs/static/images/data-block-hash-index/block-format-binary-seek.png +0 -0
- package/vendor/rocksdb/docs/static/images/data-block-hash-index/block-format-hash-index.png +0 -0
- package/vendor/rocksdb/docs/static/images/data-block-hash-index/hash-index-data-structure.png +0 -0
- package/vendor/rocksdb/docs/static/images/data-block-hash-index/perf-cache-miss.png +0 -0
- package/vendor/rocksdb/docs/static/images/data-block-hash-index/perf-throughput.png +0 -0
- package/vendor/rocksdb/docs/static/images/delrange/delrange_collapsed.png +0 -0
- package/vendor/rocksdb/docs/static/images/delrange/delrange_key_schema.png +0 -0
- package/vendor/rocksdb/docs/static/images/delrange/delrange_sst_blocks.png +0 -0
- package/vendor/rocksdb/docs/static/images/delrange/delrange_uncollapsed.png +0 -0
- package/vendor/rocksdb/docs/static/images/delrange/delrange_write_path.png +0 -0
- package/vendor/rocksdb/docs/static/images/dictcmp/dictcmp_raw_sampled.png +0 -0
- package/vendor/rocksdb/docs/static/images/dictcmp/dictcmp_sst_blocks.png +0 -0
- package/vendor/rocksdb/docs/static/images/dictcmp/dictcmp_zstd_trained.png +0 -0
- package/vendor/rocksdb/docs/static/images/integrated-blob-db/BlobDB_Benchmarks_Legacy_Vs_Integrated.png +0 -0
- package/vendor/rocksdb/docs/static/images/integrated-blob-db/BlobDB_Benchmarks_RW_RO_Perf.png +0 -0
- package/vendor/rocksdb/docs/static/images/integrated-blob-db/BlobDB_Benchmarks_Write_Amp.png +0 -0
- package/vendor/rocksdb/docs/static/images/integrated-blob-db/BlobDB_Benchmarks_Write_Perf.png +0 -0
- package/vendor/rocksdb/docs/static/images/kv-checksum/Memtable-entry.png +0 -0
- package/vendor/rocksdb/docs/static/images/kv-checksum/Memtable-write.png +0 -0
- package/vendor/rocksdb/docs/static/images/kv-checksum/ProtInfo-Memtable.png +0 -0
- package/vendor/rocksdb/docs/static/images/kv-checksum/ProtInfo-Writebatch-to-Memtable.png +0 -0
- package/vendor/rocksdb/docs/static/images/kv-checksum/ProtInfo-Writebatch.png +0 -0
- package/vendor/rocksdb/docs/static/images/kv-checksum/WAL-fragment.png +0 -0
- package/vendor/rocksdb/docs/static/images/kv-checksum/WAL-read.png +0 -0
- package/vendor/rocksdb/docs/static/images/kv-checksum/WAL-write.png +0 -0
- package/vendor/rocksdb/docs/static/images/kv-checksum/Write-batch.png +0 -0
- package/vendor/rocksdb/docs/static/images/kv-checksum/Writebatch-write.png +0 -0
- package/vendor/rocksdb/docs/static/images/lost-buffered-write-recovery/angry-cat.png +0 -0
- package/vendor/rocksdb/docs/static/images/lost-buffered-write-recovery/basic-setup.png +0 -0
- package/vendor/rocksdb/docs/static/images/lost-buffered-write-recovery/happy-cat.png +0 -0
- package/vendor/rocksdb/docs/static/images/lost-buffered-write-recovery/replay-extension.png +0 -0
- package/vendor/rocksdb/docs/static/images/lost-buffered-write-recovery/test-fs-writable-file.png +0 -0
- package/vendor/rocksdb/docs/static/images/lost-buffered-write-recovery/trace-extension.png +0 -0
- package/vendor/rocksdb/docs/static/images/pcache-blockindex.jpg +0 -0
- package/vendor/rocksdb/docs/static/images/pcache-fileindex.jpg +0 -0
- package/vendor/rocksdb/docs/static/images/pcache-filelayout.jpg +0 -0
- package/vendor/rocksdb/docs/static/images/pcache-readiopath.jpg +0 -0
- package/vendor/rocksdb/docs/static/images/pcache-tieredstorage.jpg +0 -0
- package/vendor/rocksdb/docs/static/images/pcache-writeiopath.jpg +0 -0
- package/vendor/rocksdb/docs/static/images/promo-adapt.svg +8 -0
- package/vendor/rocksdb/docs/static/images/promo-flash.svg +28 -0
- package/vendor/rocksdb/docs/static/images/promo-operations.svg +6 -0
- package/vendor/rocksdb/docs/static/images/promo-performance.svg +134 -0
- package/vendor/rocksdb/docs/static/images/rate-limiter/auto-tuned-write-KBps-series.png +0 -0
- package/vendor/rocksdb/docs/static/images/rate-limiter/write-KBps-cdf.png +0 -0
- package/vendor/rocksdb/docs/static/images/rate-limiter/write-KBps-series.png +0 -0
- package/vendor/rocksdb/docs/static/images/rocksdb-secondary-cache/Mixgraph_hit_rate.png +0 -0
- package/vendor/rocksdb/docs/static/images/rocksdb-secondary-cache/Mixgraph_throughput.png +0 -0
- package/vendor/rocksdb/docs/static/images/rocksdb-secondary-cache/arch_diagram.png +0 -0
- package/vendor/rocksdb/docs/static/images/rocksdb-secondary-cache/insert_flow.png +0 -0
- package/vendor/rocksdb/docs/static/images/rocksdb-secondary-cache/lookup_flow.png +0 -0
- package/vendor/rocksdb/docs/static/images/time-aware-tiered-storage/compaction_moving_up_conflict.png +0 -0
- package/vendor/rocksdb/docs/static/images/time-aware-tiered-storage/per_key_placement_compaction.png +0 -0
- package/vendor/rocksdb/docs/static/images/time-aware-tiered-storage/tiered_storage_design.png +0 -0
- package/vendor/rocksdb/docs/static/images/time-aware-tiered-storage/tiered_storage_overview.png +0 -0
- package/vendor/rocksdb/docs/static/images/time-aware-tiered-storage/tiered_storage_problem.png +0 -0
- package/vendor/rocksdb/docs/static/images/tree_example1.png +0 -0
- package/vendor/rocksdb/docs/static/logo.svg +76 -0
- package/vendor/rocksdb/docs/static/og_image.png +0 -0
- package/vendor/rocksdb/env/composite_env.cc +534 -0
- package/vendor/rocksdb/env/composite_env_wrapper.h +378 -0
- package/vendor/rocksdb/env/emulated_clock.h +114 -0
- package/vendor/rocksdb/env/env.cc +1233 -0
- package/vendor/rocksdb/env/env_basic_test.cc +397 -0
- package/vendor/rocksdb/env/env_chroot.cc +148 -0
- package/vendor/rocksdb/env/env_chroot.h +55 -0
- package/vendor/rocksdb/env/env_encryption.cc +1346 -0
- package/vendor/rocksdb/env/env_encryption_ctr.h +114 -0
- package/vendor/rocksdb/env/env_posix.cc +524 -0
- package/vendor/rocksdb/env/env_test.cc +3577 -0
- package/vendor/rocksdb/env/file_system.cc +277 -0
- package/vendor/rocksdb/env/file_system_tracer.cc +564 -0
- package/vendor/rocksdb/env/file_system_tracer.h +461 -0
- package/vendor/rocksdb/env/fs_posix.cc +1284 -0
- package/vendor/rocksdb/env/fs_readonly.h +105 -0
- package/vendor/rocksdb/env/fs_remap.cc +341 -0
- package/vendor/rocksdb/env/fs_remap.h +137 -0
- package/vendor/rocksdb/env/io_posix.cc +1733 -0
- package/vendor/rocksdb/env/io_posix.h +523 -0
- package/vendor/rocksdb/env/io_posix_test.cc +141 -0
- package/vendor/rocksdb/env/mock_env.cc +1058 -0
- package/vendor/rocksdb/env/mock_env.h +144 -0
- package/vendor/rocksdb/env/mock_env_test.cc +84 -0
- package/vendor/rocksdb/env/unique_id_gen.cc +164 -0
- package/vendor/rocksdb/env/unique_id_gen.h +85 -0
- package/vendor/rocksdb/examples/CMakeLists.txt +45 -0
- package/vendor/rocksdb/examples/Makefile +58 -0
- package/vendor/rocksdb/examples/README.md +2 -0
- package/vendor/rocksdb/examples/c_simple_example.c +96 -0
- package/vendor/rocksdb/examples/column_families_example.cc +88 -0
- package/vendor/rocksdb/examples/compact_files_example.cc +177 -0
- package/vendor/rocksdb/examples/compaction_filter_example.cc +96 -0
- package/vendor/rocksdb/examples/multi_processes_example.cc +393 -0
- package/vendor/rocksdb/examples/optimistic_transaction_example.cc +190 -0
- package/vendor/rocksdb/examples/options_file_example.cc +132 -0
- package/vendor/rocksdb/examples/rocksdb_backup_restore_example.cc +99 -0
- package/vendor/rocksdb/examples/rocksdb_option_file_example.ini +142 -0
- package/vendor/rocksdb/examples/simple_example.cc +93 -0
- package/vendor/rocksdb/examples/transaction_example.cc +196 -0
- package/vendor/rocksdb/file/delete_scheduler.cc +409 -0
- package/vendor/rocksdb/file/delete_scheduler.h +147 -0
- package/vendor/rocksdb/file/delete_scheduler_test.cc +717 -0
- package/vendor/rocksdb/file/file_prefetch_buffer.cc +955 -0
- package/vendor/rocksdb/file/file_prefetch_buffer.h +471 -0
- package/vendor/rocksdb/file/file_util.cc +277 -0
- package/vendor/rocksdb/file/file_util.h +91 -0
- package/vendor/rocksdb/file/filename.cc +523 -0
- package/vendor/rocksdb/file/filename.h +188 -0
- package/vendor/rocksdb/file/line_file_reader.cc +73 -0
- package/vendor/rocksdb/file/line_file_reader.h +60 -0
- package/vendor/rocksdb/file/prefetch_test.cc +2374 -0
- package/vendor/rocksdb/file/random_access_file_reader.cc +599 -0
- package/vendor/rocksdb/file/random_access_file_reader.h +210 -0
- package/vendor/rocksdb/file/random_access_file_reader_test.cc +479 -0
- package/vendor/rocksdb/file/read_write_util.cc +33 -0
- package/vendor/rocksdb/file/read_write_util.h +31 -0
- package/vendor/rocksdb/file/readahead_file_info.h +33 -0
- package/vendor/rocksdb/file/readahead_raf.cc +169 -0
- package/vendor/rocksdb/file/readahead_raf.h +29 -0
- package/vendor/rocksdb/file/sequence_file_reader.cc +320 -0
- package/vendor/rocksdb/file/sequence_file_reader.h +119 -0
- package/vendor/rocksdb/file/sst_file_manager_impl.cc +507 -0
- package/vendor/rocksdb/file/sst_file_manager_impl.h +193 -0
- package/vendor/rocksdb/file/writable_file_writer.cc +989 -0
- package/vendor/rocksdb/file/writable_file_writer.h +320 -0
- package/vendor/rocksdb/fuzz/Makefile +67 -0
- package/vendor/rocksdb/fuzz/README.md +165 -0
- package/vendor/rocksdb/fuzz/db_fuzzer.cc +172 -0
- package/vendor/rocksdb/fuzz/db_map_fuzzer.cc +107 -0
- package/vendor/rocksdb/fuzz/proto/db_operation.proto +28 -0
- package/vendor/rocksdb/fuzz/sst_file_writer_fuzzer.cc +210 -0
- package/vendor/rocksdb/fuzz/util.h +29 -0
- package/vendor/rocksdb/include/rocksdb/advanced_cache.h +623 -0
- package/vendor/rocksdb/include/rocksdb/advanced_options.h +1177 -0
- package/vendor/rocksdb/include/rocksdb/block_cache_trace_writer.h +149 -0
- package/vendor/rocksdb/include/rocksdb/c.h +2864 -0
- package/vendor/rocksdb/include/rocksdb/cache.h +442 -0
- package/vendor/rocksdb/include/rocksdb/cache_bench_tool.h +14 -0
- package/vendor/rocksdb/include/rocksdb/cleanable.h +128 -0
- package/vendor/rocksdb/include/rocksdb/compaction_filter.h +363 -0
- package/vendor/rocksdb/include/rocksdb/compaction_job_stats.h +109 -0
- package/vendor/rocksdb/include/rocksdb/comparator.h +164 -0
- package/vendor/rocksdb/include/rocksdb/compression_type.h +40 -0
- package/vendor/rocksdb/include/rocksdb/concurrent_task_limiter.h +51 -0
- package/vendor/rocksdb/include/rocksdb/configurable.h +390 -0
- package/vendor/rocksdb/include/rocksdb/convenience.h +466 -0
- package/vendor/rocksdb/include/rocksdb/customizable.h +229 -0
- package/vendor/rocksdb/include/rocksdb/data_structure.h +186 -0
- package/vendor/rocksdb/include/rocksdb/db.h +1980 -0
- package/vendor/rocksdb/include/rocksdb/db_bench_tool.h +11 -0
- package/vendor/rocksdb/include/rocksdb/db_dump_tool.h +43 -0
- package/vendor/rocksdb/include/rocksdb/db_stress_tool.h +11 -0
- package/vendor/rocksdb/include/rocksdb/env.h +1882 -0
- package/vendor/rocksdb/include/rocksdb/env_encryption.h +463 -0
- package/vendor/rocksdb/include/rocksdb/experimental.h +56 -0
- package/vendor/rocksdb/include/rocksdb/file_checksum.h +146 -0
- package/vendor/rocksdb/include/rocksdb/file_system.h +1849 -0
- package/vendor/rocksdb/include/rocksdb/filter_policy.h +206 -0
- package/vendor/rocksdb/include/rocksdb/flush_block_policy.h +75 -0
- package/vendor/rocksdb/include/rocksdb/functor_wrapper.h +56 -0
- package/vendor/rocksdb/include/rocksdb/io_status.h +244 -0
- package/vendor/rocksdb/include/rocksdb/iostats_context.h +98 -0
- package/vendor/rocksdb/include/rocksdb/iterator.h +144 -0
- package/vendor/rocksdb/include/rocksdb/ldb_tool.h +42 -0
- package/vendor/rocksdb/include/rocksdb/listener.h +840 -0
- package/vendor/rocksdb/include/rocksdb/memory_allocator.h +87 -0
- package/vendor/rocksdb/include/rocksdb/memtablerep.h +421 -0
- package/vendor/rocksdb/include/rocksdb/merge_operator.h +286 -0
- package/vendor/rocksdb/include/rocksdb/metadata.h +258 -0
- package/vendor/rocksdb/include/rocksdb/options.h +2083 -0
- package/vendor/rocksdb/include/rocksdb/perf_context.h +314 -0
- package/vendor/rocksdb/include/rocksdb/perf_level.h +36 -0
- package/vendor/rocksdb/include/rocksdb/persistent_cache.h +74 -0
- package/vendor/rocksdb/include/rocksdb/port_defs.h +22 -0
- package/vendor/rocksdb/include/rocksdb/rate_limiter.h +159 -0
- package/vendor/rocksdb/include/rocksdb/rocksdb_namespace.h +16 -0
- package/vendor/rocksdb/include/rocksdb/secondary_cache.h +139 -0
- package/vendor/rocksdb/include/rocksdb/slice.h +264 -0
- package/vendor/rocksdb/include/rocksdb/slice_transform.h +135 -0
- package/vendor/rocksdb/include/rocksdb/snapshot.h +53 -0
- package/vendor/rocksdb/include/rocksdb/sst_dump_tool.h +17 -0
- package/vendor/rocksdb/include/rocksdb/sst_file_manager.h +136 -0
- package/vendor/rocksdb/include/rocksdb/sst_file_reader.h +45 -0
- package/vendor/rocksdb/include/rocksdb/sst_file_writer.h +189 -0
- package/vendor/rocksdb/include/rocksdb/sst_partitioner.h +142 -0
- package/vendor/rocksdb/include/rocksdb/statistics.h +757 -0
- package/vendor/rocksdb/include/rocksdb/stats_history.h +70 -0
- package/vendor/rocksdb/include/rocksdb/status.h +574 -0
- package/vendor/rocksdb/include/rocksdb/system_clock.h +114 -0
- package/vendor/rocksdb/include/rocksdb/table.h +927 -0
- package/vendor/rocksdb/include/rocksdb/table_properties.h +332 -0
- package/vendor/rocksdb/include/rocksdb/table_reader_caller.h +41 -0
- package/vendor/rocksdb/include/rocksdb/thread_status.h +190 -0
- package/vendor/rocksdb/include/rocksdb/threadpool.h +67 -0
- package/vendor/rocksdb/include/rocksdb/trace_reader_writer.h +52 -0
- package/vendor/rocksdb/include/rocksdb/trace_record.h +248 -0
- package/vendor/rocksdb/include/rocksdb/trace_record_result.h +187 -0
- package/vendor/rocksdb/include/rocksdb/transaction_log.h +122 -0
- package/vendor/rocksdb/include/rocksdb/types.h +94 -0
- package/vendor/rocksdb/include/rocksdb/unique_id.h +55 -0
- package/vendor/rocksdb/include/rocksdb/universal_compaction.h +96 -0
- package/vendor/rocksdb/include/rocksdb/utilities/agg_merge.h +138 -0
- package/vendor/rocksdb/include/rocksdb/utilities/backup_engine.h +689 -0
- package/vendor/rocksdb/include/rocksdb/utilities/cache_dump_load.h +140 -0
- package/vendor/rocksdb/include/rocksdb/utilities/checkpoint.h +63 -0
- package/vendor/rocksdb/include/rocksdb/utilities/convenience.h +10 -0
- package/vendor/rocksdb/include/rocksdb/utilities/customizable_util.h +322 -0
- package/vendor/rocksdb/include/rocksdb/utilities/db_ttl.h +70 -0
- package/vendor/rocksdb/include/rocksdb/utilities/debug.h +46 -0
- package/vendor/rocksdb/include/rocksdb/utilities/env_mirror.h +179 -0
- package/vendor/rocksdb/include/rocksdb/utilities/info_log_finder.h +19 -0
- package/vendor/rocksdb/include/rocksdb/utilities/ldb_cmd.h +316 -0
- package/vendor/rocksdb/include/rocksdb/utilities/ldb_cmd_execute_result.h +75 -0
- package/vendor/rocksdb/include/rocksdb/utilities/leveldb_options.h +145 -0
- package/vendor/rocksdb/include/rocksdb/utilities/lua/rocks_lua_custom_library.h +43 -0
- package/vendor/rocksdb/include/rocksdb/utilities/lua/rocks_lua_util.h +55 -0
- package/vendor/rocksdb/include/rocksdb/utilities/memory_util.h +48 -0
- package/vendor/rocksdb/include/rocksdb/utilities/object_registry.h +583 -0
- package/vendor/rocksdb/include/rocksdb/utilities/optimistic_transaction_db.h +98 -0
- package/vendor/rocksdb/include/rocksdb/utilities/option_change_migration.h +24 -0
- package/vendor/rocksdb/include/rocksdb/utilities/options_type.h +1221 -0
- package/vendor/rocksdb/include/rocksdb/utilities/options_util.h +105 -0
- package/vendor/rocksdb/include/rocksdb/utilities/replayer.h +85 -0
- package/vendor/rocksdb/include/rocksdb/utilities/sim_cache.h +93 -0
- package/vendor/rocksdb/include/rocksdb/utilities/stackable_db.h +587 -0
- package/vendor/rocksdb/include/rocksdb/utilities/table_properties_collectors.h +88 -0
- package/vendor/rocksdb/include/rocksdb/utilities/transaction.h +683 -0
- package/vendor/rocksdb/include/rocksdb/utilities/transaction_db.h +506 -0
- package/vendor/rocksdb/include/rocksdb/utilities/transaction_db_mutex.h +89 -0
- package/vendor/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +307 -0
- package/vendor/rocksdb/include/rocksdb/version.h +43 -0
- package/vendor/rocksdb/include/rocksdb/wal_filter.h +111 -0
- package/vendor/rocksdb/include/rocksdb/wide_columns.h +210 -0
- package/vendor/rocksdb/include/rocksdb/write_batch.h +494 -0
- package/vendor/rocksdb/include/rocksdb/write_batch_base.h +144 -0
- package/vendor/rocksdb/include/rocksdb/write_buffer_manager.h +183 -0
- package/vendor/rocksdb/issue_template.md +7 -0
- package/vendor/rocksdb/java/CMakeLists.txt +549 -0
- package/vendor/rocksdb/java/GetBenchmarks.md +161 -0
- package/vendor/rocksdb/java/HISTORY-JAVA.md +86 -0
- package/vendor/rocksdb/java/Makefile +453 -0
- package/vendor/rocksdb/java/RELEASE.md +59 -0
- package/vendor/rocksdb/java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java +1640 -0
- package/vendor/rocksdb/java/crossbuild/Vagrantfile +51 -0
- package/vendor/rocksdb/java/crossbuild/build-linux-alpine.sh +70 -0
- package/vendor/rocksdb/java/crossbuild/build-linux-centos.sh +38 -0
- package/vendor/rocksdb/java/crossbuild/build-linux.sh +15 -0
- package/vendor/rocksdb/java/crossbuild/docker-build-linux-alpine.sh +17 -0
- package/vendor/rocksdb/java/crossbuild/docker-build-linux-centos.sh +38 -0
- package/vendor/rocksdb/java/jdb_bench.sh +13 -0
- package/vendor/rocksdb/java/jmh/LICENSE-HEADER.txt +5 -0
- package/vendor/rocksdb/java/jmh/README.md +24 -0
- package/vendor/rocksdb/java/jmh/pom.xml +138 -0
- package/vendor/rocksdb/java/jmh/src/main/java/org/rocksdb/jmh/ComparatorBenchmarks.java +139 -0
- package/vendor/rocksdb/java/jmh/src/main/java/org/rocksdb/jmh/GetBenchmarks.java +215 -0
- package/vendor/rocksdb/java/jmh/src/main/java/org/rocksdb/jmh/MultiGetBenchmarks.java +214 -0
- package/vendor/rocksdb/java/jmh/src/main/java/org/rocksdb/jmh/PutBenchmarks.java +112 -0
- package/vendor/rocksdb/java/jmh/src/main/java/org/rocksdb/util/FileUtils.java +59 -0
- package/vendor/rocksdb/java/jmh/src/main/java/org/rocksdb/util/KVUtils.java +72 -0
- package/vendor/rocksdb/java/pom.xml.template +178 -0
- package/vendor/rocksdb/java/rocksjni/backup_engine_options.cc +365 -0
- package/vendor/rocksdb/java/rocksjni/backupenginejni.cc +279 -0
- package/vendor/rocksdb/java/rocksjni/cache.cc +34 -0
- package/vendor/rocksdb/java/rocksjni/cassandra_compactionfilterjni.cc +25 -0
- package/vendor/rocksdb/java/rocksjni/cassandra_value_operator.cc +50 -0
- package/vendor/rocksdb/java/rocksjni/checkpoint.cc +71 -0
- package/vendor/rocksdb/java/rocksjni/clock_cache.cc +42 -0
- package/vendor/rocksdb/java/rocksjni/columnfamilyhandle.cc +72 -0
- package/vendor/rocksdb/java/rocksjni/compact_range_options.cc +222 -0
- package/vendor/rocksdb/java/rocksjni/compaction_filter.cc +29 -0
- package/vendor/rocksdb/java/rocksjni/compaction_filter_factory.cc +42 -0
- package/vendor/rocksdb/java/rocksjni/compaction_filter_factory_jnicallback.cc +79 -0
- package/vendor/rocksdb/java/rocksjni/compaction_filter_factory_jnicallback.h +37 -0
- package/vendor/rocksdb/java/rocksjni/compaction_job_info.cc +230 -0
- package/vendor/rocksdb/java/rocksjni/compaction_job_stats.cc +345 -0
- package/vendor/rocksdb/java/rocksjni/compaction_options.cc +112 -0
- package/vendor/rocksdb/java/rocksjni/compaction_options_fifo.cc +83 -0
- package/vendor/rocksdb/java/rocksjni/compaction_options_universal.cc +209 -0
- package/vendor/rocksdb/java/rocksjni/comparator.cc +60 -0
- package/vendor/rocksdb/java/rocksjni/comparatorjnicallback.cc +647 -0
- package/vendor/rocksdb/java/rocksjni/comparatorjnicallback.h +137 -0
- package/vendor/rocksdb/java/rocksjni/compression_options.cc +214 -0
- package/vendor/rocksdb/java/rocksjni/concurrent_task_limiter.cc +97 -0
- package/vendor/rocksdb/java/rocksjni/config_options.cc +103 -0
- package/vendor/rocksdb/java/rocksjni/cplusplus_to_java_convert.h +37 -0
- package/vendor/rocksdb/java/rocksjni/env.cc +205 -0
- package/vendor/rocksdb/java/rocksjni/env_options.cc +305 -0
- package/vendor/rocksdb/java/rocksjni/event_listener.cc +44 -0
- package/vendor/rocksdb/java/rocksjni/event_listener_jnicallback.cc +502 -0
- package/vendor/rocksdb/java/rocksjni/event_listener_jnicallback.h +122 -0
- package/vendor/rocksdb/java/rocksjni/filter.cc +46 -0
- package/vendor/rocksdb/java/rocksjni/ingest_external_file_options.cc +199 -0
- package/vendor/rocksdb/java/rocksjni/iterator.cc +340 -0
- package/vendor/rocksdb/java/rocksjni/jnicallback.cc +54 -0
- package/vendor/rocksdb/java/rocksjni/jnicallback.h +32 -0
- package/vendor/rocksdb/java/rocksjni/loggerjnicallback.cc +299 -0
- package/vendor/rocksdb/java/rocksjni/loggerjnicallback.h +51 -0
- package/vendor/rocksdb/java/rocksjni/lru_cache.cc +49 -0
- package/vendor/rocksdb/java/rocksjni/memory_util.cc +100 -0
- package/vendor/rocksdb/java/rocksjni/memtablejni.cc +94 -0
- package/vendor/rocksdb/java/rocksjni/merge_operator.cc +98 -0
- package/vendor/rocksdb/java/rocksjni/native_comparator_wrapper_test.cc +45 -0
- package/vendor/rocksdb/java/rocksjni/optimistic_transaction_db.cc +270 -0
- package/vendor/rocksdb/java/rocksjni/optimistic_transaction_options.cc +78 -0
- package/vendor/rocksdb/java/rocksjni/options.cc +8695 -0
- package/vendor/rocksdb/java/rocksjni/options_util.cc +139 -0
- package/vendor/rocksdb/java/rocksjni/persistent_cache.cc +60 -0
- package/vendor/rocksdb/java/rocksjni/portal.h +8706 -0
- package/vendor/rocksdb/java/rocksjni/ratelimiterjni.cc +128 -0
- package/vendor/rocksdb/java/rocksjni/remove_emptyvalue_compactionfilterjni.cc +24 -0
- package/vendor/rocksdb/java/rocksjni/restorejni.cc +42 -0
- package/vendor/rocksdb/java/rocksjni/rocks_callback_object.cc +30 -0
- package/vendor/rocksdb/java/rocksjni/rocksdb_exception_test.cc +81 -0
- package/vendor/rocksdb/java/rocksjni/rocksjni.cc +3957 -0
- package/vendor/rocksdb/java/rocksjni/slice.cc +374 -0
- package/vendor/rocksdb/java/rocksjni/snapshot.cc +27 -0
- package/vendor/rocksdb/java/rocksjni/sst_file_manager.cc +250 -0
- package/vendor/rocksdb/java/rocksjni/sst_file_reader_iterator.cc +373 -0
- package/vendor/rocksdb/java/rocksjni/sst_file_readerjni.cc +118 -0
- package/vendor/rocksdb/java/rocksjni/sst_file_writerjni.cc +310 -0
- package/vendor/rocksdb/java/rocksjni/sst_partitioner.cc +43 -0
- package/vendor/rocksdb/java/rocksjni/statistics.cc +268 -0
- package/vendor/rocksdb/java/rocksjni/statisticsjni.cc +31 -0
- package/vendor/rocksdb/java/rocksjni/statisticsjni.h +34 -0
- package/vendor/rocksdb/java/rocksjni/table.cc +145 -0
- package/vendor/rocksdb/java/rocksjni/table_filter.cc +27 -0
- package/vendor/rocksdb/java/rocksjni/table_filter_jnicallback.cc +66 -0
- package/vendor/rocksdb/java/rocksjni/table_filter_jnicallback.h +36 -0
- package/vendor/rocksdb/java/rocksjni/testable_event_listener.cc +219 -0
- package/vendor/rocksdb/java/rocksjni/thread_status.cc +125 -0
- package/vendor/rocksdb/java/rocksjni/trace_writer.cc +24 -0
- package/vendor/rocksdb/java/rocksjni/trace_writer_jnicallback.cc +118 -0
- package/vendor/rocksdb/java/rocksjni/trace_writer_jnicallback.h +36 -0
- package/vendor/rocksdb/java/rocksjni/transaction.cc +1655 -0
- package/vendor/rocksdb/java/rocksjni/transaction_db.cc +451 -0
- package/vendor/rocksdb/java/rocksjni/transaction_db_options.cc +169 -0
- package/vendor/rocksdb/java/rocksjni/transaction_log.cc +80 -0
- package/vendor/rocksdb/java/rocksjni/transaction_notifier.cc +44 -0
- package/vendor/rocksdb/java/rocksjni/transaction_notifier_jnicallback.cc +42 -0
- package/vendor/rocksdb/java/rocksjni/transaction_notifier_jnicallback.h +42 -0
- package/vendor/rocksdb/java/rocksjni/transaction_options.cc +191 -0
- package/vendor/rocksdb/java/rocksjni/ttl.cc +212 -0
- package/vendor/rocksdb/java/rocksjni/wal_filter.cc +24 -0
- package/vendor/rocksdb/java/rocksjni/wal_filter_jnicallback.cc +139 -0
- package/vendor/rocksdb/java/rocksjni/wal_filter_jnicallback.h +42 -0
- package/vendor/rocksdb/java/rocksjni/write_batch.cc +676 -0
- package/vendor/rocksdb/java/rocksjni/write_batch_test.cc +199 -0
- package/vendor/rocksdb/java/rocksjni/write_batch_with_index.cc +953 -0
- package/vendor/rocksdb/java/rocksjni/write_buffer_manager.cc +47 -0
- package/vendor/rocksdb/java/rocksjni/writebatchhandlerjnicallback.cc +519 -0
- package/vendor/rocksdb/java/rocksjni/writebatchhandlerjnicallback.h +92 -0
- package/vendor/rocksdb/java/samples/src/main/java/OptimisticTransactionSample.java +184 -0
- package/vendor/rocksdb/java/samples/src/main/java/RocksDBColumnFamilySample.java +78 -0
- package/vendor/rocksdb/java/samples/src/main/java/RocksDBSample.java +295 -0
- package/vendor/rocksdb/java/samples/src/main/java/TransactionSample.java +183 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractCompactionFilter.java +59 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractCompactionFilterFactory.java +77 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractComparator.java +124 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractComparatorJniBridge.java +119 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractEventListener.java +334 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractImmutableNativeReference.java +65 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractMutableOptions.java +368 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractNativeReference.java +49 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractRocksIterator.java +146 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractSlice.java +191 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractTableFilter.java +20 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractTraceWriter.java +70 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractTransactionNotifier.java +54 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractWalFilter.java +49 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AbstractWriteBatch.java +203 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AccessHint.java +53 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AdvancedColumnFamilyOptionsInterface.java +463 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/AdvancedMutableColumnFamilyOptionsInterface.java +830 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/BackgroundErrorReason.java +46 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/BackupEngine.java +259 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/BackupEngineOptions.java +458 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/BackupInfo.java +76 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/BlockBasedTableConfig.java +951 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/BloomFilter.java +73 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/BuiltinComparator.java +20 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ByteBufferGetStatus.java +50 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Cache.java +40 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CassandraCompactionFilter.java +20 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CassandraValueMergeOperator.java +25 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Checkpoint.java +62 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ChecksumType.java +45 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ClockCache.java +59 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ColumnFamilyDescriptor.java +84 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ColumnFamilyHandle.java +151 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ColumnFamilyMetaData.java +70 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ColumnFamilyOptions.java +1543 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ColumnFamilyOptionsInterface.java +536 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompactRangeOptions.java +245 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompactionJobInfo.java +161 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompactionJobStats.java +295 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompactionOptions.java +121 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompactionOptionsFIFO.java +87 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompactionOptionsUniversal.java +273 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompactionPriority.java +81 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompactionReason.java +141 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompactionStopStyle.java +55 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompactionStyle.java +81 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ComparatorOptions.java +133 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ComparatorType.java +48 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompressionOptions.java +150 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/CompressionType.java +121 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ConcurrentTaskLimiter.java +44 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ConcurrentTaskLimiterImpl.java +48 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ConfigOptions.java +53 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/DBOptions.java +1496 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/DBOptionsInterface.java +1756 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/DataBlockIndexType.java +32 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/DbPath.java +47 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/DirectSlice.java +136 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/EncodingType.java +55 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Env.java +167 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/EnvOptions.java +366 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/EventListener.java +335 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Experimental.java +23 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ExternalFileIngestionInfo.java +103 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/FileOperationInfo.java +112 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Filter.java +36 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/FlushJobInfo.java +186 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/FlushOptions.java +90 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/FlushReason.java +53 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/HashLinkedListMemTableConfig.java +174 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/HashSkipListMemTableConfig.java +106 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/HistogramData.java +75 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/HistogramType.java +214 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Holder.java +46 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/IndexShorteningMode.java +60 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/IndexType.java +55 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/InfoLogLevel.java +49 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/IngestExternalFileOptions.java +227 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/KeyMayExist.java +35 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/LRUCache.java +106 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/LevelMetaData.java +56 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/LiveFileMetaData.java +55 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/LogFile.java +75 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Logger.java +121 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MemTableConfig.java +29 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MemTableInfo.java +103 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MemoryUsageType.java +72 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MemoryUtil.java +60 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MergeOperator.java +18 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MutableColumnFamilyOptions.java +621 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MutableColumnFamilyOptionsInterface.java +156 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MutableDBOptions.java +292 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java +440 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MutableOptionKey.java +16 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/MutableOptionValue.java +368 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/NativeComparatorWrapper.java +59 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/NativeLibraryLoader.java +172 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/OperationStage.java +59 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/OperationType.java +55 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/OptimisticTransactionDB.java +224 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/OptimisticTransactionOptions.java +53 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/OptionString.java +261 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Options.java +2574 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/OptionsUtil.java +101 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/PersistentCache.java +26 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/PlainTableConfig.java +251 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/PrepopulateBlobCache.java +117 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Priority.java +49 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Range.java +19 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RateLimiter.java +227 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RateLimiterMode.java +52 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ReadOptions.java +822 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ReadTier.java +49 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RemoveEmptyValueCompactionFilter.java +18 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RestoreOptions.java +32 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ReusedSynchronisationType.java +65 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RocksCallbackObject.java +73 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RocksDB.java +4688 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RocksDBException.java +44 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RocksEnv.java +31 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RocksIterator.java +140 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RocksIteratorInterface.java +127 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RocksMemEnv.java +31 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RocksMutableObject.java +87 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/RocksObject.java +45 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/SanityLevel.java +47 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/SizeApproximationFlag.java +31 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/SkipListMemTableConfig.java +51 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Slice.java +135 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Snapshot.java +41 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/SstFileManager.java +249 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/SstFileMetaData.java +162 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/SstFileReader.java +82 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/SstFileReaderIterator.java +140 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/SstFileWriter.java +237 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/SstPartitionerFactory.java +15 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/SstPartitionerFixedPrefixFactory.java +19 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/StateType.java +53 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Statistics.java +153 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/StatisticsCollector.java +102 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/StatisticsCollectorCallback.java +32 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/StatsCollectorInput.java +35 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/StatsLevel.java +65 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Status.java +155 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/StringAppendOperator.java +29 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TableFileCreationBriefInfo.java +107 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TableFileCreationInfo.java +86 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TableFileCreationReason.java +46 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TableFileDeletionInfo.java +86 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TableFilter.java +21 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TableFormatConfig.java +22 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TableProperties.java +426 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ThreadStatus.java +224 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/ThreadType.java +65 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TickerType.java +802 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TimedEnv.java +30 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TraceOptions.java +32 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TraceWriter.java +36 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/Transaction.java +2162 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TransactionDB.java +401 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TransactionDBOptions.java +216 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TransactionLogIterator.java +112 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TransactionOptions.java +189 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TransactionalDB.java +65 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TransactionalOptions.java +31 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TtlDB.java +242 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/TxnDBWritePolicy.java +62 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/UInt64AddOperator.java +19 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/VectorMemTableConfig.java +46 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WALRecoveryMode.java +82 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WBWIRocksIterator.java +203 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WalFileType.java +55 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WalFilter.java +86 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WalProcessingOption.java +54 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WriteBatch.java +394 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WriteBatchInterface.java +283 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WriteBatchWithIndex.java +358 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WriteBufferManager.java +50 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WriteOptions.java +255 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WriteStallCondition.java +44 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/WriteStallInfo.java +75 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/util/ByteUtil.java +52 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/util/BytewiseComparator.java +121 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/util/Environment.java +245 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/util/IntComparator.java +67 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/util/ReverseBytewiseComparator.java +88 -0
- package/vendor/rocksdb/java/src/main/java/org/rocksdb/util/SizeUnit.java +16 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/AbstractTransactionTest.java +979 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/BackupEngineOptionsTest.java +297 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/BackupEngineTest.java +261 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/BlobOptionsTest.java +353 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/BlockBasedTableConfigTest.java +415 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/BuiltinComparatorTest.java +145 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/ByteBufferUnsupportedOperationTest.java +132 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/BytewiseComparatorRegressionTest.java +132 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CheckPointTest.java +82 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/ClockCacheTest.java +25 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/ColumnFamilyOptionsTest.java +712 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/ColumnFamilyTest.java +562 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompactRangeOptionsTest.java +102 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompactionFilterFactoryTest.java +61 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompactionJobInfoTest.java +114 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompactionJobStatsTest.java +196 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompactionOptionsFIFOTest.java +35 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompactionOptionsTest.java +52 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompactionOptionsUniversalTest.java +80 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompactionPriorityTest.java +31 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompactionStopStyleTest.java +31 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/ComparatorOptionsTest.java +58 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompressionOptionsTest.java +71 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/CompressionTypesTest.java +25 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/ConcurrentTaskLimiterTest.java +56 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/DBOptionsTest.java +902 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/DefaultEnvTest.java +113 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/DirectSliceTest.java +93 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/EnvOptionsTest.java +145 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/EventListenerTest.java +725 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/FilterTest.java +39 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/FlushOptionsTest.java +31 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/FlushTest.java +49 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/InfoLogLevelTest.java +109 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/IngestExternalFileOptionsTest.java +107 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/KeyMayExistTest.java +528 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/LRUCacheTest.java +32 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/LoggerTest.java +235 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/MemTableTest.java +108 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/MemoryUtilTest.java +136 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/MergeTest.java +465 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/MixedOptionsTest.java +85 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/MultiColumnRegressionTest.java +145 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/MultiGetManyKeysTest.java +241 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/MultiGetTest.java +530 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/MutableColumnFamilyOptionsTest.java +167 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/MutableDBOptionsTest.java +85 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/MutableOptionsGetSetTest.java +429 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/NativeComparatorWrapperTest.java +90 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/NativeLibraryLoaderTest.java +41 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/OptimisticTransactionDBTest.java +131 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/OptimisticTransactionOptionsTest.java +38 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/OptimisticTransactionTest.java +446 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/OptionsTest.java +1488 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/OptionsUtilTest.java +129 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/PlainTableConfigTest.java +89 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/PlatformRandomHelper.java +58 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/PutMultiplePartsTest.java +164 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/RateLimiterTest.java +65 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/ReadOnlyTest.java +222 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/ReadOptionsTest.java +374 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/RocksDBExceptionTest.java +115 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/RocksDBTest.java +1692 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/RocksIteratorTest.java +289 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/RocksMemEnvTest.java +137 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/RocksNativeLibraryResource.java +18 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/SecondaryDBTest.java +135 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/SliceTest.java +80 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/SnapshotTest.java +169 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/SstFileManagerTest.java +66 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/SstFileReaderTest.java +222 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/SstFileWriterTest.java +239 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/SstPartitionerTest.java +72 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/StatisticsCollectorTest.java +55 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/StatisticsTest.java +168 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/StatsCallbackMock.java +19 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/TableFilterTest.java +106 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/TimedEnvTest.java +40 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/TransactionDBOptionsTest.java +64 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/TransactionDBTest.java +177 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/TransactionLogIteratorTest.java +139 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/TransactionOptionsTest.java +72 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/TransactionTest.java +488 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/TtlDBTest.java +112 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/Types.java +43 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/VerifyChecksumsTest.java +213 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/WALRecoveryModeTest.java +22 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/WalFilterTest.java +165 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/WriteBatchHandlerTest.java +76 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/WriteBatchTest.java +528 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/WriteBatchThreadedTest.java +101 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/WriteBatchWithIndexTest.java +1068 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/WriteOptionsTest.java +75 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/test/RemoveEmptyValueCompactionFilterFactory.java +21 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/test/RocksJunitRunner.java +174 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/test/TestableEventListener.java +23 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/ByteBufferAllocator.java +16 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/BytewiseComparatorIntTest.java +267 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/BytewiseComparatorTest.java +531 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/CapturingWriteBatchHandler.java +190 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/DirectByteBufferAllocator.java +18 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/EnvironmentTest.java +304 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/HeapByteBufferAllocator.java +18 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/IntComparatorTest.java +266 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/JNIComparatorTest.java +180 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/ReverseBytewiseComparatorIntTest.java +270 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/SizeUnitTest.java +27 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/TestUtil.java +72 -0
- package/vendor/rocksdb/java/src/test/java/org/rocksdb/util/WriteBatchGetter.java +139 -0
- package/vendor/rocksdb/java/understanding_options.md +79 -0
- package/vendor/rocksdb/logging/auto_roll_logger.cc +368 -0
- package/vendor/rocksdb/logging/auto_roll_logger.h +166 -0
- package/vendor/rocksdb/logging/auto_roll_logger_test.cc +731 -0
- package/vendor/rocksdb/logging/env_logger.h +195 -0
- package/vendor/rocksdb/logging/env_logger_test.cc +163 -0
- package/vendor/rocksdb/logging/event_logger.cc +68 -0
- package/vendor/rocksdb/logging/event_logger.h +202 -0
- package/vendor/rocksdb/logging/event_logger_test.cc +45 -0
- package/vendor/rocksdb/logging/log_buffer.cc +91 -0
- package/vendor/rocksdb/logging/log_buffer.h +57 -0
- package/vendor/rocksdb/logging/logging.h +62 -0
- package/vendor/rocksdb/memory/allocator.h +58 -0
- package/vendor/rocksdb/memory/arena.cc +170 -0
- package/vendor/rocksdb/memory/arena.h +135 -0
- package/vendor/rocksdb/memory/arena_test.cc +295 -0
- package/vendor/rocksdb/memory/concurrent_arena.cc +45 -0
- package/vendor/rocksdb/memory/concurrent_arena.h +215 -0
- package/vendor/rocksdb/memory/jemalloc_nodump_allocator.cc +303 -0
- package/vendor/rocksdb/memory/jemalloc_nodump_allocator.h +99 -0
- package/vendor/rocksdb/memory/memkind_kmem_allocator.cc +44 -0
- package/vendor/rocksdb/memory/memkind_kmem_allocator.h +43 -0
- package/vendor/rocksdb/memory/memory_allocator.cc +80 -0
- package/vendor/rocksdb/memory/memory_allocator_impl.h +47 -0
- package/vendor/rocksdb/memory/memory_allocator_test.cc +236 -0
- package/vendor/rocksdb/memory/memory_usage.h +38 -0
- package/vendor/rocksdb/memtable/alloc_tracker.cc +63 -0
- package/vendor/rocksdb/memtable/hash_linklist_rep.cc +924 -0
- package/vendor/rocksdb/memtable/hash_skiplist_rep.cc +391 -0
- package/vendor/rocksdb/memtable/inlineskiplist.h +1051 -0
- package/vendor/rocksdb/memtable/inlineskiplist_test.cc +665 -0
- package/vendor/rocksdb/memtable/memtablerep_bench.cc +687 -0
- package/vendor/rocksdb/memtable/skiplist.h +498 -0
- package/vendor/rocksdb/memtable/skiplist_test.cc +388 -0
- package/vendor/rocksdb/memtable/skiplistrep.cc +368 -0
- package/vendor/rocksdb/memtable/stl_wrappers.h +33 -0
- package/vendor/rocksdb/memtable/vectorrep.cc +307 -0
- package/vendor/rocksdb/memtable/write_buffer_manager.cc +185 -0
- package/vendor/rocksdb/memtable/write_buffer_manager_test.cc +304 -0
- package/vendor/rocksdb/microbench/CMakeLists.txt +17 -0
- package/vendor/rocksdb/microbench/README.md +60 -0
- package/vendor/rocksdb/microbench/db_basic_bench.cc +1583 -0
- package/vendor/rocksdb/microbench/ribbon_bench.cc +155 -0
- package/vendor/rocksdb/monitoring/file_read_sample.h +23 -0
- package/vendor/rocksdb/monitoring/histogram.cc +270 -0
- package/vendor/rocksdb/monitoring/histogram.h +143 -0
- package/vendor/rocksdb/monitoring/histogram_test.cc +254 -0
- package/vendor/rocksdb/monitoring/histogram_windowing.cc +194 -0
- package/vendor/rocksdb/monitoring/histogram_windowing.h +84 -0
- package/vendor/rocksdb/monitoring/in_memory_stats_history.cc +50 -0
- package/vendor/rocksdb/monitoring/in_memory_stats_history.h +74 -0
- package/vendor/rocksdb/monitoring/instrumented_mutex.cc +90 -0
- package/vendor/rocksdb/monitoring/instrumented_mutex.h +126 -0
- package/vendor/rocksdb/monitoring/iostats_context.cc +78 -0
- package/vendor/rocksdb/monitoring/iostats_context_imp.h +62 -0
- package/vendor/rocksdb/monitoring/iostats_context_test.cc +31 -0
- package/vendor/rocksdb/monitoring/perf_context.cc +313 -0
- package/vendor/rocksdb/monitoring/perf_context_imp.h +96 -0
- package/vendor/rocksdb/monitoring/perf_level.cc +23 -0
- package/vendor/rocksdb/monitoring/perf_level_imp.h +14 -0
- package/vendor/rocksdb/monitoring/perf_step_timer.h +77 -0
- package/vendor/rocksdb/monitoring/persistent_stats_history.cc +170 -0
- package/vendor/rocksdb/monitoring/persistent_stats_history.h +83 -0
- package/vendor/rocksdb/monitoring/statistics.cc +534 -0
- package/vendor/rocksdb/monitoring/statistics_impl.h +144 -0
- package/vendor/rocksdb/monitoring/statistics_test.cc +88 -0
- package/vendor/rocksdb/monitoring/stats_history_test.cc +662 -0
- package/vendor/rocksdb/monitoring/thread_status_impl.cc +163 -0
- package/vendor/rocksdb/monitoring/thread_status_updater.cc +328 -0
- package/vendor/rocksdb/monitoring/thread_status_updater.h +226 -0
- package/vendor/rocksdb/monitoring/thread_status_updater_debug.cc +43 -0
- package/vendor/rocksdb/monitoring/thread_status_util.cc +208 -0
- package/vendor/rocksdb/monitoring/thread_status_util.h +139 -0
- package/vendor/rocksdb/monitoring/thread_status_util_debug.cc +46 -0
- package/vendor/rocksdb/options/cf_options.cc +1196 -0
- package/vendor/rocksdb/options/cf_options.h +347 -0
- package/vendor/rocksdb/options/configurable.cc +712 -0
- package/vendor/rocksdb/options/configurable_helper.h +185 -0
- package/vendor/rocksdb/options/configurable_test.cc +861 -0
- package/vendor/rocksdb/options/configurable_test.h +116 -0
- package/vendor/rocksdb/options/customizable.cc +133 -0
- package/vendor/rocksdb/options/customizable_test.cc +2116 -0
- package/vendor/rocksdb/options/db_options.cc +1079 -0
- package/vendor/rocksdb/options/db_options.h +152 -0
- package/vendor/rocksdb/options/options.cc +692 -0
- package/vendor/rocksdb/options/options_helper.cc +1424 -0
- package/vendor/rocksdb/options/options_helper.h +116 -0
- package/vendor/rocksdb/options/options_parser.cc +736 -0
- package/vendor/rocksdb/options/options_parser.h +149 -0
- package/vendor/rocksdb/options/options_settable_test.cc +655 -0
- package/vendor/rocksdb/options/options_test.cc +5060 -0
- package/vendor/rocksdb/plugin/README.md +43 -0
- package/vendor/rocksdb/port/README +10 -0
- package/vendor/rocksdb/port/jemalloc_helper.h +107 -0
- package/vendor/rocksdb/port/lang.h +97 -0
- package/vendor/rocksdb/port/likely.h +18 -0
- package/vendor/rocksdb/port/malloc.h +17 -0
- package/vendor/rocksdb/port/mmap.cc +98 -0
- package/vendor/rocksdb/port/mmap.h +70 -0
- package/vendor/rocksdb/port/port.h +21 -0
- package/vendor/rocksdb/port/port_dirent.h +44 -0
- package/vendor/rocksdb/port/port_example.h +101 -0
- package/vendor/rocksdb/port/port_posix.cc +300 -0
- package/vendor/rocksdb/port/port_posix.h +243 -0
- package/vendor/rocksdb/port/stack_trace.cc +336 -0
- package/vendor/rocksdb/port/stack_trace.h +31 -0
- package/vendor/rocksdb/port/sys_time.h +63 -0
- package/vendor/rocksdb/port/util_logger.h +18 -0
- package/vendor/rocksdb/port/win/env_default.cc +45 -0
- package/vendor/rocksdb/port/win/env_win.cc +1437 -0
- package/vendor/rocksdb/port/win/env_win.h +305 -0
- package/vendor/rocksdb/port/win/io_win.cc +1101 -0
- package/vendor/rocksdb/port/win/io_win.h +508 -0
- package/vendor/rocksdb/port/win/port_win.cc +303 -0
- package/vendor/rocksdb/port/win/port_win.h +379 -0
- package/vendor/rocksdb/port/win/win_jemalloc.cc +80 -0
- package/vendor/rocksdb/port/win/win_logger.cc +192 -0
- package/vendor/rocksdb/port/win/win_logger.h +64 -0
- package/vendor/rocksdb/port/win/win_thread.cc +170 -0
- package/vendor/rocksdb/port/win/win_thread.h +117 -0
- package/vendor/rocksdb/port/win/xpress_win.cc +210 -0
- package/vendor/rocksdb/port/win/xpress_win.h +26 -0
- package/vendor/rocksdb/port/xpress.h +17 -0
- package/vendor/rocksdb/rocksdb.pc.in +10 -0
- package/vendor/rocksdb/src.mk +713 -0
- package/vendor/rocksdb/table/adaptive/adaptive_table_factory.cc +125 -0
- package/vendor/rocksdb/table/adaptive/adaptive_table_factory.h +56 -0
- package/vendor/rocksdb/table/block_based/binary_search_index_reader.cc +73 -0
- package/vendor/rocksdb/table/block_based/binary_search_index_reader.h +48 -0
- package/vendor/rocksdb/table/block_based/block.cc +1291 -0
- package/vendor/rocksdb/table/block_based/block.h +921 -0
- package/vendor/rocksdb/table/block_based/block_based_table_builder.cc +2027 -0
- package/vendor/rocksdb/table/block_based/block_based_table_builder.h +209 -0
- package/vendor/rocksdb/table/block_based/block_based_table_factory.cc +962 -0
- package/vendor/rocksdb/table/block_based/block_based_table_factory.h +102 -0
- package/vendor/rocksdb/table/block_based/block_based_table_iterator.cc +500 -0
- package/vendor/rocksdb/table/block_based/block_based_table_iterator.h +310 -0
- package/vendor/rocksdb/table/block_based/block_based_table_reader.cc +3043 -0
- package/vendor/rocksdb/table/block_based/block_based_table_reader.h +745 -0
- package/vendor/rocksdb/table/block_based/block_based_table_reader_impl.h +203 -0
- package/vendor/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +758 -0
- package/vendor/rocksdb/table/block_based/block_based_table_reader_test.cc +567 -0
- package/vendor/rocksdb/table/block_based/block_builder.cc +234 -0
- package/vendor/rocksdb/table/block_based/block_builder.h +104 -0
- package/vendor/rocksdb/table/block_based/block_cache.cc +106 -0
- package/vendor/rocksdb/table/block_based/block_cache.h +140 -0
- package/vendor/rocksdb/table/block_based/block_prefetcher.cc +120 -0
- package/vendor/rocksdb/table/block_based/block_prefetcher.h +72 -0
- package/vendor/rocksdb/table/block_based/block_prefix_index.cc +226 -0
- package/vendor/rocksdb/table/block_based/block_prefix_index.h +70 -0
- package/vendor/rocksdb/table/block_based/block_test.cc +1543 -0
- package/vendor/rocksdb/table/block_based/block_type.h +34 -0
- package/vendor/rocksdb/table/block_based/cachable_entry.h +244 -0
- package/vendor/rocksdb/table/block_based/data_block_footer.cc +59 -0
- package/vendor/rocksdb/table/block_based/data_block_footer.h +25 -0
- package/vendor/rocksdb/table/block_based/data_block_hash_index.cc +94 -0
- package/vendor/rocksdb/table/block_based/data_block_hash_index.h +137 -0
- package/vendor/rocksdb/table/block_based/data_block_hash_index_test.cc +718 -0
- package/vendor/rocksdb/table/block_based/filter_block.h +183 -0
- package/vendor/rocksdb/table/block_based/filter_block_reader_common.cc +163 -0
- package/vendor/rocksdb/table/block_based/filter_block_reader_common.h +76 -0
- package/vendor/rocksdb/table/block_based/filter_policy.cc +1966 -0
- package/vendor/rocksdb/table/block_based/filter_policy_internal.h +340 -0
- package/vendor/rocksdb/table/block_based/flush_block_policy.cc +132 -0
- package/vendor/rocksdb/table/block_based/flush_block_policy_impl.h +40 -0
- package/vendor/rocksdb/table/block_based/full_filter_block.cc +290 -0
- package/vendor/rocksdb/table/block_based/full_filter_block.h +147 -0
- package/vendor/rocksdb/table/block_based/full_filter_block_test.cc +323 -0
- package/vendor/rocksdb/table/block_based/hash_index_reader.cc +147 -0
- package/vendor/rocksdb/table/block_based/hash_index_reader.h +49 -0
- package/vendor/rocksdb/table/block_based/index_builder.cc +282 -0
- package/vendor/rocksdb/table/block_based/index_builder.h +455 -0
- package/vendor/rocksdb/table/block_based/index_reader_common.cc +57 -0
- package/vendor/rocksdb/table/block_based/index_reader_common.h +85 -0
- package/vendor/rocksdb/table/block_based/mock_block_based_table.h +62 -0
- package/vendor/rocksdb/table/block_based/parsed_full_filter_block.cc +23 -0
- package/vendor/rocksdb/table/block_based/parsed_full_filter_block.h +47 -0
- package/vendor/rocksdb/table/block_based/partitioned_filter_block.cc +554 -0
- package/vendor/rocksdb/table/block_based/partitioned_filter_block.h +182 -0
- package/vendor/rocksdb/table/block_based/partitioned_filter_block_test.cc +436 -0
- package/vendor/rocksdb/table/block_based/partitioned_index_iterator.cc +163 -0
- package/vendor/rocksdb/table/block_based/partitioned_index_iterator.h +160 -0
- package/vendor/rocksdb/table/block_based/partitioned_index_reader.cc +224 -0
- package/vendor/rocksdb/table/block_based/partitioned_index_reader.h +56 -0
- package/vendor/rocksdb/table/block_based/reader_common.cc +52 -0
- package/vendor/rocksdb/table/block_based/reader_common.h +34 -0
- package/vendor/rocksdb/table/block_based/uncompression_dict_reader.cc +126 -0
- package/vendor/rocksdb/table/block_based/uncompression_dict_reader.h +61 -0
- package/vendor/rocksdb/table/block_fetcher.cc +405 -0
- package/vendor/rocksdb/table/block_fetcher.h +142 -0
- package/vendor/rocksdb/table/block_fetcher_test.cc +520 -0
- package/vendor/rocksdb/table/cleanable_test.cc +390 -0
- package/vendor/rocksdb/table/compaction_merging_iterator.cc +370 -0
- package/vendor/rocksdb/table/compaction_merging_iterator.h +44 -0
- package/vendor/rocksdb/table/cuckoo/cuckoo_table_builder.cc +551 -0
- package/vendor/rocksdb/table/cuckoo/cuckoo_table_builder.h +136 -0
- package/vendor/rocksdb/table/cuckoo/cuckoo_table_builder_test.cc +631 -0
- package/vendor/rocksdb/table/cuckoo/cuckoo_table_factory.cc +100 -0
- package/vendor/rocksdb/table/cuckoo/cuckoo_table_factory.h +80 -0
- package/vendor/rocksdb/table/cuckoo/cuckoo_table_reader.cc +412 -0
- package/vendor/rocksdb/table/cuckoo/cuckoo_table_reader.h +100 -0
- package/vendor/rocksdb/table/cuckoo/cuckoo_table_reader_test.cc +574 -0
- package/vendor/rocksdb/table/format.cc +573 -0
- package/vendor/rocksdb/table/format.h +378 -0
- package/vendor/rocksdb/table/get_context.cc +616 -0
- package/vendor/rocksdb/table/get_context.h +245 -0
- package/vendor/rocksdb/table/internal_iterator.h +224 -0
- package/vendor/rocksdb/table/iter_heap.h +44 -0
- package/vendor/rocksdb/table/iterator.cc +130 -0
- package/vendor/rocksdb/table/iterator_wrapper.h +190 -0
- package/vendor/rocksdb/table/merger_test.cc +182 -0
- package/vendor/rocksdb/table/merging_iterator.cc +1725 -0
- package/vendor/rocksdb/table/merging_iterator.h +97 -0
- package/vendor/rocksdb/table/meta_blocks.cc +564 -0
- package/vendor/rocksdb/table/meta_blocks.h +172 -0
- package/vendor/rocksdb/table/mock_table.cc +346 -0
- package/vendor/rocksdb/table/mock_table.h +94 -0
- package/vendor/rocksdb/table/multiget_context.h +405 -0
- package/vendor/rocksdb/table/persistent_cache_helper.cc +111 -0
- package/vendor/rocksdb/table/persistent_cache_helper.h +46 -0
- package/vendor/rocksdb/table/persistent_cache_options.h +34 -0
- package/vendor/rocksdb/table/plain/plain_table_bloom.cc +78 -0
- package/vendor/rocksdb/table/plain/plain_table_bloom.h +132 -0
- package/vendor/rocksdb/table/plain/plain_table_builder.cc +335 -0
- package/vendor/rocksdb/table/plain/plain_table_builder.h +152 -0
- package/vendor/rocksdb/table/plain/plain_table_factory.cc +296 -0
- package/vendor/rocksdb/table/plain/plain_table_factory.h +180 -0
- package/vendor/rocksdb/table/plain/plain_table_index.cc +211 -0
- package/vendor/rocksdb/table/plain/plain_table_index.h +246 -0
- package/vendor/rocksdb/table/plain/plain_table_key_coding.cc +507 -0
- package/vendor/rocksdb/table/plain/plain_table_key_coding.h +199 -0
- package/vendor/rocksdb/table/plain/plain_table_reader.cc +771 -0
- package/vendor/rocksdb/table/plain/plain_table_reader.h +243 -0
- package/vendor/rocksdb/table/scoped_arena_iterator.h +57 -0
- package/vendor/rocksdb/table/sst_file_dumper.cc +520 -0
- package/vendor/rocksdb/table/sst_file_dumper.h +99 -0
- package/vendor/rocksdb/table/sst_file_reader.cc +101 -0
- package/vendor/rocksdb/table/sst_file_reader_test.cc +423 -0
- package/vendor/rocksdb/table/sst_file_writer.cc +436 -0
- package/vendor/rocksdb/table/sst_file_writer_collectors.h +95 -0
- package/vendor/rocksdb/table/table_builder.h +228 -0
- package/vendor/rocksdb/table/table_factory.cc +52 -0
- package/vendor/rocksdb/table/table_properties.cc +351 -0
- package/vendor/rocksdb/table/table_properties_internal.h +14 -0
- package/vendor/rocksdb/table/table_reader.h +187 -0
- package/vendor/rocksdb/table/table_reader_bench.cc +339 -0
- package/vendor/rocksdb/table/table_test.cc +5882 -0
- package/vendor/rocksdb/table/two_level_iterator.cc +220 -0
- package/vendor/rocksdb/table/two_level_iterator.h +43 -0
- package/vendor/rocksdb/table/unique_id.cc +223 -0
- package/vendor/rocksdb/table/unique_id_impl.h +93 -0
- package/vendor/rocksdb/test_util/mock_time_env.cc +38 -0
- package/vendor/rocksdb/test_util/mock_time_env.h +78 -0
- package/vendor/rocksdb/test_util/secondary_cache_test_util.cc +96 -0
- package/vendor/rocksdb/test_util/secondary_cache_test_util.h +119 -0
- package/vendor/rocksdb/test_util/sync_point.cc +82 -0
- package/vendor/rocksdb/test_util/sync_point.h +180 -0
- package/vendor/rocksdb/test_util/sync_point_impl.cc +152 -0
- package/vendor/rocksdb/test_util/sync_point_impl.h +96 -0
- package/vendor/rocksdb/test_util/testharness.cc +107 -0
- package/vendor/rocksdb/test_util/testharness.h +124 -0
- package/vendor/rocksdb/test_util/testutil.cc +722 -0
- package/vendor/rocksdb/test_util/testutil.h +860 -0
- package/vendor/rocksdb/test_util/testutil_test.cc +43 -0
- package/vendor/rocksdb/test_util/transaction_test_util.cc +400 -0
- package/vendor/rocksdb/test_util/transaction_test_util.h +147 -0
- package/vendor/rocksdb/third-party/gcc/ppc-asm.h +390 -0
- package/vendor/rocksdb/third-party/gtest-1.8.1/fused-src/gtest/CMakeLists.txt +4 -0
- package/vendor/rocksdb/third-party/gtest-1.8.1/fused-src/gtest/gtest-all.cc +11394 -0
- package/vendor/rocksdb/third-party/gtest-1.8.1/fused-src/gtest/gtest.h +22115 -0
- package/vendor/rocksdb/third-party/gtest-1.8.1/fused-src/gtest/gtest_main.cc +37 -0
- package/vendor/rocksdb/thirdparty.inc +268 -0
- package/vendor/rocksdb/tools/CMakeLists.txt +30 -0
- package/vendor/rocksdb/tools/Dockerfile +5 -0
- package/vendor/rocksdb/tools/advisor/README.md +96 -0
- package/vendor/rocksdb/tools/advisor/advisor/__init__.py +0 -0
- package/vendor/rocksdb/tools/advisor/advisor/bench_runner.py +39 -0
- package/vendor/rocksdb/tools/advisor/advisor/config_optimizer_example.py +140 -0
- package/vendor/rocksdb/tools/advisor/advisor/db_bench_runner.py +237 -0
- package/vendor/rocksdb/tools/advisor/advisor/db_config_optimizer.py +293 -0
- package/vendor/rocksdb/tools/advisor/advisor/db_log_parser.py +134 -0
- package/vendor/rocksdb/tools/advisor/advisor/db_options_parser.py +348 -0
- package/vendor/rocksdb/tools/advisor/advisor/db_stats_fetcher.py +346 -0
- package/vendor/rocksdb/tools/advisor/advisor/db_timeseries_parser.py +203 -0
- package/vendor/rocksdb/tools/advisor/advisor/ini_parser.py +76 -0
- package/vendor/rocksdb/tools/advisor/advisor/rule_parser.py +510 -0
- package/vendor/rocksdb/tools/advisor/advisor/rule_parser_example.py +98 -0
- package/vendor/rocksdb/tools/advisor/advisor/rules.ini +214 -0
- package/vendor/rocksdb/tools/advisor/test/__init__.py +0 -0
- package/vendor/rocksdb/tools/advisor/test/input_files/LOG-0 +30 -0
- package/vendor/rocksdb/tools/advisor/test/input_files/LOG-1 +25 -0
- package/vendor/rocksdb/tools/advisor/test/input_files/OPTIONS-000005 +49 -0
- package/vendor/rocksdb/tools/advisor/test/input_files/log_stats_parser_keys_ts +3 -0
- package/vendor/rocksdb/tools/advisor/test/input_files/rules_err1.ini +56 -0
- package/vendor/rocksdb/tools/advisor/test/input_files/rules_err2.ini +15 -0
- package/vendor/rocksdb/tools/advisor/test/input_files/rules_err3.ini +15 -0
- package/vendor/rocksdb/tools/advisor/test/input_files/rules_err4.ini +15 -0
- package/vendor/rocksdb/tools/advisor/test/input_files/test_rules.ini +47 -0
- package/vendor/rocksdb/tools/advisor/test/input_files/triggered_rules.ini +83 -0
- package/vendor/rocksdb/tools/advisor/test/test_db_bench_runner.py +141 -0
- package/vendor/rocksdb/tools/advisor/test/test_db_log_parser.py +96 -0
- package/vendor/rocksdb/tools/advisor/test/test_db_options_parser.py +214 -0
- package/vendor/rocksdb/tools/advisor/test/test_db_stats_fetcher.py +121 -0
- package/vendor/rocksdb/tools/advisor/test/test_rule_parser.py +226 -0
- package/vendor/rocksdb/tools/analyze_txn_stress_test.sh +77 -0
- package/vendor/rocksdb/tools/auto_sanity_test.sh +93 -0
- package/vendor/rocksdb/tools/backup_db.sh +15 -0
- package/vendor/rocksdb/tools/benchmark.sh +1173 -0
- package/vendor/rocksdb/tools/benchmark_ci.py +182 -0
- package/vendor/rocksdb/tools/benchmark_compare.sh +342 -0
- package/vendor/rocksdb/tools/benchmark_leveldb.sh +187 -0
- package/vendor/rocksdb/tools/blob_dump.cc +103 -0
- package/vendor/rocksdb/tools/block_cache_analyzer/__init__.py +2 -0
- package/vendor/rocksdb/tools/block_cache_analyzer/block_cache_pysim.py +2000 -0
- package/vendor/rocksdb/tools/block_cache_analyzer/block_cache_pysim.sh +156 -0
- package/vendor/rocksdb/tools/block_cache_analyzer/block_cache_pysim_test.py +734 -0
- package/vendor/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer.cc +2314 -0
- package/vendor/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer.h +397 -0
- package/vendor/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_plot.py +729 -0
- package/vendor/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc +791 -0
- package/vendor/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_tool.cc +17 -0
- package/vendor/rocksdb/tools/check_all_python.py +22 -0
- package/vendor/rocksdb/tools/check_format_compatible.sh +379 -0
- package/vendor/rocksdb/tools/db_bench.cc +21 -0
- package/vendor/rocksdb/tools/db_bench_tool.cc +8604 -0
- package/vendor/rocksdb/tools/db_bench_tool_test.cc +342 -0
- package/vendor/rocksdb/tools/db_crashtest.py +1018 -0
- package/vendor/rocksdb/tools/db_repl_stress.cc +132 -0
- package/vendor/rocksdb/tools/db_sanity_test.cc +296 -0
- package/vendor/rocksdb/tools/dbench_monitor +102 -0
- package/vendor/rocksdb/tools/dump/db_dump_tool.cc +258 -0
- package/vendor/rocksdb/tools/dump/rocksdb_dump.cc +60 -0
- package/vendor/rocksdb/tools/dump/rocksdb_undump.cc +59 -0
- package/vendor/rocksdb/tools/generate_random_db.sh +31 -0
- package/vendor/rocksdb/tools/ingest_external_sst.sh +18 -0
- package/vendor/rocksdb/tools/io_tracer_parser.cc +17 -0
- package/vendor/rocksdb/tools/io_tracer_parser_test.cc +182 -0
- package/vendor/rocksdb/tools/io_tracer_parser_tool.cc +142 -0
- package/vendor/rocksdb/tools/io_tracer_parser_tool.h +38 -0
- package/vendor/rocksdb/tools/ldb.cc +13 -0
- package/vendor/rocksdb/tools/ldb_cmd.cc +4263 -0
- package/vendor/rocksdb/tools/ldb_cmd_impl.h +744 -0
- package/vendor/rocksdb/tools/ldb_cmd_test.cc +1216 -0
- package/vendor/rocksdb/tools/ldb_test.py +955 -0
- package/vendor/rocksdb/tools/ldb_tool.cc +182 -0
- package/vendor/rocksdb/tools/pflag +217 -0
- package/vendor/rocksdb/tools/reduce_levels_test.cc +212 -0
- package/vendor/rocksdb/tools/regression_test.sh +525 -0
- package/vendor/rocksdb/tools/restore_db.sh +15 -0
- package/vendor/rocksdb/tools/rocksdb_dump_test.sh +9 -0
- package/vendor/rocksdb/tools/run_blob_bench.sh +223 -0
- package/vendor/rocksdb/tools/run_flash_bench.sh +359 -0
- package/vendor/rocksdb/tools/run_leveldb.sh +175 -0
- package/vendor/rocksdb/tools/sample-dump.dmp +0 -0
- package/vendor/rocksdb/tools/simulated_hybrid_file_system.cc +243 -0
- package/vendor/rocksdb/tools/simulated_hybrid_file_system.h +124 -0
- package/vendor/rocksdb/tools/sst_dump.cc +12 -0
- package/vendor/rocksdb/tools/sst_dump_test.cc +471 -0
- package/vendor/rocksdb/tools/sst_dump_tool.cc +582 -0
- package/vendor/rocksdb/tools/trace_analyzer.cc +17 -0
- package/vendor/rocksdb/tools/trace_analyzer_test.cc +880 -0
- package/vendor/rocksdb/tools/trace_analyzer_tool.cc +1929 -0
- package/vendor/rocksdb/tools/trace_analyzer_tool.h +329 -0
- package/vendor/rocksdb/tools/verify_random_db.sh +41 -0
- package/vendor/rocksdb/tools/write_external_sst.sh +26 -0
- package/vendor/rocksdb/tools/write_stress.cc +305 -0
- package/vendor/rocksdb/tools/write_stress_runner.py +83 -0
- package/vendor/rocksdb/trace_replay/block_cache_tracer.cc +509 -0
- package/vendor/rocksdb/trace_replay/block_cache_tracer.h +239 -0
- package/vendor/rocksdb/trace_replay/block_cache_tracer_test.cc +421 -0
- package/vendor/rocksdb/trace_replay/io_tracer.cc +303 -0
- package/vendor/rocksdb/trace_replay/io_tracer.h +185 -0
- package/vendor/rocksdb/trace_replay/io_tracer_test.cc +353 -0
- package/vendor/rocksdb/trace_replay/trace_record.cc +206 -0
- package/vendor/rocksdb/trace_replay/trace_record_handler.cc +190 -0
- package/vendor/rocksdb/trace_replay/trace_record_handler.h +46 -0
- package/vendor/rocksdb/trace_replay/trace_record_result.cc +146 -0
- package/vendor/rocksdb/trace_replay/trace_replay.cc +622 -0
- package/vendor/rocksdb/trace_replay/trace_replay.h +183 -0
- package/vendor/rocksdb/util/aligned_buffer.h +235 -0
- package/vendor/rocksdb/util/async_file_reader.cc +81 -0
- package/vendor/rocksdb/util/async_file_reader.h +144 -0
- package/vendor/rocksdb/util/autovector.h +393 -0
- package/vendor/rocksdb/util/autovector_test.cc +324 -0
- package/vendor/rocksdb/util/bloom_impl.h +489 -0
- package/vendor/rocksdb/util/bloom_test.cc +1175 -0
- package/vendor/rocksdb/util/build_version.cc.in +79 -0
- package/vendor/rocksdb/util/cast_util.h +42 -0
- package/vendor/rocksdb/util/channel.h +69 -0
- package/vendor/rocksdb/util/cleanable.cc +181 -0
- package/vendor/rocksdb/util/coding.cc +90 -0
- package/vendor/rocksdb/util/coding.h +389 -0
- package/vendor/rocksdb/util/coding_lean.h +101 -0
- package/vendor/rocksdb/util/coding_test.cc +217 -0
- package/vendor/rocksdb/util/compaction_job_stats_impl.cc +92 -0
- package/vendor/rocksdb/util/comparator.cc +383 -0
- package/vendor/rocksdb/util/compression.cc +122 -0
- package/vendor/rocksdb/util/compression.h +1795 -0
- package/vendor/rocksdb/util/compression_context_cache.cc +106 -0
- package/vendor/rocksdb/util/compression_context_cache.h +47 -0
- package/vendor/rocksdb/util/concurrent_task_limiter_impl.cc +64 -0
- package/vendor/rocksdb/util/concurrent_task_limiter_impl.h +67 -0
- package/vendor/rocksdb/util/core_local.h +84 -0
- package/vendor/rocksdb/util/coro_utils.h +112 -0
- package/vendor/rocksdb/util/crc32c.cc +1292 -0
- package/vendor/rocksdb/util/crc32c.h +56 -0
- package/vendor/rocksdb/util/crc32c_arm64.cc +213 -0
- package/vendor/rocksdb/util/crc32c_arm64.h +52 -0
- package/vendor/rocksdb/util/crc32c_ppc.c +94 -0
- package/vendor/rocksdb/util/crc32c_ppc.h +22 -0
- package/vendor/rocksdb/util/crc32c_ppc_asm.S +756 -0
- package/vendor/rocksdb/util/crc32c_ppc_constants.h +900 -0
- package/vendor/rocksdb/util/crc32c_test.cc +213 -0
- package/vendor/rocksdb/util/data_structure.cc +18 -0
- package/vendor/rocksdb/util/defer.h +82 -0
- package/vendor/rocksdb/util/defer_test.cc +51 -0
- package/vendor/rocksdb/util/distributed_mutex.h +50 -0
- package/vendor/rocksdb/util/duplicate_detector.h +69 -0
- package/vendor/rocksdb/util/dynamic_bloom.cc +70 -0
- package/vendor/rocksdb/util/dynamic_bloom.h +214 -0
- package/vendor/rocksdb/util/dynamic_bloom_test.cc +325 -0
- package/vendor/rocksdb/util/fastrange.h +114 -0
- package/vendor/rocksdb/util/file_checksum_helper.cc +170 -0
- package/vendor/rocksdb/util/file_checksum_helper.h +101 -0
- package/vendor/rocksdb/util/file_reader_writer_test.cc +1058 -0
- package/vendor/rocksdb/util/filelock_test.cc +148 -0
- package/vendor/rocksdb/util/filter_bench.cc +840 -0
- package/vendor/rocksdb/util/gflags_compat.h +29 -0
- package/vendor/rocksdb/util/hash.cc +201 -0
- package/vendor/rocksdb/util/hash.h +137 -0
- package/vendor/rocksdb/util/hash128.h +26 -0
- package/vendor/rocksdb/util/hash_containers.h +51 -0
- package/vendor/rocksdb/util/hash_map.h +67 -0
- package/vendor/rocksdb/util/hash_test.cc +853 -0
- package/vendor/rocksdb/util/heap.h +174 -0
- package/vendor/rocksdb/util/heap_test.cc +131 -0
- package/vendor/rocksdb/util/kv_map.h +33 -0
- package/vendor/rocksdb/util/log_write_bench.cc +88 -0
- package/vendor/rocksdb/util/math.h +299 -0
- package/vendor/rocksdb/util/math128.h +316 -0
- package/vendor/rocksdb/util/murmurhash.cc +196 -0
- package/vendor/rocksdb/util/murmurhash.h +43 -0
- package/vendor/rocksdb/util/mutexlock.h +181 -0
- package/vendor/rocksdb/util/ppc-opcode.h +27 -0
- package/vendor/rocksdb/util/random.cc +63 -0
- package/vendor/rocksdb/util/random.h +190 -0
- package/vendor/rocksdb/util/random_test.cc +107 -0
- package/vendor/rocksdb/util/rate_limiter.cc +376 -0
- package/vendor/rocksdb/util/rate_limiter_impl.h +146 -0
- package/vendor/rocksdb/util/rate_limiter_test.cc +520 -0
- package/vendor/rocksdb/util/repeatable_thread.h +149 -0
- package/vendor/rocksdb/util/repeatable_thread_test.cc +111 -0
- package/vendor/rocksdb/util/ribbon_alg.h +1225 -0
- package/vendor/rocksdb/util/ribbon_config.cc +506 -0
- package/vendor/rocksdb/util/ribbon_config.h +182 -0
- package/vendor/rocksdb/util/ribbon_impl.h +1137 -0
- package/vendor/rocksdb/util/ribbon_test.cc +1308 -0
- package/vendor/rocksdb/util/set_comparator.h +24 -0
- package/vendor/rocksdb/util/single_thread_executor.h +56 -0
- package/vendor/rocksdb/util/slice.cc +367 -0
- package/vendor/rocksdb/util/slice_test.cc +252 -0
- package/vendor/rocksdb/util/slice_transform_test.cc +159 -0
- package/vendor/rocksdb/util/status.cc +162 -0
- package/vendor/rocksdb/util/stderr_logger.cc +30 -0
- package/vendor/rocksdb/util/stderr_logger.h +31 -0
- package/vendor/rocksdb/util/stop_watch.h +136 -0
- package/vendor/rocksdb/util/string_util.cc +502 -0
- package/vendor/rocksdb/util/string_util.h +175 -0
- package/vendor/rocksdb/util/thread_guard.h +41 -0
- package/vendor/rocksdb/util/thread_list_test.cc +362 -0
- package/vendor/rocksdb/util/thread_local.cc +521 -0
- package/vendor/rocksdb/util/thread_local.h +100 -0
- package/vendor/rocksdb/util/thread_local_test.cc +578 -0
- package/vendor/rocksdb/util/thread_operation.h +113 -0
- package/vendor/rocksdb/util/threadpool_imp.cc +551 -0
- package/vendor/rocksdb/util/threadpool_imp.h +120 -0
- package/vendor/rocksdb/util/timer.h +340 -0
- package/vendor/rocksdb/util/timer_queue.h +231 -0
- package/vendor/rocksdb/util/timer_queue_test.cc +73 -0
- package/vendor/rocksdb/util/timer_test.cc +402 -0
- package/vendor/rocksdb/util/udt_util.h +77 -0
- package/vendor/rocksdb/util/user_comparator_wrapper.h +64 -0
- package/vendor/rocksdb/util/vector_iterator.h +118 -0
- package/vendor/rocksdb/util/work_queue.h +150 -0
- package/vendor/rocksdb/util/work_queue_test.cc +272 -0
- package/vendor/rocksdb/util/xxhash.cc +48 -0
- package/vendor/rocksdb/util/xxhash.h +6360 -0
- package/vendor/rocksdb/util/xxph3.h +1764 -0
- package/vendor/rocksdb/utilities/agg_merge/agg_merge.cc +238 -0
- package/vendor/rocksdb/utilities/agg_merge/agg_merge_impl.h +49 -0
- package/vendor/rocksdb/utilities/agg_merge/agg_merge_test.cc +135 -0
- package/vendor/rocksdb/utilities/agg_merge/test_agg_merge.cc +104 -0
- package/vendor/rocksdb/utilities/agg_merge/test_agg_merge.h +47 -0
- package/vendor/rocksdb/utilities/backup/backup_engine.cc +3355 -0
- package/vendor/rocksdb/utilities/backup/backup_engine_impl.h +34 -0
- package/vendor/rocksdb/utilities/backup/backup_engine_test.cc +4414 -0
- package/vendor/rocksdb/utilities/blob_db/blob_compaction_filter.cc +488 -0
- package/vendor/rocksdb/utilities/blob_db/blob_compaction_filter.h +202 -0
- package/vendor/rocksdb/utilities/blob_db/blob_db.cc +112 -0
- package/vendor/rocksdb/utilities/blob_db/blob_db.h +264 -0
- package/vendor/rocksdb/utilities/blob_db/blob_db_gc_stats.h +54 -0
- package/vendor/rocksdb/utilities/blob_db/blob_db_impl.cc +2185 -0
- package/vendor/rocksdb/utilities/blob_db/blob_db_impl.h +501 -0
- package/vendor/rocksdb/utilities/blob_db/blob_db_impl_filesnapshot.cc +111 -0
- package/vendor/rocksdb/utilities/blob_db/blob_db_iterator.h +148 -0
- package/vendor/rocksdb/utilities/blob_db/blob_db_listener.h +69 -0
- package/vendor/rocksdb/utilities/blob_db/blob_db_test.cc +2430 -0
- package/vendor/rocksdb/utilities/blob_db/blob_dump_tool.cc +280 -0
- package/vendor/rocksdb/utilities/blob_db/blob_dump_tool.h +56 -0
- package/vendor/rocksdb/utilities/blob_db/blob_file.cc +316 -0
- package/vendor/rocksdb/utilities/blob_db/blob_file.h +244 -0
- package/vendor/rocksdb/utilities/cache_dump_load.cc +67 -0
- package/vendor/rocksdb/utilities/cache_dump_load_impl.cc +369 -0
- package/vendor/rocksdb/utilities/cache_dump_load_impl.h +356 -0
- package/vendor/rocksdb/utilities/cassandra/cassandra_compaction_filter.cc +106 -0
- package/vendor/rocksdb/utilities/cassandra/cassandra_compaction_filter.h +57 -0
- package/vendor/rocksdb/utilities/cassandra/cassandra_format_test.cc +377 -0
- package/vendor/rocksdb/utilities/cassandra/cassandra_functional_test.cc +444 -0
- package/vendor/rocksdb/utilities/cassandra/cassandra_options.h +41 -0
- package/vendor/rocksdb/utilities/cassandra/cassandra_row_merge_test.cc +98 -0
- package/vendor/rocksdb/utilities/cassandra/cassandra_serialize_test.cc +164 -0
- package/vendor/rocksdb/utilities/cassandra/format.cc +367 -0
- package/vendor/rocksdb/utilities/cassandra/format.h +183 -0
- package/vendor/rocksdb/utilities/cassandra/merge_operator.cc +80 -0
- package/vendor/rocksdb/utilities/cassandra/merge_operator.h +44 -0
- package/vendor/rocksdb/utilities/cassandra/serialize.h +81 -0
- package/vendor/rocksdb/utilities/cassandra/test_utils.cc +69 -0
- package/vendor/rocksdb/utilities/cassandra/test_utils.h +42 -0
- package/vendor/rocksdb/utilities/checkpoint/checkpoint_impl.cc +470 -0
- package/vendor/rocksdb/utilities/checkpoint/checkpoint_impl.h +64 -0
- package/vendor/rocksdb/utilities/checkpoint/checkpoint_test.cc +988 -0
- package/vendor/rocksdb/utilities/compaction_filters/layered_compaction_filter_base.h +41 -0
- package/vendor/rocksdb/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc +24 -0
- package/vendor/rocksdb/utilities/compaction_filters/remove_emptyvalue_compactionfilter.h +26 -0
- package/vendor/rocksdb/utilities/compaction_filters.cc +52 -0
- package/vendor/rocksdb/utilities/convenience/info_log_finder.cc +26 -0
- package/vendor/rocksdb/utilities/counted_fs.cc +379 -0
- package/vendor/rocksdb/utilities/counted_fs.h +158 -0
- package/vendor/rocksdb/utilities/debug.cc +118 -0
- package/vendor/rocksdb/utilities/env_mirror.cc +273 -0
- package/vendor/rocksdb/utilities/env_mirror_test.cc +216 -0
- package/vendor/rocksdb/utilities/env_timed.cc +181 -0
- package/vendor/rocksdb/utilities/env_timed.h +95 -0
- package/vendor/rocksdb/utilities/env_timed_test.cc +34 -0
- package/vendor/rocksdb/utilities/fault_injection_env.cc +555 -0
- package/vendor/rocksdb/utilities/fault_injection_env.h +258 -0
- package/vendor/rocksdb/utilities/fault_injection_fs.cc +1071 -0
- package/vendor/rocksdb/utilities/fault_injection_fs.h +593 -0
- package/vendor/rocksdb/utilities/fault_injection_secondary_cache.cc +136 -0
- package/vendor/rocksdb/utilities/fault_injection_secondary_cache.h +109 -0
- package/vendor/rocksdb/utilities/leveldb_options/leveldb_options.cc +57 -0
- package/vendor/rocksdb/utilities/memory/memory_test.cc +269 -0
- package/vendor/rocksdb/utilities/memory/memory_util.cc +50 -0
- package/vendor/rocksdb/utilities/memory_allocators.h +103 -0
- package/vendor/rocksdb/utilities/merge_operators/bytesxor.cc +57 -0
- package/vendor/rocksdb/utilities/merge_operators/bytesxor.h +40 -0
- package/vendor/rocksdb/utilities/merge_operators/max.cc +64 -0
- package/vendor/rocksdb/utilities/merge_operators/max_operator.h +35 -0
- package/vendor/rocksdb/utilities/merge_operators/put.cc +74 -0
- package/vendor/rocksdb/utilities/merge_operators/put_operator.h +56 -0
- package/vendor/rocksdb/utilities/merge_operators/sortlist.cc +95 -0
- package/vendor/rocksdb/utilities/merge_operators/sortlist.h +42 -0
- package/vendor/rocksdb/utilities/merge_operators/string_append/stringappend.cc +76 -0
- package/vendor/rocksdb/utilities/merge_operators/string_append/stringappend.h +32 -0
- package/vendor/rocksdb/utilities/merge_operators/string_append/stringappend2.cc +130 -0
- package/vendor/rocksdb/utilities/merge_operators/string_append/stringappend2.h +52 -0
- package/vendor/rocksdb/utilities/merge_operators/string_append/stringappend_test.cc +636 -0
- package/vendor/rocksdb/utilities/merge_operators/uint64add.cc +56 -0
- package/vendor/rocksdb/utilities/merge_operators/uint64add.h +35 -0
- package/vendor/rocksdb/utilities/merge_operators.cc +115 -0
- package/vendor/rocksdb/utilities/merge_operators.h +36 -0
- package/vendor/rocksdb/utilities/object_registry.cc +381 -0
- package/vendor/rocksdb/utilities/object_registry_test.cc +862 -0
- package/vendor/rocksdb/utilities/option_change_migration/option_change_migration.cc +176 -0
- package/vendor/rocksdb/utilities/option_change_migration/option_change_migration_test.cc +548 -0
- package/vendor/rocksdb/utilities/options/options_util.cc +117 -0
- package/vendor/rocksdb/utilities/options/options_util_test.cc +782 -0
- package/vendor/rocksdb/utilities/persistent_cache/block_cache_tier.cc +420 -0
- package/vendor/rocksdb/utilities/persistent_cache/block_cache_tier.h +154 -0
- package/vendor/rocksdb/utilities/persistent_cache/block_cache_tier_file.cc +608 -0
- package/vendor/rocksdb/utilities/persistent_cache/block_cache_tier_file.h +291 -0
- package/vendor/rocksdb/utilities/persistent_cache/block_cache_tier_file_buffer.h +127 -0
- package/vendor/rocksdb/utilities/persistent_cache/block_cache_tier_metadata.cc +84 -0
- package/vendor/rocksdb/utilities/persistent_cache/block_cache_tier_metadata.h +122 -0
- package/vendor/rocksdb/utilities/persistent_cache/hash_table.h +237 -0
- package/vendor/rocksdb/utilities/persistent_cache/hash_table_bench.cc +310 -0
- package/vendor/rocksdb/utilities/persistent_cache/hash_table_evictable.h +166 -0
- package/vendor/rocksdb/utilities/persistent_cache/hash_table_test.cc +161 -0
- package/vendor/rocksdb/utilities/persistent_cache/lrulist.h +172 -0
- package/vendor/rocksdb/utilities/persistent_cache/persistent_cache_bench.cc +355 -0
- package/vendor/rocksdb/utilities/persistent_cache/persistent_cache_test.cc +413 -0
- package/vendor/rocksdb/utilities/persistent_cache/persistent_cache_test.h +284 -0
- package/vendor/rocksdb/utilities/persistent_cache/persistent_cache_tier.cc +165 -0
- package/vendor/rocksdb/utilities/persistent_cache/persistent_cache_tier.h +340 -0
- package/vendor/rocksdb/utilities/persistent_cache/persistent_cache_util.h +67 -0
- package/vendor/rocksdb/utilities/persistent_cache/volatile_tier_impl.cc +138 -0
- package/vendor/rocksdb/utilities/persistent_cache/volatile_tier_impl.h +139 -0
- package/vendor/rocksdb/utilities/simulator_cache/cache_simulator.cc +287 -0
- package/vendor/rocksdb/utilities/simulator_cache/cache_simulator.h +231 -0
- package/vendor/rocksdb/utilities/simulator_cache/cache_simulator_test.cc +497 -0
- package/vendor/rocksdb/utilities/simulator_cache/sim_cache.cc +372 -0
- package/vendor/rocksdb/utilities/simulator_cache/sim_cache_test.cc +226 -0
- package/vendor/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector.cc +221 -0
- package/vendor/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector.h +68 -0
- package/vendor/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc +238 -0
- package/vendor/rocksdb/utilities/trace/file_trace_reader_writer.cc +133 -0
- package/vendor/rocksdb/utilities/trace/file_trace_reader_writer.h +48 -0
- package/vendor/rocksdb/utilities/trace/replayer_impl.cc +314 -0
- package/vendor/rocksdb/utilities/trace/replayer_impl.h +84 -0
- package/vendor/rocksdb/utilities/transactions/lock/lock_manager.cc +27 -0
- package/vendor/rocksdb/utilities/transactions/lock/lock_manager.h +80 -0
- package/vendor/rocksdb/utilities/transactions/lock/lock_tracker.h +207 -0
- package/vendor/rocksdb/utilities/transactions/lock/point/point_lock_manager.cc +719 -0
- package/vendor/rocksdb/utilities/transactions/lock/point/point_lock_manager.h +222 -0
- package/vendor/rocksdb/utilities/transactions/lock/point/point_lock_manager_test.cc +170 -0
- package/vendor/rocksdb/utilities/transactions/lock/point/point_lock_manager_test.h +324 -0
- package/vendor/rocksdb/utilities/transactions/lock/point/point_lock_tracker.cc +255 -0
- package/vendor/rocksdb/utilities/transactions/lock/point/point_lock_tracker.h +97 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_lock_manager.h +34 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_locking_test.cc +448 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/COPYING.AGPLv3 +661 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/COPYING.APACHEv2 +174 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/COPYING.GPLv2 +339 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/README +13 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/db.h +76 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/ft/comparator.h +138 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/ft/ft-status.h +102 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/concurrent_tree.cc +137 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/concurrent_tree.h +174 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/keyrange.cc +220 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/keyrange.h +141 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc +525 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.h +255 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/locktree.cc +1021 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/locktree.h +580 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/manager.cc +525 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/range_buffer.cc +263 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/range_buffer.h +178 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/treenode.cc +518 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/treenode.h +302 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/txnid_set.cc +118 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/txnid_set.h +92 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/wfg.cc +211 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/wfg.h +124 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/memory.h +215 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_assert_subst.h +39 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_atomic.h +130 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_external_pthread.h +83 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_instrumentation.h +286 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_portability.h +87 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_pthread.h +520 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_race_tools.h +179 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +197 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/txn_subst.h +27 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/standalone_port.cc +130 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/dbt.cc +151 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/dbt.h +98 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/growable_array.h +144 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/memarena.cc +199 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/memarena.h +141 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/omt.h +794 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/omt_impl.h +1295 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/partitioned_counter.h +165 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/status.h +76 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_manager.cc +501 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_manager.h +135 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_tracker.cc +154 -0
- package/vendor/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_tracker.h +146 -0
- package/vendor/rocksdb/utilities/transactions/optimistic_transaction.cc +194 -0
- package/vendor/rocksdb/utilities/transactions/optimistic_transaction.h +99 -0
- package/vendor/rocksdb/utilities/transactions/optimistic_transaction_db_impl.cc +109 -0
- package/vendor/rocksdb/utilities/transactions/optimistic_transaction_db_impl.h +86 -0
- package/vendor/rocksdb/utilities/transactions/optimistic_transaction_test.cc +1479 -0
- package/vendor/rocksdb/utilities/transactions/pessimistic_transaction.cc +1177 -0
- package/vendor/rocksdb/utilities/transactions/pessimistic_transaction.h +311 -0
- package/vendor/rocksdb/utilities/transactions/pessimistic_transaction_db.cc +780 -0
- package/vendor/rocksdb/utilities/transactions/pessimistic_transaction_db.h +316 -0
- package/vendor/rocksdb/utilities/transactions/snapshot_checker.cc +37 -0
- package/vendor/rocksdb/utilities/transactions/timestamped_snapshot_test.cc +457 -0
- package/vendor/rocksdb/utilities/transactions/transaction_base.cc +757 -0
- package/vendor/rocksdb/utilities/transactions/transaction_base.h +382 -0
- package/vendor/rocksdb/utilities/transactions/transaction_db_mutex_impl.cc +133 -0
- package/vendor/rocksdb/utilities/transactions/transaction_db_mutex_impl.h +24 -0
- package/vendor/rocksdb/utilities/transactions/transaction_test.cc +6751 -0
- package/vendor/rocksdb/utilities/transactions/transaction_test.h +578 -0
- package/vendor/rocksdb/utilities/transactions/transaction_util.cc +204 -0
- package/vendor/rocksdb/utilities/transactions/transaction_util.h +83 -0
- package/vendor/rocksdb/utilities/transactions/write_committed_transaction_ts_test.cc +578 -0
- package/vendor/rocksdb/utilities/transactions/write_prepared_transaction_test.cc +4066 -0
- package/vendor/rocksdb/utilities/transactions/write_prepared_txn.cc +515 -0
- package/vendor/rocksdb/utilities/transactions/write_prepared_txn.h +117 -0
- package/vendor/rocksdb/utilities/transactions/write_prepared_txn_db.cc +1038 -0
- package/vendor/rocksdb/utilities/transactions/write_prepared_txn_db.h +1123 -0
- package/vendor/rocksdb/utilities/transactions/write_unprepared_transaction_test.cc +779 -0
- package/vendor/rocksdb/utilities/transactions/write_unprepared_txn.cc +1056 -0
- package/vendor/rocksdb/utilities/transactions/write_unprepared_txn.h +339 -0
- package/vendor/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +476 -0
- package/vendor/rocksdb/utilities/transactions/write_unprepared_txn_db.h +106 -0
- package/vendor/rocksdb/utilities/ttl/db_ttl_impl.cc +617 -0
- package/vendor/rocksdb/utilities/ttl/db_ttl_impl.h +243 -0
- package/vendor/rocksdb/utilities/ttl/ttl_test.cc +913 -0
- package/vendor/rocksdb/utilities/util_merge_operators_test.cc +100 -0
- package/vendor/rocksdb/utilities/wal_filter.cc +22 -0
- package/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +694 -0
- package/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +742 -0
- package/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +342 -0
- package/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_test.cc +2409 -0
|
@@ -0,0 +1,4016 @@
|
|
|
1
|
+
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
2
|
+
// This source code is licensed under both the GPLv2 (found in the
|
|
3
|
+
// COPYING file in the root directory) and Apache 2.0 License
|
|
4
|
+
// (found in the LICENSE.Apache file in the root directory).
|
|
5
|
+
//
|
|
6
|
+
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
7
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
8
|
+
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
9
|
+
|
|
10
|
+
#include "db/db_with_timestamp_test_util.h"
|
|
11
|
+
#include "port/stack_trace.h"
|
|
12
|
+
#include "rocksdb/perf_context.h"
|
|
13
|
+
#include "rocksdb/utilities/debug.h"
|
|
14
|
+
#include "table/block_based/block_based_table_reader.h"
|
|
15
|
+
#include "table/block_based/block_builder.h"
|
|
16
|
+
#include "test_util/sync_point.h"
|
|
17
|
+
#include "test_util/testutil.h"
|
|
18
|
+
#include "utilities/fault_injection_env.h"
|
|
19
|
+
#include "utilities/merge_operators/string_append/stringappend2.h"
|
|
20
|
+
|
|
21
|
+
namespace ROCKSDB_NAMESPACE {
|
|
22
|
+
class DBBasicTestWithTimestamp : public DBBasicTestWithTimestampBase {
|
|
23
|
+
public:
|
|
24
|
+
DBBasicTestWithTimestamp()
|
|
25
|
+
: DBBasicTestWithTimestampBase("db_basic_test_with_timestamp") {}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
TEST_F(DBBasicTestWithTimestamp, SanityChecks) {
|
|
29
|
+
Options options = CurrentOptions();
|
|
30
|
+
options.env = env_;
|
|
31
|
+
options.create_if_missing = true;
|
|
32
|
+
options.avoid_flush_during_shutdown = true;
|
|
33
|
+
options.merge_operator = MergeOperators::CreateStringAppendTESTOperator();
|
|
34
|
+
DestroyAndReopen(options);
|
|
35
|
+
|
|
36
|
+
Options options1 = CurrentOptions();
|
|
37
|
+
options1.env = env_;
|
|
38
|
+
options1.comparator = test::BytewiseComparatorWithU64TsWrapper();
|
|
39
|
+
options1.merge_operator = MergeOperators::CreateStringAppendTESTOperator();
|
|
40
|
+
assert(options1.comparator &&
|
|
41
|
+
options1.comparator->timestamp_size() == sizeof(uint64_t));
|
|
42
|
+
ColumnFamilyHandle* handle = nullptr;
|
|
43
|
+
Status s = db_->CreateColumnFamily(options1, "data", &handle);
|
|
44
|
+
ASSERT_OK(s);
|
|
45
|
+
|
|
46
|
+
std::string dummy_ts(sizeof(uint64_t), '\0');
|
|
47
|
+
// Perform timestamp operations on default cf.
|
|
48
|
+
ASSERT_TRUE(
|
|
49
|
+
db_->Put(WriteOptions(), "key", dummy_ts, "value").IsInvalidArgument());
|
|
50
|
+
ASSERT_TRUE(db_->Merge(WriteOptions(), db_->DefaultColumnFamily(), "key",
|
|
51
|
+
dummy_ts, "value")
|
|
52
|
+
.IsInvalidArgument());
|
|
53
|
+
ASSERT_TRUE(db_->Delete(WriteOptions(), "key", dummy_ts).IsInvalidArgument());
|
|
54
|
+
ASSERT_TRUE(
|
|
55
|
+
db_->SingleDelete(WriteOptions(), "key", dummy_ts).IsInvalidArgument());
|
|
56
|
+
ASSERT_TRUE(db_->DeleteRange(WriteOptions(), db_->DefaultColumnFamily(),
|
|
57
|
+
"begin_key", "end_key", dummy_ts)
|
|
58
|
+
.IsInvalidArgument());
|
|
59
|
+
|
|
60
|
+
// Perform non-timestamp operations on "data" cf.
|
|
61
|
+
ASSERT_TRUE(
|
|
62
|
+
db_->Put(WriteOptions(), handle, "key", "value").IsInvalidArgument());
|
|
63
|
+
ASSERT_TRUE(db_->Delete(WriteOptions(), handle, "key").IsInvalidArgument());
|
|
64
|
+
ASSERT_TRUE(
|
|
65
|
+
db_->SingleDelete(WriteOptions(), handle, "key").IsInvalidArgument());
|
|
66
|
+
|
|
67
|
+
ASSERT_TRUE(
|
|
68
|
+
db_->Merge(WriteOptions(), handle, "key", "value").IsInvalidArgument());
|
|
69
|
+
ASSERT_TRUE(db_->DeleteRange(WriteOptions(), handle, "begin_key", "end_key")
|
|
70
|
+
.IsInvalidArgument());
|
|
71
|
+
|
|
72
|
+
{
|
|
73
|
+
WriteBatch wb;
|
|
74
|
+
ASSERT_OK(wb.Put(handle, "key", "value"));
|
|
75
|
+
ASSERT_TRUE(db_->Write(WriteOptions(), &wb).IsInvalidArgument());
|
|
76
|
+
}
|
|
77
|
+
{
|
|
78
|
+
WriteBatch wb;
|
|
79
|
+
ASSERT_OK(wb.Delete(handle, "key"));
|
|
80
|
+
ASSERT_TRUE(db_->Write(WriteOptions(), &wb).IsInvalidArgument());
|
|
81
|
+
}
|
|
82
|
+
{
|
|
83
|
+
WriteBatch wb;
|
|
84
|
+
ASSERT_OK(wb.SingleDelete(handle, "key"));
|
|
85
|
+
ASSERT_TRUE(db_->Write(WriteOptions(), &wb).IsInvalidArgument());
|
|
86
|
+
}
|
|
87
|
+
{
|
|
88
|
+
WriteBatch wb;
|
|
89
|
+
ASSERT_OK(wb.DeleteRange(handle, "begin_key", "end_key"));
|
|
90
|
+
ASSERT_TRUE(db_->Write(WriteOptions(), &wb).IsInvalidArgument());
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Perform timestamp operations with timestamps of incorrect size.
|
|
94
|
+
const std::string wrong_ts(sizeof(uint32_t), '\0');
|
|
95
|
+
ASSERT_TRUE(db_->Put(WriteOptions(), handle, "key", wrong_ts, "value")
|
|
96
|
+
.IsInvalidArgument());
|
|
97
|
+
ASSERT_TRUE(db_->Merge(WriteOptions(), handle, "key", wrong_ts, "value")
|
|
98
|
+
.IsInvalidArgument());
|
|
99
|
+
ASSERT_TRUE(
|
|
100
|
+
db_->Delete(WriteOptions(), handle, "key", wrong_ts).IsInvalidArgument());
|
|
101
|
+
ASSERT_TRUE(db_->SingleDelete(WriteOptions(), handle, "key", wrong_ts)
|
|
102
|
+
.IsInvalidArgument());
|
|
103
|
+
ASSERT_TRUE(
|
|
104
|
+
db_->DeleteRange(WriteOptions(), handle, "begin_key", "end_key", wrong_ts)
|
|
105
|
+
.IsInvalidArgument());
|
|
106
|
+
|
|
107
|
+
delete handle;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
TEST_F(DBBasicTestWithTimestamp, MixedCfs) {
|
|
111
|
+
Options options = CurrentOptions();
|
|
112
|
+
options.env = env_;
|
|
113
|
+
options.create_if_missing = true;
|
|
114
|
+
options.avoid_flush_during_shutdown = true;
|
|
115
|
+
DestroyAndReopen(options);
|
|
116
|
+
|
|
117
|
+
Options options1 = CurrentOptions();
|
|
118
|
+
options1.env = env_;
|
|
119
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
120
|
+
TestComparator test_cmp(kTimestampSize);
|
|
121
|
+
options1.comparator = &test_cmp;
|
|
122
|
+
ColumnFamilyHandle* handle = nullptr;
|
|
123
|
+
Status s = db_->CreateColumnFamily(options1, "data", &handle);
|
|
124
|
+
ASSERT_OK(s);
|
|
125
|
+
|
|
126
|
+
WriteBatch wb;
|
|
127
|
+
ASSERT_OK(wb.Put("a", "value"));
|
|
128
|
+
ASSERT_OK(wb.Put(handle, "a", "value"));
|
|
129
|
+
{
|
|
130
|
+
std::string ts = Timestamp(1, 0);
|
|
131
|
+
const auto ts_sz_func = [kTimestampSize, handle](uint32_t cf_id) {
|
|
132
|
+
assert(handle);
|
|
133
|
+
if (cf_id == 0) {
|
|
134
|
+
return static_cast<size_t>(0);
|
|
135
|
+
} else if (cf_id == handle->GetID()) {
|
|
136
|
+
return kTimestampSize;
|
|
137
|
+
} else {
|
|
138
|
+
assert(false);
|
|
139
|
+
return std::numeric_limits<size_t>::max();
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
ASSERT_OK(wb.UpdateTimestamps(ts, ts_sz_func));
|
|
143
|
+
ASSERT_OK(db_->Write(WriteOptions(), &wb));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const auto verify_db = [this](ColumnFamilyHandle* h, const std::string& key,
|
|
147
|
+
const std::string& ts,
|
|
148
|
+
const std::string& expected_value) {
|
|
149
|
+
ASSERT_EQ(expected_value, Get(key));
|
|
150
|
+
Slice read_ts_slice(ts);
|
|
151
|
+
ReadOptions read_opts;
|
|
152
|
+
read_opts.timestamp = &read_ts_slice;
|
|
153
|
+
std::string value;
|
|
154
|
+
ASSERT_OK(db_->Get(read_opts, h, key, &value));
|
|
155
|
+
ASSERT_EQ(expected_value, value);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
verify_db(handle, "a", Timestamp(1, 0), "value");
|
|
159
|
+
|
|
160
|
+
delete handle;
|
|
161
|
+
Close();
|
|
162
|
+
|
|
163
|
+
std::vector<ColumnFamilyDescriptor> cf_descs;
|
|
164
|
+
cf_descs.emplace_back(kDefaultColumnFamilyName, options);
|
|
165
|
+
cf_descs.emplace_back("data", options1);
|
|
166
|
+
options.create_if_missing = false;
|
|
167
|
+
s = DB::Open(options, dbname_, cf_descs, &handles_, &db_);
|
|
168
|
+
ASSERT_OK(s);
|
|
169
|
+
|
|
170
|
+
verify_db(handles_[1], "a", Timestamp(1, 0), "value");
|
|
171
|
+
|
|
172
|
+
Close();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
TEST_F(DBBasicTestWithTimestamp, CompactRangeWithSpecifiedRange) {
|
|
176
|
+
Options options = CurrentOptions();
|
|
177
|
+
options.env = env_;
|
|
178
|
+
options.create_if_missing = true;
|
|
179
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
180
|
+
TestComparator test_cmp(kTimestampSize);
|
|
181
|
+
options.comparator = &test_cmp;
|
|
182
|
+
DestroyAndReopen(options);
|
|
183
|
+
|
|
184
|
+
WriteOptions write_opts;
|
|
185
|
+
std::string ts = Timestamp(1, 0);
|
|
186
|
+
|
|
187
|
+
ASSERT_OK(db_->Put(write_opts, "foo1", ts, "bar"));
|
|
188
|
+
ASSERT_OK(Flush());
|
|
189
|
+
|
|
190
|
+
ASSERT_OK(db_->Put(write_opts, "foo2", ts, "bar"));
|
|
191
|
+
ASSERT_OK(Flush());
|
|
192
|
+
|
|
193
|
+
std::string start_str = "foo";
|
|
194
|
+
std::string end_str = "foo2";
|
|
195
|
+
Slice start(start_str), end(end_str);
|
|
196
|
+
ASSERT_OK(db_->CompactRange(CompactRangeOptions(), &start, &end));
|
|
197
|
+
|
|
198
|
+
Close();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
TEST_F(DBBasicTestWithTimestamp, GcPreserveLatestVersionBelowFullHistoryLow) {
|
|
202
|
+
Options options = CurrentOptions();
|
|
203
|
+
options.env = env_;
|
|
204
|
+
options.create_if_missing = true;
|
|
205
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
206
|
+
TestComparator test_cmp(kTimestampSize);
|
|
207
|
+
options.comparator = &test_cmp;
|
|
208
|
+
DestroyAndReopen(options);
|
|
209
|
+
|
|
210
|
+
std::string ts_str = Timestamp(1, 0);
|
|
211
|
+
WriteOptions wopts;
|
|
212
|
+
ASSERT_OK(db_->Put(wopts, "k1", ts_str, "v1"));
|
|
213
|
+
ASSERT_OK(db_->Put(wopts, "k2", ts_str, "v2"));
|
|
214
|
+
ASSERT_OK(db_->Put(wopts, "k3", ts_str, "v3"));
|
|
215
|
+
|
|
216
|
+
ts_str = Timestamp(2, 0);
|
|
217
|
+
ASSERT_OK(db_->Delete(wopts, "k3", ts_str));
|
|
218
|
+
|
|
219
|
+
ts_str = Timestamp(4, 0);
|
|
220
|
+
ASSERT_OK(db_->Put(wopts, "k1", ts_str, "v5"));
|
|
221
|
+
|
|
222
|
+
ts_str = Timestamp(5, 0);
|
|
223
|
+
ASSERT_OK(
|
|
224
|
+
db_->DeleteRange(wopts, db_->DefaultColumnFamily(), "k0", "k9", ts_str));
|
|
225
|
+
|
|
226
|
+
ts_str = Timestamp(3, 0);
|
|
227
|
+
Slice ts = ts_str;
|
|
228
|
+
CompactRangeOptions cro;
|
|
229
|
+
cro.full_history_ts_low = &ts;
|
|
230
|
+
ASSERT_OK(db_->CompactRange(cro, nullptr, nullptr));
|
|
231
|
+
|
|
232
|
+
ASSERT_OK(Flush());
|
|
233
|
+
|
|
234
|
+
ReadOptions ropts;
|
|
235
|
+
ropts.timestamp = &ts;
|
|
236
|
+
std::string value;
|
|
237
|
+
Status s = db_->Get(ropts, "k1", &value);
|
|
238
|
+
ASSERT_OK(s);
|
|
239
|
+
ASSERT_EQ("v1", value);
|
|
240
|
+
|
|
241
|
+
std::string key_ts;
|
|
242
|
+
ASSERT_TRUE(db_->Get(ropts, "k3", &value, &key_ts).IsNotFound());
|
|
243
|
+
ASSERT_EQ(Timestamp(2, 0), key_ts);
|
|
244
|
+
|
|
245
|
+
ts_str = Timestamp(5, 0);
|
|
246
|
+
ts = ts_str;
|
|
247
|
+
ropts.timestamp = &ts;
|
|
248
|
+
ASSERT_TRUE(db_->Get(ropts, "k2", &value, &key_ts).IsNotFound());
|
|
249
|
+
ASSERT_EQ(Timestamp(5, 0), key_ts);
|
|
250
|
+
ASSERT_TRUE(db_->Get(ropts, "k2", &value).IsNotFound());
|
|
251
|
+
|
|
252
|
+
Close();
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
TEST_F(DBBasicTestWithTimestamp, UpdateFullHistoryTsLow) {
|
|
256
|
+
Options options = CurrentOptions();
|
|
257
|
+
options.env = env_;
|
|
258
|
+
options.create_if_missing = true;
|
|
259
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
260
|
+
TestComparator test_cmp(kTimestampSize);
|
|
261
|
+
options.comparator = &test_cmp;
|
|
262
|
+
DestroyAndReopen(options);
|
|
263
|
+
|
|
264
|
+
const std::string kKey = "test kKey";
|
|
265
|
+
|
|
266
|
+
// Test set ts_low first and flush()
|
|
267
|
+
int current_ts_low = 5;
|
|
268
|
+
std::string ts_low_str = Timestamp(current_ts_low, 0);
|
|
269
|
+
Slice ts_low = ts_low_str;
|
|
270
|
+
CompactRangeOptions comp_opts;
|
|
271
|
+
comp_opts.full_history_ts_low = &ts_low;
|
|
272
|
+
comp_opts.bottommost_level_compaction = BottommostLevelCompaction::kForce;
|
|
273
|
+
|
|
274
|
+
ASSERT_OK(db_->CompactRange(comp_opts, nullptr, nullptr));
|
|
275
|
+
|
|
276
|
+
auto* cfd =
|
|
277
|
+
static_cast_with_check<ColumnFamilyHandleImpl>(db_->DefaultColumnFamily())
|
|
278
|
+
->cfd();
|
|
279
|
+
auto result_ts_low = cfd->GetFullHistoryTsLow();
|
|
280
|
+
|
|
281
|
+
ASSERT_TRUE(test_cmp.CompareTimestamp(ts_low, result_ts_low) == 0);
|
|
282
|
+
|
|
283
|
+
for (int i = 0; i < 10; i++) {
|
|
284
|
+
WriteOptions write_opts;
|
|
285
|
+
std::string ts = Timestamp(i, 0);
|
|
286
|
+
ASSERT_OK(db_->Put(write_opts, kKey, ts, Key(i)));
|
|
287
|
+
}
|
|
288
|
+
ASSERT_OK(Flush());
|
|
289
|
+
|
|
290
|
+
for (int i = 0; i < 10; i++) {
|
|
291
|
+
ReadOptions read_opts;
|
|
292
|
+
std::string ts_str = Timestamp(i, 0);
|
|
293
|
+
Slice ts = ts_str;
|
|
294
|
+
read_opts.timestamp = &ts;
|
|
295
|
+
std::string value;
|
|
296
|
+
Status status = db_->Get(read_opts, kKey, &value);
|
|
297
|
+
if (i < current_ts_low) {
|
|
298
|
+
ASSERT_TRUE(status.IsInvalidArgument());
|
|
299
|
+
} else {
|
|
300
|
+
ASSERT_OK(status);
|
|
301
|
+
ASSERT_TRUE(value.compare(Key(i)) == 0);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Test set ts_low and then trigger compaction
|
|
306
|
+
for (int i = 10; i < 20; i++) {
|
|
307
|
+
WriteOptions write_opts;
|
|
308
|
+
std::string ts = Timestamp(i, 0);
|
|
309
|
+
ASSERT_OK(db_->Put(write_opts, kKey, ts, Key(i)));
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
ASSERT_OK(Flush());
|
|
313
|
+
|
|
314
|
+
current_ts_low = 15;
|
|
315
|
+
ts_low_str = Timestamp(current_ts_low, 0);
|
|
316
|
+
ts_low = ts_low_str;
|
|
317
|
+
comp_opts.full_history_ts_low = &ts_low;
|
|
318
|
+
ASSERT_OK(db_->CompactRange(comp_opts, nullptr, nullptr));
|
|
319
|
+
result_ts_low = cfd->GetFullHistoryTsLow();
|
|
320
|
+
ASSERT_TRUE(test_cmp.CompareTimestamp(ts_low, result_ts_low) == 0);
|
|
321
|
+
|
|
322
|
+
for (int i = current_ts_low; i < 20; i++) {
|
|
323
|
+
ReadOptions read_opts;
|
|
324
|
+
std::string ts_str = Timestamp(i, 0);
|
|
325
|
+
Slice ts = ts_str;
|
|
326
|
+
read_opts.timestamp = &ts;
|
|
327
|
+
std::string value;
|
|
328
|
+
Status status = db_->Get(read_opts, kKey, &value);
|
|
329
|
+
ASSERT_OK(status);
|
|
330
|
+
ASSERT_TRUE(value.compare(Key(i)) == 0);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Test invalid compaction with range
|
|
334
|
+
Slice start(kKey), end(kKey);
|
|
335
|
+
Status s = db_->CompactRange(comp_opts, &start, &end);
|
|
336
|
+
ASSERT_TRUE(s.IsInvalidArgument());
|
|
337
|
+
s = db_->CompactRange(comp_opts, &start, nullptr);
|
|
338
|
+
ASSERT_TRUE(s.IsInvalidArgument());
|
|
339
|
+
s = db_->CompactRange(comp_opts, nullptr, &end);
|
|
340
|
+
ASSERT_TRUE(s.IsInvalidArgument());
|
|
341
|
+
|
|
342
|
+
// Test invalid compaction with the decreasing ts_low
|
|
343
|
+
ts_low_str = Timestamp(current_ts_low - 1, 0);
|
|
344
|
+
ts_low = ts_low_str;
|
|
345
|
+
comp_opts.full_history_ts_low = &ts_low;
|
|
346
|
+
s = db_->CompactRange(comp_opts, nullptr, nullptr);
|
|
347
|
+
ASSERT_TRUE(s.IsInvalidArgument());
|
|
348
|
+
|
|
349
|
+
Close();
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
TEST_F(DBBasicTestWithTimestamp, UpdateFullHistoryTsLowWithPublicAPI) {
|
|
353
|
+
Options options = CurrentOptions();
|
|
354
|
+
options.env = env_;
|
|
355
|
+
options.create_if_missing = true;
|
|
356
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
357
|
+
TestComparator test_cmp(kTimestampSize);
|
|
358
|
+
options.comparator = &test_cmp;
|
|
359
|
+
DestroyAndReopen(options);
|
|
360
|
+
std::string ts_low_str = Timestamp(9, 0);
|
|
361
|
+
ASSERT_OK(
|
|
362
|
+
db_->IncreaseFullHistoryTsLow(db_->DefaultColumnFamily(), ts_low_str));
|
|
363
|
+
std::string result_ts_low;
|
|
364
|
+
ASSERT_OK(db_->GetFullHistoryTsLow(nullptr, &result_ts_low));
|
|
365
|
+
ASSERT_TRUE(test_cmp.CompareTimestamp(ts_low_str, result_ts_low) == 0);
|
|
366
|
+
// test increase full_history_low backward
|
|
367
|
+
std::string ts_low_str_back = Timestamp(8, 0);
|
|
368
|
+
auto s = db_->IncreaseFullHistoryTsLow(db_->DefaultColumnFamily(),
|
|
369
|
+
ts_low_str_back);
|
|
370
|
+
ASSERT_EQ(s, Status::InvalidArgument());
|
|
371
|
+
// test IncreaseFullHistoryTsLow with a timestamp whose length is longger
|
|
372
|
+
// than the cf's timestamp size
|
|
373
|
+
std::string ts_low_str_long(Timestamp(0, 0).size() + 1, 'a');
|
|
374
|
+
s = db_->IncreaseFullHistoryTsLow(db_->DefaultColumnFamily(),
|
|
375
|
+
ts_low_str_long);
|
|
376
|
+
ASSERT_EQ(s, Status::InvalidArgument());
|
|
377
|
+
// test IncreaseFullHistoryTsLow with a timestamp which is null
|
|
378
|
+
std::string ts_low_str_null = "";
|
|
379
|
+
s = db_->IncreaseFullHistoryTsLow(db_->DefaultColumnFamily(),
|
|
380
|
+
ts_low_str_null);
|
|
381
|
+
ASSERT_EQ(s, Status::InvalidArgument());
|
|
382
|
+
// test IncreaseFullHistoryTsLow for a column family that does not enable
|
|
383
|
+
// timestamp
|
|
384
|
+
options.comparator = BytewiseComparator();
|
|
385
|
+
DestroyAndReopen(options);
|
|
386
|
+
ts_low_str = Timestamp(10, 0);
|
|
387
|
+
s = db_->IncreaseFullHistoryTsLow(db_->DefaultColumnFamily(), ts_low_str);
|
|
388
|
+
ASSERT_EQ(s, Status::InvalidArgument());
|
|
389
|
+
// test GetFullHistoryTsLow for a column family that does not enable
|
|
390
|
+
// timestamp
|
|
391
|
+
std::string current_ts_low;
|
|
392
|
+
s = db_->GetFullHistoryTsLow(db_->DefaultColumnFamily(), ¤t_ts_low);
|
|
393
|
+
ASSERT_EQ(s, Status::InvalidArgument());
|
|
394
|
+
Close();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
TEST_F(DBBasicTestWithTimestamp, GetApproximateSizes) {
|
|
398
|
+
Options options = CurrentOptions();
|
|
399
|
+
options.write_buffer_size = 100000000; // Large write buffer
|
|
400
|
+
options.compression = kNoCompression;
|
|
401
|
+
options.create_if_missing = true;
|
|
402
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
403
|
+
TestComparator test_cmp(kTimestampSize);
|
|
404
|
+
options.comparator = &test_cmp;
|
|
405
|
+
DestroyAndReopen(options);
|
|
406
|
+
auto default_cf = db_->DefaultColumnFamily();
|
|
407
|
+
|
|
408
|
+
WriteOptions write_opts;
|
|
409
|
+
std::string ts = Timestamp(1, 0);
|
|
410
|
+
|
|
411
|
+
const int N = 128;
|
|
412
|
+
Random rnd(301);
|
|
413
|
+
for (int i = 0; i < N; i++) {
|
|
414
|
+
ASSERT_OK(db_->Put(write_opts, Key(i), ts, rnd.RandomString(1024)));
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
uint64_t size;
|
|
418
|
+
std::string start = Key(50);
|
|
419
|
+
std::string end = Key(60);
|
|
420
|
+
Range r(start, end);
|
|
421
|
+
SizeApproximationOptions size_approx_options;
|
|
422
|
+
size_approx_options.include_memtables = true;
|
|
423
|
+
size_approx_options.include_files = true;
|
|
424
|
+
ASSERT_OK(
|
|
425
|
+
db_->GetApproximateSizes(size_approx_options, default_cf, &r, 1, &size));
|
|
426
|
+
ASSERT_GT(size, 6000);
|
|
427
|
+
ASSERT_LT(size, 204800);
|
|
428
|
+
|
|
429
|
+
// test multiple ranges
|
|
430
|
+
std::vector<Range> ranges;
|
|
431
|
+
std::string start_tmp = Key(10);
|
|
432
|
+
std::string end_tmp = Key(20);
|
|
433
|
+
ranges.emplace_back(Range(start_tmp, end_tmp));
|
|
434
|
+
ranges.emplace_back(Range(start, end));
|
|
435
|
+
uint64_t range_sizes[2];
|
|
436
|
+
ASSERT_OK(db_->GetApproximateSizes(size_approx_options, default_cf,
|
|
437
|
+
ranges.data(), 2, range_sizes));
|
|
438
|
+
|
|
439
|
+
ASSERT_EQ(range_sizes[1], size);
|
|
440
|
+
|
|
441
|
+
// Zero if not including mem table
|
|
442
|
+
ASSERT_OK(db_->GetApproximateSizes(&r, 1, &size));
|
|
443
|
+
ASSERT_EQ(size, 0);
|
|
444
|
+
|
|
445
|
+
start = Key(500);
|
|
446
|
+
end = Key(600);
|
|
447
|
+
r = Range(start, end);
|
|
448
|
+
ASSERT_OK(
|
|
449
|
+
db_->GetApproximateSizes(size_approx_options, default_cf, &r, 1, &size));
|
|
450
|
+
ASSERT_EQ(size, 0);
|
|
451
|
+
|
|
452
|
+
// Test range boundaries
|
|
453
|
+
ASSERT_OK(db_->Put(write_opts, Key(1000), ts, rnd.RandomString(1024)));
|
|
454
|
+
// Should include start key
|
|
455
|
+
start = Key(1000);
|
|
456
|
+
end = Key(1100);
|
|
457
|
+
r = Range(start, end);
|
|
458
|
+
ASSERT_OK(
|
|
459
|
+
db_->GetApproximateSizes(size_approx_options, default_cf, &r, 1, &size));
|
|
460
|
+
ASSERT_GT(size, 0);
|
|
461
|
+
|
|
462
|
+
// Should exclude end key
|
|
463
|
+
start = Key(900);
|
|
464
|
+
end = Key(1000);
|
|
465
|
+
r = Range(start, end);
|
|
466
|
+
ASSERT_OK(
|
|
467
|
+
db_->GetApproximateSizes(size_approx_options, default_cf, &r, 1, &size));
|
|
468
|
+
ASSERT_EQ(size, 0);
|
|
469
|
+
|
|
470
|
+
Close();
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
TEST_F(DBBasicTestWithTimestamp, SimpleIterate) {
|
|
474
|
+
const int kNumKeysPerFile = 128;
|
|
475
|
+
const uint64_t kMaxKey = 1024;
|
|
476
|
+
Options options = CurrentOptions();
|
|
477
|
+
options.env = env_;
|
|
478
|
+
options.create_if_missing = true;
|
|
479
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
480
|
+
TestComparator test_cmp(kTimestampSize);
|
|
481
|
+
options.comparator = &test_cmp;
|
|
482
|
+
options.memtable_factory.reset(
|
|
483
|
+
test::NewSpecialSkipListFactory(kNumKeysPerFile));
|
|
484
|
+
DestroyAndReopen(options);
|
|
485
|
+
const std::vector<uint64_t> start_keys = {1, 0};
|
|
486
|
+
const std::vector<std::string> write_timestamps = {Timestamp(1, 0),
|
|
487
|
+
Timestamp(3, 0)};
|
|
488
|
+
const std::vector<std::string> read_timestamps = {Timestamp(2, 0),
|
|
489
|
+
Timestamp(4, 0)};
|
|
490
|
+
for (size_t i = 0; i < write_timestamps.size(); ++i) {
|
|
491
|
+
WriteOptions write_opts;
|
|
492
|
+
for (uint64_t key = start_keys[i]; key <= kMaxKey; ++key) {
|
|
493
|
+
Status s = db_->Put(write_opts, Key1(key), write_timestamps[i],
|
|
494
|
+
"value" + std::to_string(i));
|
|
495
|
+
ASSERT_OK(s);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
for (size_t i = 0; i < read_timestamps.size(); ++i) {
|
|
499
|
+
ReadOptions read_opts;
|
|
500
|
+
Slice read_ts = read_timestamps[i];
|
|
501
|
+
read_opts.timestamp = &read_ts;
|
|
502
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
503
|
+
int count = 0;
|
|
504
|
+
uint64_t key = 0;
|
|
505
|
+
// Forward iterate.
|
|
506
|
+
for (it->Seek(Key1(0)), key = start_keys[i]; it->Valid();
|
|
507
|
+
it->Next(), ++count, ++key) {
|
|
508
|
+
CheckIterUserEntry(it.get(), Key1(key), kTypeValue,
|
|
509
|
+
"value" + std::to_string(i), write_timestamps[i]);
|
|
510
|
+
}
|
|
511
|
+
size_t expected_count = kMaxKey - start_keys[i] + 1;
|
|
512
|
+
ASSERT_EQ(expected_count, count);
|
|
513
|
+
|
|
514
|
+
// Backward iterate.
|
|
515
|
+
count = 0;
|
|
516
|
+
for (it->SeekForPrev(Key1(kMaxKey)), key = kMaxKey; it->Valid();
|
|
517
|
+
it->Prev(), ++count, --key) {
|
|
518
|
+
CheckIterUserEntry(it.get(), Key1(key), kTypeValue,
|
|
519
|
+
"value" + std::to_string(i), write_timestamps[i]);
|
|
520
|
+
}
|
|
521
|
+
ASSERT_EQ(static_cast<size_t>(kMaxKey) - start_keys[i] + 1, count);
|
|
522
|
+
|
|
523
|
+
// SeekToFirst()/SeekToLast() with lower/upper bounds.
|
|
524
|
+
// Then iter with lower and upper bounds.
|
|
525
|
+
uint64_t l = 0;
|
|
526
|
+
uint64_t r = kMaxKey + 1;
|
|
527
|
+
while (l < r) {
|
|
528
|
+
std::string lb_str = Key1(l);
|
|
529
|
+
Slice lb = lb_str;
|
|
530
|
+
std::string ub_str = Key1(r);
|
|
531
|
+
Slice ub = ub_str;
|
|
532
|
+
read_opts.iterate_lower_bound = &lb;
|
|
533
|
+
read_opts.iterate_upper_bound = &ub;
|
|
534
|
+
it.reset(db_->NewIterator(read_opts));
|
|
535
|
+
for (it->SeekToFirst(), key = std::max(l, start_keys[i]), count = 0;
|
|
536
|
+
it->Valid(); it->Next(), ++key, ++count) {
|
|
537
|
+
CheckIterUserEntry(it.get(), Key1(key), kTypeValue,
|
|
538
|
+
"value" + std::to_string(i), write_timestamps[i]);
|
|
539
|
+
}
|
|
540
|
+
ASSERT_EQ(r - std::max(l, start_keys[i]), count);
|
|
541
|
+
|
|
542
|
+
for (it->SeekToLast(), key = std::min(r, kMaxKey + 1), count = 0;
|
|
543
|
+
it->Valid(); it->Prev(), --key, ++count) {
|
|
544
|
+
CheckIterUserEntry(it.get(), Key1(key - 1), kTypeValue,
|
|
545
|
+
"value" + std::to_string(i), write_timestamps[i]);
|
|
546
|
+
}
|
|
547
|
+
l += (kMaxKey / 100);
|
|
548
|
+
r -= (kMaxKey / 100);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
Close();
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
TEST_F(DBBasicTestWithTimestamp, TrimHistoryTest) {
|
|
555
|
+
Options options = CurrentOptions();
|
|
556
|
+
options.env = env_;
|
|
557
|
+
options.create_if_missing = true;
|
|
558
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
559
|
+
TestComparator test_cmp(kTimestampSize);
|
|
560
|
+
options.comparator = &test_cmp;
|
|
561
|
+
DestroyAndReopen(options);
|
|
562
|
+
auto check_value_by_ts = [](DB* db, Slice key, std::string readTs,
|
|
563
|
+
Status status, std::string checkValue,
|
|
564
|
+
std::string expected_ts) {
|
|
565
|
+
ReadOptions ropts;
|
|
566
|
+
Slice ts = readTs;
|
|
567
|
+
ropts.timestamp = &ts;
|
|
568
|
+
std::string value;
|
|
569
|
+
std::string key_ts;
|
|
570
|
+
Status s = db->Get(ropts, key, &value, &key_ts);
|
|
571
|
+
ASSERT_TRUE(s == status);
|
|
572
|
+
if (s.ok()) {
|
|
573
|
+
ASSERT_EQ(checkValue, value);
|
|
574
|
+
}
|
|
575
|
+
if (s.ok() || s.IsNotFound()) {
|
|
576
|
+
ASSERT_EQ(expected_ts, key_ts);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
// Construct data of different versions with different ts
|
|
580
|
+
ASSERT_OK(db_->Put(WriteOptions(), "k1", Timestamp(2, 0), "v1"));
|
|
581
|
+
ASSERT_OK(db_->Put(WriteOptions(), "k1", Timestamp(4, 0), "v2"));
|
|
582
|
+
ASSERT_OK(db_->Delete(WriteOptions(), "k1", Timestamp(5, 0)));
|
|
583
|
+
ASSERT_OK(db_->Put(WriteOptions(), "k1", Timestamp(6, 0), "v3"));
|
|
584
|
+
check_value_by_ts(db_, "k1", Timestamp(7, 0), Status::OK(), "v3",
|
|
585
|
+
Timestamp(6, 0));
|
|
586
|
+
ASSERT_OK(Flush());
|
|
587
|
+
Close();
|
|
588
|
+
|
|
589
|
+
ColumnFamilyOptions cf_options(options);
|
|
590
|
+
std::vector<ColumnFamilyDescriptor> column_families;
|
|
591
|
+
column_families.push_back(
|
|
592
|
+
ColumnFamilyDescriptor(kDefaultColumnFamilyName, cf_options));
|
|
593
|
+
DBOptions db_options(options);
|
|
594
|
+
|
|
595
|
+
// Trim data whose version > Timestamp(5, 0), read(k1, ts(7)) <- NOT_FOUND.
|
|
596
|
+
ASSERT_OK(DB::OpenAndTrimHistory(db_options, dbname_, column_families,
|
|
597
|
+
&handles_, &db_, Timestamp(5, 0)));
|
|
598
|
+
check_value_by_ts(db_, "k1", Timestamp(7, 0), Status::NotFound(), "",
|
|
599
|
+
Timestamp(5, 0));
|
|
600
|
+
Close();
|
|
601
|
+
|
|
602
|
+
// Trim data whose timestamp > Timestamp(4, 0), read(k1, ts(7)) <- v2
|
|
603
|
+
ASSERT_OK(DB::OpenAndTrimHistory(db_options, dbname_, column_families,
|
|
604
|
+
&handles_, &db_, Timestamp(4, 0)));
|
|
605
|
+
check_value_by_ts(db_, "k1", Timestamp(7, 0), Status::OK(), "v2",
|
|
606
|
+
Timestamp(4, 0));
|
|
607
|
+
Close();
|
|
608
|
+
|
|
609
|
+
Reopen(options);
|
|
610
|
+
ASSERT_OK(db_->DeleteRange(WriteOptions(), db_->DefaultColumnFamily(), "k1",
|
|
611
|
+
"k3", Timestamp(7, 0)));
|
|
612
|
+
check_value_by_ts(db_, "k1", Timestamp(8, 0), Status::NotFound(), "",
|
|
613
|
+
Timestamp(7, 0));
|
|
614
|
+
Close();
|
|
615
|
+
// Trim data whose timestamp > Timestamp(6, 0), read(k1, ts(8)) <- v2
|
|
616
|
+
ASSERT_OK(DB::OpenAndTrimHistory(db_options, dbname_, column_families,
|
|
617
|
+
&handles_, &db_, Timestamp(6, 0)));
|
|
618
|
+
check_value_by_ts(db_, "k1", Timestamp(8, 0), Status::OK(), "v2",
|
|
619
|
+
Timestamp(4, 0));
|
|
620
|
+
Close();
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
TEST_F(DBBasicTestWithTimestamp, OpenAndTrimHistoryInvalidOptionTest) {
|
|
624
|
+
Destroy(last_options_);
|
|
625
|
+
|
|
626
|
+
Options options = CurrentOptions();
|
|
627
|
+
options.env = env_;
|
|
628
|
+
options.create_if_missing = true;
|
|
629
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
630
|
+
TestComparator test_cmp(kTimestampSize);
|
|
631
|
+
options.comparator = &test_cmp;
|
|
632
|
+
|
|
633
|
+
ColumnFamilyOptions cf_options(options);
|
|
634
|
+
std::vector<ColumnFamilyDescriptor> column_families;
|
|
635
|
+
column_families.push_back(
|
|
636
|
+
ColumnFamilyDescriptor(kDefaultColumnFamilyName, cf_options));
|
|
637
|
+
DBOptions db_options(options);
|
|
638
|
+
|
|
639
|
+
// OpenAndTrimHistory should not work with avoid_flush_during_recovery
|
|
640
|
+
db_options.avoid_flush_during_recovery = true;
|
|
641
|
+
ASSERT_TRUE(DB::OpenAndTrimHistory(db_options, dbname_, column_families,
|
|
642
|
+
&handles_, &db_, Timestamp(0, 0))
|
|
643
|
+
.IsInvalidArgument());
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
TEST_F(DBBasicTestWithTimestamp, GetTimestampTableProperties) {
|
|
647
|
+
Options options = CurrentOptions();
|
|
648
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
649
|
+
TestComparator test_cmp(kTimestampSize);
|
|
650
|
+
options.comparator = &test_cmp;
|
|
651
|
+
DestroyAndReopen(options);
|
|
652
|
+
// Create 2 tables
|
|
653
|
+
for (int table = 0; table < 2; ++table) {
|
|
654
|
+
for (int i = 0; i < 10; i++) {
|
|
655
|
+
std::string ts = Timestamp(i, 0);
|
|
656
|
+
ASSERT_OK(db_->Put(WriteOptions(), "key", ts, Key(i)));
|
|
657
|
+
}
|
|
658
|
+
ASSERT_OK(Flush());
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
TablePropertiesCollection props;
|
|
662
|
+
ASSERT_OK(db_->GetPropertiesOfAllTables(&props));
|
|
663
|
+
ASSERT_EQ(2U, props.size());
|
|
664
|
+
for (const auto& item : props) {
|
|
665
|
+
auto& user_collected = item.second->user_collected_properties;
|
|
666
|
+
ASSERT_TRUE(user_collected.find("rocksdb.timestamp_min") !=
|
|
667
|
+
user_collected.end());
|
|
668
|
+
ASSERT_TRUE(user_collected.find("rocksdb.timestamp_max") !=
|
|
669
|
+
user_collected.end());
|
|
670
|
+
ASSERT_EQ(user_collected.at("rocksdb.timestamp_min"), Timestamp(0, 0));
|
|
671
|
+
ASSERT_EQ(user_collected.at("rocksdb.timestamp_max"), Timestamp(9, 0));
|
|
672
|
+
}
|
|
673
|
+
Close();
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
class DBBasicTestWithTimestampTableOptions
|
|
677
|
+
: public DBBasicTestWithTimestampBase,
|
|
678
|
+
public testing::WithParamInterface<BlockBasedTableOptions::IndexType> {
|
|
679
|
+
public:
|
|
680
|
+
explicit DBBasicTestWithTimestampTableOptions()
|
|
681
|
+
: DBBasicTestWithTimestampBase(
|
|
682
|
+
"db_basic_test_with_timestamp_table_options") {}
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
INSTANTIATE_TEST_CASE_P(
|
|
686
|
+
Timestamp, DBBasicTestWithTimestampTableOptions,
|
|
687
|
+
testing::Values(
|
|
688
|
+
BlockBasedTableOptions::IndexType::kBinarySearch,
|
|
689
|
+
BlockBasedTableOptions::IndexType::kHashSearch,
|
|
690
|
+
BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch,
|
|
691
|
+
BlockBasedTableOptions::IndexType::kBinarySearchWithFirstKey));
|
|
692
|
+
|
|
693
|
+
TEST_P(DBBasicTestWithTimestampTableOptions, GetAndMultiGet) {
|
|
694
|
+
Options options = GetDefaultOptions();
|
|
695
|
+
options.create_if_missing = true;
|
|
696
|
+
options.prefix_extractor.reset(NewFixedPrefixTransform(3));
|
|
697
|
+
options.compression = kNoCompression;
|
|
698
|
+
BlockBasedTableOptions bbto;
|
|
699
|
+
bbto.index_type = GetParam();
|
|
700
|
+
bbto.block_size = 100;
|
|
701
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
702
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
703
|
+
TestComparator cmp(kTimestampSize);
|
|
704
|
+
options.comparator = &cmp;
|
|
705
|
+
DestroyAndReopen(options);
|
|
706
|
+
constexpr uint64_t kNumKeys = 1024;
|
|
707
|
+
for (uint64_t k = 0; k < kNumKeys; ++k) {
|
|
708
|
+
WriteOptions write_opts;
|
|
709
|
+
ASSERT_OK(db_->Put(write_opts, Key1(k), Timestamp(1, 0),
|
|
710
|
+
"value" + std::to_string(k)));
|
|
711
|
+
}
|
|
712
|
+
ASSERT_OK(Flush());
|
|
713
|
+
{
|
|
714
|
+
ReadOptions read_opts;
|
|
715
|
+
read_opts.total_order_seek = true;
|
|
716
|
+
std::string ts_str = Timestamp(2, 0);
|
|
717
|
+
Slice ts = ts_str;
|
|
718
|
+
read_opts.timestamp = &ts;
|
|
719
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
720
|
+
// verify Get()
|
|
721
|
+
for (it->SeekToFirst(); it->Valid(); it->Next()) {
|
|
722
|
+
std::string value_from_get;
|
|
723
|
+
std::string key_str(it->key().data(), it->key().size());
|
|
724
|
+
std::string timestamp;
|
|
725
|
+
ASSERT_OK(db_->Get(read_opts, key_str, &value_from_get, ×tamp));
|
|
726
|
+
ASSERT_EQ(it->value(), value_from_get);
|
|
727
|
+
ASSERT_EQ(Timestamp(1, 0), timestamp);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// verify MultiGet()
|
|
731
|
+
constexpr uint64_t step = 2;
|
|
732
|
+
static_assert(0 == (kNumKeys % step),
|
|
733
|
+
"kNumKeys must be a multiple of step");
|
|
734
|
+
for (uint64_t k = 0; k < kNumKeys; k += 2) {
|
|
735
|
+
std::vector<std::string> key_strs;
|
|
736
|
+
std::vector<Slice> keys;
|
|
737
|
+
for (size_t i = 0; i < step; ++i) {
|
|
738
|
+
key_strs.push_back(Key1(k + i));
|
|
739
|
+
}
|
|
740
|
+
for (size_t i = 0; i < step; ++i) {
|
|
741
|
+
keys.emplace_back(key_strs[i]);
|
|
742
|
+
}
|
|
743
|
+
std::vector<std::string> values;
|
|
744
|
+
std::vector<std::string> timestamps;
|
|
745
|
+
std::vector<Status> statuses =
|
|
746
|
+
db_->MultiGet(read_opts, keys, &values, ×tamps);
|
|
747
|
+
ASSERT_EQ(step, statuses.size());
|
|
748
|
+
ASSERT_EQ(step, values.size());
|
|
749
|
+
ASSERT_EQ(step, timestamps.size());
|
|
750
|
+
for (uint64_t i = 0; i < step; ++i) {
|
|
751
|
+
ASSERT_OK(statuses[i]);
|
|
752
|
+
ASSERT_EQ("value" + std::to_string(k + i), values[i]);
|
|
753
|
+
ASSERT_EQ(Timestamp(1, 0), timestamps[i]);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
Close();
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
TEST_P(DBBasicTestWithTimestampTableOptions, SeekWithPrefixLessThanKey) {
|
|
761
|
+
Options options = CurrentOptions();
|
|
762
|
+
options.env = env_;
|
|
763
|
+
options.create_if_missing = true;
|
|
764
|
+
options.prefix_extractor.reset(NewFixedPrefixTransform(3));
|
|
765
|
+
options.memtable_whole_key_filtering = true;
|
|
766
|
+
options.memtable_prefix_bloom_size_ratio = 0.1;
|
|
767
|
+
BlockBasedTableOptions bbto;
|
|
768
|
+
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
769
|
+
bbto.cache_index_and_filter_blocks = true;
|
|
770
|
+
bbto.whole_key_filtering = true;
|
|
771
|
+
bbto.index_type = GetParam();
|
|
772
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
773
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
774
|
+
TestComparator test_cmp(kTimestampSize);
|
|
775
|
+
options.comparator = &test_cmp;
|
|
776
|
+
DestroyAndReopen(options);
|
|
777
|
+
|
|
778
|
+
WriteOptions write_opts;
|
|
779
|
+
std::string ts = Timestamp(1, 0);
|
|
780
|
+
|
|
781
|
+
ASSERT_OK(db_->Put(write_opts, "foo1", ts, "bar"));
|
|
782
|
+
ASSERT_OK(Flush());
|
|
783
|
+
|
|
784
|
+
ASSERT_OK(db_->Put(write_opts, "foo2", ts, "bar"));
|
|
785
|
+
ASSERT_OK(Flush());
|
|
786
|
+
|
|
787
|
+
// Move sst file to next level
|
|
788
|
+
ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr));
|
|
789
|
+
|
|
790
|
+
ASSERT_OK(db_->Put(write_opts, "foo3", ts, "bar"));
|
|
791
|
+
ASSERT_OK(Flush());
|
|
792
|
+
|
|
793
|
+
ReadOptions read_opts;
|
|
794
|
+
Slice read_ts = ts;
|
|
795
|
+
read_opts.timestamp = &read_ts;
|
|
796
|
+
{
|
|
797
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
798
|
+
iter->Seek("foo");
|
|
799
|
+
ASSERT_TRUE(iter->Valid());
|
|
800
|
+
ASSERT_OK(iter->status());
|
|
801
|
+
iter->Next();
|
|
802
|
+
ASSERT_TRUE(iter->Valid());
|
|
803
|
+
ASSERT_OK(iter->status());
|
|
804
|
+
|
|
805
|
+
iter->Seek("bbb");
|
|
806
|
+
ASSERT_FALSE(iter->Valid());
|
|
807
|
+
ASSERT_OK(iter->status());
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
Close();
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
TEST_P(DBBasicTestWithTimestampTableOptions, SeekWithCappedPrefix) {
|
|
814
|
+
Options options = CurrentOptions();
|
|
815
|
+
options.env = env_;
|
|
816
|
+
options.create_if_missing = true;
|
|
817
|
+
// All of the keys or this test must be longer than 3 characters
|
|
818
|
+
constexpr int kMinKeyLen = 3;
|
|
819
|
+
options.prefix_extractor.reset(NewCappedPrefixTransform(kMinKeyLen));
|
|
820
|
+
options.memtable_whole_key_filtering = true;
|
|
821
|
+
options.memtable_prefix_bloom_size_ratio = 0.1;
|
|
822
|
+
BlockBasedTableOptions bbto;
|
|
823
|
+
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
824
|
+
bbto.cache_index_and_filter_blocks = true;
|
|
825
|
+
bbto.whole_key_filtering = true;
|
|
826
|
+
bbto.index_type = GetParam();
|
|
827
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
828
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
829
|
+
TestComparator test_cmp(kTimestampSize);
|
|
830
|
+
options.comparator = &test_cmp;
|
|
831
|
+
DestroyAndReopen(options);
|
|
832
|
+
|
|
833
|
+
WriteOptions write_opts;
|
|
834
|
+
std::string ts = Timestamp(1, 0);
|
|
835
|
+
|
|
836
|
+
ASSERT_OK(db_->Put(write_opts, "foo1", ts, "bar"));
|
|
837
|
+
ASSERT_OK(Flush());
|
|
838
|
+
|
|
839
|
+
ASSERT_OK(db_->Put(write_opts, "foo2", ts, "bar"));
|
|
840
|
+
ASSERT_OK(Flush());
|
|
841
|
+
|
|
842
|
+
// Move sst file to next level
|
|
843
|
+
ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr));
|
|
844
|
+
|
|
845
|
+
ASSERT_OK(db_->Put(write_opts, "foo3", ts, "bar"));
|
|
846
|
+
ASSERT_OK(Flush());
|
|
847
|
+
|
|
848
|
+
ReadOptions read_opts;
|
|
849
|
+
ts = Timestamp(2, 0);
|
|
850
|
+
Slice read_ts = ts;
|
|
851
|
+
read_opts.timestamp = &read_ts;
|
|
852
|
+
{
|
|
853
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
854
|
+
// Make sure the prefix extractor doesn't include timestamp, otherwise it
|
|
855
|
+
// may return invalid result.
|
|
856
|
+
iter->Seek("foo");
|
|
857
|
+
ASSERT_TRUE(iter->Valid());
|
|
858
|
+
ASSERT_OK(iter->status());
|
|
859
|
+
iter->Next();
|
|
860
|
+
ASSERT_TRUE(iter->Valid());
|
|
861
|
+
ASSERT_OK(iter->status());
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
Close();
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
TEST_P(DBBasicTestWithTimestampTableOptions, SeekWithBound) {
|
|
868
|
+
Options options = CurrentOptions();
|
|
869
|
+
options.env = env_;
|
|
870
|
+
options.create_if_missing = true;
|
|
871
|
+
options.prefix_extractor.reset(NewFixedPrefixTransform(2));
|
|
872
|
+
BlockBasedTableOptions bbto;
|
|
873
|
+
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
874
|
+
bbto.cache_index_and_filter_blocks = true;
|
|
875
|
+
bbto.whole_key_filtering = true;
|
|
876
|
+
bbto.index_type = GetParam();
|
|
877
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
878
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
879
|
+
TestComparator test_cmp(kTimestampSize);
|
|
880
|
+
options.comparator = &test_cmp;
|
|
881
|
+
DestroyAndReopen(options);
|
|
882
|
+
|
|
883
|
+
WriteOptions write_opts;
|
|
884
|
+
std::string ts = Timestamp(1, 0);
|
|
885
|
+
|
|
886
|
+
ASSERT_OK(db_->Put(write_opts, "foo1", ts, "bar1"));
|
|
887
|
+
ASSERT_OK(Flush());
|
|
888
|
+
|
|
889
|
+
ASSERT_OK(db_->Put(write_opts, "foo2", ts, "bar2"));
|
|
890
|
+
ASSERT_OK(Flush());
|
|
891
|
+
|
|
892
|
+
// Move sst file to next level
|
|
893
|
+
ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr));
|
|
894
|
+
|
|
895
|
+
for (int i = 3; i < 9; ++i) {
|
|
896
|
+
ASSERT_OK(db_->Put(write_opts, "foo" + std::to_string(i), ts,
|
|
897
|
+
"bar" + std::to_string(i)));
|
|
898
|
+
}
|
|
899
|
+
ASSERT_OK(Flush());
|
|
900
|
+
|
|
901
|
+
ReadOptions read_opts;
|
|
902
|
+
ts = Timestamp(2, 0);
|
|
903
|
+
Slice read_ts = ts;
|
|
904
|
+
read_opts.timestamp = &read_ts;
|
|
905
|
+
std::string up_bound = "foo5"; // exclusive
|
|
906
|
+
Slice up_bound_slice = up_bound;
|
|
907
|
+
std::string lo_bound = "foo2"; // inclusive
|
|
908
|
+
Slice lo_bound_slice = lo_bound;
|
|
909
|
+
read_opts.iterate_upper_bound = &up_bound_slice;
|
|
910
|
+
read_opts.iterate_lower_bound = &lo_bound_slice;
|
|
911
|
+
read_opts.auto_prefix_mode = true;
|
|
912
|
+
{
|
|
913
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
914
|
+
// Make sure the prefix extractor doesn't include timestamp, otherwise it
|
|
915
|
+
// may return invalid result.
|
|
916
|
+
iter->Seek("foo");
|
|
917
|
+
CheckIterUserEntry(iter.get(), lo_bound, kTypeValue, "bar2",
|
|
918
|
+
Timestamp(1, 0));
|
|
919
|
+
iter->SeekToFirst();
|
|
920
|
+
CheckIterUserEntry(iter.get(), lo_bound, kTypeValue, "bar2",
|
|
921
|
+
Timestamp(1, 0));
|
|
922
|
+
iter->SeekForPrev("g");
|
|
923
|
+
CheckIterUserEntry(iter.get(), "foo4", kTypeValue, "bar4", Timestamp(1, 0));
|
|
924
|
+
iter->SeekToLast();
|
|
925
|
+
CheckIterUserEntry(iter.get(), "foo4", kTypeValue, "bar4", Timestamp(1, 0));
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
Close();
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
TEST_F(DBBasicTestWithTimestamp, ChangeIterationDirection) {
|
|
932
|
+
Options options = GetDefaultOptions();
|
|
933
|
+
options.create_if_missing = true;
|
|
934
|
+
options.env = env_;
|
|
935
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
936
|
+
TestComparator test_cmp(kTimestampSize);
|
|
937
|
+
options.comparator = &test_cmp;
|
|
938
|
+
options.prefix_extractor.reset(NewFixedPrefixTransform(1));
|
|
939
|
+
options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics();
|
|
940
|
+
DestroyAndReopen(options);
|
|
941
|
+
const std::vector<std::string> timestamps = {Timestamp(1, 1), Timestamp(0, 2),
|
|
942
|
+
Timestamp(4, 3)};
|
|
943
|
+
const std::vector<std::tuple<std::string, std::string>> kvs = {
|
|
944
|
+
std::make_tuple("aa", "value1"), std::make_tuple("ab", "value2")};
|
|
945
|
+
for (const auto& ts : timestamps) {
|
|
946
|
+
WriteBatch wb(0, 0, 0, kTimestampSize);
|
|
947
|
+
for (const auto& kv : kvs) {
|
|
948
|
+
const std::string& key = std::get<0>(kv);
|
|
949
|
+
const std::string& value = std::get<1>(kv);
|
|
950
|
+
ASSERT_OK(wb.Put(key, value));
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
ASSERT_OK(wb.UpdateTimestamps(
|
|
954
|
+
ts, [kTimestampSize](uint32_t) { return kTimestampSize; }));
|
|
955
|
+
ASSERT_OK(db_->Write(WriteOptions(), &wb));
|
|
956
|
+
}
|
|
957
|
+
std::string read_ts_str = Timestamp(5, 3);
|
|
958
|
+
Slice read_ts = read_ts_str;
|
|
959
|
+
ReadOptions read_opts;
|
|
960
|
+
read_opts.timestamp = &read_ts;
|
|
961
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
962
|
+
|
|
963
|
+
it->SeekToFirst();
|
|
964
|
+
ASSERT_TRUE(it->Valid());
|
|
965
|
+
it->Prev();
|
|
966
|
+
ASSERT_FALSE(it->Valid());
|
|
967
|
+
|
|
968
|
+
it->SeekToLast();
|
|
969
|
+
ASSERT_TRUE(it->Valid());
|
|
970
|
+
uint64_t prev_reseek_count =
|
|
971
|
+
options.statistics->getTickerCount(NUMBER_OF_RESEEKS_IN_ITERATION);
|
|
972
|
+
ASSERT_EQ(0, prev_reseek_count);
|
|
973
|
+
it->Next();
|
|
974
|
+
ASSERT_FALSE(it->Valid());
|
|
975
|
+
ASSERT_EQ(1 + prev_reseek_count,
|
|
976
|
+
options.statistics->getTickerCount(NUMBER_OF_RESEEKS_IN_ITERATION));
|
|
977
|
+
|
|
978
|
+
it->Seek(std::get<0>(kvs[0]));
|
|
979
|
+
CheckIterUserEntry(it.get(), std::get<0>(kvs[0]), kTypeValue,
|
|
980
|
+
std::get<1>(kvs[0]), Timestamp(4, 3));
|
|
981
|
+
it->Next();
|
|
982
|
+
CheckIterUserEntry(it.get(), std::get<0>(kvs[1]), kTypeValue,
|
|
983
|
+
std::get<1>(kvs[1]), Timestamp(4, 3));
|
|
984
|
+
it->Prev();
|
|
985
|
+
CheckIterUserEntry(it.get(), std::get<0>(kvs[0]), kTypeValue,
|
|
986
|
+
std::get<1>(kvs[0]), Timestamp(4, 3));
|
|
987
|
+
|
|
988
|
+
prev_reseek_count =
|
|
989
|
+
options.statistics->getTickerCount(NUMBER_OF_RESEEKS_IN_ITERATION);
|
|
990
|
+
ASSERT_EQ(1, prev_reseek_count);
|
|
991
|
+
it->Next();
|
|
992
|
+
CheckIterUserEntry(it.get(), std::get<0>(kvs[1]), kTypeValue,
|
|
993
|
+
std::get<1>(kvs[1]), Timestamp(4, 3));
|
|
994
|
+
ASSERT_EQ(1 + prev_reseek_count,
|
|
995
|
+
options.statistics->getTickerCount(NUMBER_OF_RESEEKS_IN_ITERATION));
|
|
996
|
+
|
|
997
|
+
it->SeekForPrev(std::get<0>(kvs[1]));
|
|
998
|
+
CheckIterUserEntry(it.get(), std::get<0>(kvs[1]), kTypeValue,
|
|
999
|
+
std::get<1>(kvs[1]), Timestamp(4, 3));
|
|
1000
|
+
it->Prev();
|
|
1001
|
+
CheckIterUserEntry(it.get(), std::get<0>(kvs[0]), kTypeValue,
|
|
1002
|
+
std::get<1>(kvs[0]), Timestamp(4, 3));
|
|
1003
|
+
|
|
1004
|
+
prev_reseek_count =
|
|
1005
|
+
options.statistics->getTickerCount(NUMBER_OF_RESEEKS_IN_ITERATION);
|
|
1006
|
+
it->Next();
|
|
1007
|
+
CheckIterUserEntry(it.get(), std::get<0>(kvs[1]), kTypeValue,
|
|
1008
|
+
std::get<1>(kvs[1]), Timestamp(4, 3));
|
|
1009
|
+
ASSERT_EQ(1 + prev_reseek_count,
|
|
1010
|
+
options.statistics->getTickerCount(NUMBER_OF_RESEEKS_IN_ITERATION));
|
|
1011
|
+
|
|
1012
|
+
it.reset();
|
|
1013
|
+
Close();
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
TEST_F(DBBasicTestWithTimestamp, SimpleForwardIterateLowerTsBound) {
|
|
1017
|
+
constexpr int kNumKeysPerFile = 128;
|
|
1018
|
+
constexpr uint64_t kMaxKey = 1024;
|
|
1019
|
+
Options options = CurrentOptions();
|
|
1020
|
+
options.env = env_;
|
|
1021
|
+
options.create_if_missing = true;
|
|
1022
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1023
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1024
|
+
options.comparator = &test_cmp;
|
|
1025
|
+
options.memtable_factory.reset(
|
|
1026
|
+
test::NewSpecialSkipListFactory(kNumKeysPerFile));
|
|
1027
|
+
DestroyAndReopen(options);
|
|
1028
|
+
const std::vector<std::string> write_timestamps = {Timestamp(1, 0),
|
|
1029
|
+
Timestamp(3, 0)};
|
|
1030
|
+
const std::vector<std::string> read_timestamps = {Timestamp(2, 0),
|
|
1031
|
+
Timestamp(4, 0)};
|
|
1032
|
+
const std::vector<std::string> read_timestamps_lb = {Timestamp(1, 0),
|
|
1033
|
+
Timestamp(1, 0)};
|
|
1034
|
+
for (size_t i = 0; i < write_timestamps.size(); ++i) {
|
|
1035
|
+
WriteOptions write_opts;
|
|
1036
|
+
for (uint64_t key = 0; key <= kMaxKey; ++key) {
|
|
1037
|
+
Status s = db_->Put(write_opts, Key1(key), write_timestamps[i],
|
|
1038
|
+
"value" + std::to_string(i));
|
|
1039
|
+
ASSERT_OK(s);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
for (size_t i = 0; i < read_timestamps.size(); ++i) {
|
|
1043
|
+
ReadOptions read_opts;
|
|
1044
|
+
Slice read_ts = read_timestamps[i];
|
|
1045
|
+
Slice read_ts_lb = read_timestamps_lb[i];
|
|
1046
|
+
read_opts.timestamp = &read_ts;
|
|
1047
|
+
read_opts.iter_start_ts = &read_ts_lb;
|
|
1048
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
1049
|
+
int count = 0;
|
|
1050
|
+
uint64_t key = 0;
|
|
1051
|
+
for (it->Seek(Key1(0)), key = 0; it->Valid(); it->Next(), ++count, ++key) {
|
|
1052
|
+
CheckIterEntry(it.get(), Key1(key), kTypeValue,
|
|
1053
|
+
"value" + std::to_string(i), write_timestamps[i]);
|
|
1054
|
+
if (i > 0) {
|
|
1055
|
+
it->Next();
|
|
1056
|
+
CheckIterEntry(it.get(), Key1(key), kTypeValue,
|
|
1057
|
+
"value" + std::to_string(i - 1),
|
|
1058
|
+
write_timestamps[i - 1]);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
size_t expected_count = kMaxKey + 1;
|
|
1062
|
+
ASSERT_EQ(expected_count, count);
|
|
1063
|
+
}
|
|
1064
|
+
// Delete all keys@ts=5 and check iteration result with start ts set
|
|
1065
|
+
{
|
|
1066
|
+
std::string write_timestamp = Timestamp(5, 0);
|
|
1067
|
+
WriteOptions write_opts;
|
|
1068
|
+
for (uint64_t key = 0; key < kMaxKey + 1; ++key) {
|
|
1069
|
+
Status s = db_->Delete(write_opts, Key1(key), write_timestamp);
|
|
1070
|
+
ASSERT_OK(s);
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
std::string read_timestamp = Timestamp(6, 0);
|
|
1074
|
+
ReadOptions read_opts;
|
|
1075
|
+
Slice read_ts = read_timestamp;
|
|
1076
|
+
read_opts.timestamp = &read_ts;
|
|
1077
|
+
std::string read_timestamp_lb = Timestamp(2, 0);
|
|
1078
|
+
Slice read_ts_lb = read_timestamp_lb;
|
|
1079
|
+
read_opts.iter_start_ts = &read_ts_lb;
|
|
1080
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
1081
|
+
int count = 0;
|
|
1082
|
+
uint64_t key = 0;
|
|
1083
|
+
for (it->Seek(Key1(0)), key = 0; it->Valid(); it->Next(), ++count, ++key) {
|
|
1084
|
+
CheckIterEntry(it.get(), Key1(key), kTypeDeletionWithTimestamp, Slice(),
|
|
1085
|
+
write_timestamp);
|
|
1086
|
+
// Skip key@ts=3 and land on tombstone key@ts=5
|
|
1087
|
+
it->Next();
|
|
1088
|
+
}
|
|
1089
|
+
ASSERT_EQ(kMaxKey + 1, count);
|
|
1090
|
+
}
|
|
1091
|
+
Close();
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
TEST_F(DBBasicTestWithTimestamp, BackwardIterateLowerTsBound) {
|
|
1095
|
+
constexpr int kNumKeysPerFile = 128;
|
|
1096
|
+
constexpr uint64_t kMaxKey = 1024;
|
|
1097
|
+
Options options = CurrentOptions();
|
|
1098
|
+
options.env = env_;
|
|
1099
|
+
options.create_if_missing = true;
|
|
1100
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1101
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1102
|
+
options.comparator = &test_cmp;
|
|
1103
|
+
options.memtable_factory.reset(
|
|
1104
|
+
test::NewSpecialSkipListFactory(kNumKeysPerFile));
|
|
1105
|
+
DestroyAndReopen(options);
|
|
1106
|
+
const std::vector<std::string> write_timestamps = {Timestamp(1, 0),
|
|
1107
|
+
Timestamp(3, 0)};
|
|
1108
|
+
const std::vector<std::string> read_timestamps = {Timestamp(2, 0),
|
|
1109
|
+
Timestamp(4, 0)};
|
|
1110
|
+
const std::vector<std::string> read_timestamps_lb = {Timestamp(1, 0),
|
|
1111
|
+
Timestamp(1, 0)};
|
|
1112
|
+
for (size_t i = 0; i < write_timestamps.size(); ++i) {
|
|
1113
|
+
WriteOptions write_opts;
|
|
1114
|
+
for (uint64_t key = 0; key <= kMaxKey; ++key) {
|
|
1115
|
+
Status s = db_->Put(write_opts, Key1(key), write_timestamps[i],
|
|
1116
|
+
"value" + std::to_string(i));
|
|
1117
|
+
ASSERT_OK(s);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
for (size_t i = 0; i < read_timestamps.size(); ++i) {
|
|
1121
|
+
ReadOptions read_opts;
|
|
1122
|
+
Slice read_ts = read_timestamps[i];
|
|
1123
|
+
Slice read_ts_lb = read_timestamps_lb[i];
|
|
1124
|
+
read_opts.timestamp = &read_ts;
|
|
1125
|
+
read_opts.iter_start_ts = &read_ts_lb;
|
|
1126
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
1127
|
+
int count = 0;
|
|
1128
|
+
uint64_t key = 0;
|
|
1129
|
+
for (it->SeekForPrev(Key1(kMaxKey)), key = kMaxKey; it->Valid();
|
|
1130
|
+
it->Prev(), ++count, --key) {
|
|
1131
|
+
CheckIterEntry(it.get(), Key1(key), kTypeValue, "value0",
|
|
1132
|
+
write_timestamps[0]);
|
|
1133
|
+
if (i > 0) {
|
|
1134
|
+
it->Prev();
|
|
1135
|
+
CheckIterEntry(it.get(), Key1(key), kTypeValue, "value1",
|
|
1136
|
+
write_timestamps[1]);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
size_t expected_count = kMaxKey + 1;
|
|
1140
|
+
ASSERT_EQ(expected_count, count);
|
|
1141
|
+
}
|
|
1142
|
+
// Delete all keys@ts=5 and check iteration result with start ts set
|
|
1143
|
+
{
|
|
1144
|
+
std::string write_timestamp = Timestamp(5, 0);
|
|
1145
|
+
WriteOptions write_opts;
|
|
1146
|
+
for (uint64_t key = 0; key < kMaxKey + 1; ++key) {
|
|
1147
|
+
Status s = db_->Delete(write_opts, Key1(key), write_timestamp);
|
|
1148
|
+
ASSERT_OK(s);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
std::string read_timestamp = Timestamp(6, 0);
|
|
1152
|
+
ReadOptions read_opts;
|
|
1153
|
+
Slice read_ts = read_timestamp;
|
|
1154
|
+
read_opts.timestamp = &read_ts;
|
|
1155
|
+
std::string read_timestamp_lb = Timestamp(2, 0);
|
|
1156
|
+
Slice read_ts_lb = read_timestamp_lb;
|
|
1157
|
+
read_opts.iter_start_ts = &read_ts_lb;
|
|
1158
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
1159
|
+
int count = 0;
|
|
1160
|
+
uint64_t key = kMaxKey;
|
|
1161
|
+
for (it->SeekForPrev(Key1(key)), key = kMaxKey; it->Valid();
|
|
1162
|
+
it->Prev(), ++count, --key) {
|
|
1163
|
+
CheckIterEntry(it.get(), Key1(key), kTypeValue, "value1",
|
|
1164
|
+
Timestamp(3, 0));
|
|
1165
|
+
it->Prev();
|
|
1166
|
+
CheckIterEntry(it.get(), Key1(key), kTypeDeletionWithTimestamp, Slice(),
|
|
1167
|
+
write_timestamp);
|
|
1168
|
+
}
|
|
1169
|
+
ASSERT_EQ(kMaxKey + 1, count);
|
|
1170
|
+
}
|
|
1171
|
+
Close();
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
TEST_F(DBBasicTestWithTimestamp, SimpleBackwardIterateLowerTsBound) {
|
|
1175
|
+
Options options = CurrentOptions();
|
|
1176
|
+
options.env = env_;
|
|
1177
|
+
options.create_if_missing = true;
|
|
1178
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1179
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1180
|
+
options.comparator = &test_cmp;
|
|
1181
|
+
DestroyAndReopen(options);
|
|
1182
|
+
|
|
1183
|
+
std::string ts_ub_buf = Timestamp(5, 0);
|
|
1184
|
+
Slice ts_ub = ts_ub_buf;
|
|
1185
|
+
std::string ts_lb_buf = Timestamp(1, 0);
|
|
1186
|
+
Slice ts_lb = ts_lb_buf;
|
|
1187
|
+
|
|
1188
|
+
{
|
|
1189
|
+
ReadOptions read_opts;
|
|
1190
|
+
read_opts.timestamp = &ts_ub;
|
|
1191
|
+
read_opts.iter_start_ts = &ts_lb;
|
|
1192
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
1193
|
+
it->SeekToLast();
|
|
1194
|
+
ASSERT_FALSE(it->Valid());
|
|
1195
|
+
ASSERT_OK(it->status());
|
|
1196
|
+
|
|
1197
|
+
it->SeekForPrev("foo");
|
|
1198
|
+
ASSERT_FALSE(it->Valid());
|
|
1199
|
+
ASSERT_OK(it->status());
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
// Test iterate_upper_bound
|
|
1203
|
+
ASSERT_OK(db_->Put(WriteOptions(), "a", Timestamp(0, 0), "v0"));
|
|
1204
|
+
ASSERT_OK(db_->SingleDelete(WriteOptions(), "a", Timestamp(1, 0)));
|
|
1205
|
+
|
|
1206
|
+
for (int i = 0; i < 5; ++i) {
|
|
1207
|
+
ASSERT_OK(db_->Put(WriteOptions(), "b", Timestamp(i, 0),
|
|
1208
|
+
"v" + std::to_string(i)));
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
{
|
|
1212
|
+
ReadOptions read_opts;
|
|
1213
|
+
read_opts.timestamp = &ts_ub;
|
|
1214
|
+
read_opts.iter_start_ts = &ts_lb;
|
|
1215
|
+
std::string key_ub_str = "b"; // exclusive
|
|
1216
|
+
Slice key_ub = key_ub_str;
|
|
1217
|
+
read_opts.iterate_upper_bound = &key_ub;
|
|
1218
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
1219
|
+
it->SeekToLast();
|
|
1220
|
+
CheckIterEntry(it.get(), "a", kTypeSingleDeletion, Slice(),
|
|
1221
|
+
Timestamp(1, 0));
|
|
1222
|
+
|
|
1223
|
+
key_ub_str = "a"; // exclusive
|
|
1224
|
+
key_ub = key_ub_str;
|
|
1225
|
+
read_opts.iterate_upper_bound = &key_ub;
|
|
1226
|
+
it.reset(db_->NewIterator(read_opts));
|
|
1227
|
+
it->SeekToLast();
|
|
1228
|
+
ASSERT_FALSE(it->Valid());
|
|
1229
|
+
ASSERT_OK(it->status());
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
Close();
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
TEST_F(DBBasicTestWithTimestamp, BackwardIterateLowerTsBound_Reseek) {
|
|
1236
|
+
Options options = CurrentOptions();
|
|
1237
|
+
options.env = env_;
|
|
1238
|
+
options.create_if_missing = true;
|
|
1239
|
+
options.max_sequential_skip_in_iterations = 2;
|
|
1240
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1241
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1242
|
+
options.comparator = &test_cmp;
|
|
1243
|
+
DestroyAndReopen(options);
|
|
1244
|
+
|
|
1245
|
+
for (int i = 0; i < 10; ++i) {
|
|
1246
|
+
ASSERT_OK(db_->Put(WriteOptions(), "a", Timestamp(i, 0),
|
|
1247
|
+
"v" + std::to_string(i)));
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
for (int i = 0; i < 10; ++i) {
|
|
1251
|
+
ASSERT_OK(db_->Put(WriteOptions(), "b", Timestamp(i, 0),
|
|
1252
|
+
"v" + std::to_string(i)));
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
{
|
|
1256
|
+
std::string ts_ub_buf = Timestamp(6, 0);
|
|
1257
|
+
Slice ts_ub = ts_ub_buf;
|
|
1258
|
+
std::string ts_lb_buf = Timestamp(4, 0);
|
|
1259
|
+
Slice ts_lb = ts_lb_buf;
|
|
1260
|
+
|
|
1261
|
+
ReadOptions read_opts;
|
|
1262
|
+
read_opts.timestamp = &ts_ub;
|
|
1263
|
+
read_opts.iter_start_ts = &ts_lb;
|
|
1264
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
1265
|
+
it->SeekToLast();
|
|
1266
|
+
for (int i = 0; i < 3 && it->Valid(); it->Prev(), ++i) {
|
|
1267
|
+
CheckIterEntry(it.get(), "b", kTypeValue, "v" + std::to_string(4 + i),
|
|
1268
|
+
Timestamp(4 + i, 0));
|
|
1269
|
+
}
|
|
1270
|
+
for (int i = 0; i < 3 && it->Valid(); it->Prev(), ++i) {
|
|
1271
|
+
CheckIterEntry(it.get(), "a", kTypeValue, "v" + std::to_string(4 + i),
|
|
1272
|
+
Timestamp(4 + i, 0));
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
Close();
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
TEST_F(DBBasicTestWithTimestamp, ReseekToTargetTimestamp) {
|
|
1280
|
+
Options options = CurrentOptions();
|
|
1281
|
+
options.env = env_;
|
|
1282
|
+
options.create_if_missing = true;
|
|
1283
|
+
constexpr size_t kNumKeys = 16;
|
|
1284
|
+
options.max_sequential_skip_in_iterations = kNumKeys / 2;
|
|
1285
|
+
options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics();
|
|
1286
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1287
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1288
|
+
options.comparator = &test_cmp;
|
|
1289
|
+
DestroyAndReopen(options);
|
|
1290
|
+
// Insert kNumKeys
|
|
1291
|
+
WriteOptions write_opts;
|
|
1292
|
+
Status s;
|
|
1293
|
+
for (size_t i = 0; i != kNumKeys; ++i) {
|
|
1294
|
+
std::string ts = Timestamp(static_cast<uint64_t>(i + 1), 0);
|
|
1295
|
+
s = db_->Put(write_opts, "foo", ts, "value" + std::to_string(i));
|
|
1296
|
+
ASSERT_OK(s);
|
|
1297
|
+
}
|
|
1298
|
+
{
|
|
1299
|
+
ReadOptions read_opts;
|
|
1300
|
+
std::string ts_str = Timestamp(1, 0);
|
|
1301
|
+
Slice ts = ts_str;
|
|
1302
|
+
read_opts.timestamp = &ts;
|
|
1303
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
1304
|
+
iter->SeekToFirst();
|
|
1305
|
+
CheckIterUserEntry(iter.get(), "foo", kTypeValue, "value0", ts_str);
|
|
1306
|
+
ASSERT_EQ(
|
|
1307
|
+
1, options.statistics->getTickerCount(NUMBER_OF_RESEEKS_IN_ITERATION));
|
|
1308
|
+
|
|
1309
|
+
ts_str = Timestamp(kNumKeys, 0);
|
|
1310
|
+
ts = ts_str;
|
|
1311
|
+
read_opts.timestamp = &ts;
|
|
1312
|
+
iter.reset(db_->NewIterator(read_opts));
|
|
1313
|
+
iter->SeekToLast();
|
|
1314
|
+
CheckIterUserEntry(iter.get(), "foo", kTypeValue,
|
|
1315
|
+
"value" + std::to_string(kNumKeys - 1), ts_str);
|
|
1316
|
+
ASSERT_EQ(
|
|
1317
|
+
2, options.statistics->getTickerCount(NUMBER_OF_RESEEKS_IN_ITERATION));
|
|
1318
|
+
}
|
|
1319
|
+
Close();
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
TEST_F(DBBasicTestWithTimestamp, ReseekToNextUserKey) {
|
|
1323
|
+
Options options = CurrentOptions();
|
|
1324
|
+
options.env = env_;
|
|
1325
|
+
options.create_if_missing = true;
|
|
1326
|
+
constexpr size_t kNumKeys = 16;
|
|
1327
|
+
options.max_sequential_skip_in_iterations = kNumKeys / 2;
|
|
1328
|
+
options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics();
|
|
1329
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1330
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1331
|
+
options.comparator = &test_cmp;
|
|
1332
|
+
DestroyAndReopen(options);
|
|
1333
|
+
// Write kNumKeys + 1 keys
|
|
1334
|
+
WriteOptions write_opts;
|
|
1335
|
+
Status s;
|
|
1336
|
+
for (size_t i = 0; i != kNumKeys; ++i) {
|
|
1337
|
+
std::string ts = Timestamp(static_cast<uint64_t>(i + 1), 0);
|
|
1338
|
+
s = db_->Put(write_opts, "a", ts, "value" + std::to_string(i));
|
|
1339
|
+
ASSERT_OK(s);
|
|
1340
|
+
}
|
|
1341
|
+
{
|
|
1342
|
+
std::string ts_str = Timestamp(static_cast<uint64_t>(kNumKeys + 1), 0);
|
|
1343
|
+
WriteBatch batch(0, 0, 0, kTimestampSize);
|
|
1344
|
+
{ ASSERT_OK(batch.Put("a", "new_value")); }
|
|
1345
|
+
{ ASSERT_OK(batch.Put("b", "new_value")); }
|
|
1346
|
+
s = batch.UpdateTimestamps(
|
|
1347
|
+
ts_str, [kTimestampSize](uint32_t) { return kTimestampSize; });
|
|
1348
|
+
ASSERT_OK(s);
|
|
1349
|
+
s = db_->Write(write_opts, &batch);
|
|
1350
|
+
ASSERT_OK(s);
|
|
1351
|
+
}
|
|
1352
|
+
{
|
|
1353
|
+
ReadOptions read_opts;
|
|
1354
|
+
std::string ts_str = Timestamp(static_cast<uint64_t>(kNumKeys + 1), 0);
|
|
1355
|
+
Slice ts = ts_str;
|
|
1356
|
+
read_opts.timestamp = &ts;
|
|
1357
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
1358
|
+
iter->Seek("a");
|
|
1359
|
+
iter->Next();
|
|
1360
|
+
CheckIterUserEntry(iter.get(), "b", kTypeValue, "new_value", ts_str);
|
|
1361
|
+
ASSERT_EQ(
|
|
1362
|
+
1, options.statistics->getTickerCount(NUMBER_OF_RESEEKS_IN_ITERATION));
|
|
1363
|
+
}
|
|
1364
|
+
Close();
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
TEST_F(DBBasicTestWithTimestamp, ReseekToUserKeyBeforeSavedKey) {
|
|
1368
|
+
Options options = GetDefaultOptions();
|
|
1369
|
+
options.env = env_;
|
|
1370
|
+
options.create_if_missing = true;
|
|
1371
|
+
constexpr size_t kNumKeys = 16;
|
|
1372
|
+
options.max_sequential_skip_in_iterations = kNumKeys / 2;
|
|
1373
|
+
options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics();
|
|
1374
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1375
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1376
|
+
options.comparator = &test_cmp;
|
|
1377
|
+
DestroyAndReopen(options);
|
|
1378
|
+
for (size_t i = 0; i < kNumKeys; ++i) {
|
|
1379
|
+
std::string ts = Timestamp(static_cast<uint64_t>(i + 1), 0);
|
|
1380
|
+
WriteOptions write_opts;
|
|
1381
|
+
Status s = db_->Put(write_opts, "b", ts, "value" + std::to_string(i));
|
|
1382
|
+
ASSERT_OK(s);
|
|
1383
|
+
}
|
|
1384
|
+
{
|
|
1385
|
+
std::string ts = Timestamp(1, 0);
|
|
1386
|
+
WriteOptions write_opts;
|
|
1387
|
+
ASSERT_OK(db_->Put(write_opts, "a", ts, "value"));
|
|
1388
|
+
}
|
|
1389
|
+
{
|
|
1390
|
+
ReadOptions read_opts;
|
|
1391
|
+
std::string ts_str = Timestamp(1, 0);
|
|
1392
|
+
Slice ts = ts_str;
|
|
1393
|
+
read_opts.timestamp = &ts;
|
|
1394
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
1395
|
+
iter->SeekToLast();
|
|
1396
|
+
iter->Prev();
|
|
1397
|
+
CheckIterUserEntry(iter.get(), "a", kTypeValue, "value", ts_str);
|
|
1398
|
+
ASSERT_EQ(
|
|
1399
|
+
1, options.statistics->getTickerCount(NUMBER_OF_RESEEKS_IN_ITERATION));
|
|
1400
|
+
}
|
|
1401
|
+
Close();
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
TEST_F(DBBasicTestWithTimestamp, MultiGetWithFastLocalBloom) {
|
|
1405
|
+
Options options = CurrentOptions();
|
|
1406
|
+
options.env = env_;
|
|
1407
|
+
options.create_if_missing = true;
|
|
1408
|
+
BlockBasedTableOptions bbto;
|
|
1409
|
+
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
1410
|
+
bbto.cache_index_and_filter_blocks = true;
|
|
1411
|
+
bbto.whole_key_filtering = true;
|
|
1412
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
1413
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1414
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1415
|
+
options.comparator = &test_cmp;
|
|
1416
|
+
DestroyAndReopen(options);
|
|
1417
|
+
|
|
1418
|
+
// Write any value
|
|
1419
|
+
WriteOptions write_opts;
|
|
1420
|
+
std::string ts = Timestamp(1, 0);
|
|
1421
|
+
|
|
1422
|
+
ASSERT_OK(db_->Put(write_opts, "foo", ts, "bar"));
|
|
1423
|
+
|
|
1424
|
+
ASSERT_OK(Flush());
|
|
1425
|
+
|
|
1426
|
+
// Read with MultiGet
|
|
1427
|
+
ReadOptions read_opts;
|
|
1428
|
+
Slice read_ts = ts;
|
|
1429
|
+
read_opts.timestamp = &read_ts;
|
|
1430
|
+
size_t batch_size = 1;
|
|
1431
|
+
std::vector<Slice> keys(batch_size);
|
|
1432
|
+
std::vector<PinnableSlice> values(batch_size);
|
|
1433
|
+
std::vector<Status> statuses(batch_size);
|
|
1434
|
+
std::vector<std::string> timestamps(batch_size);
|
|
1435
|
+
keys[0] = "foo";
|
|
1436
|
+
ColumnFamilyHandle* cfh = db_->DefaultColumnFamily();
|
|
1437
|
+
db_->MultiGet(read_opts, cfh, batch_size, keys.data(), values.data(),
|
|
1438
|
+
timestamps.data(), statuses.data(), true);
|
|
1439
|
+
|
|
1440
|
+
ASSERT_OK(statuses[0]);
|
|
1441
|
+
ASSERT_EQ(Timestamp(1, 0), timestamps[0]);
|
|
1442
|
+
for (auto& elem : values) {
|
|
1443
|
+
elem.Reset();
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
ASSERT_OK(db_->SingleDelete(WriteOptions(), "foo", Timestamp(2, 0)));
|
|
1447
|
+
ts = Timestamp(3, 0);
|
|
1448
|
+
read_ts = ts;
|
|
1449
|
+
read_opts.timestamp = &read_ts;
|
|
1450
|
+
db_->MultiGet(read_opts, cfh, batch_size, keys.data(), values.data(),
|
|
1451
|
+
timestamps.data(), statuses.data(), true);
|
|
1452
|
+
ASSERT_TRUE(statuses[0].IsNotFound());
|
|
1453
|
+
ASSERT_EQ(Timestamp(2, 0), timestamps[0]);
|
|
1454
|
+
|
|
1455
|
+
Close();
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
TEST_P(DBBasicTestWithTimestampTableOptions, MultiGetWithPrefix) {
|
|
1459
|
+
Options options = CurrentOptions();
|
|
1460
|
+
options.env = env_;
|
|
1461
|
+
options.create_if_missing = true;
|
|
1462
|
+
options.prefix_extractor.reset(NewCappedPrefixTransform(5));
|
|
1463
|
+
BlockBasedTableOptions bbto;
|
|
1464
|
+
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
1465
|
+
bbto.cache_index_and_filter_blocks = true;
|
|
1466
|
+
bbto.whole_key_filtering = false;
|
|
1467
|
+
bbto.index_type = GetParam();
|
|
1468
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
1469
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1470
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1471
|
+
options.comparator = &test_cmp;
|
|
1472
|
+
DestroyAndReopen(options);
|
|
1473
|
+
|
|
1474
|
+
// Write any value
|
|
1475
|
+
WriteOptions write_opts;
|
|
1476
|
+
std::string ts = Timestamp(1, 0);
|
|
1477
|
+
|
|
1478
|
+
ASSERT_OK(db_->Put(write_opts, "foo", ts, "bar"));
|
|
1479
|
+
|
|
1480
|
+
ASSERT_OK(Flush());
|
|
1481
|
+
|
|
1482
|
+
// Read with MultiGet
|
|
1483
|
+
ReadOptions read_opts;
|
|
1484
|
+
Slice read_ts = ts;
|
|
1485
|
+
read_opts.timestamp = &read_ts;
|
|
1486
|
+
size_t batch_size = 1;
|
|
1487
|
+
std::vector<Slice> keys(batch_size);
|
|
1488
|
+
std::vector<PinnableSlice> values(batch_size);
|
|
1489
|
+
std::vector<Status> statuses(batch_size);
|
|
1490
|
+
std::vector<std::string> timestamps(batch_size);
|
|
1491
|
+
keys[0] = "foo";
|
|
1492
|
+
ColumnFamilyHandle* cfh = db_->DefaultColumnFamily();
|
|
1493
|
+
db_->MultiGet(read_opts, cfh, batch_size, keys.data(), values.data(),
|
|
1494
|
+
timestamps.data(), statuses.data(), true);
|
|
1495
|
+
|
|
1496
|
+
ASSERT_OK(statuses[0]);
|
|
1497
|
+
ASSERT_EQ(Timestamp(1, 0), timestamps[0]);
|
|
1498
|
+
for (auto& elem : values) {
|
|
1499
|
+
elem.Reset();
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
ASSERT_OK(db_->SingleDelete(WriteOptions(), "foo", Timestamp(2, 0)));
|
|
1503
|
+
// TODO re-enable after fixing a bug of kHashSearch
|
|
1504
|
+
if (GetParam() != BlockBasedTableOptions::IndexType::kHashSearch) {
|
|
1505
|
+
ASSERT_OK(Flush());
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
ts = Timestamp(3, 0);
|
|
1509
|
+
read_ts = ts;
|
|
1510
|
+
db_->MultiGet(read_opts, cfh, batch_size, keys.data(), values.data(),
|
|
1511
|
+
timestamps.data(), statuses.data(), true);
|
|
1512
|
+
ASSERT_TRUE(statuses[0].IsNotFound());
|
|
1513
|
+
ASSERT_EQ(Timestamp(2, 0), timestamps[0]);
|
|
1514
|
+
|
|
1515
|
+
Close();
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
TEST_P(DBBasicTestWithTimestampTableOptions, MultiGetWithMemBloomFilter) {
|
|
1519
|
+
Options options = CurrentOptions();
|
|
1520
|
+
options.env = env_;
|
|
1521
|
+
options.create_if_missing = true;
|
|
1522
|
+
options.prefix_extractor.reset(NewCappedPrefixTransform(5));
|
|
1523
|
+
BlockBasedTableOptions bbto;
|
|
1524
|
+
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
1525
|
+
bbto.cache_index_and_filter_blocks = true;
|
|
1526
|
+
bbto.whole_key_filtering = false;
|
|
1527
|
+
bbto.index_type = GetParam();
|
|
1528
|
+
options.memtable_prefix_bloom_size_ratio = 0.1;
|
|
1529
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
1530
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1531
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1532
|
+
options.comparator = &test_cmp;
|
|
1533
|
+
DestroyAndReopen(options);
|
|
1534
|
+
|
|
1535
|
+
// Write any value
|
|
1536
|
+
WriteOptions write_opts;
|
|
1537
|
+
std::string ts = Timestamp(1, 0);
|
|
1538
|
+
|
|
1539
|
+
ASSERT_OK(db_->Put(write_opts, "foo", ts, "bar"));
|
|
1540
|
+
|
|
1541
|
+
// Read with MultiGet
|
|
1542
|
+
ts = Timestamp(2, 0);
|
|
1543
|
+
Slice read_ts = ts;
|
|
1544
|
+
ReadOptions read_opts;
|
|
1545
|
+
read_opts.timestamp = &read_ts;
|
|
1546
|
+
size_t batch_size = 1;
|
|
1547
|
+
std::vector<Slice> keys(batch_size);
|
|
1548
|
+
std::vector<PinnableSlice> values(batch_size);
|
|
1549
|
+
std::vector<Status> statuses(batch_size);
|
|
1550
|
+
keys[0] = "foo";
|
|
1551
|
+
ColumnFamilyHandle* cfh = db_->DefaultColumnFamily();
|
|
1552
|
+
db_->MultiGet(read_opts, cfh, batch_size, keys.data(), values.data(),
|
|
1553
|
+
statuses.data());
|
|
1554
|
+
|
|
1555
|
+
ASSERT_OK(statuses[0]);
|
|
1556
|
+
Close();
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
TEST_F(DBBasicTestWithTimestamp, MultiGetRangeFiltering) {
|
|
1560
|
+
Options options = CurrentOptions();
|
|
1561
|
+
options.env = env_;
|
|
1562
|
+
options.create_if_missing = true;
|
|
1563
|
+
BlockBasedTableOptions bbto;
|
|
1564
|
+
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
1565
|
+
bbto.cache_index_and_filter_blocks = true;
|
|
1566
|
+
bbto.whole_key_filtering = false;
|
|
1567
|
+
options.memtable_prefix_bloom_size_ratio = 0.1;
|
|
1568
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
1569
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1570
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1571
|
+
options.comparator = &test_cmp;
|
|
1572
|
+
DestroyAndReopen(options);
|
|
1573
|
+
|
|
1574
|
+
// Write any value
|
|
1575
|
+
WriteOptions write_opts;
|
|
1576
|
+
std::string ts = Timestamp(1, 0);
|
|
1577
|
+
|
|
1578
|
+
// random data
|
|
1579
|
+
for (int i = 0; i < 3; i++) {
|
|
1580
|
+
auto key = std::to_string(i * 10);
|
|
1581
|
+
auto value = std::to_string(i * 10);
|
|
1582
|
+
Slice key_slice = key;
|
|
1583
|
+
Slice value_slice = value;
|
|
1584
|
+
ASSERT_OK(db_->Put(write_opts, key_slice, ts, value_slice));
|
|
1585
|
+
ASSERT_OK(Flush());
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
// Make num_levels to 2 to do key range filtering of sst files
|
|
1589
|
+
ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr));
|
|
1590
|
+
|
|
1591
|
+
ASSERT_OK(db_->Put(write_opts, "foo", ts, "bar"));
|
|
1592
|
+
|
|
1593
|
+
ASSERT_OK(Flush());
|
|
1594
|
+
|
|
1595
|
+
// Read with MultiGet
|
|
1596
|
+
ts = Timestamp(2, 0);
|
|
1597
|
+
Slice read_ts = ts;
|
|
1598
|
+
ReadOptions read_opts;
|
|
1599
|
+
read_opts.timestamp = &read_ts;
|
|
1600
|
+
size_t batch_size = 1;
|
|
1601
|
+
std::vector<Slice> keys(batch_size);
|
|
1602
|
+
std::vector<PinnableSlice> values(batch_size);
|
|
1603
|
+
std::vector<Status> statuses(batch_size);
|
|
1604
|
+
keys[0] = "foo";
|
|
1605
|
+
ColumnFamilyHandle* cfh = db_->DefaultColumnFamily();
|
|
1606
|
+
db_->MultiGet(read_opts, cfh, batch_size, keys.data(), values.data(),
|
|
1607
|
+
statuses.data());
|
|
1608
|
+
|
|
1609
|
+
ASSERT_OK(statuses[0]);
|
|
1610
|
+
Close();
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
TEST_P(DBBasicTestWithTimestampTableOptions, MultiGetPrefixFilter) {
|
|
1614
|
+
Options options = CurrentOptions();
|
|
1615
|
+
options.env = env_;
|
|
1616
|
+
options.create_if_missing = true;
|
|
1617
|
+
options.prefix_extractor.reset(NewCappedPrefixTransform(3));
|
|
1618
|
+
BlockBasedTableOptions bbto;
|
|
1619
|
+
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
1620
|
+
bbto.cache_index_and_filter_blocks = true;
|
|
1621
|
+
bbto.whole_key_filtering = false;
|
|
1622
|
+
bbto.index_type = GetParam();
|
|
1623
|
+
options.memtable_prefix_bloom_size_ratio = 0.1;
|
|
1624
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
1625
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1626
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1627
|
+
options.comparator = &test_cmp;
|
|
1628
|
+
DestroyAndReopen(options);
|
|
1629
|
+
|
|
1630
|
+
WriteOptions write_opts;
|
|
1631
|
+
std::string ts = Timestamp(1, 0);
|
|
1632
|
+
|
|
1633
|
+
ASSERT_OK(db_->Put(write_opts, "foo", ts, "bar"));
|
|
1634
|
+
|
|
1635
|
+
ASSERT_OK(Flush());
|
|
1636
|
+
// Read with MultiGet
|
|
1637
|
+
ts = Timestamp(2, 0);
|
|
1638
|
+
Slice read_ts = ts;
|
|
1639
|
+
ReadOptions read_opts;
|
|
1640
|
+
read_opts.timestamp = &read_ts;
|
|
1641
|
+
size_t batch_size = 1;
|
|
1642
|
+
std::vector<Slice> keys(batch_size);
|
|
1643
|
+
std::vector<std::string> values(batch_size);
|
|
1644
|
+
std::vector<std::string> timestamps(batch_size);
|
|
1645
|
+
keys[0] = "foo";
|
|
1646
|
+
ColumnFamilyHandle* cfh = db_->DefaultColumnFamily();
|
|
1647
|
+
std::vector<ColumnFamilyHandle*> cfhs(keys.size(), cfh);
|
|
1648
|
+
std::vector<Status> statuses =
|
|
1649
|
+
db_->MultiGet(read_opts, cfhs, keys, &values, ×tamps);
|
|
1650
|
+
|
|
1651
|
+
ASSERT_OK(statuses[0]);
|
|
1652
|
+
Close();
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
TEST_F(DBBasicTestWithTimestamp, MaxKeysSkippedDuringNext) {
|
|
1656
|
+
Options options = CurrentOptions();
|
|
1657
|
+
options.env = env_;
|
|
1658
|
+
options.create_if_missing = true;
|
|
1659
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1660
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1661
|
+
options.comparator = &test_cmp;
|
|
1662
|
+
DestroyAndReopen(options);
|
|
1663
|
+
constexpr size_t max_skippable_internal_keys = 2;
|
|
1664
|
+
const size_t kNumKeys = max_skippable_internal_keys + 2;
|
|
1665
|
+
WriteOptions write_opts;
|
|
1666
|
+
Status s;
|
|
1667
|
+
{
|
|
1668
|
+
std::string ts = Timestamp(1, 0);
|
|
1669
|
+
ASSERT_OK(db_->Put(write_opts, "a", ts, "value"));
|
|
1670
|
+
}
|
|
1671
|
+
for (size_t i = 0; i < kNumKeys; ++i) {
|
|
1672
|
+
std::string ts = Timestamp(static_cast<uint64_t>(i + 1), 0);
|
|
1673
|
+
s = db_->Put(write_opts, "b", ts, "value" + std::to_string(i));
|
|
1674
|
+
ASSERT_OK(s);
|
|
1675
|
+
}
|
|
1676
|
+
{
|
|
1677
|
+
ReadOptions read_opts;
|
|
1678
|
+
read_opts.max_skippable_internal_keys = max_skippable_internal_keys;
|
|
1679
|
+
std::string ts_str = Timestamp(1, 0);
|
|
1680
|
+
Slice ts = ts_str;
|
|
1681
|
+
read_opts.timestamp = &ts;
|
|
1682
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
1683
|
+
iter->SeekToFirst();
|
|
1684
|
+
iter->Next();
|
|
1685
|
+
ASSERT_TRUE(iter->status().IsIncomplete());
|
|
1686
|
+
}
|
|
1687
|
+
Close();
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
TEST_F(DBBasicTestWithTimestamp, MaxKeysSkippedDuringPrev) {
|
|
1691
|
+
Options options = GetDefaultOptions();
|
|
1692
|
+
options.env = env_;
|
|
1693
|
+
options.create_if_missing = true;
|
|
1694
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1695
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1696
|
+
options.comparator = &test_cmp;
|
|
1697
|
+
DestroyAndReopen(options);
|
|
1698
|
+
constexpr size_t max_skippable_internal_keys = 2;
|
|
1699
|
+
const size_t kNumKeys = max_skippable_internal_keys + 2;
|
|
1700
|
+
WriteOptions write_opts;
|
|
1701
|
+
Status s;
|
|
1702
|
+
{
|
|
1703
|
+
std::string ts = Timestamp(1, 0);
|
|
1704
|
+
ASSERT_OK(db_->Put(write_opts, "b", ts, "value"));
|
|
1705
|
+
}
|
|
1706
|
+
for (size_t i = 0; i < kNumKeys; ++i) {
|
|
1707
|
+
std::string ts = Timestamp(static_cast<uint64_t>(i + 1), 0);
|
|
1708
|
+
s = db_->Put(write_opts, "a", ts, "value" + std::to_string(i));
|
|
1709
|
+
ASSERT_OK(s);
|
|
1710
|
+
}
|
|
1711
|
+
{
|
|
1712
|
+
ReadOptions read_opts;
|
|
1713
|
+
read_opts.max_skippable_internal_keys = max_skippable_internal_keys;
|
|
1714
|
+
std::string ts_str = Timestamp(1, 0);
|
|
1715
|
+
Slice ts = ts_str;
|
|
1716
|
+
read_opts.timestamp = &ts;
|
|
1717
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
1718
|
+
iter->SeekToLast();
|
|
1719
|
+
iter->Prev();
|
|
1720
|
+
ASSERT_TRUE(iter->status().IsIncomplete());
|
|
1721
|
+
}
|
|
1722
|
+
Close();
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
// Create two L0, and compact them to a new L1. In this test, L1 is L_bottom.
|
|
1726
|
+
// Two L0s:
|
|
1727
|
+
// f1 f2
|
|
1728
|
+
// <a, 1, kTypeValue> <a, 3, kTypeDeletionWithTimestamp>...<b, 2, kTypeValue>
|
|
1729
|
+
// Since f2.smallest < f1.largest < f2.largest
|
|
1730
|
+
// f1 and f2 will be the inputs of a real compaction instead of trivial move.
|
|
1731
|
+
TEST_F(DBBasicTestWithTimestamp, CompactDeletionWithTimestampMarkerToBottom) {
|
|
1732
|
+
Options options = CurrentOptions();
|
|
1733
|
+
options.env = env_;
|
|
1734
|
+
options.create_if_missing = true;
|
|
1735
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1736
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1737
|
+
options.comparator = &test_cmp;
|
|
1738
|
+
options.num_levels = 2;
|
|
1739
|
+
options.level0_file_num_compaction_trigger = 2;
|
|
1740
|
+
DestroyAndReopen(options);
|
|
1741
|
+
WriteOptions write_opts;
|
|
1742
|
+
std::string ts = Timestamp(1, 0);
|
|
1743
|
+
ASSERT_OK(db_->Put(write_opts, "a", ts, "value0"));
|
|
1744
|
+
ASSERT_OK(Flush());
|
|
1745
|
+
|
|
1746
|
+
ts = Timestamp(2, 0);
|
|
1747
|
+
ASSERT_OK(db_->Put(write_opts, "b", ts, "value0"));
|
|
1748
|
+
ts = Timestamp(3, 0);
|
|
1749
|
+
ASSERT_OK(db_->Delete(write_opts, "a", ts));
|
|
1750
|
+
ASSERT_OK(Flush());
|
|
1751
|
+
ASSERT_OK(dbfull()->TEST_WaitForCompact());
|
|
1752
|
+
|
|
1753
|
+
ReadOptions read_opts;
|
|
1754
|
+
ts = Timestamp(1, 0);
|
|
1755
|
+
Slice read_ts = ts;
|
|
1756
|
+
read_opts.timestamp = &read_ts;
|
|
1757
|
+
std::string value;
|
|
1758
|
+
Status s = db_->Get(read_opts, "a", &value);
|
|
1759
|
+
ASSERT_OK(s);
|
|
1760
|
+
ASSERT_EQ("value0", value);
|
|
1761
|
+
|
|
1762
|
+
ts = Timestamp(3, 0);
|
|
1763
|
+
read_ts = ts;
|
|
1764
|
+
read_opts.timestamp = &read_ts;
|
|
1765
|
+
std::string key_ts;
|
|
1766
|
+
s = db_->Get(read_opts, "a", &value, &key_ts);
|
|
1767
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
1768
|
+
ASSERT_EQ(Timestamp(3, 0), key_ts);
|
|
1769
|
+
|
|
1770
|
+
// Time-travel to the past before deletion
|
|
1771
|
+
ts = Timestamp(2, 0);
|
|
1772
|
+
read_ts = ts;
|
|
1773
|
+
read_opts.timestamp = &read_ts;
|
|
1774
|
+
s = db_->Get(read_opts, "a", &value);
|
|
1775
|
+
ASSERT_OK(s);
|
|
1776
|
+
ASSERT_EQ("value0", value);
|
|
1777
|
+
Close();
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
#if !defined(ROCKSDB_VALGRIND_RUN) || defined(ROCKSDB_FULL_VALGRIND_RUN)
|
|
1781
|
+
class DBBasicTestWithTimestampFilterPrefixSettings
|
|
1782
|
+
: public DBBasicTestWithTimestampBase,
|
|
1783
|
+
public testing::WithParamInterface<
|
|
1784
|
+
std::tuple<std::shared_ptr<const FilterPolicy>, bool, bool,
|
|
1785
|
+
std::shared_ptr<const SliceTransform>, bool, double,
|
|
1786
|
+
BlockBasedTableOptions::IndexType>> {
|
|
1787
|
+
public:
|
|
1788
|
+
DBBasicTestWithTimestampFilterPrefixSettings()
|
|
1789
|
+
: DBBasicTestWithTimestampBase(
|
|
1790
|
+
"db_basic_test_with_timestamp_filter_prefix") {}
|
|
1791
|
+
};
|
|
1792
|
+
|
|
1793
|
+
TEST_P(DBBasicTestWithTimestampFilterPrefixSettings, GetAndMultiGet) {
|
|
1794
|
+
Options options = CurrentOptions();
|
|
1795
|
+
options.env = env_;
|
|
1796
|
+
options.create_if_missing = true;
|
|
1797
|
+
BlockBasedTableOptions bbto;
|
|
1798
|
+
bbto.filter_policy = std::get<0>(GetParam());
|
|
1799
|
+
bbto.whole_key_filtering = std::get<1>(GetParam());
|
|
1800
|
+
bbto.cache_index_and_filter_blocks = std::get<2>(GetParam());
|
|
1801
|
+
bbto.index_type = std::get<6>(GetParam());
|
|
1802
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
1803
|
+
options.prefix_extractor = std::get<3>(GetParam());
|
|
1804
|
+
options.memtable_whole_key_filtering = std::get<4>(GetParam());
|
|
1805
|
+
options.memtable_prefix_bloom_size_ratio = std::get<5>(GetParam());
|
|
1806
|
+
|
|
1807
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
1808
|
+
TestComparator test_cmp(kTimestampSize);
|
|
1809
|
+
options.comparator = &test_cmp;
|
|
1810
|
+
DestroyAndReopen(options);
|
|
1811
|
+
const int kMaxKey = 1000;
|
|
1812
|
+
|
|
1813
|
+
// Write any value
|
|
1814
|
+
WriteOptions write_opts;
|
|
1815
|
+
std::string ts = Timestamp(1, 0);
|
|
1816
|
+
|
|
1817
|
+
int idx = 0;
|
|
1818
|
+
for (; idx < kMaxKey / 4; idx++) {
|
|
1819
|
+
ASSERT_OK(db_->Put(write_opts, Key1(idx), ts, "bar"));
|
|
1820
|
+
ASSERT_OK(db_->Put(write_opts, KeyWithPrefix("foo", idx), ts, "bar"));
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
ASSERT_OK(Flush());
|
|
1824
|
+
ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr));
|
|
1825
|
+
|
|
1826
|
+
for (; idx < kMaxKey / 2; idx++) {
|
|
1827
|
+
ASSERT_OK(db_->Put(write_opts, Key1(idx), ts, "bar"));
|
|
1828
|
+
ASSERT_OK(db_->Put(write_opts, KeyWithPrefix("foo", idx), ts, "bar"));
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
ASSERT_OK(Flush());
|
|
1832
|
+
|
|
1833
|
+
for (; idx < kMaxKey; idx++) {
|
|
1834
|
+
ASSERT_OK(db_->Put(write_opts, Key1(idx), ts, "bar"));
|
|
1835
|
+
ASSERT_OK(db_->Put(write_opts, KeyWithPrefix("foo", idx), ts, "bar"));
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
// Read with MultiGet
|
|
1839
|
+
ReadOptions read_opts;
|
|
1840
|
+
Slice read_ts = ts;
|
|
1841
|
+
read_opts.timestamp = &read_ts;
|
|
1842
|
+
|
|
1843
|
+
for (idx = 0; idx < kMaxKey; idx++) {
|
|
1844
|
+
size_t batch_size = 4;
|
|
1845
|
+
std::vector<std::string> keys_str(batch_size);
|
|
1846
|
+
std::vector<PinnableSlice> values(batch_size);
|
|
1847
|
+
std::vector<Status> statuses(batch_size);
|
|
1848
|
+
ColumnFamilyHandle* cfh = db_->DefaultColumnFamily();
|
|
1849
|
+
|
|
1850
|
+
keys_str[0] = Key1(idx);
|
|
1851
|
+
keys_str[1] = KeyWithPrefix("foo", idx);
|
|
1852
|
+
keys_str[2] = Key1(kMaxKey + idx);
|
|
1853
|
+
keys_str[3] = KeyWithPrefix("foo", kMaxKey + idx);
|
|
1854
|
+
|
|
1855
|
+
auto keys = ConvertStrToSlice(keys_str);
|
|
1856
|
+
|
|
1857
|
+
db_->MultiGet(read_opts, cfh, batch_size, keys.data(), values.data(),
|
|
1858
|
+
statuses.data());
|
|
1859
|
+
|
|
1860
|
+
for (int i = 0; i < 2; i++) {
|
|
1861
|
+
ASSERT_OK(statuses[i]);
|
|
1862
|
+
}
|
|
1863
|
+
for (int i = 2; i < 4; i++) {
|
|
1864
|
+
ASSERT_TRUE(statuses[i].IsNotFound());
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
for (int i = 0; i < 2; i++) {
|
|
1868
|
+
std::string value;
|
|
1869
|
+
ASSERT_OK(db_->Get(read_opts, keys[i], &value));
|
|
1870
|
+
std::unique_ptr<Iterator> it1(db_->NewIterator(read_opts));
|
|
1871
|
+
ASSERT_NE(nullptr, it1);
|
|
1872
|
+
ASSERT_OK(it1->status());
|
|
1873
|
+
it1->Seek(keys[i]);
|
|
1874
|
+
ASSERT_TRUE(it1->Valid());
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
for (int i = 2; i < 4; i++) {
|
|
1878
|
+
std::string value;
|
|
1879
|
+
Status s = db_->Get(read_opts, keys[i], &value);
|
|
1880
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
Close();
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
INSTANTIATE_TEST_CASE_P(
|
|
1887
|
+
Timestamp, DBBasicTestWithTimestampFilterPrefixSettings,
|
|
1888
|
+
::testing::Combine(
|
|
1889
|
+
::testing::Values(
|
|
1890
|
+
std::shared_ptr<const FilterPolicy>(nullptr),
|
|
1891
|
+
std::shared_ptr<const FilterPolicy>(NewBloomFilterPolicy(10, true)),
|
|
1892
|
+
std::shared_ptr<const FilterPolicy>(NewBloomFilterPolicy(10,
|
|
1893
|
+
false))),
|
|
1894
|
+
::testing::Bool(), ::testing::Bool(),
|
|
1895
|
+
::testing::Values(
|
|
1896
|
+
std::shared_ptr<const SliceTransform>(NewFixedPrefixTransform(1)),
|
|
1897
|
+
std::shared_ptr<const SliceTransform>(NewFixedPrefixTransform(4)),
|
|
1898
|
+
std::shared_ptr<const SliceTransform>(NewFixedPrefixTransform(7)),
|
|
1899
|
+
std::shared_ptr<const SliceTransform>(NewFixedPrefixTransform(8))),
|
|
1900
|
+
::testing::Bool(), ::testing::Values(0, 0.1),
|
|
1901
|
+
::testing::Values(
|
|
1902
|
+
BlockBasedTableOptions::IndexType::kBinarySearch,
|
|
1903
|
+
BlockBasedTableOptions::IndexType::kHashSearch,
|
|
1904
|
+
BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch,
|
|
1905
|
+
BlockBasedTableOptions::IndexType::kBinarySearchWithFirstKey)));
|
|
1906
|
+
#endif // !defined(ROCKSDB_VALGRIND_RUN) || defined(ROCKSDB_FULL_VALGRIND_RUN)
|
|
1907
|
+
|
|
1908
|
+
class DataVisibilityTest : public DBBasicTestWithTimestampBase {
|
|
1909
|
+
public:
|
|
1910
|
+
DataVisibilityTest() : DBBasicTestWithTimestampBase("data_visibility_test") {
|
|
1911
|
+
// Initialize test data
|
|
1912
|
+
for (int i = 0; i < kTestDataSize; i++) {
|
|
1913
|
+
test_data_[i].key = "key" + std::to_string(i);
|
|
1914
|
+
test_data_[i].value = "value" + std::to_string(i);
|
|
1915
|
+
test_data_[i].timestamp = Timestamp(i, 0);
|
|
1916
|
+
test_data_[i].ts = i;
|
|
1917
|
+
test_data_[i].seq_num = kMaxSequenceNumber;
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
protected:
|
|
1922
|
+
struct TestData {
|
|
1923
|
+
std::string key;
|
|
1924
|
+
std::string value;
|
|
1925
|
+
int ts;
|
|
1926
|
+
std::string timestamp;
|
|
1927
|
+
SequenceNumber seq_num;
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1930
|
+
constexpr static int kTestDataSize = 3;
|
|
1931
|
+
TestData test_data_[kTestDataSize];
|
|
1932
|
+
|
|
1933
|
+
void PutTestData(int index, ColumnFamilyHandle* cfh = nullptr) {
|
|
1934
|
+
ASSERT_LE(index, kTestDataSize);
|
|
1935
|
+
WriteOptions write_opts;
|
|
1936
|
+
|
|
1937
|
+
if (cfh == nullptr) {
|
|
1938
|
+
ASSERT_OK(db_->Put(write_opts, test_data_[index].key,
|
|
1939
|
+
test_data_[index].timestamp, test_data_[index].value));
|
|
1940
|
+
const Snapshot* snap = db_->GetSnapshot();
|
|
1941
|
+
test_data_[index].seq_num = snap->GetSequenceNumber();
|
|
1942
|
+
if (index > 0) {
|
|
1943
|
+
ASSERT_GT(test_data_[index].seq_num, test_data_[index - 1].seq_num);
|
|
1944
|
+
}
|
|
1945
|
+
db_->ReleaseSnapshot(snap);
|
|
1946
|
+
} else {
|
|
1947
|
+
ASSERT_OK(db_->Put(write_opts, cfh, test_data_[index].key,
|
|
1948
|
+
test_data_[index].timestamp, test_data_[index].value));
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
void AssertVisibility(int ts, SequenceNumber seq,
|
|
1953
|
+
std::vector<Status> statuses) {
|
|
1954
|
+
ASSERT_EQ(kTestDataSize, statuses.size());
|
|
1955
|
+
for (int i = 0; i < kTestDataSize; i++) {
|
|
1956
|
+
if (test_data_[i].seq_num <= seq && test_data_[i].ts <= ts) {
|
|
1957
|
+
ASSERT_OK(statuses[i]);
|
|
1958
|
+
} else {
|
|
1959
|
+
ASSERT_TRUE(statuses[i].IsNotFound());
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
std::vector<Slice> GetKeys() {
|
|
1965
|
+
std::vector<Slice> ret(kTestDataSize);
|
|
1966
|
+
for (int i = 0; i < kTestDataSize; i++) {
|
|
1967
|
+
ret[i] = test_data_[i].key;
|
|
1968
|
+
}
|
|
1969
|
+
return ret;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
void VerifyDefaultCF(int ts, const Snapshot* snap = nullptr) {
|
|
1973
|
+
ReadOptions read_opts;
|
|
1974
|
+
std::string read_ts = Timestamp(ts, 0);
|
|
1975
|
+
Slice read_ts_slice = read_ts;
|
|
1976
|
+
read_opts.timestamp = &read_ts_slice;
|
|
1977
|
+
read_opts.snapshot = snap;
|
|
1978
|
+
|
|
1979
|
+
ColumnFamilyHandle* cfh = db_->DefaultColumnFamily();
|
|
1980
|
+
std::vector<ColumnFamilyHandle*> cfs(kTestDataSize, cfh);
|
|
1981
|
+
SequenceNumber seq =
|
|
1982
|
+
snap ? snap->GetSequenceNumber() : kMaxSequenceNumber - 1;
|
|
1983
|
+
|
|
1984
|
+
// There're several MultiGet interfaces with not exactly the same
|
|
1985
|
+
// implementations, query data with all of them.
|
|
1986
|
+
auto keys = GetKeys();
|
|
1987
|
+
std::vector<std::string> values;
|
|
1988
|
+
auto s1 = db_->MultiGet(read_opts, cfs, keys, &values);
|
|
1989
|
+
AssertVisibility(ts, seq, s1);
|
|
1990
|
+
|
|
1991
|
+
auto s2 = db_->MultiGet(read_opts, keys, &values);
|
|
1992
|
+
AssertVisibility(ts, seq, s2);
|
|
1993
|
+
|
|
1994
|
+
std::vector<std::string> timestamps;
|
|
1995
|
+
auto s3 = db_->MultiGet(read_opts, cfs, keys, &values, ×tamps);
|
|
1996
|
+
AssertVisibility(ts, seq, s3);
|
|
1997
|
+
|
|
1998
|
+
auto s4 = db_->MultiGet(read_opts, keys, &values, ×tamps);
|
|
1999
|
+
AssertVisibility(ts, seq, s4);
|
|
2000
|
+
|
|
2001
|
+
std::vector<PinnableSlice> values_ps5(kTestDataSize);
|
|
2002
|
+
std::vector<Status> s5(kTestDataSize);
|
|
2003
|
+
db_->MultiGet(read_opts, cfh, kTestDataSize, keys.data(), values_ps5.data(),
|
|
2004
|
+
s5.data());
|
|
2005
|
+
AssertVisibility(ts, seq, s5);
|
|
2006
|
+
|
|
2007
|
+
std::vector<PinnableSlice> values_ps6(kTestDataSize);
|
|
2008
|
+
std::vector<Status> s6(kTestDataSize);
|
|
2009
|
+
std::vector<std::string> timestamps_array(kTestDataSize);
|
|
2010
|
+
db_->MultiGet(read_opts, cfh, kTestDataSize, keys.data(), values_ps6.data(),
|
|
2011
|
+
timestamps_array.data(), s6.data());
|
|
2012
|
+
AssertVisibility(ts, seq, s6);
|
|
2013
|
+
|
|
2014
|
+
std::vector<PinnableSlice> values_ps7(kTestDataSize);
|
|
2015
|
+
std::vector<Status> s7(kTestDataSize);
|
|
2016
|
+
db_->MultiGet(read_opts, kTestDataSize, cfs.data(), keys.data(),
|
|
2017
|
+
values_ps7.data(), s7.data());
|
|
2018
|
+
AssertVisibility(ts, seq, s7);
|
|
2019
|
+
|
|
2020
|
+
std::vector<PinnableSlice> values_ps8(kTestDataSize);
|
|
2021
|
+
std::vector<Status> s8(kTestDataSize);
|
|
2022
|
+
db_->MultiGet(read_opts, kTestDataSize, cfs.data(), keys.data(),
|
|
2023
|
+
values_ps8.data(), timestamps_array.data(), s8.data());
|
|
2024
|
+
AssertVisibility(ts, seq, s8);
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
void VerifyDefaultCF(const Snapshot* snap = nullptr) {
|
|
2028
|
+
for (int i = 0; i <= kTestDataSize; i++) {
|
|
2029
|
+
VerifyDefaultCF(i, snap);
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
};
|
|
2033
|
+
constexpr int DataVisibilityTest::kTestDataSize;
|
|
2034
|
+
|
|
2035
|
+
// Application specifies timestamp but not snapshot.
|
|
2036
|
+
// reader writer
|
|
2037
|
+
// ts'=90
|
|
2038
|
+
// ts=100
|
|
2039
|
+
// seq=10
|
|
2040
|
+
// seq'=11
|
|
2041
|
+
// write finishes
|
|
2042
|
+
// GetImpl(ts,seq)
|
|
2043
|
+
// It is OK to return <k, t1, s1> if ts>=t1 AND seq>=s1. If ts>=t1 but seq<s1,
|
|
2044
|
+
// the key should not be returned.
|
|
2045
|
+
TEST_F(DataVisibilityTest, PointLookupWithoutSnapshot1) {
|
|
2046
|
+
Options options = CurrentOptions();
|
|
2047
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2048
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2049
|
+
options.comparator = &test_cmp;
|
|
2050
|
+
DestroyAndReopen(options);
|
|
2051
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
2052
|
+
SyncPoint::GetInstance()->LoadDependency({
|
|
2053
|
+
{"DBImpl::GetImpl:3",
|
|
2054
|
+
"DataVisibilityTest::PointLookupWithoutSnapshot1:BeforePut"},
|
|
2055
|
+
{"DataVisibilityTest::PointLookupWithoutSnapshot1:AfterPut",
|
|
2056
|
+
"DBImpl::GetImpl:4"},
|
|
2057
|
+
});
|
|
2058
|
+
SyncPoint::GetInstance()->EnableProcessing();
|
|
2059
|
+
port::Thread writer_thread([this]() {
|
|
2060
|
+
std::string write_ts = Timestamp(1, 0);
|
|
2061
|
+
WriteOptions write_opts;
|
|
2062
|
+
TEST_SYNC_POINT(
|
|
2063
|
+
"DataVisibilityTest::PointLookupWithoutSnapshot1:BeforePut");
|
|
2064
|
+
Status s = db_->Put(write_opts, "foo", write_ts, "value");
|
|
2065
|
+
ASSERT_OK(s);
|
|
2066
|
+
TEST_SYNC_POINT("DataVisibilityTest::PointLookupWithoutSnapshot1:AfterPut");
|
|
2067
|
+
});
|
|
2068
|
+
ReadOptions read_opts;
|
|
2069
|
+
std::string read_ts_str = Timestamp(3, 0);
|
|
2070
|
+
Slice read_ts = read_ts_str;
|
|
2071
|
+
read_opts.timestamp = &read_ts;
|
|
2072
|
+
std::string value;
|
|
2073
|
+
Status s = db_->Get(read_opts, "foo", &value);
|
|
2074
|
+
|
|
2075
|
+
writer_thread.join();
|
|
2076
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
2077
|
+
Close();
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
// Application specifies timestamp but not snapshot.
|
|
2081
|
+
// reader writer
|
|
2082
|
+
// ts'=90
|
|
2083
|
+
// ts=100
|
|
2084
|
+
// seq=10
|
|
2085
|
+
// seq'=11
|
|
2086
|
+
// write finishes
|
|
2087
|
+
// Flush
|
|
2088
|
+
// GetImpl(ts,seq)
|
|
2089
|
+
// It is OK to return <k, t1, s1> if ts>=t1 AND seq>=s1. If ts>=t1 but seq<s1,
|
|
2090
|
+
// the key should not be returned.
|
|
2091
|
+
TEST_F(DataVisibilityTest, PointLookupWithoutSnapshot2) {
|
|
2092
|
+
Options options = CurrentOptions();
|
|
2093
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2094
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2095
|
+
options.comparator = &test_cmp;
|
|
2096
|
+
DestroyAndReopen(options);
|
|
2097
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
2098
|
+
SyncPoint::GetInstance()->LoadDependency({
|
|
2099
|
+
{"DBImpl::GetImpl:3",
|
|
2100
|
+
"DataVisibilityTest::PointLookupWithoutSnapshot2:BeforePut"},
|
|
2101
|
+
{"DataVisibilityTest::PointLookupWithoutSnapshot2:AfterPut",
|
|
2102
|
+
"DBImpl::GetImpl:4"},
|
|
2103
|
+
});
|
|
2104
|
+
SyncPoint::GetInstance()->EnableProcessing();
|
|
2105
|
+
port::Thread writer_thread([this]() {
|
|
2106
|
+
std::string write_ts = Timestamp(1, 0);
|
|
2107
|
+
WriteOptions write_opts;
|
|
2108
|
+
TEST_SYNC_POINT(
|
|
2109
|
+
"DataVisibilityTest::PointLookupWithoutSnapshot2:BeforePut");
|
|
2110
|
+
Status s = db_->Put(write_opts, "foo", write_ts, "value");
|
|
2111
|
+
ASSERT_OK(s);
|
|
2112
|
+
ASSERT_OK(Flush());
|
|
2113
|
+
|
|
2114
|
+
write_ts = Timestamp(2, 0);
|
|
2115
|
+
s = db_->Put(write_opts, "bar", write_ts, "value");
|
|
2116
|
+
ASSERT_OK(s);
|
|
2117
|
+
TEST_SYNC_POINT("DataVisibilityTest::PointLookupWithoutSnapshot2:AfterPut");
|
|
2118
|
+
});
|
|
2119
|
+
ReadOptions read_opts;
|
|
2120
|
+
std::string read_ts_str = Timestamp(3, 0);
|
|
2121
|
+
Slice read_ts = read_ts_str;
|
|
2122
|
+
read_opts.timestamp = &read_ts;
|
|
2123
|
+
std::string value;
|
|
2124
|
+
Status s = db_->Get(read_opts, "foo", &value);
|
|
2125
|
+
writer_thread.join();
|
|
2126
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
2127
|
+
Close();
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
// Application specifies both timestamp and snapshot.
|
|
2131
|
+
// reader writer
|
|
2132
|
+
// seq=10
|
|
2133
|
+
// ts'=90
|
|
2134
|
+
// ts=100
|
|
2135
|
+
// seq'=11
|
|
2136
|
+
// write finishes
|
|
2137
|
+
// GetImpl(ts,seq)
|
|
2138
|
+
// Since application specifies both timestamp and snapshot, application expects
|
|
2139
|
+
// to see data that visible in BOTH timestamp and sequence number. Therefore,
|
|
2140
|
+
// <k, t1, s1> can be returned only if t1<=ts AND s1<=seq.
|
|
2141
|
+
TEST_F(DataVisibilityTest, PointLookupWithSnapshot1) {
|
|
2142
|
+
Options options = CurrentOptions();
|
|
2143
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2144
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2145
|
+
options.comparator = &test_cmp;
|
|
2146
|
+
DestroyAndReopen(options);
|
|
2147
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
2148
|
+
SyncPoint::GetInstance()->LoadDependency({
|
|
2149
|
+
{"DataVisibilityTest::PointLookupWithSnapshot1:AfterTakingSnap",
|
|
2150
|
+
"DataVisibilityTest::PointLookupWithSnapshot1:BeforePut"},
|
|
2151
|
+
{"DataVisibilityTest::PointLookupWithSnapshot1:AfterPut",
|
|
2152
|
+
"DBImpl::GetImpl:1"},
|
|
2153
|
+
});
|
|
2154
|
+
SyncPoint::GetInstance()->EnableProcessing();
|
|
2155
|
+
port::Thread writer_thread([this]() {
|
|
2156
|
+
std::string write_ts = Timestamp(1, 0);
|
|
2157
|
+
WriteOptions write_opts;
|
|
2158
|
+
TEST_SYNC_POINT("DataVisibilityTest::PointLookupWithSnapshot1:BeforePut");
|
|
2159
|
+
Status s = db_->Put(write_opts, "foo", write_ts, "value");
|
|
2160
|
+
TEST_SYNC_POINT("DataVisibilityTest::PointLookupWithSnapshot1:AfterPut");
|
|
2161
|
+
ASSERT_OK(s);
|
|
2162
|
+
});
|
|
2163
|
+
ReadOptions read_opts;
|
|
2164
|
+
const Snapshot* snap = db_->GetSnapshot();
|
|
2165
|
+
TEST_SYNC_POINT(
|
|
2166
|
+
"DataVisibilityTest::PointLookupWithSnapshot1:AfterTakingSnap");
|
|
2167
|
+
read_opts.snapshot = snap;
|
|
2168
|
+
std::string read_ts_str = Timestamp(3, 0);
|
|
2169
|
+
Slice read_ts = read_ts_str;
|
|
2170
|
+
read_opts.timestamp = &read_ts;
|
|
2171
|
+
std::string value;
|
|
2172
|
+
Status s = db_->Get(read_opts, "foo", &value);
|
|
2173
|
+
writer_thread.join();
|
|
2174
|
+
|
|
2175
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
2176
|
+
|
|
2177
|
+
db_->ReleaseSnapshot(snap);
|
|
2178
|
+
Close();
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
// Application specifies both timestamp and snapshot.
|
|
2182
|
+
// reader writer
|
|
2183
|
+
// seq=10
|
|
2184
|
+
// ts'=90
|
|
2185
|
+
// ts=100
|
|
2186
|
+
// seq'=11
|
|
2187
|
+
// write finishes
|
|
2188
|
+
// Flush
|
|
2189
|
+
// GetImpl(ts,seq)
|
|
2190
|
+
// Since application specifies both timestamp and snapshot, application expects
|
|
2191
|
+
// to see data that visible in BOTH timestamp and sequence number. Therefore,
|
|
2192
|
+
// <k, t1, s1> can be returned only if t1<=ts AND s1<=seq.
|
|
2193
|
+
TEST_F(DataVisibilityTest, PointLookupWithSnapshot2) {
|
|
2194
|
+
Options options = CurrentOptions();
|
|
2195
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2196
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2197
|
+
options.comparator = &test_cmp;
|
|
2198
|
+
DestroyAndReopen(options);
|
|
2199
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
2200
|
+
SyncPoint::GetInstance()->LoadDependency({
|
|
2201
|
+
{"DataVisibilityTest::PointLookupWithSnapshot2:AfterTakingSnap",
|
|
2202
|
+
"DataVisibilityTest::PointLookupWithSnapshot2:BeforePut"},
|
|
2203
|
+
});
|
|
2204
|
+
SyncPoint::GetInstance()->EnableProcessing();
|
|
2205
|
+
port::Thread writer_thread([this]() {
|
|
2206
|
+
std::string write_ts = Timestamp(1, 0);
|
|
2207
|
+
WriteOptions write_opts;
|
|
2208
|
+
TEST_SYNC_POINT("DataVisibilityTest::PointLookupWithSnapshot2:BeforePut");
|
|
2209
|
+
Status s = db_->Put(write_opts, "foo", write_ts, "value1");
|
|
2210
|
+
ASSERT_OK(s);
|
|
2211
|
+
ASSERT_OK(Flush());
|
|
2212
|
+
|
|
2213
|
+
write_ts = Timestamp(2, 0);
|
|
2214
|
+
s = db_->Put(write_opts, "bar", write_ts, "value2");
|
|
2215
|
+
ASSERT_OK(s);
|
|
2216
|
+
});
|
|
2217
|
+
const Snapshot* snap = db_->GetSnapshot();
|
|
2218
|
+
TEST_SYNC_POINT(
|
|
2219
|
+
"DataVisibilityTest::PointLookupWithSnapshot2:AfterTakingSnap");
|
|
2220
|
+
writer_thread.join();
|
|
2221
|
+
std::string read_ts_str = Timestamp(3, 0);
|
|
2222
|
+
Slice read_ts = read_ts_str;
|
|
2223
|
+
ReadOptions read_opts;
|
|
2224
|
+
read_opts.snapshot = snap;
|
|
2225
|
+
read_opts.timestamp = &read_ts;
|
|
2226
|
+
std::string value;
|
|
2227
|
+
Status s = db_->Get(read_opts, "foo", &value);
|
|
2228
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
2229
|
+
db_->ReleaseSnapshot(snap);
|
|
2230
|
+
Close();
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
// Application specifies timestamp but not snapshot.
|
|
2234
|
+
// reader writer
|
|
2235
|
+
// ts'=90
|
|
2236
|
+
// ts=100
|
|
2237
|
+
// seq=10
|
|
2238
|
+
// seq'=11
|
|
2239
|
+
// write finishes
|
|
2240
|
+
// scan(ts,seq)
|
|
2241
|
+
// <k, t1, s1> can be seen in scan as long as ts>=t1 AND seq>=s1. If ts>=t1 but
|
|
2242
|
+
// seq<s1, then the key should not be returned.
|
|
2243
|
+
TEST_F(DataVisibilityTest, RangeScanWithoutSnapshot) {
|
|
2244
|
+
Options options = CurrentOptions();
|
|
2245
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2246
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2247
|
+
options.comparator = &test_cmp;
|
|
2248
|
+
DestroyAndReopen(options);
|
|
2249
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
2250
|
+
SyncPoint::GetInstance()->LoadDependency({
|
|
2251
|
+
{"DBImpl::NewIterator:3",
|
|
2252
|
+
"DataVisibilityTest::RangeScanWithoutSnapshot:BeforePut"},
|
|
2253
|
+
});
|
|
2254
|
+
SyncPoint::GetInstance()->EnableProcessing();
|
|
2255
|
+
port::Thread writer_thread([this]() {
|
|
2256
|
+
WriteOptions write_opts;
|
|
2257
|
+
TEST_SYNC_POINT("DataVisibilityTest::RangeScanWithoutSnapshot:BeforePut");
|
|
2258
|
+
for (int i = 0; i < 3; ++i) {
|
|
2259
|
+
std::string write_ts = Timestamp(i + 1, 0);
|
|
2260
|
+
Status s = db_->Put(write_opts, "key" + std::to_string(i), write_ts,
|
|
2261
|
+
"value" + std::to_string(i));
|
|
2262
|
+
ASSERT_OK(s);
|
|
2263
|
+
}
|
|
2264
|
+
});
|
|
2265
|
+
std::string read_ts_str = Timestamp(10, 0);
|
|
2266
|
+
Slice read_ts = read_ts_str;
|
|
2267
|
+
ReadOptions read_opts;
|
|
2268
|
+
read_opts.total_order_seek = true;
|
|
2269
|
+
read_opts.timestamp = &read_ts;
|
|
2270
|
+
Iterator* it = db_->NewIterator(read_opts);
|
|
2271
|
+
ASSERT_NE(nullptr, it);
|
|
2272
|
+
writer_thread.join();
|
|
2273
|
+
it->SeekToFirst();
|
|
2274
|
+
ASSERT_FALSE(it->Valid());
|
|
2275
|
+
delete it;
|
|
2276
|
+
Close();
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
// Application specifies both timestamp and snapshot.
|
|
2280
|
+
// reader writer
|
|
2281
|
+
// seq=10
|
|
2282
|
+
// ts'=90
|
|
2283
|
+
// ts=100 seq'=11
|
|
2284
|
+
// write finishes
|
|
2285
|
+
// scan(ts,seq)
|
|
2286
|
+
// <k, t1, s1> can be seen by the scan only if t1<=ts AND s1<=seq. If t1<=ts
|
|
2287
|
+
// but s1>seq, then the key should not be returned.
|
|
2288
|
+
TEST_F(DataVisibilityTest, RangeScanWithSnapshot) {
|
|
2289
|
+
Options options = CurrentOptions();
|
|
2290
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2291
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2292
|
+
options.comparator = &test_cmp;
|
|
2293
|
+
DestroyAndReopen(options);
|
|
2294
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
2295
|
+
SyncPoint::GetInstance()->LoadDependency({
|
|
2296
|
+
{"DataVisibilityTest::RangeScanWithSnapshot:AfterTakingSnapshot",
|
|
2297
|
+
"DataVisibilityTest::RangeScanWithSnapshot:BeforePut"},
|
|
2298
|
+
});
|
|
2299
|
+
SyncPoint::GetInstance()->EnableProcessing();
|
|
2300
|
+
port::Thread writer_thread([this]() {
|
|
2301
|
+
WriteOptions write_opts;
|
|
2302
|
+
TEST_SYNC_POINT("DataVisibilityTest::RangeScanWithSnapshot:BeforePut");
|
|
2303
|
+
for (int i = 0; i < 3; ++i) {
|
|
2304
|
+
std::string write_ts = Timestamp(i + 1, 0);
|
|
2305
|
+
Status s = db_->Put(write_opts, "key" + std::to_string(i), write_ts,
|
|
2306
|
+
"value" + std::to_string(i));
|
|
2307
|
+
ASSERT_OK(s);
|
|
2308
|
+
}
|
|
2309
|
+
});
|
|
2310
|
+
const Snapshot* snap = db_->GetSnapshot();
|
|
2311
|
+
TEST_SYNC_POINT(
|
|
2312
|
+
"DataVisibilityTest::RangeScanWithSnapshot:AfterTakingSnapshot");
|
|
2313
|
+
|
|
2314
|
+
writer_thread.join();
|
|
2315
|
+
|
|
2316
|
+
std::string read_ts_str = Timestamp(10, 0);
|
|
2317
|
+
Slice read_ts = read_ts_str;
|
|
2318
|
+
ReadOptions read_opts;
|
|
2319
|
+
read_opts.snapshot = snap;
|
|
2320
|
+
read_opts.total_order_seek = true;
|
|
2321
|
+
read_opts.timestamp = &read_ts;
|
|
2322
|
+
Iterator* it = db_->NewIterator(read_opts);
|
|
2323
|
+
ASSERT_NE(nullptr, it);
|
|
2324
|
+
it->Seek("key0");
|
|
2325
|
+
ASSERT_FALSE(it->Valid());
|
|
2326
|
+
|
|
2327
|
+
delete it;
|
|
2328
|
+
db_->ReleaseSnapshot(snap);
|
|
2329
|
+
Close();
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
// Application specifies both timestamp and snapshot.
|
|
2333
|
+
// Query each combination and make sure for MultiGet key <k, t1, s1>, only
|
|
2334
|
+
// return keys that ts>=t1 AND seq>=s1.
|
|
2335
|
+
TEST_F(DataVisibilityTest, MultiGetWithTimestamp) {
|
|
2336
|
+
Options options = CurrentOptions();
|
|
2337
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2338
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2339
|
+
options.comparator = &test_cmp;
|
|
2340
|
+
DestroyAndReopen(options);
|
|
2341
|
+
|
|
2342
|
+
const Snapshot* snap0 = db_->GetSnapshot();
|
|
2343
|
+
PutTestData(0);
|
|
2344
|
+
VerifyDefaultCF();
|
|
2345
|
+
VerifyDefaultCF(snap0);
|
|
2346
|
+
|
|
2347
|
+
const Snapshot* snap1 = db_->GetSnapshot();
|
|
2348
|
+
PutTestData(1);
|
|
2349
|
+
VerifyDefaultCF();
|
|
2350
|
+
VerifyDefaultCF(snap0);
|
|
2351
|
+
VerifyDefaultCF(snap1);
|
|
2352
|
+
|
|
2353
|
+
ASSERT_OK(Flush());
|
|
2354
|
+
|
|
2355
|
+
const Snapshot* snap2 = db_->GetSnapshot();
|
|
2356
|
+
PutTestData(2);
|
|
2357
|
+
VerifyDefaultCF();
|
|
2358
|
+
VerifyDefaultCF(snap0);
|
|
2359
|
+
VerifyDefaultCF(snap1);
|
|
2360
|
+
VerifyDefaultCF(snap2);
|
|
2361
|
+
|
|
2362
|
+
db_->ReleaseSnapshot(snap0);
|
|
2363
|
+
db_->ReleaseSnapshot(snap1);
|
|
2364
|
+
db_->ReleaseSnapshot(snap2);
|
|
2365
|
+
|
|
2366
|
+
Close();
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
// Application specifies timestamp but not snapshot.
|
|
2370
|
+
// reader writer
|
|
2371
|
+
// ts'=0, 1
|
|
2372
|
+
// ts=3
|
|
2373
|
+
// seq=10
|
|
2374
|
+
// seq'=11, 12
|
|
2375
|
+
// write finishes
|
|
2376
|
+
// MultiGet(ts,seq)
|
|
2377
|
+
// For MultiGet <k, t1, s1>, only return keys that ts>=t1 AND seq>=s1.
|
|
2378
|
+
TEST_F(DataVisibilityTest, MultiGetWithoutSnapshot) {
|
|
2379
|
+
Options options = CurrentOptions();
|
|
2380
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2381
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2382
|
+
options.comparator = &test_cmp;
|
|
2383
|
+
DestroyAndReopen(options);
|
|
2384
|
+
|
|
2385
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
2386
|
+
SyncPoint::GetInstance()->LoadDependency({
|
|
2387
|
+
{"DBImpl::MultiGet:AfterGetSeqNum1",
|
|
2388
|
+
"DataVisibilityTest::MultiGetWithoutSnapshot:BeforePut"},
|
|
2389
|
+
{"DataVisibilityTest::MultiGetWithoutSnapshot:AfterPut",
|
|
2390
|
+
"DBImpl::MultiGet:AfterGetSeqNum2"},
|
|
2391
|
+
});
|
|
2392
|
+
SyncPoint::GetInstance()->EnableProcessing();
|
|
2393
|
+
port::Thread writer_thread([this]() {
|
|
2394
|
+
TEST_SYNC_POINT("DataVisibilityTest::MultiGetWithoutSnapshot:BeforePut");
|
|
2395
|
+
PutTestData(0);
|
|
2396
|
+
PutTestData(1);
|
|
2397
|
+
TEST_SYNC_POINT("DataVisibilityTest::MultiGetWithoutSnapshot:AfterPut");
|
|
2398
|
+
});
|
|
2399
|
+
|
|
2400
|
+
ReadOptions read_opts;
|
|
2401
|
+
std::string read_ts = Timestamp(kTestDataSize, 0);
|
|
2402
|
+
Slice read_ts_slice = read_ts;
|
|
2403
|
+
read_opts.timestamp = &read_ts_slice;
|
|
2404
|
+
auto keys = GetKeys();
|
|
2405
|
+
std::vector<std::string> values;
|
|
2406
|
+
auto ss = db_->MultiGet(read_opts, keys, &values);
|
|
2407
|
+
|
|
2408
|
+
writer_thread.join();
|
|
2409
|
+
for (auto s : ss) {
|
|
2410
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
2411
|
+
}
|
|
2412
|
+
VerifyDefaultCF();
|
|
2413
|
+
Close();
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
TEST_F(DataVisibilityTest, MultiGetCrossCF) {
|
|
2417
|
+
Options options = CurrentOptions();
|
|
2418
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2419
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2420
|
+
options.comparator = &test_cmp;
|
|
2421
|
+
DestroyAndReopen(options);
|
|
2422
|
+
|
|
2423
|
+
CreateAndReopenWithCF({"second"}, options);
|
|
2424
|
+
ColumnFamilyHandle* second_cf = handles_[1];
|
|
2425
|
+
|
|
2426
|
+
const Snapshot* snap0 = db_->GetSnapshot();
|
|
2427
|
+
PutTestData(0);
|
|
2428
|
+
PutTestData(0, second_cf);
|
|
2429
|
+
VerifyDefaultCF();
|
|
2430
|
+
VerifyDefaultCF(snap0);
|
|
2431
|
+
|
|
2432
|
+
const Snapshot* snap1 = db_->GetSnapshot();
|
|
2433
|
+
PutTestData(1);
|
|
2434
|
+
PutTestData(1, second_cf);
|
|
2435
|
+
VerifyDefaultCF();
|
|
2436
|
+
VerifyDefaultCF(snap0);
|
|
2437
|
+
VerifyDefaultCF(snap1);
|
|
2438
|
+
|
|
2439
|
+
ASSERT_OK(Flush());
|
|
2440
|
+
|
|
2441
|
+
const Snapshot* snap2 = db_->GetSnapshot();
|
|
2442
|
+
PutTestData(2);
|
|
2443
|
+
PutTestData(2, second_cf);
|
|
2444
|
+
VerifyDefaultCF();
|
|
2445
|
+
VerifyDefaultCF(snap0);
|
|
2446
|
+
VerifyDefaultCF(snap1);
|
|
2447
|
+
VerifyDefaultCF(snap2);
|
|
2448
|
+
|
|
2449
|
+
ReadOptions read_opts;
|
|
2450
|
+
std::string read_ts = Timestamp(kTestDataSize, 0);
|
|
2451
|
+
Slice read_ts_slice = read_ts;
|
|
2452
|
+
read_opts.timestamp = &read_ts_slice;
|
|
2453
|
+
read_opts.snapshot = snap1;
|
|
2454
|
+
auto keys = GetKeys();
|
|
2455
|
+
auto keys2 = GetKeys();
|
|
2456
|
+
keys.insert(keys.end(), keys2.begin(), keys2.end());
|
|
2457
|
+
std::vector<ColumnFamilyHandle*> cfs(kTestDataSize,
|
|
2458
|
+
db_->DefaultColumnFamily());
|
|
2459
|
+
std::vector<ColumnFamilyHandle*> cfs2(kTestDataSize, second_cf);
|
|
2460
|
+
cfs.insert(cfs.end(), cfs2.begin(), cfs2.end());
|
|
2461
|
+
|
|
2462
|
+
std::vector<std::string> values;
|
|
2463
|
+
auto ss = db_->MultiGet(read_opts, cfs, keys, &values);
|
|
2464
|
+
for (int i = 0; i < 2 * kTestDataSize; i++) {
|
|
2465
|
+
if (i % 3 == 0) {
|
|
2466
|
+
// only the first key for each column family should be returned
|
|
2467
|
+
ASSERT_OK(ss[i]);
|
|
2468
|
+
} else {
|
|
2469
|
+
ASSERT_TRUE(ss[i].IsNotFound());
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
db_->ReleaseSnapshot(snap0);
|
|
2474
|
+
db_->ReleaseSnapshot(snap1);
|
|
2475
|
+
db_->ReleaseSnapshot(snap2);
|
|
2476
|
+
Close();
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
#if !defined(ROCKSDB_VALGRIND_RUN) || defined(ROCKSDB_FULL_VALGRIND_RUN)
|
|
2480
|
+
class DBBasicTestWithTimestampCompressionSettings
|
|
2481
|
+
: public DBBasicTestWithTimestampBase,
|
|
2482
|
+
public testing::WithParamInterface<
|
|
2483
|
+
std::tuple<std::shared_ptr<const FilterPolicy>, CompressionType,
|
|
2484
|
+
uint32_t, uint32_t>> {
|
|
2485
|
+
public:
|
|
2486
|
+
DBBasicTestWithTimestampCompressionSettings()
|
|
2487
|
+
: DBBasicTestWithTimestampBase(
|
|
2488
|
+
"db_basic_test_with_timestamp_compression") {}
|
|
2489
|
+
};
|
|
2490
|
+
|
|
2491
|
+
TEST_P(DBBasicTestWithTimestampCompressionSettings, PutAndGet) {
|
|
2492
|
+
const int kNumKeysPerFile = 1024;
|
|
2493
|
+
const size_t kNumTimestamps = 4;
|
|
2494
|
+
Options options = CurrentOptions();
|
|
2495
|
+
options.create_if_missing = true;
|
|
2496
|
+
options.env = env_;
|
|
2497
|
+
options.memtable_factory.reset(
|
|
2498
|
+
test::NewSpecialSkipListFactory(kNumKeysPerFile));
|
|
2499
|
+
size_t ts_sz = Timestamp(0, 0).size();
|
|
2500
|
+
TestComparator test_cmp(ts_sz);
|
|
2501
|
+
options.comparator = &test_cmp;
|
|
2502
|
+
BlockBasedTableOptions bbto;
|
|
2503
|
+
bbto.filter_policy = std::get<0>(GetParam());
|
|
2504
|
+
bbto.whole_key_filtering = true;
|
|
2505
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
2506
|
+
|
|
2507
|
+
const CompressionType comp_type = std::get<1>(GetParam());
|
|
2508
|
+
#if LZ4_VERSION_NUMBER < 10400 // r124+
|
|
2509
|
+
if (comp_type == kLZ4Compression || comp_type == kLZ4HCCompression) {
|
|
2510
|
+
return;
|
|
2511
|
+
}
|
|
2512
|
+
#endif // LZ4_VERSION_NUMBER >= 10400
|
|
2513
|
+
if (!ZSTD_Supported() && comp_type == kZSTD) {
|
|
2514
|
+
return;
|
|
2515
|
+
}
|
|
2516
|
+
if (!Zlib_Supported() && comp_type == kZlibCompression) {
|
|
2517
|
+
return;
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
options.compression = comp_type;
|
|
2521
|
+
options.compression_opts.max_dict_bytes = std::get<2>(GetParam());
|
|
2522
|
+
if (comp_type == kZSTD) {
|
|
2523
|
+
options.compression_opts.zstd_max_train_bytes = std::get<2>(GetParam());
|
|
2524
|
+
}
|
|
2525
|
+
options.compression_opts.parallel_threads = std::get<3>(GetParam());
|
|
2526
|
+
options.target_file_size_base = 1 << 26; // 64MB
|
|
2527
|
+
DestroyAndReopen(options);
|
|
2528
|
+
CreateAndReopenWithCF({"pikachu"}, options);
|
|
2529
|
+
size_t num_cfs = handles_.size();
|
|
2530
|
+
ASSERT_EQ(2, num_cfs);
|
|
2531
|
+
std::vector<std::string> write_ts_list;
|
|
2532
|
+
std::vector<std::string> read_ts_list;
|
|
2533
|
+
|
|
2534
|
+
for (size_t i = 0; i != kNumTimestamps; ++i) {
|
|
2535
|
+
write_ts_list.push_back(Timestamp(i * 2, 0));
|
|
2536
|
+
read_ts_list.push_back(Timestamp(1 + i * 2, 0));
|
|
2537
|
+
const Slice write_ts = write_ts_list.back();
|
|
2538
|
+
WriteOptions wopts;
|
|
2539
|
+
for (int cf = 0; cf != static_cast<int>(num_cfs); ++cf) {
|
|
2540
|
+
for (size_t j = 0; j != (kNumKeysPerFile - 1) / kNumTimestamps; ++j) {
|
|
2541
|
+
ASSERT_OK(
|
|
2542
|
+
db_->Put(wopts, handles_[cf], Key1(j), write_ts,
|
|
2543
|
+
"value_" + std::to_string(j) + "_" + std::to_string(i)));
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
const auto& verify_db_func = [&]() {
|
|
2548
|
+
for (size_t i = 0; i != kNumTimestamps; ++i) {
|
|
2549
|
+
ReadOptions ropts;
|
|
2550
|
+
const Slice read_ts = read_ts_list[i];
|
|
2551
|
+
ropts.timestamp = &read_ts;
|
|
2552
|
+
for (int cf = 0; cf != static_cast<int>(num_cfs); ++cf) {
|
|
2553
|
+
ColumnFamilyHandle* cfh = handles_[cf];
|
|
2554
|
+
for (size_t j = 0; j != (kNumKeysPerFile - 1) / kNumTimestamps; ++j) {
|
|
2555
|
+
std::string value;
|
|
2556
|
+
ASSERT_OK(db_->Get(ropts, cfh, Key1(j), &value));
|
|
2557
|
+
ASSERT_EQ("value_" + std::to_string(j) + "_" + std::to_string(i),
|
|
2558
|
+
value);
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
};
|
|
2563
|
+
verify_db_func();
|
|
2564
|
+
Close();
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
TEST_P(DBBasicTestWithTimestampCompressionSettings, PutDeleteGet) {
|
|
2568
|
+
Options options = CurrentOptions();
|
|
2569
|
+
options.env = env_;
|
|
2570
|
+
options.create_if_missing = true;
|
|
2571
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2572
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2573
|
+
options.comparator = &test_cmp;
|
|
2574
|
+
const int kNumKeysPerFile = 1024;
|
|
2575
|
+
options.memtable_factory.reset(
|
|
2576
|
+
test::NewSpecialSkipListFactory(kNumKeysPerFile));
|
|
2577
|
+
BlockBasedTableOptions bbto;
|
|
2578
|
+
bbto.filter_policy = std::get<0>(GetParam());
|
|
2579
|
+
bbto.whole_key_filtering = true;
|
|
2580
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
2581
|
+
|
|
2582
|
+
const CompressionType comp_type = std::get<1>(GetParam());
|
|
2583
|
+
#if LZ4_VERSION_NUMBER < 10400 // r124+
|
|
2584
|
+
if (comp_type == kLZ4Compression || comp_type == kLZ4HCCompression) {
|
|
2585
|
+
return;
|
|
2586
|
+
}
|
|
2587
|
+
#endif // LZ4_VERSION_NUMBER >= 10400
|
|
2588
|
+
if (!ZSTD_Supported() && comp_type == kZSTD) {
|
|
2589
|
+
return;
|
|
2590
|
+
}
|
|
2591
|
+
if (!Zlib_Supported() && comp_type == kZlibCompression) {
|
|
2592
|
+
return;
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
options.compression = comp_type;
|
|
2596
|
+
options.compression_opts.max_dict_bytes = std::get<2>(GetParam());
|
|
2597
|
+
if (comp_type == kZSTD) {
|
|
2598
|
+
options.compression_opts.zstd_max_train_bytes = std::get<2>(GetParam());
|
|
2599
|
+
}
|
|
2600
|
+
options.compression_opts.parallel_threads = std::get<3>(GetParam());
|
|
2601
|
+
options.target_file_size_base = 1 << 26; // 64MB
|
|
2602
|
+
|
|
2603
|
+
DestroyAndReopen(options);
|
|
2604
|
+
|
|
2605
|
+
const size_t kNumL0Files =
|
|
2606
|
+
static_cast<size_t>(Options().level0_file_num_compaction_trigger);
|
|
2607
|
+
{
|
|
2608
|
+
// Half of the keys will go through Deletion and remaining half with
|
|
2609
|
+
// SingleDeletion. Generate enough L0 files with ts=1 to trigger compaction
|
|
2610
|
+
// to L1
|
|
2611
|
+
std::string ts = Timestamp(1, 0);
|
|
2612
|
+
WriteOptions wopts;
|
|
2613
|
+
for (size_t i = 0; i < kNumL0Files; ++i) {
|
|
2614
|
+
for (int j = 0; j < kNumKeysPerFile; ++j) {
|
|
2615
|
+
ASSERT_OK(db_->Put(wopts, Key1(j), ts, "value" + std::to_string(i)));
|
|
2616
|
+
}
|
|
2617
|
+
ASSERT_OK(db_->Flush(FlushOptions()));
|
|
2618
|
+
}
|
|
2619
|
+
ASSERT_OK(dbfull()->TEST_WaitForCompact());
|
|
2620
|
+
// Generate another L0 at ts=3
|
|
2621
|
+
ts = Timestamp(3, 0);
|
|
2622
|
+
for (int i = 0; i < kNumKeysPerFile; ++i) {
|
|
2623
|
+
std::string key_str = Key1(i);
|
|
2624
|
+
Slice key(key_str);
|
|
2625
|
+
if ((i % 3) == 0) {
|
|
2626
|
+
if (i < kNumKeysPerFile / 2) {
|
|
2627
|
+
ASSERT_OK(db_->Delete(wopts, key, ts));
|
|
2628
|
+
} else {
|
|
2629
|
+
ASSERT_OK(db_->SingleDelete(wopts, key, ts));
|
|
2630
|
+
}
|
|
2631
|
+
} else {
|
|
2632
|
+
ASSERT_OK(db_->Put(wopts, key, ts, "new_value"));
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
ASSERT_OK(db_->Flush(FlushOptions()));
|
|
2636
|
+
// Populate memtable at ts=5
|
|
2637
|
+
ts = Timestamp(5, 0);
|
|
2638
|
+
for (int i = 0; i != kNumKeysPerFile; ++i) {
|
|
2639
|
+
std::string key_str = Key1(i);
|
|
2640
|
+
Slice key(key_str);
|
|
2641
|
+
if ((i % 3) == 1) {
|
|
2642
|
+
if (i < kNumKeysPerFile / 2) {
|
|
2643
|
+
ASSERT_OK(db_->Delete(wopts, key, ts));
|
|
2644
|
+
} else {
|
|
2645
|
+
ASSERT_OK(db_->SingleDelete(wopts, key, ts));
|
|
2646
|
+
}
|
|
2647
|
+
} else if ((i % 3) == 2) {
|
|
2648
|
+
ASSERT_OK(db_->Put(wopts, key, ts, "new_value_2"));
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
{
|
|
2653
|
+
std::string ts_str = Timestamp(6, 0);
|
|
2654
|
+
Slice ts = ts_str;
|
|
2655
|
+
ReadOptions ropts;
|
|
2656
|
+
ropts.timestamp = &ts;
|
|
2657
|
+
for (uint64_t i = 0; i != static_cast<uint64_t>(kNumKeysPerFile); ++i) {
|
|
2658
|
+
std::string value;
|
|
2659
|
+
std::string key_ts;
|
|
2660
|
+
Status s = db_->Get(ropts, Key1(i), &value, &key_ts);
|
|
2661
|
+
if ((i % 3) == 2) {
|
|
2662
|
+
ASSERT_OK(s);
|
|
2663
|
+
ASSERT_EQ("new_value_2", value);
|
|
2664
|
+
ASSERT_EQ(Timestamp(5, 0), key_ts);
|
|
2665
|
+
} else if ((i % 3) == 1) {
|
|
2666
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
2667
|
+
ASSERT_EQ(Timestamp(5, 0), key_ts);
|
|
2668
|
+
} else {
|
|
2669
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
2670
|
+
ASSERT_EQ(Timestamp(3, 0), key_ts);
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
// A class which remembers the name of each flushed file.
|
|
2677
|
+
class FlushedFileCollector : public EventListener {
|
|
2678
|
+
public:
|
|
2679
|
+
FlushedFileCollector() {}
|
|
2680
|
+
~FlushedFileCollector() override {}
|
|
2681
|
+
|
|
2682
|
+
void OnFlushCompleted(DB* /*db*/, const FlushJobInfo& info) override {
|
|
2683
|
+
InstrumentedMutexLock lock(&mutex_);
|
|
2684
|
+
flushed_files_.push_back(info.file_path);
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
std::vector<std::string> GetFlushedFiles() {
|
|
2688
|
+
std::vector<std::string> result;
|
|
2689
|
+
{
|
|
2690
|
+
InstrumentedMutexLock lock(&mutex_);
|
|
2691
|
+
result = flushed_files_;
|
|
2692
|
+
}
|
|
2693
|
+
return result;
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
void ClearFlushedFiles() {
|
|
2697
|
+
InstrumentedMutexLock lock(&mutex_);
|
|
2698
|
+
flushed_files_.clear();
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
private:
|
|
2702
|
+
std::vector<std::string> flushed_files_;
|
|
2703
|
+
InstrumentedMutex mutex_;
|
|
2704
|
+
};
|
|
2705
|
+
|
|
2706
|
+
TEST_P(DBBasicTestWithTimestampCompressionSettings, PutAndGetWithCompaction) {
|
|
2707
|
+
const int kNumKeysPerFile = 1024;
|
|
2708
|
+
const size_t kNumTimestamps = 2;
|
|
2709
|
+
const size_t kNumKeysPerTimestamp = (kNumKeysPerFile - 1) / kNumTimestamps;
|
|
2710
|
+
const size_t kSplitPosBase = kNumKeysPerTimestamp / 2;
|
|
2711
|
+
Options options = CurrentOptions();
|
|
2712
|
+
options.create_if_missing = true;
|
|
2713
|
+
options.env = env_;
|
|
2714
|
+
options.memtable_factory.reset(
|
|
2715
|
+
test::NewSpecialSkipListFactory(kNumKeysPerFile));
|
|
2716
|
+
|
|
2717
|
+
FlushedFileCollector* collector = new FlushedFileCollector();
|
|
2718
|
+
options.listeners.emplace_back(collector);
|
|
2719
|
+
|
|
2720
|
+
size_t ts_sz = Timestamp(0, 0).size();
|
|
2721
|
+
TestComparator test_cmp(ts_sz);
|
|
2722
|
+
options.comparator = &test_cmp;
|
|
2723
|
+
BlockBasedTableOptions bbto;
|
|
2724
|
+
bbto.filter_policy = std::get<0>(GetParam());
|
|
2725
|
+
bbto.whole_key_filtering = true;
|
|
2726
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
2727
|
+
|
|
2728
|
+
const CompressionType comp_type = std::get<1>(GetParam());
|
|
2729
|
+
#if LZ4_VERSION_NUMBER < 10400 // r124+
|
|
2730
|
+
if (comp_type == kLZ4Compression || comp_type == kLZ4HCCompression) {
|
|
2731
|
+
return;
|
|
2732
|
+
}
|
|
2733
|
+
#endif // LZ4_VERSION_NUMBER >= 10400
|
|
2734
|
+
if (!ZSTD_Supported() && comp_type == kZSTD) {
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
if (!Zlib_Supported() && comp_type == kZlibCompression) {
|
|
2738
|
+
return;
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
options.compression = comp_type;
|
|
2742
|
+
options.compression_opts.max_dict_bytes = std::get<2>(GetParam());
|
|
2743
|
+
if (comp_type == kZSTD) {
|
|
2744
|
+
options.compression_opts.zstd_max_train_bytes = std::get<2>(GetParam());
|
|
2745
|
+
}
|
|
2746
|
+
options.compression_opts.parallel_threads = std::get<3>(GetParam());
|
|
2747
|
+
DestroyAndReopen(options);
|
|
2748
|
+
CreateAndReopenWithCF({"pikachu"}, options);
|
|
2749
|
+
|
|
2750
|
+
size_t num_cfs = handles_.size();
|
|
2751
|
+
ASSERT_EQ(2, num_cfs);
|
|
2752
|
+
std::vector<std::string> write_ts_list;
|
|
2753
|
+
std::vector<std::string> read_ts_list;
|
|
2754
|
+
|
|
2755
|
+
const auto& verify_records_func = [&](size_t i, size_t begin, size_t end,
|
|
2756
|
+
ColumnFamilyHandle* cfh) {
|
|
2757
|
+
std::string value;
|
|
2758
|
+
std::string timestamp;
|
|
2759
|
+
|
|
2760
|
+
ReadOptions ropts;
|
|
2761
|
+
const Slice read_ts = read_ts_list[i];
|
|
2762
|
+
ropts.timestamp = &read_ts;
|
|
2763
|
+
std::string expected_timestamp =
|
|
2764
|
+
std::string(write_ts_list[i].data(), write_ts_list[i].size());
|
|
2765
|
+
|
|
2766
|
+
for (size_t j = begin; j <= end; ++j) {
|
|
2767
|
+
ASSERT_OK(db_->Get(ropts, cfh, Key1(j), &value, ×tamp));
|
|
2768
|
+
ASSERT_EQ("value_" + std::to_string(j) + "_" + std::to_string(i), value);
|
|
2769
|
+
ASSERT_EQ(expected_timestamp, timestamp);
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
|
|
2773
|
+
for (size_t i = 0; i != kNumTimestamps; ++i) {
|
|
2774
|
+
write_ts_list.push_back(Timestamp(i * 2, 0));
|
|
2775
|
+
read_ts_list.push_back(Timestamp(1 + i * 2, 0));
|
|
2776
|
+
const Slice write_ts = write_ts_list.back();
|
|
2777
|
+
WriteOptions wopts;
|
|
2778
|
+
for (int cf = 0; cf != static_cast<int>(num_cfs); ++cf) {
|
|
2779
|
+
size_t memtable_get_start = 0;
|
|
2780
|
+
for (size_t j = 0; j != kNumKeysPerTimestamp; ++j) {
|
|
2781
|
+
ASSERT_OK(
|
|
2782
|
+
db_->Put(wopts, handles_[cf], Key1(j), write_ts,
|
|
2783
|
+
"value_" + std::to_string(j) + "_" + std::to_string(i)));
|
|
2784
|
+
if (j == kSplitPosBase + i || j == kNumKeysPerTimestamp - 1) {
|
|
2785
|
+
verify_records_func(i, memtable_get_start, j, handles_[cf]);
|
|
2786
|
+
memtable_get_start = j + 1;
|
|
2787
|
+
|
|
2788
|
+
// flush all keys with the same timestamp to two sst files, split at
|
|
2789
|
+
// incremental positions such that lowerlevel[1].smallest.userkey ==
|
|
2790
|
+
// higherlevel[0].largest.userkey
|
|
2791
|
+
ASSERT_OK(Flush(cf));
|
|
2792
|
+
ASSERT_OK(dbfull()->TEST_WaitForCompact()); // wait for flush (which
|
|
2793
|
+
// is also a compaction)
|
|
2794
|
+
|
|
2795
|
+
// compact files (2 at each level) to a lower level such that all
|
|
2796
|
+
// keys with the same timestamp is at one level, with newer versions
|
|
2797
|
+
// at higher levels.
|
|
2798
|
+
CompactionOptions compact_opt;
|
|
2799
|
+
compact_opt.compression = kNoCompression;
|
|
2800
|
+
ASSERT_OK(db_->CompactFiles(compact_opt, handles_[cf],
|
|
2801
|
+
collector->GetFlushedFiles(),
|
|
2802
|
+
static_cast<int>(kNumTimestamps - i)));
|
|
2803
|
+
collector->ClearFlushedFiles();
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
const auto& verify_db_func = [&]() {
|
|
2809
|
+
for (size_t i = 0; i != kNumTimestamps; ++i) {
|
|
2810
|
+
ReadOptions ropts;
|
|
2811
|
+
const Slice read_ts = read_ts_list[i];
|
|
2812
|
+
ropts.timestamp = &read_ts;
|
|
2813
|
+
std::string expected_timestamp(write_ts_list[i].data(),
|
|
2814
|
+
write_ts_list[i].size());
|
|
2815
|
+
for (int cf = 0; cf != static_cast<int>(num_cfs); ++cf) {
|
|
2816
|
+
ColumnFamilyHandle* cfh = handles_[cf];
|
|
2817
|
+
verify_records_func(i, 0, kNumKeysPerTimestamp - 1, cfh);
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
};
|
|
2821
|
+
verify_db_func();
|
|
2822
|
+
Close();
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
TEST_F(DBBasicTestWithTimestamp, BatchWriteAndMultiGet) {
|
|
2826
|
+
const int kNumKeysPerFile = 8192;
|
|
2827
|
+
const size_t kNumTimestamps = 2;
|
|
2828
|
+
const size_t kNumKeysPerTimestamp = (kNumKeysPerFile - 1) / kNumTimestamps;
|
|
2829
|
+
Options options = CurrentOptions();
|
|
2830
|
+
options.create_if_missing = true;
|
|
2831
|
+
options.env = env_;
|
|
2832
|
+
options.memtable_factory.reset(
|
|
2833
|
+
test::NewSpecialSkipListFactory(kNumKeysPerFile));
|
|
2834
|
+
options.memtable_prefix_bloom_size_ratio = 0.1;
|
|
2835
|
+
options.memtable_whole_key_filtering = true;
|
|
2836
|
+
|
|
2837
|
+
size_t ts_sz = Timestamp(0, 0).size();
|
|
2838
|
+
TestComparator test_cmp(ts_sz);
|
|
2839
|
+
options.comparator = &test_cmp;
|
|
2840
|
+
BlockBasedTableOptions bbto;
|
|
2841
|
+
bbto.filter_policy.reset(NewBloomFilterPolicy(
|
|
2842
|
+
10 /*bits_per_key*/, false /*use_block_based_builder*/));
|
|
2843
|
+
bbto.whole_key_filtering = true;
|
|
2844
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
2845
|
+
DestroyAndReopen(options);
|
|
2846
|
+
CreateAndReopenWithCF({"pikachu"}, options);
|
|
2847
|
+
size_t num_cfs = handles_.size();
|
|
2848
|
+
ASSERT_EQ(2, num_cfs);
|
|
2849
|
+
std::vector<std::string> write_ts_list;
|
|
2850
|
+
std::vector<std::string> read_ts_list;
|
|
2851
|
+
|
|
2852
|
+
const auto& verify_records_func = [&](size_t i, ColumnFamilyHandle* cfh) {
|
|
2853
|
+
std::vector<Slice> keys;
|
|
2854
|
+
std::vector<std::string> key_vals;
|
|
2855
|
+
std::vector<std::string> values;
|
|
2856
|
+
std::vector<std::string> timestamps;
|
|
2857
|
+
|
|
2858
|
+
for (size_t j = 0; j != kNumKeysPerTimestamp; ++j) {
|
|
2859
|
+
key_vals.push_back(Key1(j));
|
|
2860
|
+
}
|
|
2861
|
+
for (size_t j = 0; j != kNumKeysPerTimestamp; ++j) {
|
|
2862
|
+
keys.push_back(key_vals[j]);
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
ReadOptions ropts;
|
|
2866
|
+
const Slice read_ts = read_ts_list[i];
|
|
2867
|
+
ropts.timestamp = &read_ts;
|
|
2868
|
+
std::string expected_timestamp(write_ts_list[i].data(),
|
|
2869
|
+
write_ts_list[i].size());
|
|
2870
|
+
|
|
2871
|
+
std::vector<ColumnFamilyHandle*> cfhs(keys.size(), cfh);
|
|
2872
|
+
std::vector<Status> statuses =
|
|
2873
|
+
db_->MultiGet(ropts, cfhs, keys, &values, ×tamps);
|
|
2874
|
+
for (size_t j = 0; j != kNumKeysPerTimestamp; ++j) {
|
|
2875
|
+
ASSERT_OK(statuses[j]);
|
|
2876
|
+
ASSERT_EQ("value_" + std::to_string(j) + "_" + std::to_string(i),
|
|
2877
|
+
values[j]);
|
|
2878
|
+
ASSERT_EQ(expected_timestamp, timestamps[j]);
|
|
2879
|
+
}
|
|
2880
|
+
};
|
|
2881
|
+
|
|
2882
|
+
const std::string dummy_ts(ts_sz, '\0');
|
|
2883
|
+
for (size_t i = 0; i != kNumTimestamps; ++i) {
|
|
2884
|
+
write_ts_list.push_back(Timestamp(i * 2, 0));
|
|
2885
|
+
read_ts_list.push_back(Timestamp(1 + i * 2, 0));
|
|
2886
|
+
const Slice& write_ts = write_ts_list.back();
|
|
2887
|
+
for (int cf = 0; cf != static_cast<int>(num_cfs); ++cf) {
|
|
2888
|
+
WriteOptions wopts;
|
|
2889
|
+
WriteBatch batch(0, 0, 0, ts_sz);
|
|
2890
|
+
for (size_t j = 0; j != kNumKeysPerTimestamp; ++j) {
|
|
2891
|
+
const std::string key = Key1(j);
|
|
2892
|
+
const std::string value =
|
|
2893
|
+
"value_" + std::to_string(j) + "_" + std::to_string(i);
|
|
2894
|
+
ASSERT_OK(batch.Put(handles_[cf], key, value));
|
|
2895
|
+
}
|
|
2896
|
+
ASSERT_OK(batch.UpdateTimestamps(write_ts,
|
|
2897
|
+
[ts_sz](uint32_t) { return ts_sz; }));
|
|
2898
|
+
ASSERT_OK(db_->Write(wopts, &batch));
|
|
2899
|
+
|
|
2900
|
+
verify_records_func(i, handles_[cf]);
|
|
2901
|
+
|
|
2902
|
+
ASSERT_OK(Flush(cf));
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
const auto& verify_db_func = [&]() {
|
|
2907
|
+
for (size_t i = 0; i != kNumTimestamps; ++i) {
|
|
2908
|
+
ReadOptions ropts;
|
|
2909
|
+
const Slice read_ts = read_ts_list[i];
|
|
2910
|
+
ropts.timestamp = &read_ts;
|
|
2911
|
+
for (int cf = 0; cf != static_cast<int>(num_cfs); ++cf) {
|
|
2912
|
+
ColumnFamilyHandle* cfh = handles_[cf];
|
|
2913
|
+
verify_records_func(i, cfh);
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
};
|
|
2917
|
+
verify_db_func();
|
|
2918
|
+
Close();
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
TEST_F(DBBasicTestWithTimestamp, MultiGetNoReturnTs) {
|
|
2922
|
+
Options options = CurrentOptions();
|
|
2923
|
+
options.env = env_;
|
|
2924
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2925
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2926
|
+
options.comparator = &test_cmp;
|
|
2927
|
+
DestroyAndReopen(options);
|
|
2928
|
+
WriteOptions write_opts;
|
|
2929
|
+
std::string ts = Timestamp(1, 0);
|
|
2930
|
+
ASSERT_OK(db_->Put(write_opts, "foo", ts, "value"));
|
|
2931
|
+
ASSERT_OK(db_->Put(write_opts, "bar", ts, "value"));
|
|
2932
|
+
ASSERT_OK(db_->Put(write_opts, "fooxxxxxxxxxxxxxxxx", ts, "value"));
|
|
2933
|
+
ASSERT_OK(db_->Put(write_opts, "barxxxxxxxxxxxxxxxx", ts, "value"));
|
|
2934
|
+
ColumnFamilyHandle* cfh = dbfull()->DefaultColumnFamily();
|
|
2935
|
+
ts = Timestamp(2, 0);
|
|
2936
|
+
Slice read_ts = ts;
|
|
2937
|
+
ReadOptions read_opts;
|
|
2938
|
+
read_opts.timestamp = &read_ts;
|
|
2939
|
+
{
|
|
2940
|
+
ColumnFamilyHandle* column_families[] = {cfh, cfh};
|
|
2941
|
+
Slice keys[] = {"foo", "bar"};
|
|
2942
|
+
PinnableSlice values[] = {PinnableSlice(), PinnableSlice()};
|
|
2943
|
+
Status statuses[] = {Status::OK(), Status::OK()};
|
|
2944
|
+
dbfull()->MultiGet(read_opts, /*num_keys=*/2, &column_families[0], &keys[0],
|
|
2945
|
+
&values[0], &statuses[0], /*sorted_input=*/false);
|
|
2946
|
+
for (const auto& s : statuses) {
|
|
2947
|
+
ASSERT_OK(s);
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
{
|
|
2951
|
+
ColumnFamilyHandle* column_families[] = {cfh, cfh, cfh, cfh};
|
|
2952
|
+
// Make user keys longer than configured timestamp size (16 bytes) to
|
|
2953
|
+
// verify RocksDB does not use the trailing bytes 'x' as timestamp.
|
|
2954
|
+
Slice keys[] = {"fooxxxxxxxxxxxxxxxx", "barxxxxxxxxxxxxxxxx", "foo", "bar"};
|
|
2955
|
+
PinnableSlice values[] = {PinnableSlice(), PinnableSlice(), PinnableSlice(),
|
|
2956
|
+
PinnableSlice()};
|
|
2957
|
+
Status statuses[] = {Status::OK(), Status::OK(), Status::OK(),
|
|
2958
|
+
Status::OK()};
|
|
2959
|
+
dbfull()->MultiGet(read_opts, /*num_keys=*/4, &column_families[0], &keys[0],
|
|
2960
|
+
&values[0], &statuses[0], /*sorted_input=*/false);
|
|
2961
|
+
for (const auto& s : statuses) {
|
|
2962
|
+
ASSERT_OK(s);
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
Close();
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
INSTANTIATE_TEST_CASE_P(
|
|
2970
|
+
Timestamp, DBBasicTestWithTimestampCompressionSettings,
|
|
2971
|
+
::testing::Combine(
|
|
2972
|
+
::testing::Values(std::shared_ptr<const FilterPolicy>(nullptr),
|
|
2973
|
+
std::shared_ptr<const FilterPolicy>(
|
|
2974
|
+
NewBloomFilterPolicy(10, false))),
|
|
2975
|
+
::testing::Values(kNoCompression, kZlibCompression, kLZ4Compression,
|
|
2976
|
+
kLZ4HCCompression, kZSTD),
|
|
2977
|
+
::testing::Values(0, 1 << 14), ::testing::Values(1, 4)));
|
|
2978
|
+
|
|
2979
|
+
class DBBasicTestWithTimestampPrefixSeek
|
|
2980
|
+
: public DBBasicTestWithTimestampBase,
|
|
2981
|
+
public testing::WithParamInterface<
|
|
2982
|
+
std::tuple<std::shared_ptr<const SliceTransform>,
|
|
2983
|
+
std::shared_ptr<const FilterPolicy>, bool,
|
|
2984
|
+
BlockBasedTableOptions::IndexType>> {
|
|
2985
|
+
public:
|
|
2986
|
+
DBBasicTestWithTimestampPrefixSeek()
|
|
2987
|
+
: DBBasicTestWithTimestampBase(
|
|
2988
|
+
"/db_basic_test_with_timestamp_prefix_seek") {}
|
|
2989
|
+
};
|
|
2990
|
+
|
|
2991
|
+
TEST_P(DBBasicTestWithTimestampPrefixSeek, IterateWithPrefix) {
|
|
2992
|
+
const size_t kNumKeysPerFile = 128;
|
|
2993
|
+
Options options = CurrentOptions();
|
|
2994
|
+
options.env = env_;
|
|
2995
|
+
options.create_if_missing = true;
|
|
2996
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
2997
|
+
TestComparator test_cmp(kTimestampSize);
|
|
2998
|
+
options.comparator = &test_cmp;
|
|
2999
|
+
options.prefix_extractor = std::get<0>(GetParam());
|
|
3000
|
+
options.memtable_factory.reset(
|
|
3001
|
+
test::NewSpecialSkipListFactory(kNumKeysPerFile));
|
|
3002
|
+
BlockBasedTableOptions bbto;
|
|
3003
|
+
bbto.filter_policy = std::get<1>(GetParam());
|
|
3004
|
+
bbto.index_type = std::get<3>(GetParam());
|
|
3005
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
3006
|
+
DestroyAndReopen(options);
|
|
3007
|
+
|
|
3008
|
+
const uint64_t kMaxKey = 0xffffffffffffffff;
|
|
3009
|
+
const uint64_t kMinKey = 0xfffffffffffff000;
|
|
3010
|
+
const std::vector<std::string> write_ts_list = {Timestamp(3, 0xffffffff),
|
|
3011
|
+
Timestamp(6, 0xffffffff)};
|
|
3012
|
+
WriteOptions write_opts;
|
|
3013
|
+
{
|
|
3014
|
+
for (size_t i = 0; i != write_ts_list.size(); ++i) {
|
|
3015
|
+
for (uint64_t key = kMaxKey; key >= kMinKey; --key) {
|
|
3016
|
+
Status s = db_->Put(write_opts, Key1(key), write_ts_list[i],
|
|
3017
|
+
"value" + std::to_string(i));
|
|
3018
|
+
ASSERT_OK(s);
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
const std::vector<std::string> read_ts_list = {Timestamp(5, 0xffffffff),
|
|
3023
|
+
Timestamp(9, 0xffffffff)};
|
|
3024
|
+
{
|
|
3025
|
+
ReadOptions read_opts;
|
|
3026
|
+
read_opts.total_order_seek = false;
|
|
3027
|
+
read_opts.prefix_same_as_start = std::get<2>(GetParam());
|
|
3028
|
+
fprintf(stdout, "%s %s %d\n", options.prefix_extractor->Name(),
|
|
3029
|
+
bbto.filter_policy ? bbto.filter_policy->Name() : "null",
|
|
3030
|
+
static_cast<int>(read_opts.prefix_same_as_start));
|
|
3031
|
+
for (size_t i = 0; i != read_ts_list.size(); ++i) {
|
|
3032
|
+
Slice read_ts = read_ts_list[i];
|
|
3033
|
+
read_opts.timestamp = &read_ts;
|
|
3034
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
3035
|
+
|
|
3036
|
+
// Seek to kMaxKey
|
|
3037
|
+
iter->Seek(Key1(kMaxKey));
|
|
3038
|
+
CheckIterUserEntry(iter.get(), Key1(kMaxKey), kTypeValue,
|
|
3039
|
+
"value" + std::to_string(i), write_ts_list[i]);
|
|
3040
|
+
iter->Next();
|
|
3041
|
+
ASSERT_FALSE(iter->Valid());
|
|
3042
|
+
|
|
3043
|
+
// Seek to kMinKey
|
|
3044
|
+
iter->Seek(Key1(kMinKey));
|
|
3045
|
+
CheckIterUserEntry(iter.get(), Key1(kMinKey), kTypeValue,
|
|
3046
|
+
"value" + std::to_string(i), write_ts_list[i]);
|
|
3047
|
+
iter->Prev();
|
|
3048
|
+
ASSERT_FALSE(iter->Valid());
|
|
3049
|
+
}
|
|
3050
|
+
const std::vector<uint64_t> targets = {kMinKey, kMinKey + 0x10,
|
|
3051
|
+
kMinKey + 0x100, kMaxKey};
|
|
3052
|
+
const SliceTransform* const pe = options.prefix_extractor.get();
|
|
3053
|
+
ASSERT_NE(nullptr, pe);
|
|
3054
|
+
const size_t kPrefixShift =
|
|
3055
|
+
8 * (Key1(0).size() - pe->Transform(Key1(0)).size());
|
|
3056
|
+
const uint64_t kPrefixMask =
|
|
3057
|
+
~((static_cast<uint64_t>(1) << kPrefixShift) - 1);
|
|
3058
|
+
const uint64_t kNumKeysWithinPrefix =
|
|
3059
|
+
(static_cast<uint64_t>(1) << kPrefixShift);
|
|
3060
|
+
for (size_t i = 0; i != read_ts_list.size(); ++i) {
|
|
3061
|
+
Slice read_ts = read_ts_list[i];
|
|
3062
|
+
read_opts.timestamp = &read_ts;
|
|
3063
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
3064
|
+
// Forward and backward iterate.
|
|
3065
|
+
for (size_t j = 0; j != targets.size(); ++j) {
|
|
3066
|
+
std::string start_key = Key1(targets[j]);
|
|
3067
|
+
uint64_t expected_ub =
|
|
3068
|
+
(targets[j] & kPrefixMask) - 1 + kNumKeysWithinPrefix;
|
|
3069
|
+
uint64_t expected_key = targets[j];
|
|
3070
|
+
size_t count = 0;
|
|
3071
|
+
it->Seek(Key1(targets[j]));
|
|
3072
|
+
while (it->Valid()) {
|
|
3073
|
+
std::string saved_prev_key;
|
|
3074
|
+
saved_prev_key.assign(it->key().data(), it->key().size());
|
|
3075
|
+
|
|
3076
|
+
// Out of prefix
|
|
3077
|
+
if (!read_opts.prefix_same_as_start &&
|
|
3078
|
+
pe->Transform(saved_prev_key) != pe->Transform(start_key)) {
|
|
3079
|
+
break;
|
|
3080
|
+
}
|
|
3081
|
+
CheckIterUserEntry(it.get(), Key1(expected_key), kTypeValue,
|
|
3082
|
+
"value" + std::to_string(i), write_ts_list[i]);
|
|
3083
|
+
++count;
|
|
3084
|
+
++expected_key;
|
|
3085
|
+
it->Next();
|
|
3086
|
+
}
|
|
3087
|
+
ASSERT_EQ(expected_ub - targets[j] + 1, count);
|
|
3088
|
+
|
|
3089
|
+
count = 0;
|
|
3090
|
+
expected_key = targets[j];
|
|
3091
|
+
it->SeekForPrev(start_key);
|
|
3092
|
+
uint64_t expected_lb = (targets[j] & kPrefixMask);
|
|
3093
|
+
while (it->Valid()) {
|
|
3094
|
+
// Out of prefix
|
|
3095
|
+
if (!read_opts.prefix_same_as_start &&
|
|
3096
|
+
pe->Transform(it->key()) != pe->Transform(start_key)) {
|
|
3097
|
+
break;
|
|
3098
|
+
}
|
|
3099
|
+
CheckIterUserEntry(it.get(), Key1(expected_key), kTypeValue,
|
|
3100
|
+
"value" + std::to_string(i), write_ts_list[i]);
|
|
3101
|
+
++count;
|
|
3102
|
+
--expected_key;
|
|
3103
|
+
it->Prev();
|
|
3104
|
+
}
|
|
3105
|
+
ASSERT_EQ(targets[j] - std::max(expected_lb, kMinKey) + 1, count);
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
Close();
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
// TODO(yanqin): consider handling non-fixed-length prefix extractors, e.g.
|
|
3113
|
+
// NoopTransform.
|
|
3114
|
+
INSTANTIATE_TEST_CASE_P(
|
|
3115
|
+
Timestamp, DBBasicTestWithTimestampPrefixSeek,
|
|
3116
|
+
::testing::Combine(
|
|
3117
|
+
::testing::Values(
|
|
3118
|
+
std::shared_ptr<const SliceTransform>(NewFixedPrefixTransform(1)),
|
|
3119
|
+
std::shared_ptr<const SliceTransform>(NewFixedPrefixTransform(4)),
|
|
3120
|
+
std::shared_ptr<const SliceTransform>(NewFixedPrefixTransform(7)),
|
|
3121
|
+
std::shared_ptr<const SliceTransform>(NewFixedPrefixTransform(8))),
|
|
3122
|
+
::testing::Values(std::shared_ptr<const FilterPolicy>(nullptr),
|
|
3123
|
+
std::shared_ptr<const FilterPolicy>(
|
|
3124
|
+
NewBloomFilterPolicy(10 /*bits_per_key*/, false)),
|
|
3125
|
+
std::shared_ptr<const FilterPolicy>(
|
|
3126
|
+
NewBloomFilterPolicy(20 /*bits_per_key*/,
|
|
3127
|
+
false))),
|
|
3128
|
+
::testing::Bool(),
|
|
3129
|
+
::testing::Values(
|
|
3130
|
+
BlockBasedTableOptions::IndexType::kBinarySearch,
|
|
3131
|
+
BlockBasedTableOptions::IndexType::kHashSearch,
|
|
3132
|
+
BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch,
|
|
3133
|
+
BlockBasedTableOptions::IndexType::kBinarySearchWithFirstKey)));
|
|
3134
|
+
|
|
3135
|
+
class DBBasicTestWithTsIterTombstones
|
|
3136
|
+
: public DBBasicTestWithTimestampBase,
|
|
3137
|
+
public testing::WithParamInterface<
|
|
3138
|
+
std::tuple<std::shared_ptr<const SliceTransform>,
|
|
3139
|
+
std::shared_ptr<const FilterPolicy>, int,
|
|
3140
|
+
BlockBasedTableOptions::IndexType>> {
|
|
3141
|
+
public:
|
|
3142
|
+
DBBasicTestWithTsIterTombstones()
|
|
3143
|
+
: DBBasicTestWithTimestampBase("/db_basic_ts_iter_tombstones") {}
|
|
3144
|
+
};
|
|
3145
|
+
|
|
3146
|
+
TEST_P(DBBasicTestWithTsIterTombstones, IterWithDelete) {
|
|
3147
|
+
constexpr size_t kNumKeysPerFile = 128;
|
|
3148
|
+
Options options = CurrentOptions();
|
|
3149
|
+
options.env = env_;
|
|
3150
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
3151
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3152
|
+
options.comparator = &test_cmp;
|
|
3153
|
+
options.prefix_extractor = std::get<0>(GetParam());
|
|
3154
|
+
options.memtable_factory.reset(
|
|
3155
|
+
test::NewSpecialSkipListFactory(kNumKeysPerFile));
|
|
3156
|
+
BlockBasedTableOptions bbto;
|
|
3157
|
+
bbto.filter_policy = std::get<1>(GetParam());
|
|
3158
|
+
bbto.index_type = std::get<3>(GetParam());
|
|
3159
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
3160
|
+
options.num_levels = std::get<2>(GetParam());
|
|
3161
|
+
DestroyAndReopen(options);
|
|
3162
|
+
std::vector<std::string> write_ts_strs = {Timestamp(2, 0), Timestamp(4, 0)};
|
|
3163
|
+
constexpr uint64_t kMaxKey = 0xffffffffffffffff;
|
|
3164
|
+
constexpr uint64_t kMinKey = 0xfffffffffffff000;
|
|
3165
|
+
// Insert kMinKey...kMaxKey
|
|
3166
|
+
uint64_t key = kMinKey;
|
|
3167
|
+
WriteOptions write_opts;
|
|
3168
|
+
Slice ts = write_ts_strs[0];
|
|
3169
|
+
do {
|
|
3170
|
+
Status s = db_->Put(write_opts, Key1(key), write_ts_strs[0],
|
|
3171
|
+
"value" + std::to_string(key));
|
|
3172
|
+
ASSERT_OK(s);
|
|
3173
|
+
if (kMaxKey == key) {
|
|
3174
|
+
break;
|
|
3175
|
+
}
|
|
3176
|
+
++key;
|
|
3177
|
+
} while (true);
|
|
3178
|
+
|
|
3179
|
+
for (key = kMaxKey; key >= kMinKey; --key) {
|
|
3180
|
+
Status s;
|
|
3181
|
+
if (0 != (key % 2)) {
|
|
3182
|
+
s = db_->Put(write_opts, Key1(key), write_ts_strs[1],
|
|
3183
|
+
"value1" + std::to_string(key));
|
|
3184
|
+
} else {
|
|
3185
|
+
s = db_->Delete(write_opts, Key1(key), write_ts_strs[1]);
|
|
3186
|
+
}
|
|
3187
|
+
ASSERT_OK(s);
|
|
3188
|
+
}
|
|
3189
|
+
ASSERT_OK(dbfull()->TEST_WaitForCompact());
|
|
3190
|
+
{
|
|
3191
|
+
std::string read_ts = Timestamp(4, 0);
|
|
3192
|
+
ts = read_ts;
|
|
3193
|
+
ReadOptions read_opts;
|
|
3194
|
+
read_opts.total_order_seek = true;
|
|
3195
|
+
read_opts.timestamp = &ts;
|
|
3196
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
3197
|
+
size_t count = 0;
|
|
3198
|
+
key = kMinKey + 1;
|
|
3199
|
+
for (iter->SeekToFirst(); iter->Valid(); iter->Next(), ++count, key += 2) {
|
|
3200
|
+
ASSERT_EQ(Key1(key), iter->key());
|
|
3201
|
+
ASSERT_EQ("value1" + std::to_string(key), iter->value());
|
|
3202
|
+
}
|
|
3203
|
+
ASSERT_EQ((kMaxKey - kMinKey + 1) / 2, count);
|
|
3204
|
+
|
|
3205
|
+
for (iter->SeekToLast(), count = 0, key = kMaxKey; iter->Valid();
|
|
3206
|
+
key -= 2, ++count, iter->Prev()) {
|
|
3207
|
+
ASSERT_EQ(Key1(key), iter->key());
|
|
3208
|
+
ASSERT_EQ("value1" + std::to_string(key), iter->value());
|
|
3209
|
+
}
|
|
3210
|
+
ASSERT_EQ((kMaxKey - kMinKey + 1) / 2, count);
|
|
3211
|
+
}
|
|
3212
|
+
Close();
|
|
3213
|
+
}
|
|
3214
|
+
|
|
3215
|
+
INSTANTIATE_TEST_CASE_P(
|
|
3216
|
+
Timestamp, DBBasicTestWithTsIterTombstones,
|
|
3217
|
+
::testing::Combine(
|
|
3218
|
+
::testing::Values(
|
|
3219
|
+
std::shared_ptr<const SliceTransform>(NewFixedPrefixTransform(7)),
|
|
3220
|
+
std::shared_ptr<const SliceTransform>(NewFixedPrefixTransform(8))),
|
|
3221
|
+
::testing::Values(std::shared_ptr<const FilterPolicy>(nullptr),
|
|
3222
|
+
std::shared_ptr<const FilterPolicy>(
|
|
3223
|
+
NewBloomFilterPolicy(10, false)),
|
|
3224
|
+
std::shared_ptr<const FilterPolicy>(
|
|
3225
|
+
NewBloomFilterPolicy(20, false))),
|
|
3226
|
+
::testing::Values(2, 6),
|
|
3227
|
+
::testing::Values(
|
|
3228
|
+
BlockBasedTableOptions::IndexType::kBinarySearch,
|
|
3229
|
+
BlockBasedTableOptions::IndexType::kHashSearch,
|
|
3230
|
+
BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch,
|
|
3231
|
+
BlockBasedTableOptions::IndexType::kBinarySearchWithFirstKey)));
|
|
3232
|
+
#endif // !defined(ROCKSDB_VALGRIND_RUN) || defined(ROCKSDB_FULL_VALGRIND_RUN)
|
|
3233
|
+
|
|
3234
|
+
class UpdateFullHistoryTsLowTest : public DBBasicTestWithTimestampBase {
|
|
3235
|
+
public:
|
|
3236
|
+
UpdateFullHistoryTsLowTest()
|
|
3237
|
+
: DBBasicTestWithTimestampBase("/update_full_history_ts_low_test") {}
|
|
3238
|
+
};
|
|
3239
|
+
|
|
3240
|
+
TEST_F(UpdateFullHistoryTsLowTest, ConcurrentUpdate) {
|
|
3241
|
+
Options options = CurrentOptions();
|
|
3242
|
+
options.env = env_;
|
|
3243
|
+
options.create_if_missing = true;
|
|
3244
|
+
std::string lower_ts_low = Timestamp(10, 0);
|
|
3245
|
+
std::string higher_ts_low = Timestamp(25, 0);
|
|
3246
|
+
const size_t kTimestampSize = lower_ts_low.size();
|
|
3247
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3248
|
+
options.comparator = &test_cmp;
|
|
3249
|
+
|
|
3250
|
+
DestroyAndReopen(options);
|
|
3251
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
3252
|
+
SyncPoint::GetInstance()->ClearAllCallBacks();
|
|
3253
|
+
// This workaround swaps `lower_ts_low` originally used for update by the
|
|
3254
|
+
// caller to `higher_ts_low` after its writer is queued to make sure
|
|
3255
|
+
// the caller will always get a TryAgain error.
|
|
3256
|
+
// It mimics cases where two threads update full_history_ts_low concurrently
|
|
3257
|
+
// with one thread writing a higher ts_low and one thread writing a lower
|
|
3258
|
+
// ts_low.
|
|
3259
|
+
VersionEdit* version_edit;
|
|
3260
|
+
SyncPoint::GetInstance()->SetCallBack(
|
|
3261
|
+
"DBImpl::IncreaseFullHistoryTsLowImpl:BeforeEdit",
|
|
3262
|
+
[&](void* arg) { version_edit = reinterpret_cast<VersionEdit*>(arg); });
|
|
3263
|
+
SyncPoint::GetInstance()->SetCallBack(
|
|
3264
|
+
"VersionSet::LogAndApply:BeforeWriterWaiting",
|
|
3265
|
+
[&](void* /*arg*/) { version_edit->SetFullHistoryTsLow(higher_ts_low); });
|
|
3266
|
+
SyncPoint::GetInstance()->EnableProcessing();
|
|
3267
|
+
ASSERT_TRUE(
|
|
3268
|
+
db_->IncreaseFullHistoryTsLow(db_->DefaultColumnFamily(), lower_ts_low)
|
|
3269
|
+
.IsTryAgain());
|
|
3270
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
3271
|
+
SyncPoint::GetInstance()->ClearAllCallBacks();
|
|
3272
|
+
|
|
3273
|
+
Close();
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3276
|
+
TEST_F(DBBasicTestWithTimestamp,
|
|
3277
|
+
GCPreserveRangeTombstoneWhenNoOrSmallFullHistoryLow) {
|
|
3278
|
+
Options options = CurrentOptions();
|
|
3279
|
+
options.env = env_;
|
|
3280
|
+
options.create_if_missing = true;
|
|
3281
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
3282
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3283
|
+
options.comparator = &test_cmp;
|
|
3284
|
+
DestroyAndReopen(options);
|
|
3285
|
+
|
|
3286
|
+
std::string ts_str = Timestamp(1, 0);
|
|
3287
|
+
WriteOptions wopts;
|
|
3288
|
+
ASSERT_OK(db_->Put(wopts, "k1", ts_str, "v1"));
|
|
3289
|
+
ASSERT_OK(db_->Put(wopts, "k2", ts_str, "v2"));
|
|
3290
|
+
ASSERT_OK(db_->Put(wopts, "k3", ts_str, "v3"));
|
|
3291
|
+
ts_str = Timestamp(2, 0);
|
|
3292
|
+
ASSERT_OK(
|
|
3293
|
+
db_->DeleteRange(wopts, db_->DefaultColumnFamily(), "k1", "k3", ts_str));
|
|
3294
|
+
|
|
3295
|
+
ts_str = Timestamp(3, 0);
|
|
3296
|
+
Slice ts = ts_str;
|
|
3297
|
+
ReadOptions ropts;
|
|
3298
|
+
ropts.timestamp = &ts;
|
|
3299
|
+
CompactRangeOptions cro;
|
|
3300
|
+
cro.full_history_ts_low = nullptr;
|
|
3301
|
+
std::string value, key_ts;
|
|
3302
|
+
Status s;
|
|
3303
|
+
auto verify = [&] {
|
|
3304
|
+
s = db_->Get(ropts, "k1", &value);
|
|
3305
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
3306
|
+
|
|
3307
|
+
s = db_->Get(ropts, "k2", &value, &key_ts);
|
|
3308
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
3309
|
+
ASSERT_EQ(key_ts, Timestamp(2, 0));
|
|
3310
|
+
|
|
3311
|
+
ASSERT_OK(db_->Get(ropts, "k3", &value, &key_ts));
|
|
3312
|
+
ASSERT_EQ(value, "v3");
|
|
3313
|
+
ASSERT_EQ(Timestamp(1, 0), key_ts);
|
|
3314
|
+
|
|
3315
|
+
size_t batch_size = 3;
|
|
3316
|
+
std::vector<std::string> key_strs = {"k1", "k2", "k3"};
|
|
3317
|
+
std::vector<Slice> keys{key_strs.begin(), key_strs.end()};
|
|
3318
|
+
std::vector<PinnableSlice> values(batch_size);
|
|
3319
|
+
std::vector<Status> statuses(batch_size);
|
|
3320
|
+
db_->MultiGet(ropts, db_->DefaultColumnFamily(), batch_size, keys.data(),
|
|
3321
|
+
values.data(), statuses.data(), true /* sorted_input */);
|
|
3322
|
+
ASSERT_TRUE(statuses[0].IsNotFound());
|
|
3323
|
+
ASSERT_TRUE(statuses[1].IsNotFound());
|
|
3324
|
+
ASSERT_OK(statuses[2]);
|
|
3325
|
+
;
|
|
3326
|
+
ASSERT_EQ(values[2], "v3");
|
|
3327
|
+
};
|
|
3328
|
+
verify();
|
|
3329
|
+
ASSERT_OK(db_->CompactRange(cro, nullptr, nullptr));
|
|
3330
|
+
verify();
|
|
3331
|
+
std::string lb = Timestamp(0, 0);
|
|
3332
|
+
Slice lb_slice = lb;
|
|
3333
|
+
cro.full_history_ts_low = &lb_slice;
|
|
3334
|
+
ASSERT_OK(db_->CompactRange(cro, nullptr, nullptr));
|
|
3335
|
+
verify();
|
|
3336
|
+
Close();
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
TEST_F(DBBasicTestWithTimestamp,
|
|
3340
|
+
GCRangeTombstonesAndCoveredKeysRespectingTslow) {
|
|
3341
|
+
Options options = CurrentOptions();
|
|
3342
|
+
options.env = env_;
|
|
3343
|
+
options.create_if_missing = true;
|
|
3344
|
+
BlockBasedTableOptions bbto;
|
|
3345
|
+
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
3346
|
+
bbto.cache_index_and_filter_blocks = true;
|
|
3347
|
+
bbto.whole_key_filtering = true;
|
|
3348
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
3349
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
3350
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3351
|
+
options.comparator = &test_cmp;
|
|
3352
|
+
options.num_levels = 2;
|
|
3353
|
+
DestroyAndReopen(options);
|
|
3354
|
+
|
|
3355
|
+
WriteOptions wopts;
|
|
3356
|
+
ASSERT_OK(db_->Put(wopts, "k1", Timestamp(1, 0), "v1"));
|
|
3357
|
+
ASSERT_OK(db_->Delete(wopts, "k2", Timestamp(2, 0)));
|
|
3358
|
+
ASSERT_OK(db_->DeleteRange(wopts, db_->DefaultColumnFamily(), "k1", "k3",
|
|
3359
|
+
Timestamp(3, 0)));
|
|
3360
|
+
ASSERT_OK(db_->Put(wopts, "k3", Timestamp(4, 0), "v3"));
|
|
3361
|
+
|
|
3362
|
+
ReadOptions ropts;
|
|
3363
|
+
std::string read_ts = Timestamp(5, 0);
|
|
3364
|
+
Slice read_ts_slice = read_ts;
|
|
3365
|
+
ropts.timestamp = &read_ts_slice;
|
|
3366
|
+
size_t batch_size = 3;
|
|
3367
|
+
std::vector<std::string> key_strs = {"k1", "k2", "k3"};
|
|
3368
|
+
std::vector<Slice> keys = {key_strs.begin(), key_strs.end()};
|
|
3369
|
+
std::vector<PinnableSlice> values(batch_size);
|
|
3370
|
+
std::vector<Status> statuses(batch_size);
|
|
3371
|
+
std::vector<std::string> timestamps(batch_size);
|
|
3372
|
+
db_->MultiGet(ropts, db_->DefaultColumnFamily(), batch_size, keys.data(),
|
|
3373
|
+
values.data(), timestamps.data(), statuses.data(),
|
|
3374
|
+
true /* sorted_input */);
|
|
3375
|
+
ASSERT_TRUE(statuses[0].IsNotFound());
|
|
3376
|
+
ASSERT_EQ(timestamps[0], Timestamp(3, 0));
|
|
3377
|
+
ASSERT_TRUE(statuses[1].IsNotFound());
|
|
3378
|
+
// DeleteRange has a higher timestamp than Delete for "k2"
|
|
3379
|
+
ASSERT_EQ(timestamps[1], Timestamp(3, 0));
|
|
3380
|
+
ASSERT_OK(statuses[2]);
|
|
3381
|
+
ASSERT_EQ(values[2], "v3");
|
|
3382
|
+
ASSERT_EQ(timestamps[2], Timestamp(4, 0));
|
|
3383
|
+
|
|
3384
|
+
CompactRangeOptions cro;
|
|
3385
|
+
// Range tombstone has timestamp >= full_history_ts_low, covered keys
|
|
3386
|
+
// are not dropped.
|
|
3387
|
+
std::string compaction_ts_str = Timestamp(2, 0);
|
|
3388
|
+
Slice compaction_ts = compaction_ts_str;
|
|
3389
|
+
cro.full_history_ts_low = &compaction_ts;
|
|
3390
|
+
cro.bottommost_level_compaction = BottommostLevelCompaction::kForce;
|
|
3391
|
+
ASSERT_OK(db_->CompactRange(cro, nullptr, nullptr));
|
|
3392
|
+
ropts.timestamp = &compaction_ts;
|
|
3393
|
+
std::string value, ts;
|
|
3394
|
+
ASSERT_OK(db_->Get(ropts, "k1", &value, &ts));
|
|
3395
|
+
ASSERT_EQ(value, "v1");
|
|
3396
|
+
// timestamp is below full_history_ts_low, zeroed out as the key goes into
|
|
3397
|
+
// bottommost level
|
|
3398
|
+
ASSERT_EQ(ts, Timestamp(0, 0));
|
|
3399
|
+
ASSERT_TRUE(db_->Get(ropts, "k2", &value, &ts).IsNotFound());
|
|
3400
|
+
ASSERT_EQ(ts, Timestamp(2, 0));
|
|
3401
|
+
|
|
3402
|
+
compaction_ts_str = Timestamp(4, 0);
|
|
3403
|
+
compaction_ts = compaction_ts_str;
|
|
3404
|
+
cro.full_history_ts_low = &compaction_ts;
|
|
3405
|
+
ASSERT_OK(db_->CompactRange(cro, nullptr, nullptr));
|
|
3406
|
+
ropts.timestamp = &read_ts_slice;
|
|
3407
|
+
// k1, k2 and the range tombstone should be dropped
|
|
3408
|
+
// k3 should still exist
|
|
3409
|
+
db_->MultiGet(ropts, db_->DefaultColumnFamily(), batch_size, keys.data(),
|
|
3410
|
+
values.data(), timestamps.data(), statuses.data(),
|
|
3411
|
+
true /* sorted_input */);
|
|
3412
|
+
ASSERT_TRUE(statuses[0].IsNotFound());
|
|
3413
|
+
ASSERT_TRUE(timestamps[0].empty());
|
|
3414
|
+
ASSERT_TRUE(statuses[1].IsNotFound());
|
|
3415
|
+
ASSERT_TRUE(timestamps[1].empty());
|
|
3416
|
+
ASSERT_OK(statuses[2]);
|
|
3417
|
+
ASSERT_EQ(values[2], "v3");
|
|
3418
|
+
ASSERT_EQ(timestamps[2], Timestamp(4, 0));
|
|
3419
|
+
|
|
3420
|
+
Close();
|
|
3421
|
+
}
|
|
3422
|
+
|
|
3423
|
+
TEST_P(DBBasicTestWithTimestampTableOptions, DeleteRangeBaiscReadAndIterate) {
|
|
3424
|
+
const int kNum = 200, kRangeBegin = 50, kRangeEnd = 150, kNumPerFile = 25;
|
|
3425
|
+
Options options = CurrentOptions();
|
|
3426
|
+
options.prefix_extractor.reset(NewFixedPrefixTransform(3));
|
|
3427
|
+
options.compression = kNoCompression;
|
|
3428
|
+
BlockBasedTableOptions bbto;
|
|
3429
|
+
bbto.index_type = GetParam();
|
|
3430
|
+
bbto.block_size = 100;
|
|
3431
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
3432
|
+
options.env = env_;
|
|
3433
|
+
options.create_if_missing = true;
|
|
3434
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
3435
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3436
|
+
options.comparator = &test_cmp;
|
|
3437
|
+
options.memtable_factory.reset(test::NewSpecialSkipListFactory(kNumPerFile));
|
|
3438
|
+
DestroyAndReopen(options);
|
|
3439
|
+
|
|
3440
|
+
// Write half of the keys before the tombstone and half after the tombstone.
|
|
3441
|
+
// Only covered keys (i.e., within the range and older than the tombstone)
|
|
3442
|
+
// should be deleted.
|
|
3443
|
+
for (int i = 0; i < kNum; ++i) {
|
|
3444
|
+
if (i == kNum / 2) {
|
|
3445
|
+
ASSERT_OK(db_->DeleteRange(WriteOptions(), db_->DefaultColumnFamily(),
|
|
3446
|
+
Key1(kRangeBegin), Key1(kRangeEnd),
|
|
3447
|
+
Timestamp(i, 0)));
|
|
3448
|
+
}
|
|
3449
|
+
ASSERT_OK(db_->Put(WriteOptions(), Key1(i), Timestamp(i, 0),
|
|
3450
|
+
"val" + std::to_string(i)));
|
|
3451
|
+
if (i == kNum - kNumPerFile) {
|
|
3452
|
+
ASSERT_OK(Flush());
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
|
|
3456
|
+
ReadOptions read_opts;
|
|
3457
|
+
read_opts.total_order_seek = true;
|
|
3458
|
+
std::string read_ts = Timestamp(kNum, 0);
|
|
3459
|
+
Slice read_ts_slice = read_ts;
|
|
3460
|
+
read_opts.timestamp = &read_ts_slice;
|
|
3461
|
+
{
|
|
3462
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
3463
|
+
ASSERT_OK(iter->status());
|
|
3464
|
+
|
|
3465
|
+
int expected = 0;
|
|
3466
|
+
for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
|
|
3467
|
+
ASSERT_EQ(Key1(expected), iter->key());
|
|
3468
|
+
if (expected == kRangeBegin - 1) {
|
|
3469
|
+
expected = kNum / 2;
|
|
3470
|
+
} else {
|
|
3471
|
+
++expected;
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
ASSERT_EQ(kNum, expected);
|
|
3475
|
+
|
|
3476
|
+
expected = kNum / 2;
|
|
3477
|
+
for (iter->Seek(Key1(kNum / 2)); iter->Valid(); iter->Next()) {
|
|
3478
|
+
ASSERT_EQ(Key1(expected), iter->key());
|
|
3479
|
+
++expected;
|
|
3480
|
+
}
|
|
3481
|
+
ASSERT_EQ(kNum, expected);
|
|
3482
|
+
|
|
3483
|
+
expected = kRangeBegin - 1;
|
|
3484
|
+
for (iter->SeekForPrev(Key1(kNum / 2 - 1)); iter->Valid(); iter->Prev()) {
|
|
3485
|
+
ASSERT_EQ(Key1(expected), iter->key());
|
|
3486
|
+
--expected;
|
|
3487
|
+
}
|
|
3488
|
+
ASSERT_EQ(-1, expected);
|
|
3489
|
+
|
|
3490
|
+
read_ts = Timestamp(0, 0);
|
|
3491
|
+
read_ts_slice = read_ts;
|
|
3492
|
+
read_opts.timestamp = &read_ts_slice;
|
|
3493
|
+
iter.reset(db_->NewIterator(read_opts));
|
|
3494
|
+
iter->SeekToFirst();
|
|
3495
|
+
ASSERT_TRUE(iter->Valid());
|
|
3496
|
+
ASSERT_EQ(iter->key(), Key1(0));
|
|
3497
|
+
iter->Next();
|
|
3498
|
+
ASSERT_FALSE(iter->Valid());
|
|
3499
|
+
ASSERT_OK(iter->status());
|
|
3500
|
+
}
|
|
3501
|
+
|
|
3502
|
+
read_ts = Timestamp(kNum, 0);
|
|
3503
|
+
read_ts_slice = read_ts;
|
|
3504
|
+
read_opts.timestamp = &read_ts_slice;
|
|
3505
|
+
std::string value, timestamp;
|
|
3506
|
+
Status s;
|
|
3507
|
+
for (int i = 0; i < kNum; ++i) {
|
|
3508
|
+
s = db_->Get(read_opts, Key1(i), &value, ×tamp);
|
|
3509
|
+
if (i >= kRangeBegin && i < kNum / 2) {
|
|
3510
|
+
ASSERT_TRUE(s.IsNotFound());
|
|
3511
|
+
ASSERT_EQ(timestamp, Timestamp(kNum / 2, 0));
|
|
3512
|
+
} else {
|
|
3513
|
+
ASSERT_OK(s);
|
|
3514
|
+
ASSERT_EQ(value, "val" + std::to_string(i));
|
|
3515
|
+
ASSERT_EQ(timestamp, Timestamp(i, 0));
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3519
|
+
size_t batch_size = kNum;
|
|
3520
|
+
std::vector<std::string> key_strs(batch_size);
|
|
3521
|
+
std::vector<Slice> keys(batch_size);
|
|
3522
|
+
std::vector<PinnableSlice> values(batch_size);
|
|
3523
|
+
std::vector<Status> statuses(batch_size);
|
|
3524
|
+
std::vector<std::string> timestamps(batch_size);
|
|
3525
|
+
for (int i = 0; i < kNum; ++i) {
|
|
3526
|
+
key_strs[i] = Key1(i);
|
|
3527
|
+
keys[i] = key_strs[i];
|
|
3528
|
+
}
|
|
3529
|
+
db_->MultiGet(read_opts, db_->DefaultColumnFamily(), batch_size, keys.data(),
|
|
3530
|
+
values.data(), timestamps.data(), statuses.data(),
|
|
3531
|
+
true /* sorted_input */);
|
|
3532
|
+
for (int i = 0; i < kNum; ++i) {
|
|
3533
|
+
if (i >= kRangeBegin && i < kNum / 2) {
|
|
3534
|
+
ASSERT_TRUE(statuses[i].IsNotFound());
|
|
3535
|
+
ASSERT_EQ(timestamps[i], Timestamp(kNum / 2, 0));
|
|
3536
|
+
} else {
|
|
3537
|
+
ASSERT_OK(statuses[i]);
|
|
3538
|
+
ASSERT_EQ(values[i], "val" + std::to_string(i));
|
|
3539
|
+
ASSERT_EQ(timestamps[i], Timestamp(i, 0));
|
|
3540
|
+
}
|
|
3541
|
+
}
|
|
3542
|
+
Close();
|
|
3543
|
+
}
|
|
3544
|
+
|
|
3545
|
+
TEST_F(DBBasicTestWithTimestamp, DeleteRangeGetIteratorWithSnapshot) {
|
|
3546
|
+
// 4 keys 0, 1, 2, 3 at timestamps 0, 1, 2, 3 respectively.
|
|
3547
|
+
// A range tombstone [1, 3) at timestamp 1 and has a sequence number between
|
|
3548
|
+
// key 1 and 2.
|
|
3549
|
+
Options options = CurrentOptions();
|
|
3550
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
3551
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3552
|
+
options.comparator = &test_cmp;
|
|
3553
|
+
DestroyAndReopen(options);
|
|
3554
|
+
WriteOptions write_opts;
|
|
3555
|
+
std::string put_ts = Timestamp(0, 0);
|
|
3556
|
+
const int kNum = 4, kNumPerFile = 1, kRangeBegin = 1, kRangeEnd = 3;
|
|
3557
|
+
options.memtable_factory.reset(test::NewSpecialSkipListFactory(kNumPerFile));
|
|
3558
|
+
const Snapshot* before_tombstone = nullptr;
|
|
3559
|
+
const Snapshot* after_tombstone = nullptr;
|
|
3560
|
+
for (int i = 0; i < kNum; ++i) {
|
|
3561
|
+
ASSERT_OK(db_->Put(WriteOptions(), Key1(i), Timestamp(i, 0),
|
|
3562
|
+
"val" + std::to_string(i)));
|
|
3563
|
+
if (i == kRangeBegin) {
|
|
3564
|
+
before_tombstone = db_->GetSnapshot();
|
|
3565
|
+
ASSERT_OK(db_->DeleteRange(WriteOptions(), db_->DefaultColumnFamily(),
|
|
3566
|
+
Key1(kRangeBegin), Key1(kRangeEnd),
|
|
3567
|
+
Timestamp(kRangeBegin, 0)));
|
|
3568
|
+
}
|
|
3569
|
+
if (i == kNum / 2) {
|
|
3570
|
+
ASSERT_OK(Flush());
|
|
3571
|
+
}
|
|
3572
|
+
}
|
|
3573
|
+
assert(before_tombstone);
|
|
3574
|
+
after_tombstone = db_->GetSnapshot();
|
|
3575
|
+
// snapshot and ts before tombstone
|
|
3576
|
+
std::string read_ts_str = Timestamp(kRangeBegin - 1, 0); // (0, 0)
|
|
3577
|
+
Slice read_ts = read_ts_str;
|
|
3578
|
+
ReadOptions read_opts;
|
|
3579
|
+
read_opts.timestamp = &read_ts;
|
|
3580
|
+
read_opts.snapshot = before_tombstone;
|
|
3581
|
+
std::vector<Status> expected_status = {
|
|
3582
|
+
Status::OK(), Status::NotFound(), Status::NotFound(), Status::NotFound()};
|
|
3583
|
+
std::vector<std::string> expected_values(kNum);
|
|
3584
|
+
expected_values[0] = "val" + std::to_string(0);
|
|
3585
|
+
std::vector<std::string> expected_timestamps(kNum);
|
|
3586
|
+
expected_timestamps[0] = Timestamp(0, 0);
|
|
3587
|
+
|
|
3588
|
+
size_t batch_size = kNum;
|
|
3589
|
+
std::vector<std::string> key_strs(batch_size);
|
|
3590
|
+
std::vector<Slice> keys(batch_size);
|
|
3591
|
+
std::vector<PinnableSlice> values(batch_size);
|
|
3592
|
+
std::vector<Status> statuses(batch_size);
|
|
3593
|
+
std::vector<std::string> timestamps(batch_size);
|
|
3594
|
+
for (int i = 0; i < kNum; ++i) {
|
|
3595
|
+
key_strs[i] = Key1(i);
|
|
3596
|
+
keys[i] = key_strs[i];
|
|
3597
|
+
}
|
|
3598
|
+
|
|
3599
|
+
auto verify = [&] {
|
|
3600
|
+
db_->MultiGet(read_opts, db_->DefaultColumnFamily(), batch_size,
|
|
3601
|
+
keys.data(), values.data(), timestamps.data(),
|
|
3602
|
+
statuses.data(), true /* sorted_input */);
|
|
3603
|
+
std::string value, timestamp;
|
|
3604
|
+
Status s;
|
|
3605
|
+
for (int i = 0; i < kNum; ++i) {
|
|
3606
|
+
s = db_->Get(read_opts, Key1(i), &value, ×tamp);
|
|
3607
|
+
ASSERT_EQ(s, expected_status[i]);
|
|
3608
|
+
ASSERT_EQ(statuses[i], expected_status[i]);
|
|
3609
|
+
if (s.ok()) {
|
|
3610
|
+
ASSERT_EQ(value, expected_values[i]);
|
|
3611
|
+
ASSERT_EQ(values[i], expected_values[i]);
|
|
3612
|
+
}
|
|
3613
|
+
if (!timestamp.empty()) {
|
|
3614
|
+
ASSERT_EQ(timestamp, expected_timestamps[i]);
|
|
3615
|
+
ASSERT_EQ(timestamps[i], expected_timestamps[i]);
|
|
3616
|
+
} else {
|
|
3617
|
+
ASSERT_TRUE(timestamps[i].empty());
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
std::unique_ptr<Iterator> iter(db_->NewIterator(read_opts));
|
|
3621
|
+
std::unique_ptr<Iterator> iter_for_seek(db_->NewIterator(read_opts));
|
|
3622
|
+
iter->SeekToFirst();
|
|
3623
|
+
for (int i = 0; i < kNum; ++i) {
|
|
3624
|
+
if (expected_status[i].ok()) {
|
|
3625
|
+
auto verify_iter = [&](Iterator* iter_ptr) {
|
|
3626
|
+
ASSERT_TRUE(iter_ptr->Valid());
|
|
3627
|
+
ASSERT_EQ(iter_ptr->key(), keys[i]);
|
|
3628
|
+
ASSERT_EQ(iter_ptr->value(), expected_values[i]);
|
|
3629
|
+
ASSERT_EQ(iter_ptr->timestamp(), expected_timestamps[i]);
|
|
3630
|
+
};
|
|
3631
|
+
verify_iter(iter.get());
|
|
3632
|
+
iter->Next();
|
|
3633
|
+
|
|
3634
|
+
iter_for_seek->Seek(keys[i]);
|
|
3635
|
+
verify_iter(iter_for_seek.get());
|
|
3636
|
+
|
|
3637
|
+
iter_for_seek->SeekForPrev(keys[i]);
|
|
3638
|
+
verify_iter(iter_for_seek.get());
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
ASSERT_FALSE(iter->Valid());
|
|
3642
|
+
ASSERT_OK(iter->status());
|
|
3643
|
+
};
|
|
3644
|
+
|
|
3645
|
+
verify();
|
|
3646
|
+
|
|
3647
|
+
// snapshot before tombstone and ts after tombstone
|
|
3648
|
+
read_ts_str = Timestamp(kNum, 0); // (4, 0)
|
|
3649
|
+
read_ts = read_ts_str;
|
|
3650
|
+
read_opts.timestamp = &read_ts;
|
|
3651
|
+
read_opts.snapshot = before_tombstone;
|
|
3652
|
+
expected_status[1] = Status::OK();
|
|
3653
|
+
expected_timestamps[1] = Timestamp(1, 0);
|
|
3654
|
+
expected_values[1] = "val" + std::to_string(1);
|
|
3655
|
+
verify();
|
|
3656
|
+
|
|
3657
|
+
// snapshot after tombstone and ts before tombstone
|
|
3658
|
+
read_ts_str = Timestamp(kRangeBegin - 1, 0); // (0, 0)
|
|
3659
|
+
read_ts = read_ts_str;
|
|
3660
|
+
read_opts.timestamp = &read_ts;
|
|
3661
|
+
read_opts.snapshot = after_tombstone;
|
|
3662
|
+
expected_status[1] = Status::NotFound();
|
|
3663
|
+
expected_timestamps[1].clear();
|
|
3664
|
+
expected_values[1].clear();
|
|
3665
|
+
verify();
|
|
3666
|
+
|
|
3667
|
+
// snapshot and ts after tombstone
|
|
3668
|
+
read_ts_str = Timestamp(kNum, 0); // (4, 0)
|
|
3669
|
+
read_ts = read_ts_str;
|
|
3670
|
+
read_opts.timestamp = &read_ts;
|
|
3671
|
+
read_opts.snapshot = after_tombstone;
|
|
3672
|
+
for (int i = 0; i < kNum; ++i) {
|
|
3673
|
+
if (i == kRangeBegin) {
|
|
3674
|
+
expected_status[i] = Status::NotFound();
|
|
3675
|
+
expected_values[i].clear();
|
|
3676
|
+
} else {
|
|
3677
|
+
expected_status[i] = Status::OK();
|
|
3678
|
+
expected_values[i] = "val" + std::to_string(i);
|
|
3679
|
+
}
|
|
3680
|
+
expected_timestamps[i] = Timestamp(i, 0);
|
|
3681
|
+
}
|
|
3682
|
+
verify();
|
|
3683
|
+
|
|
3684
|
+
db_->ReleaseSnapshot(before_tombstone);
|
|
3685
|
+
db_->ReleaseSnapshot(after_tombstone);
|
|
3686
|
+
Close();
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3689
|
+
TEST_F(DBBasicTestWithTimestamp, MergeBasic) {
|
|
3690
|
+
Options options = GetDefaultOptions();
|
|
3691
|
+
options.create_if_missing = true;
|
|
3692
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
3693
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3694
|
+
options.comparator = &test_cmp;
|
|
3695
|
+
options.merge_operator = std::make_shared<StringAppendTESTOperator>('.');
|
|
3696
|
+
DestroyAndReopen(options);
|
|
3697
|
+
|
|
3698
|
+
const std::array<std::string, 3> write_ts_strs = {
|
|
3699
|
+
Timestamp(100, 0), Timestamp(200, 0), Timestamp(300, 0)};
|
|
3700
|
+
constexpr size_t kNumOfUniqKeys = 100;
|
|
3701
|
+
ColumnFamilyHandle* default_cf = db_->DefaultColumnFamily();
|
|
3702
|
+
|
|
3703
|
+
for (size_t i = 0; i < write_ts_strs.size(); ++i) {
|
|
3704
|
+
for (size_t j = 0; j < kNumOfUniqKeys; ++j) {
|
|
3705
|
+
Status s;
|
|
3706
|
+
if (i == 0) {
|
|
3707
|
+
const std::string val = "v" + std::to_string(j) + "_0";
|
|
3708
|
+
s = db_->Put(WriteOptions(), Key1(j), write_ts_strs[i], val);
|
|
3709
|
+
} else {
|
|
3710
|
+
const std::string merge_op = std::to_string(i);
|
|
3711
|
+
s = db_->Merge(WriteOptions(), default_cf, Key1(j), write_ts_strs[i],
|
|
3712
|
+
merge_op);
|
|
3713
|
+
}
|
|
3714
|
+
ASSERT_OK(s);
|
|
3715
|
+
}
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
std::array<std::string, 3> read_ts_strs = {
|
|
3719
|
+
Timestamp(150, 0), Timestamp(250, 0), Timestamp(350, 0)};
|
|
3720
|
+
|
|
3721
|
+
const auto verify_db_with_get = [&]() {
|
|
3722
|
+
for (size_t i = 0; i < kNumOfUniqKeys; ++i) {
|
|
3723
|
+
const std::string base_val = "v" + std::to_string(i) + "_0";
|
|
3724
|
+
const std::array<std::string, 3> expected_values = {
|
|
3725
|
+
base_val, base_val + ".1", base_val + ".1.2"};
|
|
3726
|
+
const std::array<std::string, 3>& expected_ts = write_ts_strs;
|
|
3727
|
+
ReadOptions read_opts;
|
|
3728
|
+
for (size_t j = 0; j < read_ts_strs.size(); ++j) {
|
|
3729
|
+
Slice read_ts = read_ts_strs[j];
|
|
3730
|
+
read_opts.timestamp = &read_ts;
|
|
3731
|
+
std::string value;
|
|
3732
|
+
std::string ts;
|
|
3733
|
+
const Status s = db_->Get(read_opts, Key1(i), &value, &ts);
|
|
3734
|
+
ASSERT_OK(s);
|
|
3735
|
+
ASSERT_EQ(expected_values[j], value);
|
|
3736
|
+
ASSERT_EQ(expected_ts[j], ts);
|
|
3737
|
+
|
|
3738
|
+
// Do Seek/SeekForPrev
|
|
3739
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
3740
|
+
it->Seek(Key1(i));
|
|
3741
|
+
ASSERT_TRUE(it->Valid());
|
|
3742
|
+
ASSERT_EQ(expected_values[j], it->value());
|
|
3743
|
+
ASSERT_EQ(expected_ts[j], it->timestamp());
|
|
3744
|
+
|
|
3745
|
+
it->SeekForPrev(Key1(i));
|
|
3746
|
+
ASSERT_TRUE(it->Valid());
|
|
3747
|
+
ASSERT_EQ(expected_values[j], it->value());
|
|
3748
|
+
ASSERT_EQ(expected_ts[j], it->timestamp());
|
|
3749
|
+
}
|
|
3750
|
+
}
|
|
3751
|
+
};
|
|
3752
|
+
|
|
3753
|
+
const auto verify_db_with_iterator = [&]() {
|
|
3754
|
+
std::string value_suffix;
|
|
3755
|
+
for (size_t i = 0; i < read_ts_strs.size(); ++i) {
|
|
3756
|
+
ReadOptions read_opts;
|
|
3757
|
+
Slice read_ts = read_ts_strs[i];
|
|
3758
|
+
read_opts.timestamp = &read_ts;
|
|
3759
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
3760
|
+
size_t key_int_val = 0;
|
|
3761
|
+
for (it->SeekToFirst(); it->Valid(); it->Next(), ++key_int_val) {
|
|
3762
|
+
const std::string key = Key1(key_int_val);
|
|
3763
|
+
const std::string value =
|
|
3764
|
+
"v" + std::to_string(key_int_val) + "_0" + value_suffix;
|
|
3765
|
+
ASSERT_EQ(key, it->key());
|
|
3766
|
+
ASSERT_EQ(value, it->value());
|
|
3767
|
+
ASSERT_EQ(write_ts_strs[i], it->timestamp());
|
|
3768
|
+
}
|
|
3769
|
+
ASSERT_EQ(kNumOfUniqKeys, key_int_val);
|
|
3770
|
+
|
|
3771
|
+
key_int_val = kNumOfUniqKeys - 1;
|
|
3772
|
+
for (it->SeekToLast(); it->Valid(); it->Prev(), --key_int_val) {
|
|
3773
|
+
const std::string key = Key1(key_int_val);
|
|
3774
|
+
const std::string value =
|
|
3775
|
+
"v" + std::to_string(key_int_val) + "_0" + value_suffix;
|
|
3776
|
+
ASSERT_EQ(key, it->key());
|
|
3777
|
+
ASSERT_EQ(value, it->value());
|
|
3778
|
+
ASSERT_EQ(write_ts_strs[i], it->timestamp());
|
|
3779
|
+
}
|
|
3780
|
+
ASSERT_EQ(std::numeric_limits<size_t>::max(), key_int_val);
|
|
3781
|
+
|
|
3782
|
+
value_suffix = value_suffix + "." + std::to_string(i + 1);
|
|
3783
|
+
}
|
|
3784
|
+
};
|
|
3785
|
+
|
|
3786
|
+
verify_db_with_get();
|
|
3787
|
+
verify_db_with_iterator();
|
|
3788
|
+
|
|
3789
|
+
ASSERT_OK(db_->Flush(FlushOptions()));
|
|
3790
|
+
|
|
3791
|
+
verify_db_with_get();
|
|
3792
|
+
verify_db_with_iterator();
|
|
3793
|
+
|
|
3794
|
+
Close();
|
|
3795
|
+
}
|
|
3796
|
+
|
|
3797
|
+
TEST_F(DBBasicTestWithTimestamp, MergeAfterDeletion) {
|
|
3798
|
+
Options options = GetDefaultOptions();
|
|
3799
|
+
options.create_if_missing = true;
|
|
3800
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
3801
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3802
|
+
options.comparator = &test_cmp;
|
|
3803
|
+
options.merge_operator = std::make_shared<StringAppendTESTOperator>('.');
|
|
3804
|
+
DestroyAndReopen(options);
|
|
3805
|
+
|
|
3806
|
+
ColumnFamilyHandle* const column_family = db_->DefaultColumnFamily();
|
|
3807
|
+
|
|
3808
|
+
const size_t num_keys_per_file = 10;
|
|
3809
|
+
const size_t num_merges_per_key = 2;
|
|
3810
|
+
for (size_t i = 0; i < num_keys_per_file; ++i) {
|
|
3811
|
+
std::string ts = Timestamp(i + 10000, 0);
|
|
3812
|
+
Status s = db_->Delete(WriteOptions(), Key1(i), ts);
|
|
3813
|
+
ASSERT_OK(s);
|
|
3814
|
+
for (size_t j = 1; j <= num_merges_per_key; ++j) {
|
|
3815
|
+
ts = Timestamp(i + 10000 + j, 0);
|
|
3816
|
+
s = db_->Merge(WriteOptions(), column_family, Key1(i), ts,
|
|
3817
|
+
std::to_string(j));
|
|
3818
|
+
ASSERT_OK(s);
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
|
|
3822
|
+
const auto verify_db = [&]() {
|
|
3823
|
+
ReadOptions read_opts;
|
|
3824
|
+
std::string read_ts_str = Timestamp(20000, 0);
|
|
3825
|
+
Slice ts = read_ts_str;
|
|
3826
|
+
read_opts.timestamp = &ts;
|
|
3827
|
+
std::unique_ptr<Iterator> it(db_->NewIterator(read_opts));
|
|
3828
|
+
size_t count = 0;
|
|
3829
|
+
for (it->SeekToFirst(); it->Valid(); it->Next(), ++count) {
|
|
3830
|
+
std::string key = Key1(count);
|
|
3831
|
+
ASSERT_EQ(key, it->key());
|
|
3832
|
+
std::string value;
|
|
3833
|
+
for (size_t j = 1; j <= num_merges_per_key; ++j) {
|
|
3834
|
+
value.append(std::to_string(j));
|
|
3835
|
+
if (j < num_merges_per_key) {
|
|
3836
|
+
value.push_back('.');
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
ASSERT_EQ(value, it->value());
|
|
3840
|
+
std::string ts1 = Timestamp(count + 10000 + num_merges_per_key, 0);
|
|
3841
|
+
ASSERT_EQ(ts1, it->timestamp());
|
|
3842
|
+
}
|
|
3843
|
+
ASSERT_OK(it->status());
|
|
3844
|
+
ASSERT_EQ(num_keys_per_file, count);
|
|
3845
|
+
for (it->SeekToLast(); it->Valid(); it->Prev(), --count) {
|
|
3846
|
+
std::string key = Key1(count - 1);
|
|
3847
|
+
ASSERT_EQ(key, it->key());
|
|
3848
|
+
std::string value;
|
|
3849
|
+
for (size_t j = 1; j <= num_merges_per_key; ++j) {
|
|
3850
|
+
value.append(std::to_string(j));
|
|
3851
|
+
if (j < num_merges_per_key) {
|
|
3852
|
+
value.push_back('.');
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
ASSERT_EQ(value, it->value());
|
|
3856
|
+
std::string ts1 = Timestamp(count - 1 + 10000 + num_merges_per_key, 0);
|
|
3857
|
+
ASSERT_EQ(ts1, it->timestamp());
|
|
3858
|
+
}
|
|
3859
|
+
ASSERT_OK(it->status());
|
|
3860
|
+
ASSERT_EQ(0, count);
|
|
3861
|
+
};
|
|
3862
|
+
|
|
3863
|
+
verify_db();
|
|
3864
|
+
|
|
3865
|
+
Close();
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3868
|
+
TEST_F(DBBasicTestWithTimestamp, RangeTombstoneApproximateSize) {
|
|
3869
|
+
// Test code path for calculating range tombstone compensated size
|
|
3870
|
+
// during flush and compaction.
|
|
3871
|
+
Options options = CurrentOptions();
|
|
3872
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
3873
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3874
|
+
options.comparator = &test_cmp;
|
|
3875
|
+
DestroyAndReopen(options);
|
|
3876
|
+
// So that the compaction below is non-bottommost and will calcualte
|
|
3877
|
+
// compensated range tombstone size.
|
|
3878
|
+
ASSERT_OK(db_->Put(WriteOptions(), Key(1), Timestamp(1, 0), "val"));
|
|
3879
|
+
ASSERT_OK(Flush());
|
|
3880
|
+
MoveFilesToLevel(5);
|
|
3881
|
+
ASSERT_OK(db_->DeleteRange(WriteOptions(), db_->DefaultColumnFamily(), Key(0),
|
|
3882
|
+
Key(1), Timestamp(1, 0)));
|
|
3883
|
+
ASSERT_OK(db_->DeleteRange(WriteOptions(), db_->DefaultColumnFamily(), Key(1),
|
|
3884
|
+
Key(2), Timestamp(2, 0)));
|
|
3885
|
+
ASSERT_OK(Flush());
|
|
3886
|
+
ASSERT_OK(dbfull()->RunManualCompaction(
|
|
3887
|
+
static_cast_with_check<ColumnFamilyHandleImpl>(db_->DefaultColumnFamily())
|
|
3888
|
+
->cfd(),
|
|
3889
|
+
0 /* input_level */, 1 /* output_level */, CompactRangeOptions(),
|
|
3890
|
+
nullptr /* begin */, nullptr /* end */, true /* exclusive */,
|
|
3891
|
+
true /* disallow_trivial_move */,
|
|
3892
|
+
std::numeric_limits<uint64_t>::max() /* max_file_num_to_ignore */,
|
|
3893
|
+
"" /*trim_ts*/));
|
|
3894
|
+
}
|
|
3895
|
+
|
|
3896
|
+
TEST_F(DBBasicTestWithTimestamp, IterSeekToLastWithIterateUpperbound) {
|
|
3897
|
+
// Test for a bug fix where DBIter::SeekToLast() could fail when
|
|
3898
|
+
// iterate_upper_bound and iter_start_ts are both set.
|
|
3899
|
+
Options options = CurrentOptions();
|
|
3900
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
3901
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3902
|
+
options.comparator = &test_cmp;
|
|
3903
|
+
DestroyAndReopen(options);
|
|
3904
|
+
|
|
3905
|
+
ASSERT_OK(db_->Put(WriteOptions(), Key(1), Timestamp(2, 0), "val"));
|
|
3906
|
+
ReadOptions ro;
|
|
3907
|
+
std::string k = Key(1);
|
|
3908
|
+
Slice k_slice = k;
|
|
3909
|
+
ro.iterate_upper_bound = &k_slice;
|
|
3910
|
+
std::string ts = Timestamp(3, 0);
|
|
3911
|
+
Slice read_ts = ts;
|
|
3912
|
+
ro.timestamp = &read_ts;
|
|
3913
|
+
std::string start_ts = Timestamp(0, 0);
|
|
3914
|
+
Slice start_ts_slice = start_ts;
|
|
3915
|
+
ro.iter_start_ts = &start_ts_slice;
|
|
3916
|
+
std::unique_ptr<Iterator> iter{db_->NewIterator(ro)};
|
|
3917
|
+
iter->SeekToLast();
|
|
3918
|
+
ASSERT_FALSE(iter->Valid());
|
|
3919
|
+
ASSERT_OK(iter->status());
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3922
|
+
TEST_F(DBBasicTestWithTimestamp, TimestampFilterTableReadOnGet) {
|
|
3923
|
+
Options options = CurrentOptions();
|
|
3924
|
+
options.env = env_;
|
|
3925
|
+
options.create_if_missing = true;
|
|
3926
|
+
options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics();
|
|
3927
|
+
const size_t kTimestampSize = Timestamp(0, 0).size();
|
|
3928
|
+
TestComparator test_cmp(kTimestampSize);
|
|
3929
|
+
options.comparator = &test_cmp;
|
|
3930
|
+
BlockBasedTableOptions bbto;
|
|
3931
|
+
bbto.block_size = 100;
|
|
3932
|
+
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
|
|
3933
|
+
DestroyAndReopen(options);
|
|
3934
|
+
|
|
3935
|
+
// Put
|
|
3936
|
+
// Create two SST files
|
|
3937
|
+
// file1: key => [1, 3], timestamp => [10, 20]
|
|
3938
|
+
// file2, key => [2, 4], timestamp => [30, 40]
|
|
3939
|
+
{
|
|
3940
|
+
WriteOptions write_opts;
|
|
3941
|
+
std::string write_ts = Timestamp(10, 0);
|
|
3942
|
+
ASSERT_OK(db_->Put(write_opts, Key1(1), write_ts, "value1"));
|
|
3943
|
+
write_ts = Timestamp(20, 0);
|
|
3944
|
+
ASSERT_OK(db_->Put(write_opts, Key1(3), write_ts, "value3"));
|
|
3945
|
+
ASSERT_OK(Flush());
|
|
3946
|
+
|
|
3947
|
+
write_ts = Timestamp(30, 0);
|
|
3948
|
+
ASSERT_OK(db_->Put(write_opts, Key1(2), write_ts, "value2"));
|
|
3949
|
+
write_ts = Timestamp(40, 0);
|
|
3950
|
+
ASSERT_OK(db_->Put(write_opts, Key1(4), write_ts, "value4"));
|
|
3951
|
+
ASSERT_OK(Flush());
|
|
3952
|
+
}
|
|
3953
|
+
|
|
3954
|
+
// Get with timestamp
|
|
3955
|
+
{
|
|
3956
|
+
auto prev_checked_events = options.statistics->getTickerCount(
|
|
3957
|
+
Tickers::TIMESTAMP_FILTER_TABLE_CHECKED);
|
|
3958
|
+
auto prev_filtered_events = options.statistics->getTickerCount(
|
|
3959
|
+
Tickers::TIMESTAMP_FILTER_TABLE_FILTERED);
|
|
3960
|
+
|
|
3961
|
+
// key=3 (ts=20) does not exist at timestamp=1
|
|
3962
|
+
std::string read_ts_str = Timestamp(1, 0);
|
|
3963
|
+
Slice read_ts_slice = Slice(read_ts_str);
|
|
3964
|
+
ReadOptions read_opts;
|
|
3965
|
+
read_opts.timestamp = &read_ts_slice;
|
|
3966
|
+
std::string value_from_get = "";
|
|
3967
|
+
std::string timestamp_from_get = "";
|
|
3968
|
+
auto status =
|
|
3969
|
+
db_->Get(read_opts, Key1(3), &value_from_get, ×tamp_from_get);
|
|
3970
|
+
ASSERT_TRUE(status.IsNotFound());
|
|
3971
|
+
ASSERT_EQ(value_from_get, std::string(""));
|
|
3972
|
+
ASSERT_EQ(timestamp_from_get, std::string(""));
|
|
3973
|
+
|
|
3974
|
+
// key=3 is in the key ranges for both files, so both files will be queried.
|
|
3975
|
+
// The table read was skipped because the timestamp is out of the table
|
|
3976
|
+
// range, i.e.., 1 < [10,20], [30,40].
|
|
3977
|
+
// The tickers increase by 2 due to 2 files.
|
|
3978
|
+
ASSERT_EQ(prev_checked_events + 2,
|
|
3979
|
+
options.statistics->getTickerCount(
|
|
3980
|
+
Tickers::TIMESTAMP_FILTER_TABLE_CHECKED));
|
|
3981
|
+
ASSERT_EQ(prev_filtered_events + 2,
|
|
3982
|
+
options.statistics->getTickerCount(
|
|
3983
|
+
Tickers::TIMESTAMP_FILTER_TABLE_FILTERED));
|
|
3984
|
+
|
|
3985
|
+
// key=3 (ts=20) exists at timestamp = 25
|
|
3986
|
+
read_ts_str = Timestamp(25, 0);
|
|
3987
|
+
read_ts_slice = Slice(read_ts_str);
|
|
3988
|
+
read_opts.timestamp = &read_ts_slice;
|
|
3989
|
+
ASSERT_OK(
|
|
3990
|
+
db_->Get(read_opts, Key1(3), &value_from_get, ×tamp_from_get));
|
|
3991
|
+
ASSERT_EQ("value3", value_from_get);
|
|
3992
|
+
ASSERT_EQ(Timestamp(20, 0), timestamp_from_get);
|
|
3993
|
+
|
|
3994
|
+
// file1 was not skipped, because the timestamp is in range, [10,20] < 25.
|
|
3995
|
+
// file2 was skipped, because the timestamp is not in range, 25 < [30,40].
|
|
3996
|
+
// So the checked ticker increase by 2 due to 2 files;
|
|
3997
|
+
// filtered ticker increase by 1 because file2 was skipped
|
|
3998
|
+
ASSERT_EQ(prev_checked_events + 4,
|
|
3999
|
+
options.statistics->getTickerCount(
|
|
4000
|
+
Tickers::TIMESTAMP_FILTER_TABLE_CHECKED));
|
|
4001
|
+
ASSERT_EQ(prev_filtered_events + 3,
|
|
4002
|
+
options.statistics->getTickerCount(
|
|
4003
|
+
Tickers::TIMESTAMP_FILTER_TABLE_FILTERED));
|
|
4004
|
+
}
|
|
4005
|
+
|
|
4006
|
+
Close();
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
} // namespace ROCKSDB_NAMESPACE
|
|
4010
|
+
|
|
4011
|
+
int main(int argc, char** argv) {
|
|
4012
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
4013
|
+
::testing::InitGoogleTest(&argc, argv);
|
|
4014
|
+
RegisterCustomObjects(argc, argv);
|
|
4015
|
+
return RUN_ALL_TESTS();
|
|
4016
|
+
}
|