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,4263 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
3
|
+
// This source code is licensed under both the GPLv2 (found in the
|
|
4
|
+
// COPYING file in the root directory) and Apache 2.0 License
|
|
5
|
+
// (found in the LICENSE.Apache file in the root directory).
|
|
6
|
+
//
|
|
7
|
+
#include "rocksdb/utilities/ldb_cmd.h"
|
|
8
|
+
|
|
9
|
+
#include <cinttypes>
|
|
10
|
+
#include <cstdlib>
|
|
11
|
+
#include <ctime>
|
|
12
|
+
#include <fstream>
|
|
13
|
+
#include <functional>
|
|
14
|
+
#include <iostream>
|
|
15
|
+
#include <limits>
|
|
16
|
+
#include <sstream>
|
|
17
|
+
#include <stdexcept>
|
|
18
|
+
#include <string>
|
|
19
|
+
|
|
20
|
+
#include "db/blob/blob_index.h"
|
|
21
|
+
#include "db/db_impl/db_impl.h"
|
|
22
|
+
#include "db/dbformat.h"
|
|
23
|
+
#include "db/log_reader.h"
|
|
24
|
+
#include "db/version_util.h"
|
|
25
|
+
#include "db/write_batch_internal.h"
|
|
26
|
+
#include "file/filename.h"
|
|
27
|
+
#include "rocksdb/cache.h"
|
|
28
|
+
#include "rocksdb/experimental.h"
|
|
29
|
+
#include "rocksdb/file_checksum.h"
|
|
30
|
+
#include "rocksdb/filter_policy.h"
|
|
31
|
+
#include "rocksdb/options.h"
|
|
32
|
+
#include "rocksdb/table_properties.h"
|
|
33
|
+
#include "rocksdb/utilities/backup_engine.h"
|
|
34
|
+
#include "rocksdb/utilities/checkpoint.h"
|
|
35
|
+
#include "rocksdb/utilities/debug.h"
|
|
36
|
+
#include "rocksdb/utilities/options_util.h"
|
|
37
|
+
#include "rocksdb/write_batch.h"
|
|
38
|
+
#include "rocksdb/write_buffer_manager.h"
|
|
39
|
+
#include "table/scoped_arena_iterator.h"
|
|
40
|
+
#include "table/sst_file_dumper.h"
|
|
41
|
+
#include "tools/ldb_cmd_impl.h"
|
|
42
|
+
#include "util/cast_util.h"
|
|
43
|
+
#include "util/coding.h"
|
|
44
|
+
#include "util/file_checksum_helper.h"
|
|
45
|
+
#include "util/stderr_logger.h"
|
|
46
|
+
#include "util/string_util.h"
|
|
47
|
+
#include "utilities/blob_db/blob_dump_tool.h"
|
|
48
|
+
#include "utilities/merge_operators.h"
|
|
49
|
+
#include "utilities/ttl/db_ttl_impl.h"
|
|
50
|
+
|
|
51
|
+
namespace ROCKSDB_NAMESPACE {
|
|
52
|
+
|
|
53
|
+
class FileChecksumGenCrc32c;
|
|
54
|
+
class FileChecksumGenCrc32cFactory;
|
|
55
|
+
|
|
56
|
+
const std::string LDBCommand::ARG_ENV_URI = "env_uri";
|
|
57
|
+
const std::string LDBCommand::ARG_FS_URI = "fs_uri";
|
|
58
|
+
const std::string LDBCommand::ARG_DB = "db";
|
|
59
|
+
const std::string LDBCommand::ARG_PATH = "path";
|
|
60
|
+
const std::string LDBCommand::ARG_SECONDARY_PATH = "secondary_path";
|
|
61
|
+
const std::string LDBCommand::ARG_HEX = "hex";
|
|
62
|
+
const std::string LDBCommand::ARG_KEY_HEX = "key_hex";
|
|
63
|
+
const std::string LDBCommand::ARG_VALUE_HEX = "value_hex";
|
|
64
|
+
const std::string LDBCommand::ARG_CF_NAME = "column_family";
|
|
65
|
+
const std::string LDBCommand::ARG_TTL = "ttl";
|
|
66
|
+
const std::string LDBCommand::ARG_TTL_START = "start_time";
|
|
67
|
+
const std::string LDBCommand::ARG_TTL_END = "end_time";
|
|
68
|
+
const std::string LDBCommand::ARG_TIMESTAMP = "timestamp";
|
|
69
|
+
const std::string LDBCommand::ARG_TRY_LOAD_OPTIONS = "try_load_options";
|
|
70
|
+
const std::string LDBCommand::ARG_DISABLE_CONSISTENCY_CHECKS =
|
|
71
|
+
"disable_consistency_checks";
|
|
72
|
+
const std::string LDBCommand::ARG_IGNORE_UNKNOWN_OPTIONS =
|
|
73
|
+
"ignore_unknown_options";
|
|
74
|
+
const std::string LDBCommand::ARG_FROM = "from";
|
|
75
|
+
const std::string LDBCommand::ARG_TO = "to";
|
|
76
|
+
const std::string LDBCommand::ARG_MAX_KEYS = "max_keys";
|
|
77
|
+
const std::string LDBCommand::ARG_BLOOM_BITS = "bloom_bits";
|
|
78
|
+
const std::string LDBCommand::ARG_FIX_PREFIX_LEN = "fix_prefix_len";
|
|
79
|
+
const std::string LDBCommand::ARG_COMPRESSION_TYPE = "compression_type";
|
|
80
|
+
const std::string LDBCommand::ARG_COMPRESSION_MAX_DICT_BYTES =
|
|
81
|
+
"compression_max_dict_bytes";
|
|
82
|
+
const std::string LDBCommand::ARG_BLOCK_SIZE = "block_size";
|
|
83
|
+
const std::string LDBCommand::ARG_AUTO_COMPACTION = "auto_compaction";
|
|
84
|
+
const std::string LDBCommand::ARG_DB_WRITE_BUFFER_SIZE = "db_write_buffer_size";
|
|
85
|
+
const std::string LDBCommand::ARG_WRITE_BUFFER_SIZE = "write_buffer_size";
|
|
86
|
+
const std::string LDBCommand::ARG_FILE_SIZE = "file_size";
|
|
87
|
+
const std::string LDBCommand::ARG_CREATE_IF_MISSING = "create_if_missing";
|
|
88
|
+
const std::string LDBCommand::ARG_NO_VALUE = "no_value";
|
|
89
|
+
const std::string LDBCommand::ARG_ENABLE_BLOB_FILES = "enable_blob_files";
|
|
90
|
+
const std::string LDBCommand::ARG_MIN_BLOB_SIZE = "min_blob_size";
|
|
91
|
+
const std::string LDBCommand::ARG_BLOB_FILE_SIZE = "blob_file_size";
|
|
92
|
+
const std::string LDBCommand::ARG_BLOB_COMPRESSION_TYPE =
|
|
93
|
+
"blob_compression_type";
|
|
94
|
+
const std::string LDBCommand::ARG_ENABLE_BLOB_GARBAGE_COLLECTION =
|
|
95
|
+
"enable_blob_garbage_collection";
|
|
96
|
+
const std::string LDBCommand::ARG_BLOB_GARBAGE_COLLECTION_AGE_CUTOFF =
|
|
97
|
+
"blob_garbage_collection_age_cutoff";
|
|
98
|
+
const std::string LDBCommand::ARG_BLOB_GARBAGE_COLLECTION_FORCE_THRESHOLD =
|
|
99
|
+
"blob_garbage_collection_force_threshold";
|
|
100
|
+
const std::string LDBCommand::ARG_BLOB_COMPACTION_READAHEAD_SIZE =
|
|
101
|
+
"blob_compaction_readahead_size";
|
|
102
|
+
const std::string LDBCommand::ARG_BLOB_FILE_STARTING_LEVEL =
|
|
103
|
+
"blob_file_starting_level";
|
|
104
|
+
const std::string LDBCommand::ARG_PREPOPULATE_BLOB_CACHE =
|
|
105
|
+
"prepopulate_blob_cache";
|
|
106
|
+
const std::string LDBCommand::ARG_DECODE_BLOB_INDEX = "decode_blob_index";
|
|
107
|
+
const std::string LDBCommand::ARG_DUMP_UNCOMPRESSED_BLOBS =
|
|
108
|
+
"dump_uncompressed_blobs";
|
|
109
|
+
|
|
110
|
+
const char* LDBCommand::DELIM = " ==> ";
|
|
111
|
+
|
|
112
|
+
namespace {
|
|
113
|
+
|
|
114
|
+
void DumpWalFile(Options options, std::string wal_file, bool print_header,
|
|
115
|
+
bool print_values, bool is_write_committed,
|
|
116
|
+
LDBCommandExecuteResult* exec_state);
|
|
117
|
+
|
|
118
|
+
void DumpSstFile(Options options, std::string filename, bool output_hex,
|
|
119
|
+
bool show_properties, bool decode_blob_index,
|
|
120
|
+
std::string from_key = "", std::string to_key = "");
|
|
121
|
+
|
|
122
|
+
void DumpBlobFile(const std::string& filename, bool is_key_hex,
|
|
123
|
+
bool is_value_hex, bool dump_uncompressed_blobs);
|
|
124
|
+
}; // namespace
|
|
125
|
+
|
|
126
|
+
LDBCommand* LDBCommand::InitFromCmdLineArgs(
|
|
127
|
+
int argc, char const* const* argv, const Options& options,
|
|
128
|
+
const LDBOptions& ldb_options,
|
|
129
|
+
const std::vector<ColumnFamilyDescriptor>* column_families) {
|
|
130
|
+
std::vector<std::string> args;
|
|
131
|
+
for (int i = 1; i < argc; i++) {
|
|
132
|
+
args.push_back(argv[i]);
|
|
133
|
+
}
|
|
134
|
+
return InitFromCmdLineArgs(args, options, ldb_options, column_families,
|
|
135
|
+
SelectCommand);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Parse the command-line arguments and create the appropriate LDBCommand2
|
|
140
|
+
* instance.
|
|
141
|
+
* The command line arguments must be in the following format:
|
|
142
|
+
* ./ldb --db=PATH_TO_DB [--commonOpt1=commonOpt1Val] ..
|
|
143
|
+
* COMMAND <PARAM1> <PARAM2> ... [-cmdSpecificOpt1=cmdSpecificOpt1Val] ..
|
|
144
|
+
* This is similar to the command line format used by HBaseClientTool.
|
|
145
|
+
* Command name is not included in args.
|
|
146
|
+
* Returns nullptr if the command-line cannot be parsed.
|
|
147
|
+
*/
|
|
148
|
+
LDBCommand* LDBCommand::InitFromCmdLineArgs(
|
|
149
|
+
const std::vector<std::string>& args, const Options& options,
|
|
150
|
+
const LDBOptions& ldb_options,
|
|
151
|
+
const std::vector<ColumnFamilyDescriptor>* /*column_families*/,
|
|
152
|
+
const std::function<LDBCommand*(const ParsedParams&)>& selector) {
|
|
153
|
+
// --x=y command line arguments are added as x->y map entries in
|
|
154
|
+
// parsed_params.option_map.
|
|
155
|
+
//
|
|
156
|
+
// Command-line arguments of the form --hex end up in this array as hex to
|
|
157
|
+
// parsed_params.flags
|
|
158
|
+
ParsedParams parsed_params;
|
|
159
|
+
|
|
160
|
+
// Everything other than option_map and flags. Represents commands
|
|
161
|
+
// and their parameters. For eg: put key1 value1 go into this vector.
|
|
162
|
+
std::vector<std::string> cmdTokens;
|
|
163
|
+
|
|
164
|
+
const std::string OPTION_PREFIX = "--";
|
|
165
|
+
|
|
166
|
+
for (const auto& arg : args) {
|
|
167
|
+
if (arg[0] == '-' && arg[1] == '-') {
|
|
168
|
+
std::vector<std::string> splits = StringSplit(arg, '=');
|
|
169
|
+
// --option_name=option_value
|
|
170
|
+
if (splits.size() == 2) {
|
|
171
|
+
std::string optionKey = splits[0].substr(OPTION_PREFIX.size());
|
|
172
|
+
parsed_params.option_map[optionKey] = splits[1];
|
|
173
|
+
} else if (splits.size() == 1) {
|
|
174
|
+
// --flag_name
|
|
175
|
+
std::string optionKey = splits[0].substr(OPTION_PREFIX.size());
|
|
176
|
+
parsed_params.flags.push_back(optionKey);
|
|
177
|
+
} else {
|
|
178
|
+
// --option_name=option_value, option_value contains '='
|
|
179
|
+
std::string optionKey = splits[0].substr(OPTION_PREFIX.size());
|
|
180
|
+
parsed_params.option_map[optionKey] =
|
|
181
|
+
arg.substr(splits[0].length() + 1);
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
cmdTokens.push_back(arg);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (cmdTokens.size() < 1) {
|
|
189
|
+
fprintf(stderr, "Command not specified!");
|
|
190
|
+
return nullptr;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
parsed_params.cmd = cmdTokens[0];
|
|
194
|
+
parsed_params.cmd_params.assign(cmdTokens.begin() + 1, cmdTokens.end());
|
|
195
|
+
|
|
196
|
+
LDBCommand* command = selector(parsed_params);
|
|
197
|
+
|
|
198
|
+
if (command) {
|
|
199
|
+
command->SetDBOptions(options);
|
|
200
|
+
command->SetLDBOptions(ldb_options);
|
|
201
|
+
}
|
|
202
|
+
return command;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
LDBCommand* LDBCommand::SelectCommand(const ParsedParams& parsed_params) {
|
|
206
|
+
if (parsed_params.cmd == GetCommand::Name()) {
|
|
207
|
+
return new GetCommand(parsed_params.cmd_params, parsed_params.option_map,
|
|
208
|
+
parsed_params.flags);
|
|
209
|
+
} else if (parsed_params.cmd == PutCommand::Name()) {
|
|
210
|
+
return new PutCommand(parsed_params.cmd_params, parsed_params.option_map,
|
|
211
|
+
parsed_params.flags);
|
|
212
|
+
} else if (parsed_params.cmd == BatchPutCommand::Name()) {
|
|
213
|
+
return new BatchPutCommand(parsed_params.cmd_params,
|
|
214
|
+
parsed_params.option_map, parsed_params.flags);
|
|
215
|
+
} else if (parsed_params.cmd == ScanCommand::Name()) {
|
|
216
|
+
return new ScanCommand(parsed_params.cmd_params, parsed_params.option_map,
|
|
217
|
+
parsed_params.flags);
|
|
218
|
+
} else if (parsed_params.cmd == DeleteCommand::Name()) {
|
|
219
|
+
return new DeleteCommand(parsed_params.cmd_params, parsed_params.option_map,
|
|
220
|
+
parsed_params.flags);
|
|
221
|
+
} else if (parsed_params.cmd == SingleDeleteCommand::Name()) {
|
|
222
|
+
return new SingleDeleteCommand(parsed_params.cmd_params,
|
|
223
|
+
parsed_params.option_map,
|
|
224
|
+
parsed_params.flags);
|
|
225
|
+
} else if (parsed_params.cmd == DeleteRangeCommand::Name()) {
|
|
226
|
+
return new DeleteRangeCommand(parsed_params.cmd_params,
|
|
227
|
+
parsed_params.option_map,
|
|
228
|
+
parsed_params.flags);
|
|
229
|
+
} else if (parsed_params.cmd == ApproxSizeCommand::Name()) {
|
|
230
|
+
return new ApproxSizeCommand(parsed_params.cmd_params,
|
|
231
|
+
parsed_params.option_map, parsed_params.flags);
|
|
232
|
+
} else if (parsed_params.cmd == DBQuerierCommand::Name()) {
|
|
233
|
+
return new DBQuerierCommand(parsed_params.cmd_params,
|
|
234
|
+
parsed_params.option_map, parsed_params.flags);
|
|
235
|
+
} else if (parsed_params.cmd == CompactorCommand::Name()) {
|
|
236
|
+
return new CompactorCommand(parsed_params.cmd_params,
|
|
237
|
+
parsed_params.option_map, parsed_params.flags);
|
|
238
|
+
} else if (parsed_params.cmd == WALDumperCommand::Name()) {
|
|
239
|
+
return new WALDumperCommand(parsed_params.cmd_params,
|
|
240
|
+
parsed_params.option_map, parsed_params.flags);
|
|
241
|
+
} else if (parsed_params.cmd == ReduceDBLevelsCommand::Name()) {
|
|
242
|
+
return new ReduceDBLevelsCommand(parsed_params.cmd_params,
|
|
243
|
+
parsed_params.option_map,
|
|
244
|
+
parsed_params.flags);
|
|
245
|
+
} else if (parsed_params.cmd == ChangeCompactionStyleCommand::Name()) {
|
|
246
|
+
return new ChangeCompactionStyleCommand(parsed_params.cmd_params,
|
|
247
|
+
parsed_params.option_map,
|
|
248
|
+
parsed_params.flags);
|
|
249
|
+
} else if (parsed_params.cmd == DBDumperCommand::Name()) {
|
|
250
|
+
return new DBDumperCommand(parsed_params.cmd_params,
|
|
251
|
+
parsed_params.option_map, parsed_params.flags);
|
|
252
|
+
} else if (parsed_params.cmd == DBLoaderCommand::Name()) {
|
|
253
|
+
return new DBLoaderCommand(parsed_params.cmd_params,
|
|
254
|
+
parsed_params.option_map, parsed_params.flags);
|
|
255
|
+
} else if (parsed_params.cmd == ManifestDumpCommand::Name()) {
|
|
256
|
+
return new ManifestDumpCommand(parsed_params.cmd_params,
|
|
257
|
+
parsed_params.option_map,
|
|
258
|
+
parsed_params.flags);
|
|
259
|
+
} else if (parsed_params.cmd == FileChecksumDumpCommand::Name()) {
|
|
260
|
+
return new FileChecksumDumpCommand(parsed_params.cmd_params,
|
|
261
|
+
parsed_params.option_map,
|
|
262
|
+
parsed_params.flags);
|
|
263
|
+
} else if (parsed_params.cmd == GetPropertyCommand::Name()) {
|
|
264
|
+
return new GetPropertyCommand(parsed_params.cmd_params,
|
|
265
|
+
parsed_params.option_map,
|
|
266
|
+
parsed_params.flags);
|
|
267
|
+
} else if (parsed_params.cmd == ListColumnFamiliesCommand::Name()) {
|
|
268
|
+
return new ListColumnFamiliesCommand(parsed_params.cmd_params,
|
|
269
|
+
parsed_params.option_map,
|
|
270
|
+
parsed_params.flags);
|
|
271
|
+
} else if (parsed_params.cmd == CreateColumnFamilyCommand::Name()) {
|
|
272
|
+
return new CreateColumnFamilyCommand(parsed_params.cmd_params,
|
|
273
|
+
parsed_params.option_map,
|
|
274
|
+
parsed_params.flags);
|
|
275
|
+
} else if (parsed_params.cmd == DropColumnFamilyCommand::Name()) {
|
|
276
|
+
return new DropColumnFamilyCommand(parsed_params.cmd_params,
|
|
277
|
+
parsed_params.option_map,
|
|
278
|
+
parsed_params.flags);
|
|
279
|
+
} else if (parsed_params.cmd == DBFileDumperCommand::Name()) {
|
|
280
|
+
return new DBFileDumperCommand(parsed_params.cmd_params,
|
|
281
|
+
parsed_params.option_map,
|
|
282
|
+
parsed_params.flags);
|
|
283
|
+
} else if (parsed_params.cmd == DBLiveFilesMetadataDumperCommand::Name()) {
|
|
284
|
+
return new DBLiveFilesMetadataDumperCommand(parsed_params.cmd_params,
|
|
285
|
+
parsed_params.option_map,
|
|
286
|
+
parsed_params.flags);
|
|
287
|
+
} else if (parsed_params.cmd == InternalDumpCommand::Name()) {
|
|
288
|
+
return new InternalDumpCommand(parsed_params.cmd_params,
|
|
289
|
+
parsed_params.option_map,
|
|
290
|
+
parsed_params.flags);
|
|
291
|
+
} else if (parsed_params.cmd == CheckConsistencyCommand::Name()) {
|
|
292
|
+
return new CheckConsistencyCommand(parsed_params.cmd_params,
|
|
293
|
+
parsed_params.option_map,
|
|
294
|
+
parsed_params.flags);
|
|
295
|
+
} else if (parsed_params.cmd == CheckPointCommand::Name()) {
|
|
296
|
+
return new CheckPointCommand(parsed_params.cmd_params,
|
|
297
|
+
parsed_params.option_map, parsed_params.flags);
|
|
298
|
+
} else if (parsed_params.cmd == RepairCommand::Name()) {
|
|
299
|
+
return new RepairCommand(parsed_params.cmd_params, parsed_params.option_map,
|
|
300
|
+
parsed_params.flags);
|
|
301
|
+
} else if (parsed_params.cmd == BackupCommand::Name()) {
|
|
302
|
+
return new BackupCommand(parsed_params.cmd_params, parsed_params.option_map,
|
|
303
|
+
parsed_params.flags);
|
|
304
|
+
} else if (parsed_params.cmd == RestoreCommand::Name()) {
|
|
305
|
+
return new RestoreCommand(parsed_params.cmd_params,
|
|
306
|
+
parsed_params.option_map, parsed_params.flags);
|
|
307
|
+
} else if (parsed_params.cmd == WriteExternalSstFilesCommand::Name()) {
|
|
308
|
+
return new WriteExternalSstFilesCommand(parsed_params.cmd_params,
|
|
309
|
+
parsed_params.option_map,
|
|
310
|
+
parsed_params.flags);
|
|
311
|
+
} else if (parsed_params.cmd == IngestExternalSstFilesCommand::Name()) {
|
|
312
|
+
return new IngestExternalSstFilesCommand(parsed_params.cmd_params,
|
|
313
|
+
parsed_params.option_map,
|
|
314
|
+
parsed_params.flags);
|
|
315
|
+
} else if (parsed_params.cmd == ListFileRangeDeletesCommand::Name()) {
|
|
316
|
+
return new ListFileRangeDeletesCommand(parsed_params.option_map,
|
|
317
|
+
parsed_params.flags);
|
|
318
|
+
} else if (parsed_params.cmd == UnsafeRemoveSstFileCommand::Name()) {
|
|
319
|
+
return new UnsafeRemoveSstFileCommand(parsed_params.cmd_params,
|
|
320
|
+
parsed_params.option_map,
|
|
321
|
+
parsed_params.flags);
|
|
322
|
+
} else if (parsed_params.cmd == UpdateManifestCommand::Name()) {
|
|
323
|
+
return new UpdateManifestCommand(parsed_params.cmd_params,
|
|
324
|
+
parsed_params.option_map,
|
|
325
|
+
parsed_params.flags);
|
|
326
|
+
}
|
|
327
|
+
return nullptr;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/* Run the command, and return the execute result. */
|
|
331
|
+
void LDBCommand::Run() {
|
|
332
|
+
if (!exec_state_.IsNotStarted()) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (!options_.env || options_.env == Env::Default()) {
|
|
337
|
+
Env* env = Env::Default();
|
|
338
|
+
Status s = Env::CreateFromUri(config_options_, env_uri_, fs_uri_, &env,
|
|
339
|
+
&env_guard_);
|
|
340
|
+
if (!s.ok()) {
|
|
341
|
+
fprintf(stderr, "%s\n", s.ToString().c_str());
|
|
342
|
+
exec_state_ = LDBCommandExecuteResult::Failed(s.ToString());
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
options_.env = env;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (db_ == nullptr && !NoDBOpen()) {
|
|
349
|
+
OpenDB();
|
|
350
|
+
if (exec_state_.IsFailed() && try_load_options_) {
|
|
351
|
+
// We don't always return if there is a failure because a WAL file or
|
|
352
|
+
// manifest file can be given to "dump" command so we should continue.
|
|
353
|
+
// --try_load_options is not valid in those cases.
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// We'll intentionally proceed even if the DB can't be opened because users
|
|
359
|
+
// can also specify a filename, not just a directory.
|
|
360
|
+
DoCommand();
|
|
361
|
+
|
|
362
|
+
if (exec_state_.IsNotStarted()) {
|
|
363
|
+
exec_state_ = LDBCommandExecuteResult::Succeed("");
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
if (db_ != nullptr) {
|
|
367
|
+
CloseDB();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
LDBCommand::LDBCommand(const std::map<std::string, std::string>& options,
|
|
372
|
+
const std::vector<std::string>& flags, bool is_read_only,
|
|
373
|
+
const std::vector<std::string>& valid_cmd_line_options)
|
|
374
|
+
: db_(nullptr),
|
|
375
|
+
db_ttl_(nullptr),
|
|
376
|
+
is_read_only_(is_read_only),
|
|
377
|
+
is_key_hex_(false),
|
|
378
|
+
is_value_hex_(false),
|
|
379
|
+
is_db_ttl_(false),
|
|
380
|
+
timestamp_(false),
|
|
381
|
+
try_load_options_(false),
|
|
382
|
+
create_if_missing_(false),
|
|
383
|
+
option_map_(options),
|
|
384
|
+
flags_(flags),
|
|
385
|
+
valid_cmd_line_options_(valid_cmd_line_options) {
|
|
386
|
+
auto itr = options.find(ARG_DB);
|
|
387
|
+
if (itr != options.end()) {
|
|
388
|
+
db_path_ = itr->second;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
itr = options.find(ARG_ENV_URI);
|
|
392
|
+
if (itr != options.end()) {
|
|
393
|
+
env_uri_ = itr->second;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
itr = options.find(ARG_FS_URI);
|
|
397
|
+
if (itr != options.end()) {
|
|
398
|
+
fs_uri_ = itr->second;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
itr = options.find(ARG_CF_NAME);
|
|
402
|
+
if (itr != options.end()) {
|
|
403
|
+
column_family_name_ = itr->second;
|
|
404
|
+
} else {
|
|
405
|
+
column_family_name_ = kDefaultColumnFamilyName;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
itr = options.find(ARG_SECONDARY_PATH);
|
|
409
|
+
secondary_path_ = "";
|
|
410
|
+
if (itr != options.end()) {
|
|
411
|
+
secondary_path_ = itr->second;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
is_key_hex_ = IsKeyHex(options, flags);
|
|
415
|
+
is_value_hex_ = IsValueHex(options, flags);
|
|
416
|
+
is_db_ttl_ = IsFlagPresent(flags, ARG_TTL);
|
|
417
|
+
timestamp_ = IsFlagPresent(flags, ARG_TIMESTAMP);
|
|
418
|
+
try_load_options_ = IsTryLoadOptions(options, flags);
|
|
419
|
+
force_consistency_checks_ =
|
|
420
|
+
!IsFlagPresent(flags, ARG_DISABLE_CONSISTENCY_CHECKS);
|
|
421
|
+
enable_blob_files_ = IsFlagPresent(flags, ARG_ENABLE_BLOB_FILES);
|
|
422
|
+
enable_blob_garbage_collection_ =
|
|
423
|
+
IsFlagPresent(flags, ARG_ENABLE_BLOB_GARBAGE_COLLECTION);
|
|
424
|
+
config_options_.ignore_unknown_options =
|
|
425
|
+
IsFlagPresent(flags, ARG_IGNORE_UNKNOWN_OPTIONS);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
void LDBCommand::OpenDB() {
|
|
429
|
+
PrepareOptions();
|
|
430
|
+
if (!exec_state_.IsNotStarted()) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
if (column_families_.empty() && !options_.merge_operator) {
|
|
434
|
+
// No harm to add a general merge operator if it is not specified.
|
|
435
|
+
options_.merge_operator = MergeOperators::CreateStringAppendOperator(':');
|
|
436
|
+
}
|
|
437
|
+
// Open the DB.
|
|
438
|
+
Status st;
|
|
439
|
+
std::vector<ColumnFamilyHandle*> handles_opened;
|
|
440
|
+
if (is_db_ttl_) {
|
|
441
|
+
// ldb doesn't yet support TTL DB with multiple column families
|
|
442
|
+
if (!column_family_name_.empty() || !column_families_.empty()) {
|
|
443
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
444
|
+
"ldb doesn't support TTL DB with multiple column families");
|
|
445
|
+
}
|
|
446
|
+
if (!secondary_path_.empty()) {
|
|
447
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
448
|
+
"Open as secondary is not supported for TTL DB yet.");
|
|
449
|
+
}
|
|
450
|
+
if (is_read_only_) {
|
|
451
|
+
st = DBWithTTL::Open(options_, db_path_, &db_ttl_, 0, true);
|
|
452
|
+
} else {
|
|
453
|
+
st = DBWithTTL::Open(options_, db_path_, &db_ttl_);
|
|
454
|
+
}
|
|
455
|
+
db_ = db_ttl_;
|
|
456
|
+
} else {
|
|
457
|
+
if (is_read_only_ && secondary_path_.empty()) {
|
|
458
|
+
if (column_families_.empty()) {
|
|
459
|
+
st = DB::OpenForReadOnly(options_, db_path_, &db_);
|
|
460
|
+
} else {
|
|
461
|
+
st = DB::OpenForReadOnly(options_, db_path_, column_families_,
|
|
462
|
+
&handles_opened, &db_);
|
|
463
|
+
}
|
|
464
|
+
} else {
|
|
465
|
+
if (column_families_.empty()) {
|
|
466
|
+
if (secondary_path_.empty()) {
|
|
467
|
+
st = DB::Open(options_, db_path_, &db_);
|
|
468
|
+
} else {
|
|
469
|
+
st = DB::OpenAsSecondary(options_, db_path_, secondary_path_, &db_);
|
|
470
|
+
}
|
|
471
|
+
} else {
|
|
472
|
+
if (secondary_path_.empty()) {
|
|
473
|
+
st = DB::Open(options_, db_path_, column_families_, &handles_opened,
|
|
474
|
+
&db_);
|
|
475
|
+
} else {
|
|
476
|
+
st = DB::OpenAsSecondary(options_, db_path_, secondary_path_,
|
|
477
|
+
column_families_, &handles_opened, &db_);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
if (!st.ok()) {
|
|
483
|
+
std::string msg = st.ToString();
|
|
484
|
+
exec_state_ = LDBCommandExecuteResult::Failed(msg);
|
|
485
|
+
} else if (!handles_opened.empty()) {
|
|
486
|
+
assert(handles_opened.size() == column_families_.size());
|
|
487
|
+
bool found_cf_name = false;
|
|
488
|
+
for (size_t i = 0; i < handles_opened.size(); i++) {
|
|
489
|
+
cf_handles_[column_families_[i].name] = handles_opened[i];
|
|
490
|
+
if (column_family_name_ == column_families_[i].name) {
|
|
491
|
+
found_cf_name = true;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
if (!found_cf_name) {
|
|
495
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
496
|
+
"Non-existing column family " + column_family_name_);
|
|
497
|
+
CloseDB();
|
|
498
|
+
}
|
|
499
|
+
} else {
|
|
500
|
+
// We successfully opened DB in single column family mode.
|
|
501
|
+
assert(column_families_.empty());
|
|
502
|
+
if (column_family_name_ != kDefaultColumnFamilyName) {
|
|
503
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
504
|
+
"Non-existing column family " + column_family_name_);
|
|
505
|
+
CloseDB();
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
void LDBCommand::CloseDB() {
|
|
511
|
+
if (db_ != nullptr) {
|
|
512
|
+
for (auto& pair : cf_handles_) {
|
|
513
|
+
delete pair.second;
|
|
514
|
+
}
|
|
515
|
+
Status s = db_->Close();
|
|
516
|
+
s.PermitUncheckedError();
|
|
517
|
+
delete db_;
|
|
518
|
+
db_ = nullptr;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
ColumnFamilyHandle* LDBCommand::GetCfHandle() {
|
|
523
|
+
if (!cf_handles_.empty()) {
|
|
524
|
+
auto it = cf_handles_.find(column_family_name_);
|
|
525
|
+
if (it == cf_handles_.end()) {
|
|
526
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
527
|
+
"Cannot find column family " + column_family_name_);
|
|
528
|
+
} else {
|
|
529
|
+
return it->second;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return db_->DefaultColumnFamily();
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
std::vector<std::string> LDBCommand::BuildCmdLineOptions(
|
|
536
|
+
std::vector<std::string> options) {
|
|
537
|
+
std::vector<std::string> ret = {ARG_ENV_URI,
|
|
538
|
+
ARG_FS_URI,
|
|
539
|
+
ARG_DB,
|
|
540
|
+
ARG_SECONDARY_PATH,
|
|
541
|
+
ARG_BLOOM_BITS,
|
|
542
|
+
ARG_BLOCK_SIZE,
|
|
543
|
+
ARG_AUTO_COMPACTION,
|
|
544
|
+
ARG_COMPRESSION_TYPE,
|
|
545
|
+
ARG_COMPRESSION_MAX_DICT_BYTES,
|
|
546
|
+
ARG_WRITE_BUFFER_SIZE,
|
|
547
|
+
ARG_FILE_SIZE,
|
|
548
|
+
ARG_FIX_PREFIX_LEN,
|
|
549
|
+
ARG_TRY_LOAD_OPTIONS,
|
|
550
|
+
ARG_DISABLE_CONSISTENCY_CHECKS,
|
|
551
|
+
ARG_ENABLE_BLOB_FILES,
|
|
552
|
+
ARG_MIN_BLOB_SIZE,
|
|
553
|
+
ARG_BLOB_FILE_SIZE,
|
|
554
|
+
ARG_BLOB_COMPRESSION_TYPE,
|
|
555
|
+
ARG_ENABLE_BLOB_GARBAGE_COLLECTION,
|
|
556
|
+
ARG_BLOB_GARBAGE_COLLECTION_AGE_CUTOFF,
|
|
557
|
+
ARG_BLOB_GARBAGE_COLLECTION_FORCE_THRESHOLD,
|
|
558
|
+
ARG_BLOB_COMPACTION_READAHEAD_SIZE,
|
|
559
|
+
ARG_BLOB_FILE_STARTING_LEVEL,
|
|
560
|
+
ARG_PREPOPULATE_BLOB_CACHE,
|
|
561
|
+
ARG_IGNORE_UNKNOWN_OPTIONS,
|
|
562
|
+
ARG_CF_NAME};
|
|
563
|
+
ret.insert(ret.end(), options.begin(), options.end());
|
|
564
|
+
return ret;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Parses the specific double option and fills in the value.
|
|
569
|
+
* Returns true if the option is found.
|
|
570
|
+
* Returns false if the option is not found or if there is an error parsing the
|
|
571
|
+
* value. If there is an error, the specified exec_state is also
|
|
572
|
+
* updated.
|
|
573
|
+
*/
|
|
574
|
+
bool LDBCommand::ParseDoubleOption(
|
|
575
|
+
const std::map<std::string, std::string>& /*options*/,
|
|
576
|
+
const std::string& option, double& value,
|
|
577
|
+
LDBCommandExecuteResult& exec_state) {
|
|
578
|
+
auto itr = option_map_.find(option);
|
|
579
|
+
if (itr != option_map_.end()) {
|
|
580
|
+
#if defined(CYGWIN)
|
|
581
|
+
char* str_end = nullptr;
|
|
582
|
+
value = std::strtod(itr->second.c_str(), &str_end);
|
|
583
|
+
if (str_end == itr->second.c_str()) {
|
|
584
|
+
exec_state =
|
|
585
|
+
LDBCommandExecuteResult::Failed(option + " has an invalid value.");
|
|
586
|
+
} else if (errno == ERANGE) {
|
|
587
|
+
exec_state = LDBCommandExecuteResult::Failed(
|
|
588
|
+
option + " has a value out-of-range.");
|
|
589
|
+
} else {
|
|
590
|
+
return true;
|
|
591
|
+
}
|
|
592
|
+
#else
|
|
593
|
+
try {
|
|
594
|
+
value = std::stod(itr->second);
|
|
595
|
+
return true;
|
|
596
|
+
} catch (const std::invalid_argument&) {
|
|
597
|
+
exec_state =
|
|
598
|
+
LDBCommandExecuteResult::Failed(option + " has an invalid value.");
|
|
599
|
+
} catch (const std::out_of_range&) {
|
|
600
|
+
exec_state = LDBCommandExecuteResult::Failed(
|
|
601
|
+
option + " has a value out-of-range.");
|
|
602
|
+
}
|
|
603
|
+
#endif
|
|
604
|
+
}
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Parses the specific integer option and fills in the value.
|
|
610
|
+
* Returns true if the option is found.
|
|
611
|
+
* Returns false if the option is not found or if there is an error parsing the
|
|
612
|
+
* value. If there is an error, the specified exec_state is also
|
|
613
|
+
* updated.
|
|
614
|
+
*/
|
|
615
|
+
bool LDBCommand::ParseIntOption(
|
|
616
|
+
const std::map<std::string, std::string>& /*options*/,
|
|
617
|
+
const std::string& option, int& value,
|
|
618
|
+
LDBCommandExecuteResult& exec_state) {
|
|
619
|
+
auto itr = option_map_.find(option);
|
|
620
|
+
if (itr != option_map_.end()) {
|
|
621
|
+
#if defined(CYGWIN)
|
|
622
|
+
char* str_end = nullptr;
|
|
623
|
+
value = strtol(itr->second.c_str(), &str_end, 10);
|
|
624
|
+
if (str_end == itr->second.c_str()) {
|
|
625
|
+
exec_state =
|
|
626
|
+
LDBCommandExecuteResult::Failed(option + " has an invalid value.");
|
|
627
|
+
} else if (errno == ERANGE) {
|
|
628
|
+
exec_state = LDBCommandExecuteResult::Failed(
|
|
629
|
+
option + " has a value out-of-range.");
|
|
630
|
+
} else {
|
|
631
|
+
return true;
|
|
632
|
+
}
|
|
633
|
+
#else
|
|
634
|
+
try {
|
|
635
|
+
value = std::stoi(itr->second);
|
|
636
|
+
return true;
|
|
637
|
+
} catch (const std::invalid_argument&) {
|
|
638
|
+
exec_state =
|
|
639
|
+
LDBCommandExecuteResult::Failed(option + " has an invalid value.");
|
|
640
|
+
} catch (const std::out_of_range&) {
|
|
641
|
+
exec_state = LDBCommandExecuteResult::Failed(
|
|
642
|
+
option + " has a value out-of-range.");
|
|
643
|
+
}
|
|
644
|
+
#endif
|
|
645
|
+
}
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Parses the specified option and fills in the value.
|
|
651
|
+
* Returns true if the option is found.
|
|
652
|
+
* Returns false otherwise.
|
|
653
|
+
*/
|
|
654
|
+
bool LDBCommand::ParseStringOption(
|
|
655
|
+
const std::map<std::string, std::string>& /*options*/,
|
|
656
|
+
const std::string& option, std::string* value) {
|
|
657
|
+
auto itr = option_map_.find(option);
|
|
658
|
+
if (itr != option_map_.end()) {
|
|
659
|
+
*value = itr->second;
|
|
660
|
+
return true;
|
|
661
|
+
}
|
|
662
|
+
return false;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Parses the specified compression type and fills in the value.
|
|
667
|
+
* Returns true if the compression type is found.
|
|
668
|
+
* Returns false otherwise.
|
|
669
|
+
*/
|
|
670
|
+
bool LDBCommand::ParseCompressionTypeOption(
|
|
671
|
+
const std::map<std::string, std::string>& /*options*/,
|
|
672
|
+
const std::string& option, CompressionType& value,
|
|
673
|
+
LDBCommandExecuteResult& exec_state) {
|
|
674
|
+
auto itr = option_map_.find(option);
|
|
675
|
+
if (itr != option_map_.end()) {
|
|
676
|
+
const std::string& comp = itr->second;
|
|
677
|
+
if (comp == "no") {
|
|
678
|
+
value = kNoCompression;
|
|
679
|
+
return true;
|
|
680
|
+
} else if (comp == "snappy") {
|
|
681
|
+
value = kSnappyCompression;
|
|
682
|
+
return true;
|
|
683
|
+
} else if (comp == "zlib") {
|
|
684
|
+
value = kZlibCompression;
|
|
685
|
+
return true;
|
|
686
|
+
} else if (comp == "bzip2") {
|
|
687
|
+
value = kBZip2Compression;
|
|
688
|
+
return true;
|
|
689
|
+
} else if (comp == "lz4") {
|
|
690
|
+
value = kLZ4Compression;
|
|
691
|
+
return true;
|
|
692
|
+
} else if (comp == "lz4hc") {
|
|
693
|
+
value = kLZ4HCCompression;
|
|
694
|
+
return true;
|
|
695
|
+
} else if (comp == "xpress") {
|
|
696
|
+
value = kXpressCompression;
|
|
697
|
+
return true;
|
|
698
|
+
} else if (comp == "zstd") {
|
|
699
|
+
value = kZSTD;
|
|
700
|
+
return true;
|
|
701
|
+
} else {
|
|
702
|
+
// Unknown compression.
|
|
703
|
+
exec_state = LDBCommandExecuteResult::Failed(
|
|
704
|
+
"Unknown compression algorithm: " + comp);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
void LDBCommand::OverrideBaseOptions() {
|
|
711
|
+
options_.create_if_missing = false;
|
|
712
|
+
|
|
713
|
+
int db_write_buffer_size;
|
|
714
|
+
if (ParseIntOption(option_map_, ARG_DB_WRITE_BUFFER_SIZE,
|
|
715
|
+
db_write_buffer_size, exec_state_)) {
|
|
716
|
+
if (db_write_buffer_size >= 0) {
|
|
717
|
+
options_.db_write_buffer_size = db_write_buffer_size;
|
|
718
|
+
} else {
|
|
719
|
+
exec_state_ = LDBCommandExecuteResult::Failed(ARG_DB_WRITE_BUFFER_SIZE +
|
|
720
|
+
" must be >= 0.");
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
if (options_.db_paths.size() == 0) {
|
|
725
|
+
options_.db_paths.emplace_back(db_path_,
|
|
726
|
+
std::numeric_limits<uint64_t>::max());
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
OverrideBaseCFOptions(static_cast<ColumnFamilyOptions*>(&options_));
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
void LDBCommand::OverrideBaseCFOptions(ColumnFamilyOptions* cf_opts) {
|
|
733
|
+
BlockBasedTableOptions table_options;
|
|
734
|
+
bool use_table_options = false;
|
|
735
|
+
int bits;
|
|
736
|
+
if (ParseIntOption(option_map_, ARG_BLOOM_BITS, bits, exec_state_)) {
|
|
737
|
+
if (bits > 0) {
|
|
738
|
+
use_table_options = true;
|
|
739
|
+
table_options.filter_policy.reset(NewBloomFilterPolicy(bits));
|
|
740
|
+
} else {
|
|
741
|
+
exec_state_ =
|
|
742
|
+
LDBCommandExecuteResult::Failed(ARG_BLOOM_BITS + " must be > 0.");
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
int block_size;
|
|
747
|
+
if (ParseIntOption(option_map_, ARG_BLOCK_SIZE, block_size, exec_state_)) {
|
|
748
|
+
if (block_size > 0) {
|
|
749
|
+
use_table_options = true;
|
|
750
|
+
table_options.block_size = block_size;
|
|
751
|
+
} else {
|
|
752
|
+
exec_state_ =
|
|
753
|
+
LDBCommandExecuteResult::Failed(ARG_BLOCK_SIZE + " must be > 0.");
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
cf_opts->force_consistency_checks = force_consistency_checks_;
|
|
758
|
+
if (use_table_options) {
|
|
759
|
+
cf_opts->table_factory.reset(NewBlockBasedTableFactory(table_options));
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
cf_opts->enable_blob_files = enable_blob_files_;
|
|
763
|
+
|
|
764
|
+
int min_blob_size;
|
|
765
|
+
if (ParseIntOption(option_map_, ARG_MIN_BLOB_SIZE, min_blob_size,
|
|
766
|
+
exec_state_)) {
|
|
767
|
+
if (min_blob_size >= 0) {
|
|
768
|
+
cf_opts->min_blob_size = min_blob_size;
|
|
769
|
+
} else {
|
|
770
|
+
exec_state_ =
|
|
771
|
+
LDBCommandExecuteResult::Failed(ARG_MIN_BLOB_SIZE + " must be >= 0.");
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
int blob_file_size;
|
|
776
|
+
if (ParseIntOption(option_map_, ARG_BLOB_FILE_SIZE, blob_file_size,
|
|
777
|
+
exec_state_)) {
|
|
778
|
+
if (blob_file_size > 0) {
|
|
779
|
+
cf_opts->blob_file_size = blob_file_size;
|
|
780
|
+
} else {
|
|
781
|
+
exec_state_ =
|
|
782
|
+
LDBCommandExecuteResult::Failed(ARG_BLOB_FILE_SIZE + " must be > 0.");
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
cf_opts->enable_blob_garbage_collection = enable_blob_garbage_collection_;
|
|
787
|
+
|
|
788
|
+
double blob_garbage_collection_age_cutoff;
|
|
789
|
+
if (ParseDoubleOption(option_map_, ARG_BLOB_GARBAGE_COLLECTION_AGE_CUTOFF,
|
|
790
|
+
blob_garbage_collection_age_cutoff, exec_state_)) {
|
|
791
|
+
if (blob_garbage_collection_age_cutoff >= 0 &&
|
|
792
|
+
blob_garbage_collection_age_cutoff <= 1) {
|
|
793
|
+
cf_opts->blob_garbage_collection_age_cutoff =
|
|
794
|
+
blob_garbage_collection_age_cutoff;
|
|
795
|
+
} else {
|
|
796
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
797
|
+
ARG_BLOB_GARBAGE_COLLECTION_AGE_CUTOFF + " must be >= 0 and <= 1.");
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
double blob_garbage_collection_force_threshold;
|
|
802
|
+
if (ParseDoubleOption(option_map_,
|
|
803
|
+
ARG_BLOB_GARBAGE_COLLECTION_FORCE_THRESHOLD,
|
|
804
|
+
blob_garbage_collection_force_threshold, exec_state_)) {
|
|
805
|
+
if (blob_garbage_collection_force_threshold >= 0 &&
|
|
806
|
+
blob_garbage_collection_force_threshold <= 1) {
|
|
807
|
+
cf_opts->blob_garbage_collection_force_threshold =
|
|
808
|
+
blob_garbage_collection_force_threshold;
|
|
809
|
+
} else {
|
|
810
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
811
|
+
ARG_BLOB_GARBAGE_COLLECTION_FORCE_THRESHOLD +
|
|
812
|
+
" must be >= 0 and <= 1.");
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
int blob_compaction_readahead_size;
|
|
817
|
+
if (ParseIntOption(option_map_, ARG_BLOB_COMPACTION_READAHEAD_SIZE,
|
|
818
|
+
blob_compaction_readahead_size, exec_state_)) {
|
|
819
|
+
if (blob_compaction_readahead_size > 0) {
|
|
820
|
+
cf_opts->blob_compaction_readahead_size = blob_compaction_readahead_size;
|
|
821
|
+
} else {
|
|
822
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
823
|
+
ARG_BLOB_COMPACTION_READAHEAD_SIZE + " must be > 0.");
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
int blob_file_starting_level;
|
|
828
|
+
if (ParseIntOption(option_map_, ARG_BLOB_FILE_STARTING_LEVEL,
|
|
829
|
+
blob_file_starting_level, exec_state_)) {
|
|
830
|
+
if (blob_file_starting_level >= 0) {
|
|
831
|
+
cf_opts->blob_file_starting_level = blob_file_starting_level;
|
|
832
|
+
} else {
|
|
833
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
834
|
+
ARG_BLOB_FILE_STARTING_LEVEL + " must be >= 0.");
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
int prepopulate_blob_cache;
|
|
839
|
+
if (ParseIntOption(option_map_, ARG_PREPOPULATE_BLOB_CACHE,
|
|
840
|
+
prepopulate_blob_cache, exec_state_)) {
|
|
841
|
+
switch (prepopulate_blob_cache) {
|
|
842
|
+
case 0:
|
|
843
|
+
cf_opts->prepopulate_blob_cache = PrepopulateBlobCache::kDisable;
|
|
844
|
+
break;
|
|
845
|
+
case 1:
|
|
846
|
+
cf_opts->prepopulate_blob_cache = PrepopulateBlobCache::kFlushOnly;
|
|
847
|
+
break;
|
|
848
|
+
default:
|
|
849
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
850
|
+
ARG_PREPOPULATE_BLOB_CACHE +
|
|
851
|
+
" must be 0 (disable) or 1 (flush only).");
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
auto itr = option_map_.find(ARG_AUTO_COMPACTION);
|
|
856
|
+
if (itr != option_map_.end()) {
|
|
857
|
+
cf_opts->disable_auto_compactions = !StringToBool(itr->second);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
CompressionType compression_type;
|
|
861
|
+
if (ParseCompressionTypeOption(option_map_, ARG_COMPRESSION_TYPE,
|
|
862
|
+
compression_type, exec_state_)) {
|
|
863
|
+
cf_opts->compression = compression_type;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
CompressionType blob_compression_type;
|
|
867
|
+
if (ParseCompressionTypeOption(option_map_, ARG_BLOB_COMPRESSION_TYPE,
|
|
868
|
+
blob_compression_type, exec_state_)) {
|
|
869
|
+
cf_opts->blob_compression_type = blob_compression_type;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
int compression_max_dict_bytes;
|
|
873
|
+
if (ParseIntOption(option_map_, ARG_COMPRESSION_MAX_DICT_BYTES,
|
|
874
|
+
compression_max_dict_bytes, exec_state_)) {
|
|
875
|
+
if (compression_max_dict_bytes >= 0) {
|
|
876
|
+
cf_opts->compression_opts.max_dict_bytes = compression_max_dict_bytes;
|
|
877
|
+
} else {
|
|
878
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
879
|
+
ARG_COMPRESSION_MAX_DICT_BYTES + " must be >= 0.");
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
int write_buffer_size;
|
|
884
|
+
if (ParseIntOption(option_map_, ARG_WRITE_BUFFER_SIZE, write_buffer_size,
|
|
885
|
+
exec_state_)) {
|
|
886
|
+
if (write_buffer_size > 0) {
|
|
887
|
+
cf_opts->write_buffer_size = write_buffer_size;
|
|
888
|
+
} else {
|
|
889
|
+
exec_state_ = LDBCommandExecuteResult::Failed(ARG_WRITE_BUFFER_SIZE +
|
|
890
|
+
" must be > 0.");
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
int file_size;
|
|
895
|
+
if (ParseIntOption(option_map_, ARG_FILE_SIZE, file_size, exec_state_)) {
|
|
896
|
+
if (file_size > 0) {
|
|
897
|
+
cf_opts->target_file_size_base = file_size;
|
|
898
|
+
} else {
|
|
899
|
+
exec_state_ =
|
|
900
|
+
LDBCommandExecuteResult::Failed(ARG_FILE_SIZE + " must be > 0.");
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
int fix_prefix_len;
|
|
905
|
+
if (ParseIntOption(option_map_, ARG_FIX_PREFIX_LEN, fix_prefix_len,
|
|
906
|
+
exec_state_)) {
|
|
907
|
+
if (fix_prefix_len > 0) {
|
|
908
|
+
cf_opts->prefix_extractor.reset(
|
|
909
|
+
NewFixedPrefixTransform(static_cast<size_t>(fix_prefix_len)));
|
|
910
|
+
} else {
|
|
911
|
+
exec_state_ =
|
|
912
|
+
LDBCommandExecuteResult::Failed(ARG_FIX_PREFIX_LEN + " must be > 0.");
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// First, initializes the options state using the OPTIONS file when enabled.
|
|
918
|
+
// Second, overrides the options according to the CLI arguments and the
|
|
919
|
+
// specific subcommand being run.
|
|
920
|
+
void LDBCommand::PrepareOptions() {
|
|
921
|
+
if (!create_if_missing_ && try_load_options_) {
|
|
922
|
+
config_options_.env = options_.env;
|
|
923
|
+
Status s = LoadLatestOptions(config_options_, db_path_, &options_,
|
|
924
|
+
&column_families_);
|
|
925
|
+
if (!s.ok() && !s.IsNotFound()) {
|
|
926
|
+
// Option file exists but load option file error.
|
|
927
|
+
std::string msg = s.ToString();
|
|
928
|
+
exec_state_ = LDBCommandExecuteResult::Failed(msg);
|
|
929
|
+
db_ = nullptr;
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
if (!options_.wal_dir.empty()) {
|
|
933
|
+
if (options_.env->FileExists(options_.wal_dir).IsNotFound()) {
|
|
934
|
+
options_.wal_dir = db_path_;
|
|
935
|
+
fprintf(
|
|
936
|
+
stderr,
|
|
937
|
+
"wal_dir loaded from the option file doesn't exist. Ignore it.\n");
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// If merge operator is not set, set a string append operator.
|
|
942
|
+
for (auto& cf_entry : column_families_) {
|
|
943
|
+
if (!cf_entry.options.merge_operator) {
|
|
944
|
+
cf_entry.options.merge_operator =
|
|
945
|
+
MergeOperators::CreateStringAppendOperator(':');
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
if (options_.env == Env::Default()) {
|
|
951
|
+
options_.env = config_options_.env;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
OverrideBaseOptions();
|
|
955
|
+
if (exec_state_.IsFailed()) {
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
if (column_families_.empty()) {
|
|
960
|
+
// Reads the MANIFEST to figure out what column families exist. In this
|
|
961
|
+
// case, the option overrides from the CLI argument/specific subcommand
|
|
962
|
+
// apply to all column families.
|
|
963
|
+
std::vector<std::string> cf_list;
|
|
964
|
+
Status st = DB::ListColumnFamilies(options_, db_path_, &cf_list);
|
|
965
|
+
// It is possible the DB doesn't exist yet, for "create if not
|
|
966
|
+
// existing" case. The failure is ignored here. We rely on DB::Open()
|
|
967
|
+
// to give us the correct error message for problem with opening
|
|
968
|
+
// existing DB.
|
|
969
|
+
if (st.ok() && cf_list.size() > 1) {
|
|
970
|
+
// Ignore single column family DB.
|
|
971
|
+
for (auto cf_name : cf_list) {
|
|
972
|
+
column_families_.emplace_back(cf_name, options_);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
} else {
|
|
976
|
+
// We got column families from the OPTIONS file. In this case, the option
|
|
977
|
+
// overrides from the CLI argument/specific subcommand only apply to the
|
|
978
|
+
// column family specified by `--column_family_name`.
|
|
979
|
+
auto column_families_iter =
|
|
980
|
+
std::find_if(column_families_.begin(), column_families_.end(),
|
|
981
|
+
[this](const ColumnFamilyDescriptor& cf_desc) {
|
|
982
|
+
return cf_desc.name == column_family_name_;
|
|
983
|
+
});
|
|
984
|
+
if (column_families_iter == column_families_.end()) {
|
|
985
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
986
|
+
"Non-existing column family " + column_family_name_);
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
OverrideBaseCFOptions(&column_families_iter->options);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
bool LDBCommand::ParseKeyValue(const std::string& line, std::string* key,
|
|
994
|
+
std::string* value, bool is_key_hex,
|
|
995
|
+
bool is_value_hex) {
|
|
996
|
+
size_t pos = line.find(DELIM);
|
|
997
|
+
if (pos != std::string::npos) {
|
|
998
|
+
*key = line.substr(0, pos);
|
|
999
|
+
*value = line.substr(pos + strlen(DELIM));
|
|
1000
|
+
if (is_key_hex) {
|
|
1001
|
+
*key = HexToString(*key);
|
|
1002
|
+
}
|
|
1003
|
+
if (is_value_hex) {
|
|
1004
|
+
*value = HexToString(*value);
|
|
1005
|
+
}
|
|
1006
|
+
return true;
|
|
1007
|
+
} else {
|
|
1008
|
+
return false;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Make sure that ONLY the command-line options and flags expected by this
|
|
1014
|
+
* command are specified on the command-line. Extraneous options are usually
|
|
1015
|
+
* the result of user error.
|
|
1016
|
+
* Returns true if all checks pass. Else returns false, and prints an
|
|
1017
|
+
* appropriate error msg to stderr.
|
|
1018
|
+
*/
|
|
1019
|
+
bool LDBCommand::ValidateCmdLineOptions() {
|
|
1020
|
+
for (auto itr = option_map_.begin(); itr != option_map_.end(); ++itr) {
|
|
1021
|
+
if (std::find(valid_cmd_line_options_.begin(),
|
|
1022
|
+
valid_cmd_line_options_.end(),
|
|
1023
|
+
itr->first) == valid_cmd_line_options_.end()) {
|
|
1024
|
+
fprintf(stderr, "Invalid command-line option %s\n", itr->first.c_str());
|
|
1025
|
+
return false;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
for (std::vector<std::string>::const_iterator itr = flags_.begin();
|
|
1030
|
+
itr != flags_.end(); ++itr) {
|
|
1031
|
+
if (std::find(valid_cmd_line_options_.begin(),
|
|
1032
|
+
valid_cmd_line_options_.end(),
|
|
1033
|
+
*itr) == valid_cmd_line_options_.end()) {
|
|
1034
|
+
fprintf(stderr, "Invalid command-line flag %s\n", itr->c_str());
|
|
1035
|
+
return false;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
if (!NoDBOpen() && option_map_.find(ARG_DB) == option_map_.end() &&
|
|
1040
|
+
option_map_.find(ARG_PATH) == option_map_.end()) {
|
|
1041
|
+
fprintf(stderr, "Either %s or %s must be specified.\n", ARG_DB.c_str(),
|
|
1042
|
+
ARG_PATH.c_str());
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
return true;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
std::string LDBCommand::HexToString(const std::string& str) {
|
|
1050
|
+
std::string result;
|
|
1051
|
+
std::string::size_type len = str.length();
|
|
1052
|
+
if (len < 2 || str[0] != '0' || str[1] != 'x') {
|
|
1053
|
+
fprintf(stderr, "Invalid hex input %s. Must start with 0x\n", str.c_str());
|
|
1054
|
+
throw "Invalid hex input";
|
|
1055
|
+
}
|
|
1056
|
+
if (!Slice(str.data() + 2, len - 2).DecodeHex(&result)) {
|
|
1057
|
+
throw "Invalid hex input";
|
|
1058
|
+
}
|
|
1059
|
+
return result;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
std::string LDBCommand::StringToHex(const std::string& str) {
|
|
1063
|
+
std::string result("0x");
|
|
1064
|
+
result.append(Slice(str).ToString(true));
|
|
1065
|
+
return result;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
std::string LDBCommand::PrintKeyValue(const std::string& key,
|
|
1069
|
+
const std::string& value, bool is_key_hex,
|
|
1070
|
+
bool is_value_hex) {
|
|
1071
|
+
std::string result;
|
|
1072
|
+
result.append(is_key_hex ? StringToHex(key) : key);
|
|
1073
|
+
result.append(DELIM);
|
|
1074
|
+
result.append(is_value_hex ? StringToHex(value) : value);
|
|
1075
|
+
return result;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
std::string LDBCommand::PrintKeyValue(const std::string& key,
|
|
1079
|
+
const std::string& value, bool is_hex) {
|
|
1080
|
+
return PrintKeyValue(key, value, is_hex, is_hex);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
std::string LDBCommand::HelpRangeCmdArgs() {
|
|
1084
|
+
std::ostringstream str_stream;
|
|
1085
|
+
str_stream << " ";
|
|
1086
|
+
str_stream << "[--" << ARG_FROM << "] ";
|
|
1087
|
+
str_stream << "[--" << ARG_TO << "] ";
|
|
1088
|
+
return str_stream.str();
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
bool LDBCommand::IsKeyHex(const std::map<std::string, std::string>& options,
|
|
1092
|
+
const std::vector<std::string>& flags) {
|
|
1093
|
+
return (IsFlagPresent(flags, ARG_HEX) || IsFlagPresent(flags, ARG_KEY_HEX) ||
|
|
1094
|
+
ParseBooleanOption(options, ARG_HEX, false) ||
|
|
1095
|
+
ParseBooleanOption(options, ARG_KEY_HEX, false));
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
bool LDBCommand::IsValueHex(const std::map<std::string, std::string>& options,
|
|
1099
|
+
const std::vector<std::string>& flags) {
|
|
1100
|
+
return (IsFlagPresent(flags, ARG_HEX) ||
|
|
1101
|
+
IsFlagPresent(flags, ARG_VALUE_HEX) ||
|
|
1102
|
+
ParseBooleanOption(options, ARG_HEX, false) ||
|
|
1103
|
+
ParseBooleanOption(options, ARG_VALUE_HEX, false));
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
bool LDBCommand::IsTryLoadOptions(
|
|
1107
|
+
const std::map<std::string, std::string>& options,
|
|
1108
|
+
const std::vector<std::string>& flags) {
|
|
1109
|
+
if (IsFlagPresent(flags, ARG_TRY_LOAD_OPTIONS)) {
|
|
1110
|
+
return true;
|
|
1111
|
+
}
|
|
1112
|
+
// if `DB` is specified and not explicitly to create a new db, default
|
|
1113
|
+
// `try_load_options` to true. The user could still disable that by set
|
|
1114
|
+
// `try_load_options=false`.
|
|
1115
|
+
// Note: Opening as TTL DB doesn't support `try_load_options`, so it's default
|
|
1116
|
+
// to false. TODO: TTL_DB may need to fix that, otherwise it's unable to open
|
|
1117
|
+
// DB which has incompatible setting with default options.
|
|
1118
|
+
bool default_val = (options.find(ARG_DB) != options.end()) &&
|
|
1119
|
+
!IsFlagPresent(flags, ARG_CREATE_IF_MISSING) &&
|
|
1120
|
+
!IsFlagPresent(flags, ARG_TTL);
|
|
1121
|
+
return ParseBooleanOption(options, ARG_TRY_LOAD_OPTIONS, default_val);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
bool LDBCommand::ParseBooleanOption(
|
|
1125
|
+
const std::map<std::string, std::string>& options,
|
|
1126
|
+
const std::string& option, bool default_val) {
|
|
1127
|
+
auto itr = options.find(option);
|
|
1128
|
+
if (itr != options.end()) {
|
|
1129
|
+
std::string option_val = itr->second;
|
|
1130
|
+
return StringToBool(itr->second);
|
|
1131
|
+
}
|
|
1132
|
+
return default_val;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
bool LDBCommand::StringToBool(std::string val) {
|
|
1136
|
+
std::transform(val.begin(), val.end(), val.begin(),
|
|
1137
|
+
[](char ch) -> char { return (char)::tolower(ch); });
|
|
1138
|
+
|
|
1139
|
+
if (val == "true") {
|
|
1140
|
+
return true;
|
|
1141
|
+
} else if (val == "false") {
|
|
1142
|
+
return false;
|
|
1143
|
+
} else {
|
|
1144
|
+
throw "Invalid value for boolean argument";
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
CompactorCommand::CompactorCommand(
|
|
1149
|
+
const std::vector<std::string>& /*params*/,
|
|
1150
|
+
const std::map<std::string, std::string>& options,
|
|
1151
|
+
const std::vector<std::string>& flags)
|
|
1152
|
+
: LDBCommand(options, flags, false,
|
|
1153
|
+
BuildCmdLineOptions({ARG_FROM, ARG_TO, ARG_HEX, ARG_KEY_HEX,
|
|
1154
|
+
ARG_VALUE_HEX, ARG_TTL})),
|
|
1155
|
+
null_from_(true),
|
|
1156
|
+
null_to_(true) {
|
|
1157
|
+
auto itr = options.find(ARG_FROM);
|
|
1158
|
+
if (itr != options.end()) {
|
|
1159
|
+
null_from_ = false;
|
|
1160
|
+
from_ = itr->second;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
itr = options.find(ARG_TO);
|
|
1164
|
+
if (itr != options.end()) {
|
|
1165
|
+
null_to_ = false;
|
|
1166
|
+
to_ = itr->second;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
if (is_key_hex_) {
|
|
1170
|
+
if (!null_from_) {
|
|
1171
|
+
from_ = HexToString(from_);
|
|
1172
|
+
}
|
|
1173
|
+
if (!null_to_) {
|
|
1174
|
+
to_ = HexToString(to_);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
void CompactorCommand::Help(std::string& ret) {
|
|
1180
|
+
ret.append(" ");
|
|
1181
|
+
ret.append(CompactorCommand::Name());
|
|
1182
|
+
ret.append(HelpRangeCmdArgs());
|
|
1183
|
+
ret.append("\n");
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
void CompactorCommand::DoCommand() {
|
|
1187
|
+
if (!db_) {
|
|
1188
|
+
assert(GetExecuteState().IsFailed());
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
Slice* begin = nullptr;
|
|
1193
|
+
Slice* end = nullptr;
|
|
1194
|
+
if (!null_from_) {
|
|
1195
|
+
begin = new Slice(from_);
|
|
1196
|
+
}
|
|
1197
|
+
if (!null_to_) {
|
|
1198
|
+
end = new Slice(to_);
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
CompactRangeOptions cro;
|
|
1202
|
+
cro.bottommost_level_compaction = BottommostLevelCompaction::kForceOptimized;
|
|
1203
|
+
|
|
1204
|
+
Status s = db_->CompactRange(cro, GetCfHandle(), begin, end);
|
|
1205
|
+
if (!s.ok()) {
|
|
1206
|
+
std::stringstream oss;
|
|
1207
|
+
oss << "Compaction failed: " << s.ToString();
|
|
1208
|
+
exec_state_ = LDBCommandExecuteResult::Failed(oss.str());
|
|
1209
|
+
} else {
|
|
1210
|
+
exec_state_ = LDBCommandExecuteResult::Succeed("");
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
delete begin;
|
|
1214
|
+
delete end;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
// ---------------------------------------------------------------------------
|
|
1218
|
+
const std::string DBLoaderCommand::ARG_DISABLE_WAL = "disable_wal";
|
|
1219
|
+
const std::string DBLoaderCommand::ARG_BULK_LOAD = "bulk_load";
|
|
1220
|
+
const std::string DBLoaderCommand::ARG_COMPACT = "compact";
|
|
1221
|
+
|
|
1222
|
+
DBLoaderCommand::DBLoaderCommand(
|
|
1223
|
+
const std::vector<std::string>& /*params*/,
|
|
1224
|
+
const std::map<std::string, std::string>& options,
|
|
1225
|
+
const std::vector<std::string>& flags)
|
|
1226
|
+
: LDBCommand(
|
|
1227
|
+
options, flags, false,
|
|
1228
|
+
BuildCmdLineOptions({ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX, ARG_FROM,
|
|
1229
|
+
ARG_TO, ARG_CREATE_IF_MISSING, ARG_DISABLE_WAL,
|
|
1230
|
+
ARG_BULK_LOAD, ARG_COMPACT})),
|
|
1231
|
+
disable_wal_(false),
|
|
1232
|
+
bulk_load_(false),
|
|
1233
|
+
compact_(false) {
|
|
1234
|
+
create_if_missing_ = IsFlagPresent(flags, ARG_CREATE_IF_MISSING);
|
|
1235
|
+
disable_wal_ = IsFlagPresent(flags, ARG_DISABLE_WAL);
|
|
1236
|
+
bulk_load_ = IsFlagPresent(flags, ARG_BULK_LOAD);
|
|
1237
|
+
compact_ = IsFlagPresent(flags, ARG_COMPACT);
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
void DBLoaderCommand::Help(std::string& ret) {
|
|
1241
|
+
ret.append(" ");
|
|
1242
|
+
ret.append(DBLoaderCommand::Name());
|
|
1243
|
+
ret.append(" [--" + ARG_CREATE_IF_MISSING + "]");
|
|
1244
|
+
ret.append(" [--" + ARG_DISABLE_WAL + "]");
|
|
1245
|
+
ret.append(" [--" + ARG_BULK_LOAD + "]");
|
|
1246
|
+
ret.append(" [--" + ARG_COMPACT + "]");
|
|
1247
|
+
ret.append("\n");
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
void DBLoaderCommand::OverrideBaseOptions() {
|
|
1251
|
+
LDBCommand::OverrideBaseOptions();
|
|
1252
|
+
options_.create_if_missing = create_if_missing_;
|
|
1253
|
+
if (bulk_load_) {
|
|
1254
|
+
options_.PrepareForBulkLoad();
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
void DBLoaderCommand::DoCommand() {
|
|
1259
|
+
if (!db_) {
|
|
1260
|
+
assert(GetExecuteState().IsFailed());
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
WriteOptions write_options;
|
|
1265
|
+
if (disable_wal_) {
|
|
1266
|
+
write_options.disableWAL = true;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
int bad_lines = 0;
|
|
1270
|
+
std::string line;
|
|
1271
|
+
// prefer ifstream getline performance vs that from std::cin istream
|
|
1272
|
+
std::ifstream ifs_stdin("/dev/stdin");
|
|
1273
|
+
std::istream* istream_p = ifs_stdin.is_open() ? &ifs_stdin : &std::cin;
|
|
1274
|
+
Status s;
|
|
1275
|
+
while (s.ok() && getline(*istream_p, line, '\n')) {
|
|
1276
|
+
std::string key;
|
|
1277
|
+
std::string value;
|
|
1278
|
+
if (ParseKeyValue(line, &key, &value, is_key_hex_, is_value_hex_)) {
|
|
1279
|
+
s = db_->Put(write_options, GetCfHandle(), Slice(key), Slice(value));
|
|
1280
|
+
} else if (0 == line.find("Keys in range:")) {
|
|
1281
|
+
// ignore this line
|
|
1282
|
+
} else if (0 == line.find("Created bg thread 0x")) {
|
|
1283
|
+
// ignore this line
|
|
1284
|
+
} else {
|
|
1285
|
+
bad_lines++;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
if (bad_lines > 0) {
|
|
1290
|
+
std::cout << "Warning: " << bad_lines << " bad lines ignored." << std::endl;
|
|
1291
|
+
}
|
|
1292
|
+
if (!s.ok()) {
|
|
1293
|
+
std::stringstream oss;
|
|
1294
|
+
oss << "Load failed: " << s.ToString();
|
|
1295
|
+
exec_state_ = LDBCommandExecuteResult::Failed(oss.str());
|
|
1296
|
+
}
|
|
1297
|
+
if (compact_ && s.ok()) {
|
|
1298
|
+
s = db_->CompactRange(CompactRangeOptions(), GetCfHandle(), nullptr,
|
|
1299
|
+
nullptr);
|
|
1300
|
+
}
|
|
1301
|
+
if (!s.ok()) {
|
|
1302
|
+
std::stringstream oss;
|
|
1303
|
+
oss << "Compaction failed: " << s.ToString();
|
|
1304
|
+
exec_state_ = LDBCommandExecuteResult::Failed(oss.str());
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
// ----------------------------------------------------------------------------
|
|
1309
|
+
|
|
1310
|
+
namespace {
|
|
1311
|
+
|
|
1312
|
+
void DumpManifestFile(Options options, std::string file, bool verbose, bool hex,
|
|
1313
|
+
bool json) {
|
|
1314
|
+
EnvOptions sopt;
|
|
1315
|
+
std::string dbname("dummy");
|
|
1316
|
+
std::shared_ptr<Cache> tc(NewLRUCache(options.max_open_files - 10,
|
|
1317
|
+
options.table_cache_numshardbits));
|
|
1318
|
+
// Notice we are using the default options not through SanitizeOptions(),
|
|
1319
|
+
// if VersionSet::DumpManifest() depends on any option done by
|
|
1320
|
+
// SanitizeOptions(), we need to initialize it manually.
|
|
1321
|
+
options.db_paths.emplace_back("dummy", 0);
|
|
1322
|
+
options.num_levels = 64;
|
|
1323
|
+
WriteController wc(options.delayed_write_rate);
|
|
1324
|
+
WriteBufferManager wb(options.db_write_buffer_size);
|
|
1325
|
+
ImmutableDBOptions immutable_db_options(options);
|
|
1326
|
+
VersionSet versions(dbname, &immutable_db_options, sopt, tc.get(), &wb, &wc,
|
|
1327
|
+
/*block_cache_tracer=*/nullptr, /*io_tracer=*/nullptr,
|
|
1328
|
+
/*db_id*/ "", /*db_session_id*/ "");
|
|
1329
|
+
Status s = versions.DumpManifest(options, file, verbose, hex, json);
|
|
1330
|
+
if (!s.ok()) {
|
|
1331
|
+
fprintf(stderr, "Error in processing file %s %s\n", file.c_str(),
|
|
1332
|
+
s.ToString().c_str());
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
} // namespace
|
|
1337
|
+
|
|
1338
|
+
const std::string ManifestDumpCommand::ARG_VERBOSE = "verbose";
|
|
1339
|
+
const std::string ManifestDumpCommand::ARG_JSON = "json";
|
|
1340
|
+
const std::string ManifestDumpCommand::ARG_PATH = "path";
|
|
1341
|
+
|
|
1342
|
+
void ManifestDumpCommand::Help(std::string& ret) {
|
|
1343
|
+
ret.append(" ");
|
|
1344
|
+
ret.append(ManifestDumpCommand::Name());
|
|
1345
|
+
ret.append(" [--" + ARG_VERBOSE + "]");
|
|
1346
|
+
ret.append(" [--" + ARG_JSON + "]");
|
|
1347
|
+
ret.append(" [--" + ARG_PATH + "=<path_to_manifest_file>]");
|
|
1348
|
+
ret.append("\n");
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
ManifestDumpCommand::ManifestDumpCommand(
|
|
1352
|
+
const std::vector<std::string>& /*params*/,
|
|
1353
|
+
const std::map<std::string, std::string>& options,
|
|
1354
|
+
const std::vector<std::string>& flags)
|
|
1355
|
+
: LDBCommand(
|
|
1356
|
+
options, flags, false,
|
|
1357
|
+
BuildCmdLineOptions({ARG_VERBOSE, ARG_PATH, ARG_HEX, ARG_JSON})),
|
|
1358
|
+
verbose_(false),
|
|
1359
|
+
json_(false),
|
|
1360
|
+
path_("") {
|
|
1361
|
+
verbose_ = IsFlagPresent(flags, ARG_VERBOSE);
|
|
1362
|
+
json_ = IsFlagPresent(flags, ARG_JSON);
|
|
1363
|
+
|
|
1364
|
+
auto itr = options.find(ARG_PATH);
|
|
1365
|
+
if (itr != options.end()) {
|
|
1366
|
+
path_ = itr->second;
|
|
1367
|
+
if (path_.empty()) {
|
|
1368
|
+
exec_state_ = LDBCommandExecuteResult::Failed("--path: missing pathname");
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
void ManifestDumpCommand::DoCommand() {
|
|
1374
|
+
std::string manifestfile;
|
|
1375
|
+
|
|
1376
|
+
if (!path_.empty()) {
|
|
1377
|
+
manifestfile = path_;
|
|
1378
|
+
} else {
|
|
1379
|
+
// We need to find the manifest file by searching the directory
|
|
1380
|
+
// containing the db for files of the form MANIFEST_[0-9]+
|
|
1381
|
+
|
|
1382
|
+
std::vector<std::string> files;
|
|
1383
|
+
Status s = options_.env->GetChildren(db_path_, &files);
|
|
1384
|
+
if (!s.ok()) {
|
|
1385
|
+
std::string err_msg = s.ToString();
|
|
1386
|
+
err_msg.append(": Failed to list the content of ");
|
|
1387
|
+
err_msg.append(db_path_);
|
|
1388
|
+
exec_state_ = LDBCommandExecuteResult::Failed(err_msg);
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
const std::string kManifestNamePrefix = "MANIFEST-";
|
|
1392
|
+
std::string matched_file;
|
|
1393
|
+
#ifdef OS_WIN
|
|
1394
|
+
const char kPathDelim = '\\';
|
|
1395
|
+
#else
|
|
1396
|
+
const char kPathDelim = '/';
|
|
1397
|
+
#endif
|
|
1398
|
+
for (const auto& file_path : files) {
|
|
1399
|
+
// Some Env::GetChildren() return absolute paths. Some directories' path
|
|
1400
|
+
// end with path delim, e.g. '/' or '\\'.
|
|
1401
|
+
size_t pos = file_path.find_last_of(kPathDelim);
|
|
1402
|
+
if (pos == file_path.size() - 1) {
|
|
1403
|
+
continue;
|
|
1404
|
+
}
|
|
1405
|
+
std::string fname;
|
|
1406
|
+
if (pos != std::string::npos) {
|
|
1407
|
+
// Absolute path.
|
|
1408
|
+
fname.assign(file_path, pos + 1, file_path.size() - pos - 1);
|
|
1409
|
+
} else {
|
|
1410
|
+
fname = file_path;
|
|
1411
|
+
}
|
|
1412
|
+
uint64_t file_num = 0;
|
|
1413
|
+
FileType file_type = kWalFile; // Just for initialization
|
|
1414
|
+
if (ParseFileName(fname, &file_num, &file_type) &&
|
|
1415
|
+
file_type == kDescriptorFile) {
|
|
1416
|
+
if (!matched_file.empty()) {
|
|
1417
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
1418
|
+
"Multiple MANIFEST files found; use --path to select one");
|
|
1419
|
+
return;
|
|
1420
|
+
} else {
|
|
1421
|
+
matched_file.swap(fname);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
if (matched_file.empty()) {
|
|
1426
|
+
std::string err_msg("No MANIFEST found in ");
|
|
1427
|
+
err_msg.append(db_path_);
|
|
1428
|
+
exec_state_ = LDBCommandExecuteResult::Failed(err_msg);
|
|
1429
|
+
return;
|
|
1430
|
+
}
|
|
1431
|
+
if (db_path_.back() != '/') {
|
|
1432
|
+
db_path_.append("/");
|
|
1433
|
+
}
|
|
1434
|
+
manifestfile = db_path_ + matched_file;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
if (verbose_) {
|
|
1438
|
+
fprintf(stdout, "Processing Manifest file %s\n", manifestfile.c_str());
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
DumpManifestFile(options_, manifestfile, verbose_, is_key_hex_, json_);
|
|
1442
|
+
|
|
1443
|
+
if (verbose_) {
|
|
1444
|
+
fprintf(stdout, "Processing Manifest file %s done\n", manifestfile.c_str());
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
// ----------------------------------------------------------------------------
|
|
1449
|
+
namespace {
|
|
1450
|
+
|
|
1451
|
+
Status GetLiveFilesChecksumInfoFromVersionSet(Options options,
|
|
1452
|
+
const std::string& db_path,
|
|
1453
|
+
FileChecksumList* checksum_list) {
|
|
1454
|
+
EnvOptions sopt;
|
|
1455
|
+
Status s;
|
|
1456
|
+
std::string dbname(db_path);
|
|
1457
|
+
std::shared_ptr<Cache> tc(NewLRUCache(options.max_open_files - 10,
|
|
1458
|
+
options.table_cache_numshardbits));
|
|
1459
|
+
// Notice we are using the default options not through SanitizeOptions(),
|
|
1460
|
+
// if VersionSet::GetLiveFilesChecksumInfo depends on any option done by
|
|
1461
|
+
// SanitizeOptions(), we need to initialize it manually.
|
|
1462
|
+
options.db_paths.emplace_back(db_path, 0);
|
|
1463
|
+
options.num_levels = 64;
|
|
1464
|
+
WriteController wc(options.delayed_write_rate);
|
|
1465
|
+
WriteBufferManager wb(options.db_write_buffer_size);
|
|
1466
|
+
ImmutableDBOptions immutable_db_options(options);
|
|
1467
|
+
VersionSet versions(dbname, &immutable_db_options, sopt, tc.get(), &wb, &wc,
|
|
1468
|
+
/*block_cache_tracer=*/nullptr, /*io_tracer=*/nullptr,
|
|
1469
|
+
/*db_id*/ "", /*db_session_id*/ "");
|
|
1470
|
+
std::vector<std::string> cf_name_list;
|
|
1471
|
+
s = versions.ListColumnFamilies(&cf_name_list, db_path,
|
|
1472
|
+
immutable_db_options.fs.get());
|
|
1473
|
+
if (s.ok()) {
|
|
1474
|
+
std::vector<ColumnFamilyDescriptor> cf_list;
|
|
1475
|
+
for (const auto& name : cf_name_list) {
|
|
1476
|
+
cf_list.emplace_back(name, ColumnFamilyOptions(options));
|
|
1477
|
+
}
|
|
1478
|
+
s = versions.Recover(cf_list, true);
|
|
1479
|
+
}
|
|
1480
|
+
if (s.ok()) {
|
|
1481
|
+
s = versions.GetLiveFilesChecksumInfo(checksum_list);
|
|
1482
|
+
}
|
|
1483
|
+
return s;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
} // namespace
|
|
1487
|
+
|
|
1488
|
+
const std::string FileChecksumDumpCommand::ARG_PATH = "path";
|
|
1489
|
+
|
|
1490
|
+
void FileChecksumDumpCommand::Help(std::string& ret) {
|
|
1491
|
+
ret.append(" ");
|
|
1492
|
+
ret.append(FileChecksumDumpCommand::Name());
|
|
1493
|
+
ret.append(" [--" + ARG_PATH + "=<path_to_manifest_file>]");
|
|
1494
|
+
ret.append("\n");
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
FileChecksumDumpCommand::FileChecksumDumpCommand(
|
|
1498
|
+
const std::vector<std::string>& /*params*/,
|
|
1499
|
+
const std::map<std::string, std::string>& options,
|
|
1500
|
+
const std::vector<std::string>& flags)
|
|
1501
|
+
: LDBCommand(options, flags, false,
|
|
1502
|
+
BuildCmdLineOptions({ARG_PATH, ARG_HEX})),
|
|
1503
|
+
path_("") {
|
|
1504
|
+
auto itr = options.find(ARG_PATH);
|
|
1505
|
+
if (itr != options.end()) {
|
|
1506
|
+
path_ = itr->second;
|
|
1507
|
+
if (path_.empty()) {
|
|
1508
|
+
exec_state_ = LDBCommandExecuteResult::Failed("--path: missing pathname");
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
is_checksum_hex_ = IsFlagPresent(flags, ARG_HEX);
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
void FileChecksumDumpCommand::DoCommand() {
|
|
1515
|
+
// print out the checksum information in the following format:
|
|
1516
|
+
// sst file number, checksum function name, checksum value
|
|
1517
|
+
// sst file number, checksum function name, checksum value
|
|
1518
|
+
// ......
|
|
1519
|
+
|
|
1520
|
+
std::unique_ptr<FileChecksumList> checksum_list(NewFileChecksumList());
|
|
1521
|
+
Status s = GetLiveFilesChecksumInfoFromVersionSet(options_, db_path_,
|
|
1522
|
+
checksum_list.get());
|
|
1523
|
+
if (s.ok() && checksum_list != nullptr) {
|
|
1524
|
+
std::vector<uint64_t> file_numbers;
|
|
1525
|
+
std::vector<std::string> checksums;
|
|
1526
|
+
std::vector<std::string> checksum_func_names;
|
|
1527
|
+
s = checksum_list->GetAllFileChecksums(&file_numbers, &checksums,
|
|
1528
|
+
&checksum_func_names);
|
|
1529
|
+
if (s.ok()) {
|
|
1530
|
+
for (size_t i = 0; i < file_numbers.size(); i++) {
|
|
1531
|
+
assert(i < file_numbers.size());
|
|
1532
|
+
assert(i < checksums.size());
|
|
1533
|
+
assert(i < checksum_func_names.size());
|
|
1534
|
+
std::string checksum;
|
|
1535
|
+
if (is_checksum_hex_) {
|
|
1536
|
+
checksum = StringToHex(checksums[i]);
|
|
1537
|
+
} else {
|
|
1538
|
+
checksum = std::move(checksums[i]);
|
|
1539
|
+
}
|
|
1540
|
+
fprintf(stdout, "%" PRId64 ", %s, %s\n", file_numbers[i],
|
|
1541
|
+
checksum_func_names[i].c_str(), checksum.c_str());
|
|
1542
|
+
}
|
|
1543
|
+
fprintf(stdout, "Print SST file checksum information finished \n");
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
if (!s.ok()) {
|
|
1548
|
+
exec_state_ = LDBCommandExecuteResult::Failed(s.ToString());
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
// ----------------------------------------------------------------------------
|
|
1553
|
+
|
|
1554
|
+
void GetPropertyCommand::Help(std::string& ret) {
|
|
1555
|
+
ret.append(" ");
|
|
1556
|
+
ret.append(GetPropertyCommand::Name());
|
|
1557
|
+
ret.append(" <property_name>");
|
|
1558
|
+
ret.append("\n");
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
GetPropertyCommand::GetPropertyCommand(
|
|
1562
|
+
const std::vector<std::string>& params,
|
|
1563
|
+
const std::map<std::string, std::string>& options,
|
|
1564
|
+
const std::vector<std::string>& flags)
|
|
1565
|
+
: LDBCommand(options, flags, true, BuildCmdLineOptions({})) {
|
|
1566
|
+
if (params.size() != 1) {
|
|
1567
|
+
exec_state_ =
|
|
1568
|
+
LDBCommandExecuteResult::Failed("property name must be specified");
|
|
1569
|
+
} else {
|
|
1570
|
+
property_ = params[0];
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
void GetPropertyCommand::DoCommand() {
|
|
1575
|
+
if (!db_) {
|
|
1576
|
+
assert(GetExecuteState().IsFailed());
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
std::map<std::string, std::string> value_map;
|
|
1581
|
+
std::string value;
|
|
1582
|
+
|
|
1583
|
+
// Rather than having different ldb command for map properties vs. string
|
|
1584
|
+
// properties, we simply try Map property first. (This order only chosen
|
|
1585
|
+
// because I prefer the map-style output for
|
|
1586
|
+
// "rocksdb.aggregated-table-properties".)
|
|
1587
|
+
if (db_->GetMapProperty(GetCfHandle(), property_, &value_map)) {
|
|
1588
|
+
if (value_map.empty()) {
|
|
1589
|
+
fprintf(stdout, "%s: <empty map>\n", property_.c_str());
|
|
1590
|
+
} else {
|
|
1591
|
+
for (auto& e : value_map) {
|
|
1592
|
+
fprintf(stdout, "%s.%s: %s\n", property_.c_str(), e.first.c_str(),
|
|
1593
|
+
e.second.c_str());
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
} else if (db_->GetProperty(GetCfHandle(), property_, &value)) {
|
|
1597
|
+
fprintf(stdout, "%s: %s\n", property_.c_str(), value.c_str());
|
|
1598
|
+
} else {
|
|
1599
|
+
exec_state_ =
|
|
1600
|
+
LDBCommandExecuteResult::Failed("failed to get property: " + property_);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
// ----------------------------------------------------------------------------
|
|
1605
|
+
|
|
1606
|
+
void ListColumnFamiliesCommand::Help(std::string& ret) {
|
|
1607
|
+
ret.append(" ");
|
|
1608
|
+
ret.append(ListColumnFamiliesCommand::Name());
|
|
1609
|
+
ret.append("\n");
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
ListColumnFamiliesCommand::ListColumnFamiliesCommand(
|
|
1613
|
+
const std::vector<std::string>& /*params*/,
|
|
1614
|
+
const std::map<std::string, std::string>& options,
|
|
1615
|
+
const std::vector<std::string>& flags)
|
|
1616
|
+
: LDBCommand(options, flags, false, BuildCmdLineOptions({})) {}
|
|
1617
|
+
|
|
1618
|
+
void ListColumnFamiliesCommand::DoCommand() {
|
|
1619
|
+
std::vector<std::string> column_families;
|
|
1620
|
+
Status s = DB::ListColumnFamilies(options_, db_path_, &column_families);
|
|
1621
|
+
if (!s.ok()) {
|
|
1622
|
+
fprintf(stderr, "Error in processing db %s %s\n", db_path_.c_str(),
|
|
1623
|
+
s.ToString().c_str());
|
|
1624
|
+
} else {
|
|
1625
|
+
fprintf(stdout, "Column families in %s: \n{", db_path_.c_str());
|
|
1626
|
+
bool first = true;
|
|
1627
|
+
for (auto cf : column_families) {
|
|
1628
|
+
if (!first) {
|
|
1629
|
+
fprintf(stdout, ", ");
|
|
1630
|
+
}
|
|
1631
|
+
first = false;
|
|
1632
|
+
fprintf(stdout, "%s", cf.c_str());
|
|
1633
|
+
}
|
|
1634
|
+
fprintf(stdout, "}\n");
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
void CreateColumnFamilyCommand::Help(std::string& ret) {
|
|
1639
|
+
ret.append(" ");
|
|
1640
|
+
ret.append(CreateColumnFamilyCommand::Name());
|
|
1641
|
+
ret.append(" --db=<db_path> <new_column_family_name>");
|
|
1642
|
+
ret.append("\n");
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
CreateColumnFamilyCommand::CreateColumnFamilyCommand(
|
|
1646
|
+
const std::vector<std::string>& params,
|
|
1647
|
+
const std::map<std::string, std::string>& options,
|
|
1648
|
+
const std::vector<std::string>& flags)
|
|
1649
|
+
: LDBCommand(options, flags, true, {ARG_DB}) {
|
|
1650
|
+
if (params.size() != 1) {
|
|
1651
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
1652
|
+
"new column family name must be specified");
|
|
1653
|
+
} else {
|
|
1654
|
+
new_cf_name_ = params[0];
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
void CreateColumnFamilyCommand::DoCommand() {
|
|
1659
|
+
if (!db_) {
|
|
1660
|
+
assert(GetExecuteState().IsFailed());
|
|
1661
|
+
return;
|
|
1662
|
+
}
|
|
1663
|
+
ColumnFamilyHandle* new_cf_handle = nullptr;
|
|
1664
|
+
Status st = db_->CreateColumnFamily(options_, new_cf_name_, &new_cf_handle);
|
|
1665
|
+
if (st.ok()) {
|
|
1666
|
+
fprintf(stdout, "OK\n");
|
|
1667
|
+
} else {
|
|
1668
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
1669
|
+
"Fail to create new column family: " + st.ToString());
|
|
1670
|
+
}
|
|
1671
|
+
delete new_cf_handle;
|
|
1672
|
+
CloseDB();
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
void DropColumnFamilyCommand::Help(std::string& ret) {
|
|
1676
|
+
ret.append(" ");
|
|
1677
|
+
ret.append(DropColumnFamilyCommand::Name());
|
|
1678
|
+
ret.append(" --db=<db_path> <column_family_name_to_drop>");
|
|
1679
|
+
ret.append("\n");
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
DropColumnFamilyCommand::DropColumnFamilyCommand(
|
|
1683
|
+
const std::vector<std::string>& params,
|
|
1684
|
+
const std::map<std::string, std::string>& options,
|
|
1685
|
+
const std::vector<std::string>& flags)
|
|
1686
|
+
: LDBCommand(options, flags, true, {ARG_DB}) {
|
|
1687
|
+
if (params.size() != 1) {
|
|
1688
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
1689
|
+
"The name of column family to drop must be specified");
|
|
1690
|
+
} else {
|
|
1691
|
+
cf_name_to_drop_ = params[0];
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
void DropColumnFamilyCommand::DoCommand() {
|
|
1696
|
+
if (!db_) {
|
|
1697
|
+
assert(GetExecuteState().IsFailed());
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
auto iter = cf_handles_.find(cf_name_to_drop_);
|
|
1701
|
+
if (iter == cf_handles_.end()) {
|
|
1702
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
1703
|
+
"Column family: " + cf_name_to_drop_ + " doesn't exist in db.");
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
ColumnFamilyHandle* cf_handle_to_drop = iter->second;
|
|
1707
|
+
Status st = db_->DropColumnFamily(cf_handle_to_drop);
|
|
1708
|
+
if (st.ok()) {
|
|
1709
|
+
fprintf(stdout, "OK\n");
|
|
1710
|
+
} else {
|
|
1711
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
1712
|
+
"Fail to drop column family: " + st.ToString());
|
|
1713
|
+
}
|
|
1714
|
+
CloseDB();
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
// ----------------------------------------------------------------------------
|
|
1718
|
+
namespace {
|
|
1719
|
+
|
|
1720
|
+
// This function only called when it's the sane case of >1 buckets in time-range
|
|
1721
|
+
// Also called only when timekv falls between ttl_start and ttl_end provided
|
|
1722
|
+
void IncBucketCounts(std::vector<uint64_t>& bucket_counts, int ttl_start,
|
|
1723
|
+
int time_range, int bucket_size, int timekv,
|
|
1724
|
+
int num_buckets) {
|
|
1725
|
+
#ifdef NDEBUG
|
|
1726
|
+
(void)time_range;
|
|
1727
|
+
(void)num_buckets;
|
|
1728
|
+
#endif
|
|
1729
|
+
assert(time_range > 0 && timekv >= ttl_start && bucket_size > 0 &&
|
|
1730
|
+
timekv < (ttl_start + time_range) && num_buckets > 1);
|
|
1731
|
+
int bucket = (timekv - ttl_start) / bucket_size;
|
|
1732
|
+
bucket_counts[bucket]++;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
void PrintBucketCounts(const std::vector<uint64_t>& bucket_counts,
|
|
1736
|
+
int ttl_start, int ttl_end, int bucket_size,
|
|
1737
|
+
int num_buckets) {
|
|
1738
|
+
int time_point = ttl_start;
|
|
1739
|
+
for (int i = 0; i < num_buckets - 1; i++, time_point += bucket_size) {
|
|
1740
|
+
fprintf(stdout, "Keys in range %s to %s : %lu\n",
|
|
1741
|
+
TimeToHumanString(time_point).c_str(),
|
|
1742
|
+
TimeToHumanString(time_point + bucket_size).c_str(),
|
|
1743
|
+
(unsigned long)bucket_counts[i]);
|
|
1744
|
+
}
|
|
1745
|
+
fprintf(stdout, "Keys in range %s to %s : %lu\n",
|
|
1746
|
+
TimeToHumanString(time_point).c_str(),
|
|
1747
|
+
TimeToHumanString(ttl_end).c_str(),
|
|
1748
|
+
(unsigned long)bucket_counts[num_buckets - 1]);
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
} // namespace
|
|
1752
|
+
|
|
1753
|
+
const std::string InternalDumpCommand::ARG_COUNT_ONLY = "count_only";
|
|
1754
|
+
const std::string InternalDumpCommand::ARG_COUNT_DELIM = "count_delim";
|
|
1755
|
+
const std::string InternalDumpCommand::ARG_STATS = "stats";
|
|
1756
|
+
const std::string InternalDumpCommand::ARG_INPUT_KEY_HEX = "input_key_hex";
|
|
1757
|
+
|
|
1758
|
+
InternalDumpCommand::InternalDumpCommand(
|
|
1759
|
+
const std::vector<std::string>& /*params*/,
|
|
1760
|
+
const std::map<std::string, std::string>& options,
|
|
1761
|
+
const std::vector<std::string>& flags)
|
|
1762
|
+
: LDBCommand(options, flags, true,
|
|
1763
|
+
BuildCmdLineOptions(
|
|
1764
|
+
{ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX, ARG_FROM, ARG_TO,
|
|
1765
|
+
ARG_MAX_KEYS, ARG_COUNT_ONLY, ARG_COUNT_DELIM, ARG_STATS,
|
|
1766
|
+
ARG_INPUT_KEY_HEX, ARG_DECODE_BLOB_INDEX})),
|
|
1767
|
+
has_from_(false),
|
|
1768
|
+
has_to_(false),
|
|
1769
|
+
max_keys_(-1),
|
|
1770
|
+
delim_("."),
|
|
1771
|
+
count_only_(false),
|
|
1772
|
+
count_delim_(false),
|
|
1773
|
+
print_stats_(false),
|
|
1774
|
+
is_input_key_hex_(false),
|
|
1775
|
+
decode_blob_index_(false) {
|
|
1776
|
+
has_from_ = ParseStringOption(options, ARG_FROM, &from_);
|
|
1777
|
+
has_to_ = ParseStringOption(options, ARG_TO, &to_);
|
|
1778
|
+
|
|
1779
|
+
ParseIntOption(options, ARG_MAX_KEYS, max_keys_, exec_state_);
|
|
1780
|
+
auto itr = options.find(ARG_COUNT_DELIM);
|
|
1781
|
+
if (itr != options.end()) {
|
|
1782
|
+
delim_ = itr->second;
|
|
1783
|
+
count_delim_ = true;
|
|
1784
|
+
// fprintf(stdout,"delim = %c\n",delim_[0]);
|
|
1785
|
+
} else {
|
|
1786
|
+
count_delim_ = IsFlagPresent(flags, ARG_COUNT_DELIM);
|
|
1787
|
+
delim_ = ".";
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
print_stats_ = IsFlagPresent(flags, ARG_STATS);
|
|
1791
|
+
count_only_ = IsFlagPresent(flags, ARG_COUNT_ONLY);
|
|
1792
|
+
is_input_key_hex_ = IsFlagPresent(flags, ARG_INPUT_KEY_HEX);
|
|
1793
|
+
decode_blob_index_ = IsFlagPresent(flags, ARG_DECODE_BLOB_INDEX);
|
|
1794
|
+
|
|
1795
|
+
if (is_input_key_hex_) {
|
|
1796
|
+
if (has_from_) {
|
|
1797
|
+
from_ = HexToString(from_);
|
|
1798
|
+
}
|
|
1799
|
+
if (has_to_) {
|
|
1800
|
+
to_ = HexToString(to_);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
void InternalDumpCommand::Help(std::string& ret) {
|
|
1806
|
+
ret.append(" ");
|
|
1807
|
+
ret.append(InternalDumpCommand::Name());
|
|
1808
|
+
ret.append(HelpRangeCmdArgs());
|
|
1809
|
+
ret.append(" [--" + ARG_INPUT_KEY_HEX + "]");
|
|
1810
|
+
ret.append(" [--" + ARG_MAX_KEYS + "=<N>]");
|
|
1811
|
+
ret.append(" [--" + ARG_COUNT_ONLY + "]");
|
|
1812
|
+
ret.append(" [--" + ARG_COUNT_DELIM + "=<char>]");
|
|
1813
|
+
ret.append(" [--" + ARG_STATS + "]");
|
|
1814
|
+
ret.append(" [--" + ARG_DECODE_BLOB_INDEX + "]");
|
|
1815
|
+
ret.append("\n");
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
void InternalDumpCommand::DoCommand() {
|
|
1819
|
+
if (!db_) {
|
|
1820
|
+
assert(GetExecuteState().IsFailed());
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
if (print_stats_) {
|
|
1825
|
+
std::string stats;
|
|
1826
|
+
if (db_->GetProperty(GetCfHandle(), "rocksdb.stats", &stats)) {
|
|
1827
|
+
fprintf(stdout, "%s\n", stats.c_str());
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
// Cast as DBImpl to get internal iterator
|
|
1832
|
+
std::vector<KeyVersion> key_versions;
|
|
1833
|
+
Status st = GetAllKeyVersions(db_, GetCfHandle(), from_, to_, max_keys_,
|
|
1834
|
+
&key_versions);
|
|
1835
|
+
if (!st.ok()) {
|
|
1836
|
+
exec_state_ = LDBCommandExecuteResult::Failed(st.ToString());
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
std::string rtype1, rtype2, row, val;
|
|
1840
|
+
rtype2 = "";
|
|
1841
|
+
uint64_t c = 0;
|
|
1842
|
+
uint64_t s1 = 0, s2 = 0;
|
|
1843
|
+
|
|
1844
|
+
long long count = 0;
|
|
1845
|
+
for (auto& key_version : key_versions) {
|
|
1846
|
+
ValueType value_type = static_cast<ValueType>(key_version.type);
|
|
1847
|
+
InternalKey ikey(key_version.user_key, key_version.sequence, value_type);
|
|
1848
|
+
if (has_to_ && ikey.user_key() == to_) {
|
|
1849
|
+
// GetAllKeyVersions() includes keys with user key `to_`, but idump has
|
|
1850
|
+
// traditionally excluded such keys.
|
|
1851
|
+
break;
|
|
1852
|
+
}
|
|
1853
|
+
++count;
|
|
1854
|
+
int k;
|
|
1855
|
+
if (count_delim_) {
|
|
1856
|
+
rtype1 = "";
|
|
1857
|
+
s1 = 0;
|
|
1858
|
+
row = ikey.Encode().ToString();
|
|
1859
|
+
val = key_version.value;
|
|
1860
|
+
for (k = 0; row[k] != '\x01' && row[k] != '\0'; k++) s1++;
|
|
1861
|
+
for (k = 0; val[k] != '\x01' && val[k] != '\0'; k++) s1++;
|
|
1862
|
+
for (int j = 0; row[j] != delim_[0] && row[j] != '\0' && row[j] != '\x01';
|
|
1863
|
+
j++)
|
|
1864
|
+
rtype1 += row[j];
|
|
1865
|
+
if (rtype2.compare("") && rtype2.compare(rtype1) != 0) {
|
|
1866
|
+
fprintf(stdout, "%s => count:%" PRIu64 "\tsize:%" PRIu64 "\n",
|
|
1867
|
+
rtype2.c_str(), c, s2);
|
|
1868
|
+
c = 1;
|
|
1869
|
+
s2 = s1;
|
|
1870
|
+
rtype2 = rtype1;
|
|
1871
|
+
} else {
|
|
1872
|
+
c++;
|
|
1873
|
+
s2 += s1;
|
|
1874
|
+
rtype2 = rtype1;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
if (!count_only_ && !count_delim_) {
|
|
1879
|
+
std::string key = ikey.DebugString(is_key_hex_);
|
|
1880
|
+
Slice value(key_version.value);
|
|
1881
|
+
if (!decode_blob_index_ || value_type != kTypeBlobIndex) {
|
|
1882
|
+
fprintf(stdout, "%s => %s\n", key.c_str(),
|
|
1883
|
+
value.ToString(is_value_hex_).c_str());
|
|
1884
|
+
} else {
|
|
1885
|
+
BlobIndex blob_index;
|
|
1886
|
+
|
|
1887
|
+
const Status s = blob_index.DecodeFrom(value);
|
|
1888
|
+
if (!s.ok()) {
|
|
1889
|
+
fprintf(stderr, "%s => error decoding blob index =>\n", key.c_str());
|
|
1890
|
+
} else {
|
|
1891
|
+
fprintf(stdout, "%s => %s\n", key.c_str(),
|
|
1892
|
+
blob_index.DebugString(is_value_hex_).c_str());
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
// Terminate if maximum number of keys have been dumped
|
|
1898
|
+
if (max_keys_ > 0 && count >= max_keys_) break;
|
|
1899
|
+
}
|
|
1900
|
+
if (count_delim_) {
|
|
1901
|
+
fprintf(stdout, "%s => count:%" PRIu64 "\tsize:%" PRIu64 "\n",
|
|
1902
|
+
rtype2.c_str(), c, s2);
|
|
1903
|
+
} else {
|
|
1904
|
+
fprintf(stdout, "Internal keys in range: %lld\n", count);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
const std::string DBDumperCommand::ARG_COUNT_ONLY = "count_only";
|
|
1909
|
+
const std::string DBDumperCommand::ARG_COUNT_DELIM = "count_delim";
|
|
1910
|
+
const std::string DBDumperCommand::ARG_STATS = "stats";
|
|
1911
|
+
const std::string DBDumperCommand::ARG_TTL_BUCKET = "bucket";
|
|
1912
|
+
|
|
1913
|
+
DBDumperCommand::DBDumperCommand(
|
|
1914
|
+
const std::vector<std::string>& /*params*/,
|
|
1915
|
+
const std::map<std::string, std::string>& options,
|
|
1916
|
+
const std::vector<std::string>& flags)
|
|
1917
|
+
: LDBCommand(
|
|
1918
|
+
options, flags, true,
|
|
1919
|
+
BuildCmdLineOptions(
|
|
1920
|
+
{ARG_TTL, ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX, ARG_FROM, ARG_TO,
|
|
1921
|
+
ARG_MAX_KEYS, ARG_COUNT_ONLY, ARG_COUNT_DELIM, ARG_STATS,
|
|
1922
|
+
ARG_TTL_START, ARG_TTL_END, ARG_TTL_BUCKET, ARG_TIMESTAMP,
|
|
1923
|
+
ARG_PATH, ARG_DECODE_BLOB_INDEX, ARG_DUMP_UNCOMPRESSED_BLOBS})),
|
|
1924
|
+
null_from_(true),
|
|
1925
|
+
null_to_(true),
|
|
1926
|
+
max_keys_(-1),
|
|
1927
|
+
count_only_(false),
|
|
1928
|
+
count_delim_(false),
|
|
1929
|
+
print_stats_(false),
|
|
1930
|
+
decode_blob_index_(false) {
|
|
1931
|
+
auto itr = options.find(ARG_FROM);
|
|
1932
|
+
if (itr != options.end()) {
|
|
1933
|
+
null_from_ = false;
|
|
1934
|
+
from_ = itr->second;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
itr = options.find(ARG_TO);
|
|
1938
|
+
if (itr != options.end()) {
|
|
1939
|
+
null_to_ = false;
|
|
1940
|
+
to_ = itr->second;
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
itr = options.find(ARG_MAX_KEYS);
|
|
1944
|
+
if (itr != options.end()) {
|
|
1945
|
+
try {
|
|
1946
|
+
#if defined(CYGWIN)
|
|
1947
|
+
max_keys_ = strtol(itr->second.c_str(), 0, 10);
|
|
1948
|
+
#else
|
|
1949
|
+
max_keys_ = std::stoi(itr->second);
|
|
1950
|
+
#endif
|
|
1951
|
+
} catch (const std::invalid_argument&) {
|
|
1952
|
+
exec_state_ = LDBCommandExecuteResult::Failed(ARG_MAX_KEYS +
|
|
1953
|
+
" has an invalid value");
|
|
1954
|
+
} catch (const std::out_of_range&) {
|
|
1955
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
1956
|
+
ARG_MAX_KEYS + " has a value out-of-range");
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
itr = options.find(ARG_COUNT_DELIM);
|
|
1960
|
+
if (itr != options.end()) {
|
|
1961
|
+
delim_ = itr->second;
|
|
1962
|
+
count_delim_ = true;
|
|
1963
|
+
} else {
|
|
1964
|
+
count_delim_ = IsFlagPresent(flags, ARG_COUNT_DELIM);
|
|
1965
|
+
delim_ = ".";
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
print_stats_ = IsFlagPresent(flags, ARG_STATS);
|
|
1969
|
+
count_only_ = IsFlagPresent(flags, ARG_COUNT_ONLY);
|
|
1970
|
+
decode_blob_index_ = IsFlagPresent(flags, ARG_DECODE_BLOB_INDEX);
|
|
1971
|
+
dump_uncompressed_blobs_ = IsFlagPresent(flags, ARG_DUMP_UNCOMPRESSED_BLOBS);
|
|
1972
|
+
|
|
1973
|
+
if (is_key_hex_) {
|
|
1974
|
+
if (!null_from_) {
|
|
1975
|
+
from_ = HexToString(from_);
|
|
1976
|
+
}
|
|
1977
|
+
if (!null_to_) {
|
|
1978
|
+
to_ = HexToString(to_);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
itr = options.find(ARG_PATH);
|
|
1983
|
+
if (itr != options.end()) {
|
|
1984
|
+
path_ = itr->second;
|
|
1985
|
+
if (db_path_.empty()) {
|
|
1986
|
+
db_path_ = path_;
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
void DBDumperCommand::Help(std::string& ret) {
|
|
1992
|
+
ret.append(" ");
|
|
1993
|
+
ret.append(DBDumperCommand::Name());
|
|
1994
|
+
ret.append(HelpRangeCmdArgs());
|
|
1995
|
+
ret.append(" [--" + ARG_TTL + "]");
|
|
1996
|
+
ret.append(" [--" + ARG_MAX_KEYS + "=<N>]");
|
|
1997
|
+
ret.append(" [--" + ARG_TIMESTAMP + "]");
|
|
1998
|
+
ret.append(" [--" + ARG_COUNT_ONLY + "]");
|
|
1999
|
+
ret.append(" [--" + ARG_COUNT_DELIM + "=<char>]");
|
|
2000
|
+
ret.append(" [--" + ARG_STATS + "]");
|
|
2001
|
+
ret.append(" [--" + ARG_TTL_BUCKET + "=<N>]");
|
|
2002
|
+
ret.append(" [--" + ARG_TTL_START + "=<N>:- is inclusive]");
|
|
2003
|
+
ret.append(" [--" + ARG_TTL_END + "=<N>:- is exclusive]");
|
|
2004
|
+
ret.append(" [--" + ARG_PATH + "=<path_to_a_file>]");
|
|
2005
|
+
ret.append(" [--" + ARG_DECODE_BLOB_INDEX + "]");
|
|
2006
|
+
ret.append(" [--" + ARG_DUMP_UNCOMPRESSED_BLOBS + "]");
|
|
2007
|
+
ret.append("\n");
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
/**
|
|
2011
|
+
* Handles two separate cases:
|
|
2012
|
+
*
|
|
2013
|
+
* 1) --db is specified - just dump the database.
|
|
2014
|
+
*
|
|
2015
|
+
* 2) --path is specified - determine based on file extension what dumping
|
|
2016
|
+
* function to call. Please note that we intentionally use the extension
|
|
2017
|
+
* and avoid probing the file contents under the assumption that renaming
|
|
2018
|
+
* the files is not a supported scenario.
|
|
2019
|
+
*
|
|
2020
|
+
*/
|
|
2021
|
+
void DBDumperCommand::DoCommand() {
|
|
2022
|
+
if (!db_) {
|
|
2023
|
+
assert(!path_.empty());
|
|
2024
|
+
std::string fileName = GetFileNameFromPath(path_);
|
|
2025
|
+
uint64_t number;
|
|
2026
|
+
FileType type;
|
|
2027
|
+
|
|
2028
|
+
exec_state_ = LDBCommandExecuteResult::Succeed("");
|
|
2029
|
+
|
|
2030
|
+
if (!ParseFileName(fileName, &number, &type)) {
|
|
2031
|
+
exec_state_ =
|
|
2032
|
+
LDBCommandExecuteResult::Failed("Can't parse file type: " + path_);
|
|
2033
|
+
return;
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
switch (type) {
|
|
2037
|
+
case kWalFile:
|
|
2038
|
+
// TODO(myabandeh): allow configuring is_write_commited
|
|
2039
|
+
DumpWalFile(options_, path_, /* print_header_ */ true,
|
|
2040
|
+
/* print_values_ */ true, true /* is_write_commited */,
|
|
2041
|
+
&exec_state_);
|
|
2042
|
+
break;
|
|
2043
|
+
case kTableFile:
|
|
2044
|
+
DumpSstFile(options_, path_, is_key_hex_, /* show_properties */ true,
|
|
2045
|
+
decode_blob_index_, from_, to_);
|
|
2046
|
+
break;
|
|
2047
|
+
case kDescriptorFile:
|
|
2048
|
+
DumpManifestFile(options_, path_, /* verbose_ */ false, is_key_hex_,
|
|
2049
|
+
/* json_ */ false);
|
|
2050
|
+
break;
|
|
2051
|
+
case kBlobFile:
|
|
2052
|
+
DumpBlobFile(path_, is_key_hex_, is_value_hex_,
|
|
2053
|
+
dump_uncompressed_blobs_);
|
|
2054
|
+
break;
|
|
2055
|
+
default:
|
|
2056
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2057
|
+
"File type not supported: " + path_);
|
|
2058
|
+
break;
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
} else {
|
|
2062
|
+
DoDumpCommand();
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
void DBDumperCommand::DoDumpCommand() {
|
|
2067
|
+
assert(nullptr != db_);
|
|
2068
|
+
assert(path_.empty());
|
|
2069
|
+
|
|
2070
|
+
// Parse command line args
|
|
2071
|
+
uint64_t count = 0;
|
|
2072
|
+
if (print_stats_) {
|
|
2073
|
+
std::string stats;
|
|
2074
|
+
if (db_->GetProperty("rocksdb.stats", &stats)) {
|
|
2075
|
+
fprintf(stdout, "%s\n", stats.c_str());
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
// Setup key iterator
|
|
2080
|
+
ReadOptions scan_read_opts;
|
|
2081
|
+
scan_read_opts.total_order_seek = true;
|
|
2082
|
+
Iterator* iter = db_->NewIterator(scan_read_opts, GetCfHandle());
|
|
2083
|
+
Status st = iter->status();
|
|
2084
|
+
if (!st.ok()) {
|
|
2085
|
+
exec_state_ =
|
|
2086
|
+
LDBCommandExecuteResult::Failed("Iterator error." + st.ToString());
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
if (!null_from_) {
|
|
2090
|
+
iter->Seek(from_);
|
|
2091
|
+
} else {
|
|
2092
|
+
iter->SeekToFirst();
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
int max_keys = max_keys_;
|
|
2096
|
+
int ttl_start;
|
|
2097
|
+
if (!ParseIntOption(option_map_, ARG_TTL_START, ttl_start, exec_state_)) {
|
|
2098
|
+
ttl_start = DBWithTTLImpl::kMinTimestamp; // TTL introduction time
|
|
2099
|
+
}
|
|
2100
|
+
int ttl_end;
|
|
2101
|
+
if (!ParseIntOption(option_map_, ARG_TTL_END, ttl_end, exec_state_)) {
|
|
2102
|
+
ttl_end = DBWithTTLImpl::kMaxTimestamp; // Max time allowed by TTL feature
|
|
2103
|
+
}
|
|
2104
|
+
if (ttl_end < ttl_start) {
|
|
2105
|
+
fprintf(stderr, "Error: End time can't be less than start time\n");
|
|
2106
|
+
delete iter;
|
|
2107
|
+
return;
|
|
2108
|
+
}
|
|
2109
|
+
int time_range = ttl_end - ttl_start;
|
|
2110
|
+
int bucket_size;
|
|
2111
|
+
if (!ParseIntOption(option_map_, ARG_TTL_BUCKET, bucket_size, exec_state_) ||
|
|
2112
|
+
bucket_size <= 0) {
|
|
2113
|
+
bucket_size = time_range; // Will have just 1 bucket by default
|
|
2114
|
+
}
|
|
2115
|
+
// cretaing variables for row count of each type
|
|
2116
|
+
std::string rtype1, rtype2, row, val;
|
|
2117
|
+
rtype2 = "";
|
|
2118
|
+
uint64_t c = 0;
|
|
2119
|
+
uint64_t s1 = 0, s2 = 0;
|
|
2120
|
+
|
|
2121
|
+
// At this point, bucket_size=0 => time_range=0
|
|
2122
|
+
int num_buckets = (bucket_size >= time_range)
|
|
2123
|
+
? 1
|
|
2124
|
+
: ((time_range + bucket_size - 1) / bucket_size);
|
|
2125
|
+
std::vector<uint64_t> bucket_counts(num_buckets, 0);
|
|
2126
|
+
if (is_db_ttl_ && !count_only_ && timestamp_ && !count_delim_) {
|
|
2127
|
+
fprintf(stdout, "Dumping key-values from %s to %s\n",
|
|
2128
|
+
TimeToHumanString(ttl_start).c_str(),
|
|
2129
|
+
TimeToHumanString(ttl_end).c_str());
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
HistogramImpl vsize_hist;
|
|
2133
|
+
|
|
2134
|
+
for (; iter->Valid(); iter->Next()) {
|
|
2135
|
+
int rawtime = 0;
|
|
2136
|
+
// If end marker was specified, we stop before it
|
|
2137
|
+
if (!null_to_ && (iter->key().ToString() >= to_)) break;
|
|
2138
|
+
// Terminate if maximum number of keys have been dumped
|
|
2139
|
+
if (max_keys == 0) break;
|
|
2140
|
+
if (is_db_ttl_) {
|
|
2141
|
+
TtlIterator* it_ttl = static_cast_with_check<TtlIterator>(iter);
|
|
2142
|
+
rawtime = it_ttl->ttl_timestamp();
|
|
2143
|
+
if (rawtime < ttl_start || rawtime >= ttl_end) {
|
|
2144
|
+
continue;
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
if (max_keys > 0) {
|
|
2148
|
+
--max_keys;
|
|
2149
|
+
}
|
|
2150
|
+
if (is_db_ttl_ && num_buckets > 1) {
|
|
2151
|
+
IncBucketCounts(bucket_counts, ttl_start, time_range, bucket_size,
|
|
2152
|
+
rawtime, num_buckets);
|
|
2153
|
+
}
|
|
2154
|
+
++count;
|
|
2155
|
+
if (count_delim_) {
|
|
2156
|
+
rtype1 = "";
|
|
2157
|
+
row = iter->key().ToString();
|
|
2158
|
+
val = iter->value().ToString();
|
|
2159
|
+
s1 = row.size() + val.size();
|
|
2160
|
+
for (int j = 0; row[j] != delim_[0] && row[j] != '\0'; j++)
|
|
2161
|
+
rtype1 += row[j];
|
|
2162
|
+
if (rtype2.compare("") && rtype2.compare(rtype1) != 0) {
|
|
2163
|
+
fprintf(stdout, "%s => count:%" PRIu64 "\tsize:%" PRIu64 "\n",
|
|
2164
|
+
rtype2.c_str(), c, s2);
|
|
2165
|
+
c = 1;
|
|
2166
|
+
s2 = s1;
|
|
2167
|
+
rtype2 = rtype1;
|
|
2168
|
+
} else {
|
|
2169
|
+
c++;
|
|
2170
|
+
s2 += s1;
|
|
2171
|
+
rtype2 = rtype1;
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
if (count_only_) {
|
|
2176
|
+
vsize_hist.Add(iter->value().size());
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
if (!count_only_ && !count_delim_) {
|
|
2180
|
+
if (is_db_ttl_ && timestamp_) {
|
|
2181
|
+
fprintf(stdout, "%s ", TimeToHumanString(rawtime).c_str());
|
|
2182
|
+
}
|
|
2183
|
+
std::string str =
|
|
2184
|
+
PrintKeyValue(iter->key().ToString(), iter->value().ToString(),
|
|
2185
|
+
is_key_hex_, is_value_hex_);
|
|
2186
|
+
fprintf(stdout, "%s\n", str.c_str());
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
if (num_buckets > 1 && is_db_ttl_) {
|
|
2191
|
+
PrintBucketCounts(bucket_counts, ttl_start, ttl_end, bucket_size,
|
|
2192
|
+
num_buckets);
|
|
2193
|
+
} else if (count_delim_) {
|
|
2194
|
+
fprintf(stdout, "%s => count:%" PRIu64 "\tsize:%" PRIu64 "\n",
|
|
2195
|
+
rtype2.c_str(), c, s2);
|
|
2196
|
+
} else {
|
|
2197
|
+
fprintf(stdout, "Keys in range: %" PRIu64 "\n", count);
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
if (count_only_) {
|
|
2201
|
+
fprintf(stdout, "Value size distribution: \n");
|
|
2202
|
+
fprintf(stdout, "%s\n", vsize_hist.ToString().c_str());
|
|
2203
|
+
}
|
|
2204
|
+
// Clean up
|
|
2205
|
+
delete iter;
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
const std::string ReduceDBLevelsCommand::ARG_NEW_LEVELS = "new_levels";
|
|
2209
|
+
const std::string ReduceDBLevelsCommand::ARG_PRINT_OLD_LEVELS =
|
|
2210
|
+
"print_old_levels";
|
|
2211
|
+
|
|
2212
|
+
ReduceDBLevelsCommand::ReduceDBLevelsCommand(
|
|
2213
|
+
const std::vector<std::string>& /*params*/,
|
|
2214
|
+
const std::map<std::string, std::string>& options,
|
|
2215
|
+
const std::vector<std::string>& flags)
|
|
2216
|
+
: LDBCommand(options, flags, false,
|
|
2217
|
+
BuildCmdLineOptions({ARG_NEW_LEVELS, ARG_PRINT_OLD_LEVELS})),
|
|
2218
|
+
old_levels_(1 << 7),
|
|
2219
|
+
new_levels_(-1),
|
|
2220
|
+
print_old_levels_(false) {
|
|
2221
|
+
ParseIntOption(option_map_, ARG_NEW_LEVELS, new_levels_, exec_state_);
|
|
2222
|
+
print_old_levels_ = IsFlagPresent(flags, ARG_PRINT_OLD_LEVELS);
|
|
2223
|
+
|
|
2224
|
+
if (new_levels_ <= 0) {
|
|
2225
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2226
|
+
" Use --" + ARG_NEW_LEVELS + " to specify a new level number\n");
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
std::vector<std::string> ReduceDBLevelsCommand::PrepareArgs(
|
|
2231
|
+
const std::string& db_path, int new_levels, bool print_old_level) {
|
|
2232
|
+
std::vector<std::string> ret;
|
|
2233
|
+
ret.push_back("reduce_levels");
|
|
2234
|
+
ret.push_back("--" + ARG_DB + "=" + db_path);
|
|
2235
|
+
ret.push_back("--" + ARG_NEW_LEVELS + "=" + std::to_string(new_levels));
|
|
2236
|
+
if (print_old_level) {
|
|
2237
|
+
ret.push_back("--" + ARG_PRINT_OLD_LEVELS);
|
|
2238
|
+
}
|
|
2239
|
+
return ret;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
void ReduceDBLevelsCommand::Help(std::string& ret) {
|
|
2243
|
+
ret.append(" ");
|
|
2244
|
+
ret.append(ReduceDBLevelsCommand::Name());
|
|
2245
|
+
ret.append(" --" + ARG_NEW_LEVELS + "=<New number of levels>");
|
|
2246
|
+
ret.append(" [--" + ARG_PRINT_OLD_LEVELS + "]");
|
|
2247
|
+
ret.append("\n");
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
void ReduceDBLevelsCommand::OverrideBaseCFOptions(
|
|
2251
|
+
ColumnFamilyOptions* cf_opts) {
|
|
2252
|
+
LDBCommand::OverrideBaseCFOptions(cf_opts);
|
|
2253
|
+
cf_opts->num_levels = old_levels_;
|
|
2254
|
+
cf_opts->max_bytes_for_level_multiplier_additional.resize(cf_opts->num_levels,
|
|
2255
|
+
1);
|
|
2256
|
+
// Disable size compaction
|
|
2257
|
+
cf_opts->max_bytes_for_level_base = 1ULL << 50;
|
|
2258
|
+
cf_opts->max_bytes_for_level_multiplier = 1;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
Status ReduceDBLevelsCommand::GetOldNumOfLevels(Options& opt, int* levels) {
|
|
2262
|
+
ImmutableDBOptions db_options(opt);
|
|
2263
|
+
EnvOptions soptions;
|
|
2264
|
+
std::shared_ptr<Cache> tc(
|
|
2265
|
+
NewLRUCache(opt.max_open_files - 10, opt.table_cache_numshardbits));
|
|
2266
|
+
const InternalKeyComparator cmp(opt.comparator);
|
|
2267
|
+
WriteController wc(opt.delayed_write_rate);
|
|
2268
|
+
WriteBufferManager wb(opt.db_write_buffer_size);
|
|
2269
|
+
VersionSet versions(db_path_, &db_options, soptions, tc.get(), &wb, &wc,
|
|
2270
|
+
/*block_cache_tracer=*/nullptr, /*io_tracer=*/nullptr,
|
|
2271
|
+
/*db_id*/ "", /*db_session_id*/ "");
|
|
2272
|
+
std::vector<ColumnFamilyDescriptor> dummy;
|
|
2273
|
+
ColumnFamilyDescriptor dummy_descriptor(kDefaultColumnFamilyName,
|
|
2274
|
+
ColumnFamilyOptions(opt));
|
|
2275
|
+
dummy.push_back(dummy_descriptor);
|
|
2276
|
+
// We rely the VersionSet::Recover to tell us the internal data structures
|
|
2277
|
+
// in the db. And the Recover() should never do any change
|
|
2278
|
+
// (like LogAndApply) to the manifest file.
|
|
2279
|
+
Status st = versions.Recover(dummy);
|
|
2280
|
+
if (!st.ok()) {
|
|
2281
|
+
return st;
|
|
2282
|
+
}
|
|
2283
|
+
int max = -1;
|
|
2284
|
+
auto default_cfd = versions.GetColumnFamilySet()->GetDefault();
|
|
2285
|
+
for (int i = 0; i < default_cfd->NumberLevels(); i++) {
|
|
2286
|
+
if (default_cfd->current()->storage_info()->NumLevelFiles(i)) {
|
|
2287
|
+
max = i;
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
*levels = max + 1;
|
|
2292
|
+
return st;
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
void ReduceDBLevelsCommand::DoCommand() {
|
|
2296
|
+
if (new_levels_ <= 1) {
|
|
2297
|
+
exec_state_ =
|
|
2298
|
+
LDBCommandExecuteResult::Failed("Invalid number of levels.\n");
|
|
2299
|
+
return;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
Status st;
|
|
2303
|
+
PrepareOptions();
|
|
2304
|
+
int old_level_num = -1;
|
|
2305
|
+
st = GetOldNumOfLevels(options_, &old_level_num);
|
|
2306
|
+
if (!st.ok()) {
|
|
2307
|
+
exec_state_ = LDBCommandExecuteResult::Failed(st.ToString());
|
|
2308
|
+
return;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
if (print_old_levels_) {
|
|
2312
|
+
fprintf(stdout, "The old number of levels in use is %d\n", old_level_num);
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
if (old_level_num <= new_levels_) {
|
|
2316
|
+
return;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
old_levels_ = old_level_num;
|
|
2320
|
+
|
|
2321
|
+
OpenDB();
|
|
2322
|
+
if (exec_state_.IsFailed()) {
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2325
|
+
assert(db_ != nullptr);
|
|
2326
|
+
// Compact the whole DB to put all files to the highest level.
|
|
2327
|
+
fprintf(stdout, "Compacting the db...\n");
|
|
2328
|
+
st =
|
|
2329
|
+
db_->CompactRange(CompactRangeOptions(), GetCfHandle(), nullptr, nullptr);
|
|
2330
|
+
|
|
2331
|
+
CloseDB();
|
|
2332
|
+
|
|
2333
|
+
if (st.ok()) {
|
|
2334
|
+
EnvOptions soptions;
|
|
2335
|
+
st = VersionSet::ReduceNumberOfLevels(db_path_, &options_, soptions,
|
|
2336
|
+
new_levels_);
|
|
2337
|
+
}
|
|
2338
|
+
if (!st.ok()) {
|
|
2339
|
+
exec_state_ = LDBCommandExecuteResult::Failed(st.ToString());
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
const std::string ChangeCompactionStyleCommand::ARG_OLD_COMPACTION_STYLE =
|
|
2345
|
+
"old_compaction_style";
|
|
2346
|
+
const std::string ChangeCompactionStyleCommand::ARG_NEW_COMPACTION_STYLE =
|
|
2347
|
+
"new_compaction_style";
|
|
2348
|
+
|
|
2349
|
+
ChangeCompactionStyleCommand::ChangeCompactionStyleCommand(
|
|
2350
|
+
const std::vector<std::string>& /*params*/,
|
|
2351
|
+
const std::map<std::string, std::string>& options,
|
|
2352
|
+
const std::vector<std::string>& flags)
|
|
2353
|
+
: LDBCommand(options, flags, false,
|
|
2354
|
+
BuildCmdLineOptions(
|
|
2355
|
+
{ARG_OLD_COMPACTION_STYLE, ARG_NEW_COMPACTION_STYLE})),
|
|
2356
|
+
old_compaction_style_(-1),
|
|
2357
|
+
new_compaction_style_(-1) {
|
|
2358
|
+
ParseIntOption(option_map_, ARG_OLD_COMPACTION_STYLE, old_compaction_style_,
|
|
2359
|
+
exec_state_);
|
|
2360
|
+
if (old_compaction_style_ != kCompactionStyleLevel &&
|
|
2361
|
+
old_compaction_style_ != kCompactionStyleUniversal) {
|
|
2362
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2363
|
+
"Use --" + ARG_OLD_COMPACTION_STYLE + " to specify old compaction " +
|
|
2364
|
+
"style. Check ldb help for proper compaction style value.\n");
|
|
2365
|
+
return;
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
ParseIntOption(option_map_, ARG_NEW_COMPACTION_STYLE, new_compaction_style_,
|
|
2369
|
+
exec_state_);
|
|
2370
|
+
if (new_compaction_style_ != kCompactionStyleLevel &&
|
|
2371
|
+
new_compaction_style_ != kCompactionStyleUniversal) {
|
|
2372
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2373
|
+
"Use --" + ARG_NEW_COMPACTION_STYLE + " to specify new compaction " +
|
|
2374
|
+
"style. Check ldb help for proper compaction style value.\n");
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
if (new_compaction_style_ == old_compaction_style_) {
|
|
2379
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2380
|
+
"Old compaction style is the same as new compaction style. "
|
|
2381
|
+
"Nothing to do.\n");
|
|
2382
|
+
return;
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2385
|
+
if (old_compaction_style_ == kCompactionStyleUniversal &&
|
|
2386
|
+
new_compaction_style_ == kCompactionStyleLevel) {
|
|
2387
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2388
|
+
"Convert from universal compaction to level compaction. "
|
|
2389
|
+
"Nothing to do.\n");
|
|
2390
|
+
return;
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
void ChangeCompactionStyleCommand::Help(std::string& ret) {
|
|
2395
|
+
ret.append(" ");
|
|
2396
|
+
ret.append(ChangeCompactionStyleCommand::Name());
|
|
2397
|
+
ret.append(" --" + ARG_OLD_COMPACTION_STYLE + "=<Old compaction style: 0 " +
|
|
2398
|
+
"for level compaction, 1 for universal compaction>");
|
|
2399
|
+
ret.append(" --" + ARG_NEW_COMPACTION_STYLE + "=<New compaction style: 0 " +
|
|
2400
|
+
"for level compaction, 1 for universal compaction>");
|
|
2401
|
+
ret.append("\n");
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
void ChangeCompactionStyleCommand::OverrideBaseCFOptions(
|
|
2405
|
+
ColumnFamilyOptions* cf_opts) {
|
|
2406
|
+
LDBCommand::OverrideBaseCFOptions(cf_opts);
|
|
2407
|
+
if (old_compaction_style_ == kCompactionStyleLevel &&
|
|
2408
|
+
new_compaction_style_ == kCompactionStyleUniversal) {
|
|
2409
|
+
// In order to convert from level compaction to universal compaction, we
|
|
2410
|
+
// need to compact all data into a single file and move it to level 0.
|
|
2411
|
+
cf_opts->disable_auto_compactions = true;
|
|
2412
|
+
cf_opts->target_file_size_base = INT_MAX;
|
|
2413
|
+
cf_opts->target_file_size_multiplier = 1;
|
|
2414
|
+
cf_opts->max_bytes_for_level_base = INT_MAX;
|
|
2415
|
+
cf_opts->max_bytes_for_level_multiplier = 1;
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
void ChangeCompactionStyleCommand::DoCommand() {
|
|
2420
|
+
if (!db_) {
|
|
2421
|
+
assert(GetExecuteState().IsFailed());
|
|
2422
|
+
return;
|
|
2423
|
+
}
|
|
2424
|
+
// print db stats before we have made any change
|
|
2425
|
+
std::string property;
|
|
2426
|
+
std::string files_per_level;
|
|
2427
|
+
for (int i = 0; i < db_->NumberLevels(GetCfHandle()); i++) {
|
|
2428
|
+
db_->GetProperty(GetCfHandle(),
|
|
2429
|
+
"rocksdb.num-files-at-level" + std::to_string(i),
|
|
2430
|
+
&property);
|
|
2431
|
+
|
|
2432
|
+
// format print string
|
|
2433
|
+
char buf[100];
|
|
2434
|
+
snprintf(buf, sizeof(buf), "%s%s", (i ? "," : ""), property.c_str());
|
|
2435
|
+
files_per_level += buf;
|
|
2436
|
+
}
|
|
2437
|
+
fprintf(stdout, "files per level before compaction: %s\n",
|
|
2438
|
+
files_per_level.c_str());
|
|
2439
|
+
|
|
2440
|
+
// manual compact into a single file and move the file to level 0
|
|
2441
|
+
CompactRangeOptions compact_options;
|
|
2442
|
+
compact_options.change_level = true;
|
|
2443
|
+
compact_options.target_level = 0;
|
|
2444
|
+
Status s =
|
|
2445
|
+
db_->CompactRange(compact_options, GetCfHandle(), nullptr, nullptr);
|
|
2446
|
+
if (!s.ok()) {
|
|
2447
|
+
std::stringstream oss;
|
|
2448
|
+
oss << "Compaction failed: " << s.ToString();
|
|
2449
|
+
exec_state_ = LDBCommandExecuteResult::Failed(oss.str());
|
|
2450
|
+
return;
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
// verify compaction result
|
|
2454
|
+
files_per_level = "";
|
|
2455
|
+
int num_files = 0;
|
|
2456
|
+
for (int i = 0; i < db_->NumberLevels(GetCfHandle()); i++) {
|
|
2457
|
+
db_->GetProperty(GetCfHandle(),
|
|
2458
|
+
"rocksdb.num-files-at-level" + std::to_string(i),
|
|
2459
|
+
&property);
|
|
2460
|
+
|
|
2461
|
+
// format print string
|
|
2462
|
+
char buf[100];
|
|
2463
|
+
snprintf(buf, sizeof(buf), "%s%s", (i ? "," : ""), property.c_str());
|
|
2464
|
+
files_per_level += buf;
|
|
2465
|
+
|
|
2466
|
+
num_files = atoi(property.c_str());
|
|
2467
|
+
|
|
2468
|
+
// level 0 should have only 1 file
|
|
2469
|
+
if (i == 0 && num_files != 1) {
|
|
2470
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2471
|
+
"Number of db files at "
|
|
2472
|
+
"level 0 after compaction is " +
|
|
2473
|
+
std::to_string(num_files) + ", not 1.\n");
|
|
2474
|
+
return;
|
|
2475
|
+
}
|
|
2476
|
+
// other levels should have no file
|
|
2477
|
+
if (i > 0 && num_files != 0) {
|
|
2478
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2479
|
+
"Number of db files at "
|
|
2480
|
+
"level " +
|
|
2481
|
+
std::to_string(i) + " after compaction is " +
|
|
2482
|
+
std::to_string(num_files) + ", not 0.\n");
|
|
2483
|
+
return;
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
fprintf(stdout, "files per level after compaction: %s\n",
|
|
2488
|
+
files_per_level.c_str());
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
// ----------------------------------------------------------------------------
|
|
2492
|
+
|
|
2493
|
+
namespace {
|
|
2494
|
+
|
|
2495
|
+
struct StdErrReporter : public log::Reader::Reporter {
|
|
2496
|
+
void Corruption(size_t /*bytes*/, const Status& s) override {
|
|
2497
|
+
std::cerr << "Corruption detected in log file " << s.ToString() << "\n";
|
|
2498
|
+
}
|
|
2499
|
+
};
|
|
2500
|
+
|
|
2501
|
+
class InMemoryHandler : public WriteBatch::Handler {
|
|
2502
|
+
public:
|
|
2503
|
+
InMemoryHandler(std::stringstream& row, bool print_values,
|
|
2504
|
+
bool write_after_commit = false)
|
|
2505
|
+
: Handler(),
|
|
2506
|
+
row_(row),
|
|
2507
|
+
print_values_(print_values),
|
|
2508
|
+
write_after_commit_(write_after_commit) {}
|
|
2509
|
+
|
|
2510
|
+
void commonPutMerge(const Slice& key, const Slice& value) {
|
|
2511
|
+
std::string k = LDBCommand::StringToHex(key.ToString());
|
|
2512
|
+
if (print_values_) {
|
|
2513
|
+
std::string v = LDBCommand::StringToHex(value.ToString());
|
|
2514
|
+
row_ << k << " : ";
|
|
2515
|
+
row_ << v << " ";
|
|
2516
|
+
} else {
|
|
2517
|
+
row_ << k << " ";
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
Status PutCF(uint32_t cf, const Slice& key, const Slice& value) override {
|
|
2522
|
+
row_ << "PUT(" << cf << ") : ";
|
|
2523
|
+
commonPutMerge(key, value);
|
|
2524
|
+
return Status::OK();
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
Status MergeCF(uint32_t cf, const Slice& key, const Slice& value) override {
|
|
2528
|
+
row_ << "MERGE(" << cf << ") : ";
|
|
2529
|
+
commonPutMerge(key, value);
|
|
2530
|
+
return Status::OK();
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
Status MarkNoop(bool) override {
|
|
2534
|
+
row_ << "NOOP ";
|
|
2535
|
+
return Status::OK();
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
Status DeleteCF(uint32_t cf, const Slice& key) override {
|
|
2539
|
+
row_ << "DELETE(" << cf << ") : ";
|
|
2540
|
+
row_ << LDBCommand::StringToHex(key.ToString()) << " ";
|
|
2541
|
+
return Status::OK();
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
Status SingleDeleteCF(uint32_t cf, const Slice& key) override {
|
|
2545
|
+
row_ << "SINGLE_DELETE(" << cf << ") : ";
|
|
2546
|
+
row_ << LDBCommand::StringToHex(key.ToString()) << " ";
|
|
2547
|
+
return Status::OK();
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
Status DeleteRangeCF(uint32_t cf, const Slice& begin_key,
|
|
2551
|
+
const Slice& end_key) override {
|
|
2552
|
+
row_ << "DELETE_RANGE(" << cf << ") : ";
|
|
2553
|
+
row_ << LDBCommand::StringToHex(begin_key.ToString()) << " ";
|
|
2554
|
+
row_ << LDBCommand::StringToHex(end_key.ToString()) << " ";
|
|
2555
|
+
return Status::OK();
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
Status MarkBeginPrepare(bool unprepare) override {
|
|
2559
|
+
row_ << "BEGIN_PREPARE(";
|
|
2560
|
+
row_ << (unprepare ? "true" : "false") << ") ";
|
|
2561
|
+
return Status::OK();
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
Status MarkEndPrepare(const Slice& xid) override {
|
|
2565
|
+
row_ << "END_PREPARE(";
|
|
2566
|
+
row_ << LDBCommand::StringToHex(xid.ToString()) << ") ";
|
|
2567
|
+
return Status::OK();
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
Status MarkRollback(const Slice& xid) override {
|
|
2571
|
+
row_ << "ROLLBACK(";
|
|
2572
|
+
row_ << LDBCommand::StringToHex(xid.ToString()) << ") ";
|
|
2573
|
+
return Status::OK();
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
Status MarkCommit(const Slice& xid) override {
|
|
2577
|
+
row_ << "COMMIT(";
|
|
2578
|
+
row_ << LDBCommand::StringToHex(xid.ToString()) << ") ";
|
|
2579
|
+
return Status::OK();
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
Status MarkCommitWithTimestamp(const Slice& xid,
|
|
2583
|
+
const Slice& commit_ts) override {
|
|
2584
|
+
row_ << "COMMIT_WITH_TIMESTAMP(";
|
|
2585
|
+
row_ << LDBCommand::StringToHex(xid.ToString()) << ", ";
|
|
2586
|
+
row_ << LDBCommand::StringToHex(commit_ts.ToString()) << ") ";
|
|
2587
|
+
return Status::OK();
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
~InMemoryHandler() override {}
|
|
2591
|
+
|
|
2592
|
+
protected:
|
|
2593
|
+
Handler::OptionState WriteAfterCommit() const override {
|
|
2594
|
+
return write_after_commit_ ? Handler::OptionState::kEnabled
|
|
2595
|
+
: Handler::OptionState::kDisabled;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
private:
|
|
2599
|
+
std::stringstream& row_;
|
|
2600
|
+
bool print_values_;
|
|
2601
|
+
bool write_after_commit_;
|
|
2602
|
+
};
|
|
2603
|
+
|
|
2604
|
+
void DumpWalFile(Options options, std::string wal_file, bool print_header,
|
|
2605
|
+
bool print_values, bool is_write_committed,
|
|
2606
|
+
LDBCommandExecuteResult* exec_state) {
|
|
2607
|
+
const auto& fs = options.env->GetFileSystem();
|
|
2608
|
+
FileOptions soptions(options);
|
|
2609
|
+
std::unique_ptr<SequentialFileReader> wal_file_reader;
|
|
2610
|
+
Status status = SequentialFileReader::Create(
|
|
2611
|
+
fs, wal_file, soptions, &wal_file_reader, nullptr /* dbg */,
|
|
2612
|
+
nullptr /* rate_limiter */);
|
|
2613
|
+
if (!status.ok()) {
|
|
2614
|
+
if (exec_state) {
|
|
2615
|
+
*exec_state = LDBCommandExecuteResult::Failed("Failed to open WAL file " +
|
|
2616
|
+
status.ToString());
|
|
2617
|
+
} else {
|
|
2618
|
+
std::cerr << "Error: Failed to open WAL file " << status.ToString()
|
|
2619
|
+
<< std::endl;
|
|
2620
|
+
}
|
|
2621
|
+
} else {
|
|
2622
|
+
StdErrReporter reporter;
|
|
2623
|
+
uint64_t log_number;
|
|
2624
|
+
FileType type;
|
|
2625
|
+
|
|
2626
|
+
// we need the log number, but ParseFilename expects dbname/NNN.log.
|
|
2627
|
+
std::string sanitized = wal_file;
|
|
2628
|
+
size_t lastslash = sanitized.rfind('/');
|
|
2629
|
+
if (lastslash != std::string::npos)
|
|
2630
|
+
sanitized = sanitized.substr(lastslash + 1);
|
|
2631
|
+
if (!ParseFileName(sanitized, &log_number, &type)) {
|
|
2632
|
+
// bogus input, carry on as best we can
|
|
2633
|
+
log_number = 0;
|
|
2634
|
+
}
|
|
2635
|
+
log::Reader reader(options.info_log, std::move(wal_file_reader), &reporter,
|
|
2636
|
+
true /* checksum */, log_number);
|
|
2637
|
+
std::string scratch;
|
|
2638
|
+
WriteBatch batch;
|
|
2639
|
+
Slice record;
|
|
2640
|
+
std::stringstream row;
|
|
2641
|
+
if (print_header) {
|
|
2642
|
+
std::cout << "Sequence,Count,ByteSize,Physical Offset,Key(s)";
|
|
2643
|
+
if (print_values) {
|
|
2644
|
+
std::cout << " : value ";
|
|
2645
|
+
}
|
|
2646
|
+
std::cout << "\n";
|
|
2647
|
+
}
|
|
2648
|
+
while (status.ok() && reader.ReadRecord(&record, &scratch)) {
|
|
2649
|
+
row.str("");
|
|
2650
|
+
if (record.size() < WriteBatchInternal::kHeader) {
|
|
2651
|
+
reporter.Corruption(record.size(),
|
|
2652
|
+
Status::Corruption("log record too small"));
|
|
2653
|
+
} else {
|
|
2654
|
+
status = WriteBatchInternal::SetContents(&batch, record);
|
|
2655
|
+
if (!status.ok()) {
|
|
2656
|
+
std::stringstream oss;
|
|
2657
|
+
oss << "Parsing write batch failed: " << status.ToString();
|
|
2658
|
+
if (exec_state) {
|
|
2659
|
+
*exec_state = LDBCommandExecuteResult::Failed(oss.str());
|
|
2660
|
+
} else {
|
|
2661
|
+
std::cerr << oss.str() << std::endl;
|
|
2662
|
+
}
|
|
2663
|
+
break;
|
|
2664
|
+
}
|
|
2665
|
+
row << WriteBatchInternal::Sequence(&batch) << ",";
|
|
2666
|
+
row << WriteBatchInternal::Count(&batch) << ",";
|
|
2667
|
+
row << WriteBatchInternal::ByteSize(&batch) << ",";
|
|
2668
|
+
row << reader.LastRecordOffset() << ",";
|
|
2669
|
+
InMemoryHandler handler(row, print_values, is_write_committed);
|
|
2670
|
+
status = batch.Iterate(&handler);
|
|
2671
|
+
if (!status.ok()) {
|
|
2672
|
+
if (exec_state) {
|
|
2673
|
+
std::stringstream oss;
|
|
2674
|
+
oss << "Print write batch error: " << status.ToString();
|
|
2675
|
+
*exec_state = LDBCommandExecuteResult::Failed(oss.str());
|
|
2676
|
+
}
|
|
2677
|
+
row << "error: " << status.ToString();
|
|
2678
|
+
break;
|
|
2679
|
+
}
|
|
2680
|
+
row << "\n";
|
|
2681
|
+
}
|
|
2682
|
+
std::cout << row.str();
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
} // namespace
|
|
2688
|
+
|
|
2689
|
+
const std::string WALDumperCommand::ARG_WAL_FILE = "walfile";
|
|
2690
|
+
const std::string WALDumperCommand::ARG_WRITE_COMMITTED = "write_committed";
|
|
2691
|
+
const std::string WALDumperCommand::ARG_PRINT_VALUE = "print_value";
|
|
2692
|
+
const std::string WALDumperCommand::ARG_PRINT_HEADER = "header";
|
|
2693
|
+
|
|
2694
|
+
WALDumperCommand::WALDumperCommand(
|
|
2695
|
+
const std::vector<std::string>& /*params*/,
|
|
2696
|
+
const std::map<std::string, std::string>& options,
|
|
2697
|
+
const std::vector<std::string>& flags)
|
|
2698
|
+
: LDBCommand(options, flags, true,
|
|
2699
|
+
BuildCmdLineOptions({ARG_WAL_FILE, ARG_WRITE_COMMITTED,
|
|
2700
|
+
ARG_PRINT_HEADER, ARG_PRINT_VALUE})),
|
|
2701
|
+
print_header_(false),
|
|
2702
|
+
print_values_(false),
|
|
2703
|
+
is_write_committed_(false) {
|
|
2704
|
+
wal_file_.clear();
|
|
2705
|
+
|
|
2706
|
+
auto itr = options.find(ARG_WAL_FILE);
|
|
2707
|
+
if (itr != options.end()) {
|
|
2708
|
+
wal_file_ = itr->second;
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
print_header_ = IsFlagPresent(flags, ARG_PRINT_HEADER);
|
|
2712
|
+
print_values_ = IsFlagPresent(flags, ARG_PRINT_VALUE);
|
|
2713
|
+
is_write_committed_ = ParseBooleanOption(options, ARG_WRITE_COMMITTED, true);
|
|
2714
|
+
|
|
2715
|
+
if (wal_file_.empty()) {
|
|
2716
|
+
exec_state_ = LDBCommandExecuteResult::Failed("Argument " + ARG_WAL_FILE +
|
|
2717
|
+
" must be specified.");
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
void WALDumperCommand::Help(std::string& ret) {
|
|
2722
|
+
ret.append(" ");
|
|
2723
|
+
ret.append(WALDumperCommand::Name());
|
|
2724
|
+
ret.append(" --" + ARG_WAL_FILE + "=<write_ahead_log_file_path>");
|
|
2725
|
+
ret.append(" [--" + ARG_PRINT_HEADER + "] ");
|
|
2726
|
+
ret.append(" [--" + ARG_PRINT_VALUE + "] ");
|
|
2727
|
+
ret.append(" [--" + ARG_WRITE_COMMITTED + "=true|false] ");
|
|
2728
|
+
ret.append("\n");
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
void WALDumperCommand::DoCommand() {
|
|
2732
|
+
DumpWalFile(options_, wal_file_, print_header_, print_values_,
|
|
2733
|
+
is_write_committed_, &exec_state_);
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
// ----------------------------------------------------------------------------
|
|
2737
|
+
|
|
2738
|
+
GetCommand::GetCommand(const std::vector<std::string>& params,
|
|
2739
|
+
const std::map<std::string, std::string>& options,
|
|
2740
|
+
const std::vector<std::string>& flags)
|
|
2741
|
+
: LDBCommand(
|
|
2742
|
+
options, flags, true,
|
|
2743
|
+
BuildCmdLineOptions({ARG_TTL, ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX})) {
|
|
2744
|
+
if (params.size() != 1) {
|
|
2745
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2746
|
+
"<key> must be specified for the get command");
|
|
2747
|
+
} else {
|
|
2748
|
+
key_ = params.at(0);
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
if (is_key_hex_) {
|
|
2752
|
+
key_ = HexToString(key_);
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
void GetCommand::Help(std::string& ret) {
|
|
2757
|
+
ret.append(" ");
|
|
2758
|
+
ret.append(GetCommand::Name());
|
|
2759
|
+
ret.append(" <key>");
|
|
2760
|
+
ret.append(" [--" + ARG_TTL + "]");
|
|
2761
|
+
ret.append("\n");
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
void GetCommand::DoCommand() {
|
|
2765
|
+
if (!db_) {
|
|
2766
|
+
assert(GetExecuteState().IsFailed());
|
|
2767
|
+
return;
|
|
2768
|
+
}
|
|
2769
|
+
std::string value;
|
|
2770
|
+
Status st = db_->Get(ReadOptions(), GetCfHandle(), key_, &value);
|
|
2771
|
+
if (st.ok()) {
|
|
2772
|
+
fprintf(stdout, "%s\n",
|
|
2773
|
+
(is_value_hex_ ? StringToHex(value) : value).c_str());
|
|
2774
|
+
} else {
|
|
2775
|
+
std::stringstream oss;
|
|
2776
|
+
oss << "Get failed: " << st.ToString();
|
|
2777
|
+
exec_state_ = LDBCommandExecuteResult::Failed(oss.str());
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
// ----------------------------------------------------------------------------
|
|
2782
|
+
|
|
2783
|
+
ApproxSizeCommand::ApproxSizeCommand(
|
|
2784
|
+
const std::vector<std::string>& /*params*/,
|
|
2785
|
+
const std::map<std::string, std::string>& options,
|
|
2786
|
+
const std::vector<std::string>& flags)
|
|
2787
|
+
: LDBCommand(options, flags, true,
|
|
2788
|
+
BuildCmdLineOptions(
|
|
2789
|
+
{ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX, ARG_FROM, ARG_TO})) {
|
|
2790
|
+
if (options.find(ARG_FROM) != options.end()) {
|
|
2791
|
+
start_key_ = options.find(ARG_FROM)->second;
|
|
2792
|
+
} else {
|
|
2793
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2794
|
+
ARG_FROM + " must be specified for approxsize command");
|
|
2795
|
+
return;
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2798
|
+
if (options.find(ARG_TO) != options.end()) {
|
|
2799
|
+
end_key_ = options.find(ARG_TO)->second;
|
|
2800
|
+
} else {
|
|
2801
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2802
|
+
ARG_TO + " must be specified for approxsize command");
|
|
2803
|
+
return;
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
if (is_key_hex_) {
|
|
2807
|
+
start_key_ = HexToString(start_key_);
|
|
2808
|
+
end_key_ = HexToString(end_key_);
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
void ApproxSizeCommand::Help(std::string& ret) {
|
|
2813
|
+
ret.append(" ");
|
|
2814
|
+
ret.append(ApproxSizeCommand::Name());
|
|
2815
|
+
ret.append(HelpRangeCmdArgs());
|
|
2816
|
+
ret.append("\n");
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
void ApproxSizeCommand::DoCommand() {
|
|
2820
|
+
if (!db_) {
|
|
2821
|
+
assert(GetExecuteState().IsFailed());
|
|
2822
|
+
return;
|
|
2823
|
+
}
|
|
2824
|
+
Range ranges[1];
|
|
2825
|
+
ranges[0] = Range(start_key_, end_key_);
|
|
2826
|
+
uint64_t sizes[1];
|
|
2827
|
+
Status s = db_->GetApproximateSizes(GetCfHandle(), ranges, 1, sizes);
|
|
2828
|
+
if (!s.ok()) {
|
|
2829
|
+
std::stringstream oss;
|
|
2830
|
+
oss << "ApproximateSize failed: " << s.ToString();
|
|
2831
|
+
exec_state_ = LDBCommandExecuteResult::Failed(oss.str());
|
|
2832
|
+
} else {
|
|
2833
|
+
fprintf(stdout, "%lu\n", (unsigned long)sizes[0]);
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
// ----------------------------------------------------------------------------
|
|
2838
|
+
|
|
2839
|
+
BatchPutCommand::BatchPutCommand(
|
|
2840
|
+
const std::vector<std::string>& params,
|
|
2841
|
+
const std::map<std::string, std::string>& options,
|
|
2842
|
+
const std::vector<std::string>& flags)
|
|
2843
|
+
: LDBCommand(options, flags, false,
|
|
2844
|
+
BuildCmdLineOptions({ARG_TTL, ARG_HEX, ARG_KEY_HEX,
|
|
2845
|
+
ARG_VALUE_HEX, ARG_CREATE_IF_MISSING})) {
|
|
2846
|
+
if (params.size() < 2) {
|
|
2847
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2848
|
+
"At least one <key> <value> pair must be specified batchput.");
|
|
2849
|
+
} else if (params.size() % 2 != 0) {
|
|
2850
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2851
|
+
"Equal number of <key>s and <value>s must be specified for batchput.");
|
|
2852
|
+
} else {
|
|
2853
|
+
for (size_t i = 0; i < params.size(); i += 2) {
|
|
2854
|
+
std::string key = params.at(i);
|
|
2855
|
+
std::string value = params.at(i + 1);
|
|
2856
|
+
key_values_.push_back(std::pair<std::string, std::string>(
|
|
2857
|
+
is_key_hex_ ? HexToString(key) : key,
|
|
2858
|
+
is_value_hex_ ? HexToString(value) : value));
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
create_if_missing_ = IsFlagPresent(flags_, ARG_CREATE_IF_MISSING);
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
void BatchPutCommand::Help(std::string& ret) {
|
|
2865
|
+
ret.append(" ");
|
|
2866
|
+
ret.append(BatchPutCommand::Name());
|
|
2867
|
+
ret.append(" <key> <value> [<key> <value>] [..]");
|
|
2868
|
+
ret.append(" [--" + ARG_CREATE_IF_MISSING + "]");
|
|
2869
|
+
ret.append(" [--" + ARG_TTL + "]");
|
|
2870
|
+
ret.append("\n");
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
void BatchPutCommand::DoCommand() {
|
|
2874
|
+
if (!db_) {
|
|
2875
|
+
assert(GetExecuteState().IsFailed());
|
|
2876
|
+
return;
|
|
2877
|
+
}
|
|
2878
|
+
WriteBatch batch;
|
|
2879
|
+
|
|
2880
|
+
Status st;
|
|
2881
|
+
std::stringstream oss;
|
|
2882
|
+
for (std::vector<std::pair<std::string, std::string>>::const_iterator itr =
|
|
2883
|
+
key_values_.begin();
|
|
2884
|
+
itr != key_values_.end(); ++itr) {
|
|
2885
|
+
st = batch.Put(GetCfHandle(), itr->first, itr->second);
|
|
2886
|
+
if (!st.ok()) {
|
|
2887
|
+
oss << "Put to write batch failed: " << itr->first << "=>" << itr->second
|
|
2888
|
+
<< " error: " << st.ToString();
|
|
2889
|
+
break;
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
if (st.ok()) {
|
|
2893
|
+
st = db_->Write(WriteOptions(), &batch);
|
|
2894
|
+
if (!st.ok()) {
|
|
2895
|
+
oss << "Write failed: " << st.ToString();
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
if (st.ok()) {
|
|
2899
|
+
fprintf(stdout, "OK\n");
|
|
2900
|
+
} else {
|
|
2901
|
+
exec_state_ = LDBCommandExecuteResult::Failed(oss.str());
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
void BatchPutCommand::OverrideBaseOptions() {
|
|
2906
|
+
LDBCommand::OverrideBaseOptions();
|
|
2907
|
+
options_.create_if_missing = create_if_missing_;
|
|
2908
|
+
}
|
|
2909
|
+
|
|
2910
|
+
// ----------------------------------------------------------------------------
|
|
2911
|
+
|
|
2912
|
+
ScanCommand::ScanCommand(const std::vector<std::string>& /*params*/,
|
|
2913
|
+
const std::map<std::string, std::string>& options,
|
|
2914
|
+
const std::vector<std::string>& flags)
|
|
2915
|
+
: LDBCommand(
|
|
2916
|
+
options, flags, true,
|
|
2917
|
+
BuildCmdLineOptions({ARG_TTL, ARG_NO_VALUE, ARG_HEX, ARG_KEY_HEX,
|
|
2918
|
+
ARG_TO, ARG_VALUE_HEX, ARG_FROM, ARG_TIMESTAMP,
|
|
2919
|
+
ARG_MAX_KEYS, ARG_TTL_START, ARG_TTL_END})),
|
|
2920
|
+
start_key_specified_(false),
|
|
2921
|
+
end_key_specified_(false),
|
|
2922
|
+
max_keys_scanned_(-1),
|
|
2923
|
+
no_value_(false) {
|
|
2924
|
+
auto itr = options.find(ARG_FROM);
|
|
2925
|
+
if (itr != options.end()) {
|
|
2926
|
+
start_key_ = itr->second;
|
|
2927
|
+
if (is_key_hex_) {
|
|
2928
|
+
start_key_ = HexToString(start_key_);
|
|
2929
|
+
}
|
|
2930
|
+
start_key_specified_ = true;
|
|
2931
|
+
}
|
|
2932
|
+
itr = options.find(ARG_TO);
|
|
2933
|
+
if (itr != options.end()) {
|
|
2934
|
+
end_key_ = itr->second;
|
|
2935
|
+
if (is_key_hex_) {
|
|
2936
|
+
end_key_ = HexToString(end_key_);
|
|
2937
|
+
}
|
|
2938
|
+
end_key_specified_ = true;
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
std::vector<std::string>::const_iterator vitr =
|
|
2942
|
+
std::find(flags.begin(), flags.end(), ARG_NO_VALUE);
|
|
2943
|
+
if (vitr != flags.end()) {
|
|
2944
|
+
no_value_ = true;
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
itr = options.find(ARG_MAX_KEYS);
|
|
2948
|
+
if (itr != options.end()) {
|
|
2949
|
+
try {
|
|
2950
|
+
#if defined(CYGWIN)
|
|
2951
|
+
max_keys_scanned_ = strtol(itr->second.c_str(), 0, 10);
|
|
2952
|
+
#else
|
|
2953
|
+
max_keys_scanned_ = std::stoi(itr->second);
|
|
2954
|
+
#endif
|
|
2955
|
+
} catch (const std::invalid_argument&) {
|
|
2956
|
+
exec_state_ = LDBCommandExecuteResult::Failed(ARG_MAX_KEYS +
|
|
2957
|
+
" has an invalid value");
|
|
2958
|
+
} catch (const std::out_of_range&) {
|
|
2959
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
2960
|
+
ARG_MAX_KEYS + " has a value out-of-range");
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
void ScanCommand::Help(std::string& ret) {
|
|
2966
|
+
ret.append(" ");
|
|
2967
|
+
ret.append(ScanCommand::Name());
|
|
2968
|
+
ret.append(HelpRangeCmdArgs());
|
|
2969
|
+
ret.append(" [--" + ARG_TTL + "]");
|
|
2970
|
+
ret.append(" [--" + ARG_TIMESTAMP + "]");
|
|
2971
|
+
ret.append(" [--" + ARG_MAX_KEYS + "=<N>q] ");
|
|
2972
|
+
ret.append(" [--" + ARG_TTL_START + "=<N>:- is inclusive]");
|
|
2973
|
+
ret.append(" [--" + ARG_TTL_END + "=<N>:- is exclusive]");
|
|
2974
|
+
ret.append(" [--" + ARG_NO_VALUE + "]");
|
|
2975
|
+
ret.append("\n");
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
void ScanCommand::DoCommand() {
|
|
2979
|
+
if (!db_) {
|
|
2980
|
+
assert(GetExecuteState().IsFailed());
|
|
2981
|
+
return;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
int num_keys_scanned = 0;
|
|
2985
|
+
ReadOptions scan_read_opts;
|
|
2986
|
+
scan_read_opts.total_order_seek = true;
|
|
2987
|
+
Iterator* it = db_->NewIterator(scan_read_opts, GetCfHandle());
|
|
2988
|
+
if (start_key_specified_) {
|
|
2989
|
+
it->Seek(start_key_);
|
|
2990
|
+
} else {
|
|
2991
|
+
it->SeekToFirst();
|
|
2992
|
+
}
|
|
2993
|
+
int ttl_start;
|
|
2994
|
+
if (!ParseIntOption(option_map_, ARG_TTL_START, ttl_start, exec_state_)) {
|
|
2995
|
+
ttl_start = DBWithTTLImpl::kMinTimestamp; // TTL introduction time
|
|
2996
|
+
}
|
|
2997
|
+
int ttl_end;
|
|
2998
|
+
if (!ParseIntOption(option_map_, ARG_TTL_END, ttl_end, exec_state_)) {
|
|
2999
|
+
ttl_end = DBWithTTLImpl::kMaxTimestamp; // Max time allowed by TTL feature
|
|
3000
|
+
}
|
|
3001
|
+
if (ttl_end < ttl_start) {
|
|
3002
|
+
fprintf(stderr, "Error: End time can't be less than start time\n");
|
|
3003
|
+
delete it;
|
|
3004
|
+
return;
|
|
3005
|
+
}
|
|
3006
|
+
if (is_db_ttl_ && timestamp_) {
|
|
3007
|
+
fprintf(stdout, "Scanning key-values from %s to %s\n",
|
|
3008
|
+
TimeToHumanString(ttl_start).c_str(),
|
|
3009
|
+
TimeToHumanString(ttl_end).c_str());
|
|
3010
|
+
}
|
|
3011
|
+
for (;
|
|
3012
|
+
it->Valid() && (!end_key_specified_ || it->key().ToString() < end_key_);
|
|
3013
|
+
it->Next()) {
|
|
3014
|
+
if (is_db_ttl_) {
|
|
3015
|
+
TtlIterator* it_ttl = static_cast_with_check<TtlIterator>(it);
|
|
3016
|
+
int rawtime = it_ttl->ttl_timestamp();
|
|
3017
|
+
if (rawtime < ttl_start || rawtime >= ttl_end) {
|
|
3018
|
+
continue;
|
|
3019
|
+
}
|
|
3020
|
+
if (timestamp_) {
|
|
3021
|
+
fprintf(stdout, "%s ", TimeToHumanString(rawtime).c_str());
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
Slice key_slice = it->key();
|
|
3026
|
+
|
|
3027
|
+
std::string formatted_key;
|
|
3028
|
+
if (is_key_hex_) {
|
|
3029
|
+
formatted_key = "0x" + key_slice.ToString(true /* hex */);
|
|
3030
|
+
key_slice = formatted_key;
|
|
3031
|
+
} else if (ldb_options_.key_formatter) {
|
|
3032
|
+
formatted_key = ldb_options_.key_formatter->Format(key_slice);
|
|
3033
|
+
key_slice = formatted_key;
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
if (no_value_) {
|
|
3037
|
+
fprintf(stdout, "%.*s\n", static_cast<int>(key_slice.size()),
|
|
3038
|
+
key_slice.data());
|
|
3039
|
+
} else {
|
|
3040
|
+
Slice val_slice = it->value();
|
|
3041
|
+
std::string formatted_value;
|
|
3042
|
+
if (is_value_hex_) {
|
|
3043
|
+
formatted_value = "0x" + val_slice.ToString(true /* hex */);
|
|
3044
|
+
val_slice = formatted_value;
|
|
3045
|
+
}
|
|
3046
|
+
fprintf(stdout, "%.*s : %.*s\n", static_cast<int>(key_slice.size()),
|
|
3047
|
+
key_slice.data(), static_cast<int>(val_slice.size()),
|
|
3048
|
+
val_slice.data());
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
num_keys_scanned++;
|
|
3052
|
+
if (max_keys_scanned_ >= 0 && num_keys_scanned >= max_keys_scanned_) {
|
|
3053
|
+
break;
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
if (!it->status().ok()) { // Check for any errors found during the scan
|
|
3057
|
+
exec_state_ = LDBCommandExecuteResult::Failed(it->status().ToString());
|
|
3058
|
+
}
|
|
3059
|
+
delete it;
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
// ----------------------------------------------------------------------------
|
|
3063
|
+
|
|
3064
|
+
DeleteCommand::DeleteCommand(const std::vector<std::string>& params,
|
|
3065
|
+
const std::map<std::string, std::string>& options,
|
|
3066
|
+
const std::vector<std::string>& flags)
|
|
3067
|
+
: LDBCommand(options, flags, false,
|
|
3068
|
+
BuildCmdLineOptions({ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX})) {
|
|
3069
|
+
if (params.size() != 1) {
|
|
3070
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
3071
|
+
"KEY must be specified for the delete command");
|
|
3072
|
+
} else {
|
|
3073
|
+
key_ = params.at(0);
|
|
3074
|
+
if (is_key_hex_) {
|
|
3075
|
+
key_ = HexToString(key_);
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
void DeleteCommand::Help(std::string& ret) {
|
|
3081
|
+
ret.append(" ");
|
|
3082
|
+
ret.append(DeleteCommand::Name() + " <key>");
|
|
3083
|
+
ret.append("\n");
|
|
3084
|
+
}
|
|
3085
|
+
|
|
3086
|
+
void DeleteCommand::DoCommand() {
|
|
3087
|
+
if (!db_) {
|
|
3088
|
+
assert(GetExecuteState().IsFailed());
|
|
3089
|
+
return;
|
|
3090
|
+
}
|
|
3091
|
+
Status st = db_->Delete(WriteOptions(), GetCfHandle(), key_);
|
|
3092
|
+
if (st.ok()) {
|
|
3093
|
+
fprintf(stdout, "OK\n");
|
|
3094
|
+
} else {
|
|
3095
|
+
exec_state_ = LDBCommandExecuteResult::Failed(st.ToString());
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3099
|
+
SingleDeleteCommand::SingleDeleteCommand(
|
|
3100
|
+
const std::vector<std::string>& params,
|
|
3101
|
+
const std::map<std::string, std::string>& options,
|
|
3102
|
+
const std::vector<std::string>& flags)
|
|
3103
|
+
: LDBCommand(options, flags, false,
|
|
3104
|
+
BuildCmdLineOptions({ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX})) {
|
|
3105
|
+
if (params.size() != 1) {
|
|
3106
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
3107
|
+
"KEY must be specified for the single delete command");
|
|
3108
|
+
} else {
|
|
3109
|
+
key_ = params.at(0);
|
|
3110
|
+
if (is_key_hex_) {
|
|
3111
|
+
key_ = HexToString(key_);
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
void SingleDeleteCommand::Help(std::string& ret) {
|
|
3117
|
+
ret.append(" ");
|
|
3118
|
+
ret.append(SingleDeleteCommand::Name() + " <key>");
|
|
3119
|
+
ret.append("\n");
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3122
|
+
void SingleDeleteCommand::DoCommand() {
|
|
3123
|
+
if (!db_) {
|
|
3124
|
+
assert(GetExecuteState().IsFailed());
|
|
3125
|
+
return;
|
|
3126
|
+
}
|
|
3127
|
+
Status st = db_->SingleDelete(WriteOptions(), GetCfHandle(), key_);
|
|
3128
|
+
if (st.ok()) {
|
|
3129
|
+
fprintf(stdout, "OK\n");
|
|
3130
|
+
} else {
|
|
3131
|
+
exec_state_ = LDBCommandExecuteResult::Failed(st.ToString());
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
DeleteRangeCommand::DeleteRangeCommand(
|
|
3136
|
+
const std::vector<std::string>& params,
|
|
3137
|
+
const std::map<std::string, std::string>& options,
|
|
3138
|
+
const std::vector<std::string>& flags)
|
|
3139
|
+
: LDBCommand(options, flags, false,
|
|
3140
|
+
BuildCmdLineOptions({ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX})) {
|
|
3141
|
+
if (params.size() != 2) {
|
|
3142
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
3143
|
+
"begin and end keys must be specified for the delete command");
|
|
3144
|
+
} else {
|
|
3145
|
+
begin_key_ = params.at(0);
|
|
3146
|
+
end_key_ = params.at(1);
|
|
3147
|
+
if (is_key_hex_) {
|
|
3148
|
+
begin_key_ = HexToString(begin_key_);
|
|
3149
|
+
end_key_ = HexToString(end_key_);
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
|
|
3154
|
+
void DeleteRangeCommand::Help(std::string& ret) {
|
|
3155
|
+
ret.append(" ");
|
|
3156
|
+
ret.append(DeleteRangeCommand::Name() + " <begin key> <end key>");
|
|
3157
|
+
ret.append("\n");
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
void DeleteRangeCommand::DoCommand() {
|
|
3161
|
+
if (!db_) {
|
|
3162
|
+
assert(GetExecuteState().IsFailed());
|
|
3163
|
+
return;
|
|
3164
|
+
}
|
|
3165
|
+
Status st =
|
|
3166
|
+
db_->DeleteRange(WriteOptions(), GetCfHandle(), begin_key_, end_key_);
|
|
3167
|
+
if (st.ok()) {
|
|
3168
|
+
fprintf(stdout, "OK\n");
|
|
3169
|
+
} else {
|
|
3170
|
+
exec_state_ = LDBCommandExecuteResult::Failed(st.ToString());
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
PutCommand::PutCommand(const std::vector<std::string>& params,
|
|
3175
|
+
const std::map<std::string, std::string>& options,
|
|
3176
|
+
const std::vector<std::string>& flags)
|
|
3177
|
+
: LDBCommand(options, flags, false,
|
|
3178
|
+
BuildCmdLineOptions({ARG_TTL, ARG_HEX, ARG_KEY_HEX,
|
|
3179
|
+
ARG_VALUE_HEX, ARG_CREATE_IF_MISSING})) {
|
|
3180
|
+
if (params.size() != 2) {
|
|
3181
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
3182
|
+
"<key> and <value> must be specified for the put command");
|
|
3183
|
+
} else {
|
|
3184
|
+
key_ = params.at(0);
|
|
3185
|
+
value_ = params.at(1);
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
if (is_key_hex_) {
|
|
3189
|
+
key_ = HexToString(key_);
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
if (is_value_hex_) {
|
|
3193
|
+
value_ = HexToString(value_);
|
|
3194
|
+
}
|
|
3195
|
+
create_if_missing_ = IsFlagPresent(flags_, ARG_CREATE_IF_MISSING);
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3198
|
+
void PutCommand::Help(std::string& ret) {
|
|
3199
|
+
ret.append(" ");
|
|
3200
|
+
ret.append(PutCommand::Name());
|
|
3201
|
+
ret.append(" <key> <value>");
|
|
3202
|
+
ret.append(" [--" + ARG_CREATE_IF_MISSING + "]");
|
|
3203
|
+
ret.append(" [--" + ARG_TTL + "]");
|
|
3204
|
+
ret.append("\n");
|
|
3205
|
+
}
|
|
3206
|
+
|
|
3207
|
+
void PutCommand::DoCommand() {
|
|
3208
|
+
if (!db_) {
|
|
3209
|
+
assert(GetExecuteState().IsFailed());
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
Status st = db_->Put(WriteOptions(), GetCfHandle(), key_, value_);
|
|
3213
|
+
if (st.ok()) {
|
|
3214
|
+
fprintf(stdout, "OK\n");
|
|
3215
|
+
} else {
|
|
3216
|
+
exec_state_ = LDBCommandExecuteResult::Failed(st.ToString());
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
void PutCommand::OverrideBaseOptions() {
|
|
3221
|
+
LDBCommand::OverrideBaseOptions();
|
|
3222
|
+
options_.create_if_missing = create_if_missing_;
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3225
|
+
// ----------------------------------------------------------------------------
|
|
3226
|
+
|
|
3227
|
+
const char* DBQuerierCommand::HELP_CMD = "help";
|
|
3228
|
+
const char* DBQuerierCommand::GET_CMD = "get";
|
|
3229
|
+
const char* DBQuerierCommand::PUT_CMD = "put";
|
|
3230
|
+
const char* DBQuerierCommand::DELETE_CMD = "delete";
|
|
3231
|
+
|
|
3232
|
+
DBQuerierCommand::DBQuerierCommand(
|
|
3233
|
+
const std::vector<std::string>& /*params*/,
|
|
3234
|
+
const std::map<std::string, std::string>& options,
|
|
3235
|
+
const std::vector<std::string>& flags)
|
|
3236
|
+
: LDBCommand(
|
|
3237
|
+
options, flags, false,
|
|
3238
|
+
BuildCmdLineOptions({ARG_TTL, ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX})) {
|
|
3239
|
+
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3242
|
+
void DBQuerierCommand::Help(std::string& ret) {
|
|
3243
|
+
ret.append(" ");
|
|
3244
|
+
ret.append(DBQuerierCommand::Name());
|
|
3245
|
+
ret.append(" [--" + ARG_TTL + "]");
|
|
3246
|
+
ret.append("\n");
|
|
3247
|
+
ret.append(
|
|
3248
|
+
" Starts a REPL shell. Type help for list of available "
|
|
3249
|
+
"commands.");
|
|
3250
|
+
ret.append("\n");
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
void DBQuerierCommand::DoCommand() {
|
|
3254
|
+
if (!db_) {
|
|
3255
|
+
assert(GetExecuteState().IsFailed());
|
|
3256
|
+
return;
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
ReadOptions read_options;
|
|
3260
|
+
WriteOptions write_options;
|
|
3261
|
+
|
|
3262
|
+
std::string line;
|
|
3263
|
+
std::string key;
|
|
3264
|
+
std::string value;
|
|
3265
|
+
Status s;
|
|
3266
|
+
std::stringstream oss;
|
|
3267
|
+
while (s.ok() && getline(std::cin, line, '\n')) {
|
|
3268
|
+
// Parse line into std::vector<std::string>
|
|
3269
|
+
std::vector<std::string> tokens;
|
|
3270
|
+
size_t pos = 0;
|
|
3271
|
+
while (true) {
|
|
3272
|
+
size_t pos2 = line.find(' ', pos);
|
|
3273
|
+
if (pos2 == std::string::npos) {
|
|
3274
|
+
break;
|
|
3275
|
+
}
|
|
3276
|
+
tokens.push_back(line.substr(pos, pos2 - pos));
|
|
3277
|
+
pos = pos2 + 1;
|
|
3278
|
+
}
|
|
3279
|
+
tokens.push_back(line.substr(pos));
|
|
3280
|
+
|
|
3281
|
+
const std::string& cmd = tokens[0];
|
|
3282
|
+
|
|
3283
|
+
if (cmd == HELP_CMD) {
|
|
3284
|
+
fprintf(stdout,
|
|
3285
|
+
"get <key>\n"
|
|
3286
|
+
"put <key> <value>\n"
|
|
3287
|
+
"delete <key>\n");
|
|
3288
|
+
} else if (cmd == DELETE_CMD && tokens.size() == 2) {
|
|
3289
|
+
key = (is_key_hex_ ? HexToString(tokens[1]) : tokens[1]);
|
|
3290
|
+
s = db_->Delete(write_options, GetCfHandle(), Slice(key));
|
|
3291
|
+
if (s.ok()) {
|
|
3292
|
+
fprintf(stdout, "Successfully deleted %s\n", tokens[1].c_str());
|
|
3293
|
+
} else {
|
|
3294
|
+
oss << "delete " << key << " failed: " << s.ToString();
|
|
3295
|
+
}
|
|
3296
|
+
} else if (cmd == PUT_CMD && tokens.size() == 3) {
|
|
3297
|
+
key = (is_key_hex_ ? HexToString(tokens[1]) : tokens[1]);
|
|
3298
|
+
value = (is_value_hex_ ? HexToString(tokens[2]) : tokens[2]);
|
|
3299
|
+
s = db_->Put(write_options, GetCfHandle(), Slice(key), Slice(value));
|
|
3300
|
+
if (s.ok()) {
|
|
3301
|
+
fprintf(stdout, "Successfully put %s %s\n", tokens[1].c_str(),
|
|
3302
|
+
tokens[2].c_str());
|
|
3303
|
+
} else {
|
|
3304
|
+
oss << "put " << key << "=>" << value << " failed: " << s.ToString();
|
|
3305
|
+
}
|
|
3306
|
+
} else if (cmd == GET_CMD && tokens.size() == 2) {
|
|
3307
|
+
key = (is_key_hex_ ? HexToString(tokens[1]) : tokens[1]);
|
|
3308
|
+
s = db_->Get(read_options, GetCfHandle(), Slice(key), &value);
|
|
3309
|
+
if (s.ok()) {
|
|
3310
|
+
fprintf(stdout, "%s\n",
|
|
3311
|
+
PrintKeyValue(key, value, is_key_hex_, is_value_hex_).c_str());
|
|
3312
|
+
} else {
|
|
3313
|
+
if (s.IsNotFound()) {
|
|
3314
|
+
fprintf(stdout, "Not found %s\n", tokens[1].c_str());
|
|
3315
|
+
} else {
|
|
3316
|
+
oss << "get " << key << " error: " << s.ToString();
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
} else {
|
|
3320
|
+
fprintf(stdout, "Unknown command %s\n", line.c_str());
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
if (!s.ok()) {
|
|
3324
|
+
exec_state_ = LDBCommandExecuteResult::Failed(oss.str());
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3327
|
+
|
|
3328
|
+
// ----------------------------------------------------------------------------
|
|
3329
|
+
|
|
3330
|
+
CheckConsistencyCommand::CheckConsistencyCommand(
|
|
3331
|
+
const std::vector<std::string>& /*params*/,
|
|
3332
|
+
const std::map<std::string, std::string>& options,
|
|
3333
|
+
const std::vector<std::string>& flags)
|
|
3334
|
+
: LDBCommand(options, flags, true, BuildCmdLineOptions({})) {}
|
|
3335
|
+
|
|
3336
|
+
void CheckConsistencyCommand::Help(std::string& ret) {
|
|
3337
|
+
ret.append(" ");
|
|
3338
|
+
ret.append(CheckConsistencyCommand::Name());
|
|
3339
|
+
ret.append("\n");
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3342
|
+
void CheckConsistencyCommand::DoCommand() {
|
|
3343
|
+
options_.paranoid_checks = true;
|
|
3344
|
+
options_.num_levels = 64;
|
|
3345
|
+
OpenDB();
|
|
3346
|
+
if (exec_state_.IsSucceed() || exec_state_.IsNotStarted()) {
|
|
3347
|
+
fprintf(stdout, "OK\n");
|
|
3348
|
+
}
|
|
3349
|
+
CloseDB();
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3352
|
+
// ----------------------------------------------------------------------------
|
|
3353
|
+
|
|
3354
|
+
const std::string CheckPointCommand::ARG_CHECKPOINT_DIR = "checkpoint_dir";
|
|
3355
|
+
|
|
3356
|
+
CheckPointCommand::CheckPointCommand(
|
|
3357
|
+
const std::vector<std::string>& /*params*/,
|
|
3358
|
+
const std::map<std::string, std::string>& options,
|
|
3359
|
+
const std::vector<std::string>& flags)
|
|
3360
|
+
: LDBCommand(options, flags, false /* is_read_only */,
|
|
3361
|
+
BuildCmdLineOptions({ARG_CHECKPOINT_DIR})) {
|
|
3362
|
+
auto itr = options.find(ARG_CHECKPOINT_DIR);
|
|
3363
|
+
if (itr != options.end()) {
|
|
3364
|
+
checkpoint_dir_ = itr->second;
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
void CheckPointCommand::Help(std::string& ret) {
|
|
3369
|
+
ret.append(" ");
|
|
3370
|
+
ret.append(CheckPointCommand::Name());
|
|
3371
|
+
ret.append(" [--" + ARG_CHECKPOINT_DIR + "] ");
|
|
3372
|
+
ret.append("\n");
|
|
3373
|
+
}
|
|
3374
|
+
|
|
3375
|
+
void CheckPointCommand::DoCommand() {
|
|
3376
|
+
if (!db_) {
|
|
3377
|
+
assert(GetExecuteState().IsFailed());
|
|
3378
|
+
return;
|
|
3379
|
+
}
|
|
3380
|
+
Checkpoint* checkpoint;
|
|
3381
|
+
Status status = Checkpoint::Create(db_, &checkpoint);
|
|
3382
|
+
status = checkpoint->CreateCheckpoint(checkpoint_dir_);
|
|
3383
|
+
if (status.ok()) {
|
|
3384
|
+
fprintf(stdout, "OK\n");
|
|
3385
|
+
} else {
|
|
3386
|
+
exec_state_ = LDBCommandExecuteResult::Failed(status.ToString());
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
// ----------------------------------------------------------------------------
|
|
3391
|
+
|
|
3392
|
+
const std::string RepairCommand::ARG_VERBOSE = "verbose";
|
|
3393
|
+
|
|
3394
|
+
RepairCommand::RepairCommand(const std::vector<std::string>& /*params*/,
|
|
3395
|
+
const std::map<std::string, std::string>& options,
|
|
3396
|
+
const std::vector<std::string>& flags)
|
|
3397
|
+
: LDBCommand(options, flags, false, BuildCmdLineOptions({ARG_VERBOSE})) {
|
|
3398
|
+
verbose_ = IsFlagPresent(flags, ARG_VERBOSE);
|
|
3399
|
+
}
|
|
3400
|
+
|
|
3401
|
+
void RepairCommand::Help(std::string& ret) {
|
|
3402
|
+
ret.append(" ");
|
|
3403
|
+
ret.append(RepairCommand::Name());
|
|
3404
|
+
ret.append(" [--" + ARG_VERBOSE + "]");
|
|
3405
|
+
ret.append("\n");
|
|
3406
|
+
}
|
|
3407
|
+
|
|
3408
|
+
void RepairCommand::OverrideBaseOptions() {
|
|
3409
|
+
LDBCommand::OverrideBaseOptions();
|
|
3410
|
+
auto level = verbose_ ? InfoLogLevel::INFO_LEVEL : InfoLogLevel::WARN_LEVEL;
|
|
3411
|
+
options_.info_log.reset(new StderrLogger(level));
|
|
3412
|
+
}
|
|
3413
|
+
|
|
3414
|
+
void RepairCommand::DoCommand() {
|
|
3415
|
+
PrepareOptions();
|
|
3416
|
+
Status status = RepairDB(db_path_, options_);
|
|
3417
|
+
if (status.ok()) {
|
|
3418
|
+
fprintf(stdout, "OK\n");
|
|
3419
|
+
} else {
|
|
3420
|
+
exec_state_ = LDBCommandExecuteResult::Failed(status.ToString());
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
|
|
3424
|
+
// ----------------------------------------------------------------------------
|
|
3425
|
+
|
|
3426
|
+
const std::string BackupEngineCommand::ARG_NUM_THREADS = "num_threads";
|
|
3427
|
+
const std::string BackupEngineCommand::ARG_BACKUP_ENV_URI = "backup_env_uri";
|
|
3428
|
+
const std::string BackupEngineCommand::ARG_BACKUP_FS_URI = "backup_fs_uri";
|
|
3429
|
+
const std::string BackupEngineCommand::ARG_BACKUP_DIR = "backup_dir";
|
|
3430
|
+
const std::string BackupEngineCommand::ARG_STDERR_LOG_LEVEL =
|
|
3431
|
+
"stderr_log_level";
|
|
3432
|
+
|
|
3433
|
+
BackupEngineCommand::BackupEngineCommand(
|
|
3434
|
+
const std::vector<std::string>& /*params*/,
|
|
3435
|
+
const std::map<std::string, std::string>& options,
|
|
3436
|
+
const std::vector<std::string>& flags)
|
|
3437
|
+
: LDBCommand(options, flags, false /* is_read_only */,
|
|
3438
|
+
BuildCmdLineOptions({ARG_BACKUP_ENV_URI, ARG_BACKUP_FS_URI,
|
|
3439
|
+
ARG_BACKUP_DIR, ARG_NUM_THREADS,
|
|
3440
|
+
ARG_STDERR_LOG_LEVEL})),
|
|
3441
|
+
num_threads_(1) {
|
|
3442
|
+
auto itr = options.find(ARG_NUM_THREADS);
|
|
3443
|
+
if (itr != options.end()) {
|
|
3444
|
+
num_threads_ = std::stoi(itr->second);
|
|
3445
|
+
}
|
|
3446
|
+
itr = options.find(ARG_BACKUP_ENV_URI);
|
|
3447
|
+
if (itr != options.end()) {
|
|
3448
|
+
backup_env_uri_ = itr->second;
|
|
3449
|
+
}
|
|
3450
|
+
itr = options.find(ARG_BACKUP_FS_URI);
|
|
3451
|
+
if (itr != options.end()) {
|
|
3452
|
+
backup_fs_uri_ = itr->second;
|
|
3453
|
+
}
|
|
3454
|
+
if (!backup_env_uri_.empty() && !backup_fs_uri_.empty()) {
|
|
3455
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
3456
|
+
"you may not specity both --" + ARG_BACKUP_ENV_URI + " and --" +
|
|
3457
|
+
ARG_BACKUP_FS_URI);
|
|
3458
|
+
}
|
|
3459
|
+
itr = options.find(ARG_BACKUP_DIR);
|
|
3460
|
+
if (itr == options.end()) {
|
|
3461
|
+
exec_state_ = LDBCommandExecuteResult::Failed("--" + ARG_BACKUP_DIR +
|
|
3462
|
+
": missing backup directory");
|
|
3463
|
+
} else {
|
|
3464
|
+
backup_dir_ = itr->second;
|
|
3465
|
+
}
|
|
3466
|
+
|
|
3467
|
+
itr = options.find(ARG_STDERR_LOG_LEVEL);
|
|
3468
|
+
if (itr != options.end()) {
|
|
3469
|
+
int stderr_log_level = std::stoi(itr->second);
|
|
3470
|
+
if (stderr_log_level < 0 ||
|
|
3471
|
+
stderr_log_level >= InfoLogLevel::NUM_INFO_LOG_LEVELS) {
|
|
3472
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
3473
|
+
ARG_STDERR_LOG_LEVEL + " must be >= 0 and < " +
|
|
3474
|
+
std::to_string(InfoLogLevel::NUM_INFO_LOG_LEVELS) + ".");
|
|
3475
|
+
} else {
|
|
3476
|
+
logger_.reset(
|
|
3477
|
+
new StderrLogger(static_cast<InfoLogLevel>(stderr_log_level)));
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
|
|
3482
|
+
void BackupEngineCommand::Help(const std::string& name, std::string& ret) {
|
|
3483
|
+
ret.append(" ");
|
|
3484
|
+
ret.append(name);
|
|
3485
|
+
ret.append(" [--" + ARG_BACKUP_ENV_URI + " | --" + ARG_BACKUP_FS_URI + "] ");
|
|
3486
|
+
ret.append(" [--" + ARG_BACKUP_DIR + "] ");
|
|
3487
|
+
ret.append(" [--" + ARG_NUM_THREADS + "] ");
|
|
3488
|
+
ret.append(" [--" + ARG_STDERR_LOG_LEVEL + "=<int (InfoLogLevel)>] ");
|
|
3489
|
+
ret.append("\n");
|
|
3490
|
+
}
|
|
3491
|
+
|
|
3492
|
+
// ----------------------------------------------------------------------------
|
|
3493
|
+
|
|
3494
|
+
BackupCommand::BackupCommand(const std::vector<std::string>& params,
|
|
3495
|
+
const std::map<std::string, std::string>& options,
|
|
3496
|
+
const std::vector<std::string>& flags)
|
|
3497
|
+
: BackupEngineCommand(params, options, flags) {}
|
|
3498
|
+
|
|
3499
|
+
void BackupCommand::Help(std::string& ret) {
|
|
3500
|
+
BackupEngineCommand::Help(Name(), ret);
|
|
3501
|
+
}
|
|
3502
|
+
|
|
3503
|
+
void BackupCommand::DoCommand() {
|
|
3504
|
+
BackupEngine* backup_engine;
|
|
3505
|
+
Status status;
|
|
3506
|
+
if (!db_) {
|
|
3507
|
+
assert(GetExecuteState().IsFailed());
|
|
3508
|
+
return;
|
|
3509
|
+
}
|
|
3510
|
+
fprintf(stdout, "open db OK\n");
|
|
3511
|
+
|
|
3512
|
+
Env* custom_env = backup_env_guard_.get();
|
|
3513
|
+
if (custom_env == nullptr) {
|
|
3514
|
+
Status s =
|
|
3515
|
+
Env::CreateFromUri(config_options_, backup_env_uri_, backup_fs_uri_,
|
|
3516
|
+
&custom_env, &backup_env_guard_);
|
|
3517
|
+
if (!s.ok()) {
|
|
3518
|
+
exec_state_ = LDBCommandExecuteResult::Failed(s.ToString());
|
|
3519
|
+
return;
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
assert(custom_env != nullptr);
|
|
3523
|
+
|
|
3524
|
+
BackupEngineOptions backup_options =
|
|
3525
|
+
BackupEngineOptions(backup_dir_, custom_env);
|
|
3526
|
+
backup_options.info_log = logger_.get();
|
|
3527
|
+
backup_options.max_background_operations = num_threads_;
|
|
3528
|
+
status = BackupEngine::Open(options_.env, backup_options, &backup_engine);
|
|
3529
|
+
if (status.ok()) {
|
|
3530
|
+
fprintf(stdout, "open backup engine OK\n");
|
|
3531
|
+
} else {
|
|
3532
|
+
exec_state_ = LDBCommandExecuteResult::Failed(status.ToString());
|
|
3533
|
+
return;
|
|
3534
|
+
}
|
|
3535
|
+
status = backup_engine->CreateNewBackup(db_);
|
|
3536
|
+
if (status.ok()) {
|
|
3537
|
+
fprintf(stdout, "create new backup OK\n");
|
|
3538
|
+
} else {
|
|
3539
|
+
exec_state_ = LDBCommandExecuteResult::Failed(status.ToString());
|
|
3540
|
+
return;
|
|
3541
|
+
}
|
|
3542
|
+
}
|
|
3543
|
+
|
|
3544
|
+
// ----------------------------------------------------------------------------
|
|
3545
|
+
|
|
3546
|
+
RestoreCommand::RestoreCommand(
|
|
3547
|
+
const std::vector<std::string>& params,
|
|
3548
|
+
const std::map<std::string, std::string>& options,
|
|
3549
|
+
const std::vector<std::string>& flags)
|
|
3550
|
+
: BackupEngineCommand(params, options, flags) {}
|
|
3551
|
+
|
|
3552
|
+
void RestoreCommand::Help(std::string& ret) {
|
|
3553
|
+
BackupEngineCommand::Help(Name(), ret);
|
|
3554
|
+
}
|
|
3555
|
+
|
|
3556
|
+
void RestoreCommand::DoCommand() {
|
|
3557
|
+
Env* custom_env = backup_env_guard_.get();
|
|
3558
|
+
if (custom_env == nullptr) {
|
|
3559
|
+
Status s =
|
|
3560
|
+
Env::CreateFromUri(config_options_, backup_env_uri_, backup_fs_uri_,
|
|
3561
|
+
&custom_env, &backup_env_guard_);
|
|
3562
|
+
if (!s.ok()) {
|
|
3563
|
+
exec_state_ = LDBCommandExecuteResult::Failed(s.ToString());
|
|
3564
|
+
return;
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
assert(custom_env != nullptr);
|
|
3568
|
+
|
|
3569
|
+
std::unique_ptr<BackupEngineReadOnly> restore_engine;
|
|
3570
|
+
Status status;
|
|
3571
|
+
{
|
|
3572
|
+
BackupEngineOptions opts(backup_dir_, custom_env);
|
|
3573
|
+
opts.info_log = logger_.get();
|
|
3574
|
+
opts.max_background_operations = num_threads_;
|
|
3575
|
+
BackupEngineReadOnly* raw_restore_engine_ptr;
|
|
3576
|
+
status =
|
|
3577
|
+
BackupEngineReadOnly::Open(options_.env, opts, &raw_restore_engine_ptr);
|
|
3578
|
+
if (status.ok()) {
|
|
3579
|
+
restore_engine.reset(raw_restore_engine_ptr);
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
if (status.ok()) {
|
|
3583
|
+
fprintf(stdout, "open restore engine OK\n");
|
|
3584
|
+
status = restore_engine->RestoreDBFromLatestBackup(db_path_, db_path_);
|
|
3585
|
+
}
|
|
3586
|
+
if (status.ok()) {
|
|
3587
|
+
fprintf(stdout, "restore from backup OK\n");
|
|
3588
|
+
} else {
|
|
3589
|
+
exec_state_ = LDBCommandExecuteResult::Failed(status.ToString());
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
// ----------------------------------------------------------------------------
|
|
3594
|
+
|
|
3595
|
+
namespace {
|
|
3596
|
+
|
|
3597
|
+
void DumpSstFile(Options options, std::string filename, bool output_hex,
|
|
3598
|
+
bool show_properties, bool decode_blob_index,
|
|
3599
|
+
std::string from_key, std::string to_key) {
|
|
3600
|
+
if (filename.length() <= 4 ||
|
|
3601
|
+
filename.rfind(".sst") != filename.length() - 4) {
|
|
3602
|
+
std::cout << "Invalid sst file name." << std::endl;
|
|
3603
|
+
return;
|
|
3604
|
+
}
|
|
3605
|
+
// no verification
|
|
3606
|
+
ROCKSDB_NAMESPACE::SstFileDumper dumper(
|
|
3607
|
+
options, filename, Temperature::kUnknown,
|
|
3608
|
+
2 * 1024 * 1024 /* readahead_size */,
|
|
3609
|
+
/* verify_checksum */ false, output_hex, decode_blob_index);
|
|
3610
|
+
Status st = dumper.ReadSequential(true, std::numeric_limits<uint64_t>::max(),
|
|
3611
|
+
!from_key.empty(), from_key,
|
|
3612
|
+
!to_key.empty(), to_key);
|
|
3613
|
+
if (!st.ok()) {
|
|
3614
|
+
std::cerr << "Error in reading SST file " << filename << st.ToString()
|
|
3615
|
+
<< std::endl;
|
|
3616
|
+
return;
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3619
|
+
if (show_properties) {
|
|
3620
|
+
const ROCKSDB_NAMESPACE::TableProperties* table_properties;
|
|
3621
|
+
|
|
3622
|
+
std::shared_ptr<const ROCKSDB_NAMESPACE::TableProperties>
|
|
3623
|
+
table_properties_from_reader;
|
|
3624
|
+
st = dumper.ReadTableProperties(&table_properties_from_reader);
|
|
3625
|
+
if (!st.ok()) {
|
|
3626
|
+
std::cerr << filename << ": " << st.ToString()
|
|
3627
|
+
<< ". Try to use initial table properties" << std::endl;
|
|
3628
|
+
table_properties = dumper.GetInitTableProperties();
|
|
3629
|
+
} else {
|
|
3630
|
+
table_properties = table_properties_from_reader.get();
|
|
3631
|
+
}
|
|
3632
|
+
if (table_properties != nullptr) {
|
|
3633
|
+
std::cout << std::endl << "Table Properties:" << std::endl;
|
|
3634
|
+
std::cout << table_properties->ToString("\n") << std::endl;
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
void DumpBlobFile(const std::string& filename, bool is_key_hex,
|
|
3640
|
+
bool is_value_hex, bool dump_uncompressed_blobs) {
|
|
3641
|
+
using ROCKSDB_NAMESPACE::blob_db::BlobDumpTool;
|
|
3642
|
+
BlobDumpTool tool;
|
|
3643
|
+
BlobDumpTool::DisplayType blob_type = is_value_hex
|
|
3644
|
+
? BlobDumpTool::DisplayType::kHex
|
|
3645
|
+
: BlobDumpTool::DisplayType::kRaw;
|
|
3646
|
+
BlobDumpTool::DisplayType show_uncompressed_blob =
|
|
3647
|
+
dump_uncompressed_blobs ? blob_type : BlobDumpTool::DisplayType::kNone;
|
|
3648
|
+
BlobDumpTool::DisplayType show_blob =
|
|
3649
|
+
dump_uncompressed_blobs ? BlobDumpTool::DisplayType::kNone : blob_type;
|
|
3650
|
+
|
|
3651
|
+
BlobDumpTool::DisplayType show_key = is_key_hex
|
|
3652
|
+
? BlobDumpTool::DisplayType::kHex
|
|
3653
|
+
: BlobDumpTool::DisplayType::kRaw;
|
|
3654
|
+
Status s = tool.Run(filename, show_key, show_blob, show_uncompressed_blob,
|
|
3655
|
+
/* show_summary */ true);
|
|
3656
|
+
if (!s.ok()) {
|
|
3657
|
+
fprintf(stderr, "Failed: %s\n", s.ToString().c_str());
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
} // namespace
|
|
3661
|
+
|
|
3662
|
+
DBFileDumperCommand::DBFileDumperCommand(
|
|
3663
|
+
const std::vector<std::string>& /*params*/,
|
|
3664
|
+
const std::map<std::string, std::string>& options,
|
|
3665
|
+
const std::vector<std::string>& flags)
|
|
3666
|
+
: LDBCommand(options, flags, true,
|
|
3667
|
+
BuildCmdLineOptions(
|
|
3668
|
+
{ARG_DECODE_BLOB_INDEX, ARG_DUMP_UNCOMPRESSED_BLOBS})),
|
|
3669
|
+
decode_blob_index_(IsFlagPresent(flags, ARG_DECODE_BLOB_INDEX)),
|
|
3670
|
+
dump_uncompressed_blobs_(
|
|
3671
|
+
IsFlagPresent(flags, ARG_DUMP_UNCOMPRESSED_BLOBS)) {}
|
|
3672
|
+
|
|
3673
|
+
void DBFileDumperCommand::Help(std::string& ret) {
|
|
3674
|
+
ret.append(" ");
|
|
3675
|
+
ret.append(DBFileDumperCommand::Name());
|
|
3676
|
+
ret.append(" [--" + ARG_DECODE_BLOB_INDEX + "] ");
|
|
3677
|
+
ret.append(" [--" + ARG_DUMP_UNCOMPRESSED_BLOBS + "] ");
|
|
3678
|
+
ret.append("\n");
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
void DBFileDumperCommand::DoCommand() {
|
|
3682
|
+
if (!db_) {
|
|
3683
|
+
assert(GetExecuteState().IsFailed());
|
|
3684
|
+
return;
|
|
3685
|
+
}
|
|
3686
|
+
Status s;
|
|
3687
|
+
|
|
3688
|
+
// TODO: Use --hex, --key_hex, --value_hex flags consistently for
|
|
3689
|
+
// dumping manifest file, sst files and blob files.
|
|
3690
|
+
std::cout << "Manifest File" << std::endl;
|
|
3691
|
+
std::cout << "==============================" << std::endl;
|
|
3692
|
+
std::string manifest_filename;
|
|
3693
|
+
s = ReadFileToString(db_->GetEnv(), CurrentFileName(db_->GetName()),
|
|
3694
|
+
&manifest_filename);
|
|
3695
|
+
if (!s.ok() || manifest_filename.empty() ||
|
|
3696
|
+
manifest_filename.back() != '\n') {
|
|
3697
|
+
std::cerr << "Error when reading CURRENT file "
|
|
3698
|
+
<< CurrentFileName(db_->GetName()) << std::endl;
|
|
3699
|
+
}
|
|
3700
|
+
// remove the trailing '\n'
|
|
3701
|
+
manifest_filename.resize(manifest_filename.size() - 1);
|
|
3702
|
+
std::string manifest_filepath = db_->GetName() + "/" + manifest_filename;
|
|
3703
|
+
// Correct concatenation of filepath and filename:
|
|
3704
|
+
// Check that there is no double slashes (or more!) when concatenation
|
|
3705
|
+
// happens.
|
|
3706
|
+
manifest_filepath = NormalizePath(manifest_filepath);
|
|
3707
|
+
|
|
3708
|
+
std::cout << manifest_filepath << std::endl;
|
|
3709
|
+
DumpManifestFile(options_, manifest_filepath, false, false, false);
|
|
3710
|
+
std::cout << std::endl;
|
|
3711
|
+
|
|
3712
|
+
std::vector<ColumnFamilyMetaData> column_families;
|
|
3713
|
+
db_->GetAllColumnFamilyMetaData(&column_families);
|
|
3714
|
+
for (const auto& column_family : column_families) {
|
|
3715
|
+
std::cout << "Column family name: " << column_family.name << std::endl;
|
|
3716
|
+
std::cout << "==============================" << std::endl;
|
|
3717
|
+
std::cout << std::endl;
|
|
3718
|
+
std::cout << "SST Files" << std::endl;
|
|
3719
|
+
std::cout << "==============================" << std::endl;
|
|
3720
|
+
for (const LevelMetaData& level : column_family.levels) {
|
|
3721
|
+
for (const SstFileMetaData& sst_file : level.files) {
|
|
3722
|
+
std::string filename = sst_file.db_path + "/" + sst_file.name;
|
|
3723
|
+
// Correct concatenation of filepath and filename:
|
|
3724
|
+
// Check that there is no double slashes (or more!) when concatenation
|
|
3725
|
+
// happens.
|
|
3726
|
+
filename = NormalizePath(filename);
|
|
3727
|
+
std::cout << filename << " level:" << level.level << std::endl;
|
|
3728
|
+
std::cout << "------------------------------" << std::endl;
|
|
3729
|
+
DumpSstFile(options_, filename, false, true, decode_blob_index_);
|
|
3730
|
+
std::cout << std::endl;
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
std::cout << "Blob Files" << std::endl;
|
|
3734
|
+
std::cout << "==============================" << std::endl;
|
|
3735
|
+
for (const BlobMetaData& blob_file : column_family.blob_files) {
|
|
3736
|
+
std::string filename =
|
|
3737
|
+
blob_file.blob_file_path + "/" + blob_file.blob_file_name;
|
|
3738
|
+
// Correct concatenation of filepath and filename:
|
|
3739
|
+
// Check that there is no double slashes (or more!) when concatenation
|
|
3740
|
+
// happens.
|
|
3741
|
+
filename = NormalizePath(filename);
|
|
3742
|
+
std::cout << filename << std::endl;
|
|
3743
|
+
std::cout << "------------------------------" << std::endl;
|
|
3744
|
+
DumpBlobFile(filename, /* is_key_hex */ false, /* is_value_hex */ false,
|
|
3745
|
+
dump_uncompressed_blobs_);
|
|
3746
|
+
std::cout << std::endl;
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
std::cout << std::endl;
|
|
3750
|
+
|
|
3751
|
+
std::cout << "Write Ahead Log Files" << std::endl;
|
|
3752
|
+
std::cout << "==============================" << std::endl;
|
|
3753
|
+
ROCKSDB_NAMESPACE::VectorLogPtr wal_files;
|
|
3754
|
+
s = db_->GetSortedWalFiles(wal_files);
|
|
3755
|
+
if (!s.ok()) {
|
|
3756
|
+
std::cerr << "Error when getting WAL files" << std::endl;
|
|
3757
|
+
} else {
|
|
3758
|
+
std::string wal_dir;
|
|
3759
|
+
if (options_.wal_dir.empty()) {
|
|
3760
|
+
wal_dir = db_->GetName();
|
|
3761
|
+
} else {
|
|
3762
|
+
wal_dir = NormalizePath(options_.wal_dir + "/");
|
|
3763
|
+
}
|
|
3764
|
+
for (auto& wal : wal_files) {
|
|
3765
|
+
// TODO(qyang): option.wal_dir should be passed into ldb command
|
|
3766
|
+
std::string filename = wal_dir + wal->PathName();
|
|
3767
|
+
std::cout << filename << std::endl;
|
|
3768
|
+
// TODO(myabandeh): allow configuring is_write_commited
|
|
3769
|
+
DumpWalFile(options_, filename, true, true, true /* is_write_commited */,
|
|
3770
|
+
&exec_state_);
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
|
|
3775
|
+
const std::string DBLiveFilesMetadataDumperCommand::ARG_SORT_BY_FILENAME =
|
|
3776
|
+
"sort_by_filename";
|
|
3777
|
+
|
|
3778
|
+
DBLiveFilesMetadataDumperCommand::DBLiveFilesMetadataDumperCommand(
|
|
3779
|
+
const std::vector<std::string>& /*params*/,
|
|
3780
|
+
const std::map<std::string, std::string>& options,
|
|
3781
|
+
const std::vector<std::string>& flags)
|
|
3782
|
+
: LDBCommand(options, flags, true,
|
|
3783
|
+
BuildCmdLineOptions({ARG_SORT_BY_FILENAME})) {
|
|
3784
|
+
sort_by_filename_ = IsFlagPresent(flags, ARG_SORT_BY_FILENAME);
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
void DBLiveFilesMetadataDumperCommand::Help(std::string& ret) {
|
|
3788
|
+
ret.append(" ");
|
|
3789
|
+
ret.append(DBLiveFilesMetadataDumperCommand::Name());
|
|
3790
|
+
ret.append(" [--" + ARG_SORT_BY_FILENAME + "] ");
|
|
3791
|
+
ret.append("\n");
|
|
3792
|
+
}
|
|
3793
|
+
|
|
3794
|
+
void DBLiveFilesMetadataDumperCommand::DoCommand() {
|
|
3795
|
+
if (!db_) {
|
|
3796
|
+
assert(GetExecuteState().IsFailed());
|
|
3797
|
+
return;
|
|
3798
|
+
}
|
|
3799
|
+
Status s;
|
|
3800
|
+
|
|
3801
|
+
std::vector<ColumnFamilyMetaData> metadata;
|
|
3802
|
+
db_->GetAllColumnFamilyMetaData(&metadata);
|
|
3803
|
+
if (sort_by_filename_) {
|
|
3804
|
+
std::cout << "Live SST and Blob Files:" << std::endl;
|
|
3805
|
+
// tuple of <file path, level, column family name>
|
|
3806
|
+
std::vector<std::tuple<std::string, int, std::string>> all_files;
|
|
3807
|
+
|
|
3808
|
+
for (const auto& column_metadata : metadata) {
|
|
3809
|
+
// Iterate Levels
|
|
3810
|
+
const auto& levels = column_metadata.levels;
|
|
3811
|
+
const std::string& cf = column_metadata.name;
|
|
3812
|
+
for (const auto& level_metadata : levels) {
|
|
3813
|
+
// Iterate SST files
|
|
3814
|
+
const auto& sst_files = level_metadata.files;
|
|
3815
|
+
int level = level_metadata.level;
|
|
3816
|
+
for (const auto& sst_metadata : sst_files) {
|
|
3817
|
+
// The SstFileMetaData.name always starts with "/",
|
|
3818
|
+
// however SstFileMetaData.db_path is the string provided by
|
|
3819
|
+
// the user as an input. Therefore we check if we can
|
|
3820
|
+
// concantenate the two strings directly or if we need to
|
|
3821
|
+
// drop a possible extra "/" at the end of SstFileMetaData.db_path.
|
|
3822
|
+
std::string filename =
|
|
3823
|
+
NormalizePath(sst_metadata.db_path + "/" + sst_metadata.name);
|
|
3824
|
+
all_files.emplace_back(filename, level, cf);
|
|
3825
|
+
} // End of for-loop over sst files
|
|
3826
|
+
} // End of for-loop over levels
|
|
3827
|
+
|
|
3828
|
+
const auto& blob_files = column_metadata.blob_files;
|
|
3829
|
+
for (const auto& blob_metadata : blob_files) {
|
|
3830
|
+
// The BlobMetaData.blob_file_name always starts with "/",
|
|
3831
|
+
// however BlobMetaData.blob_file_path is the string provided by
|
|
3832
|
+
// the user as an input. Therefore we check if we can
|
|
3833
|
+
// concantenate the two strings directly or if we need to
|
|
3834
|
+
// drop a possible extra "/" at the end of BlobMetaData.blob_file_path.
|
|
3835
|
+
std::string filename = NormalizePath(
|
|
3836
|
+
blob_metadata.blob_file_path + "/" + blob_metadata.blob_file_name);
|
|
3837
|
+
// Level for blob files is encoded as -1
|
|
3838
|
+
all_files.emplace_back(filename, -1, cf);
|
|
3839
|
+
} // End of for-loop over blob files
|
|
3840
|
+
} // End of for-loop over column metadata
|
|
3841
|
+
|
|
3842
|
+
// Sort by filename (i.e. first entry in tuple)
|
|
3843
|
+
std::sort(all_files.begin(), all_files.end());
|
|
3844
|
+
|
|
3845
|
+
for (const auto& item : all_files) {
|
|
3846
|
+
const std::string& filename = std::get<0>(item);
|
|
3847
|
+
int level = std::get<1>(item);
|
|
3848
|
+
const std::string& cf = std::get<2>(item);
|
|
3849
|
+
if (level == -1) { // Blob File
|
|
3850
|
+
std::cout << filename << ", column family '" << cf << "'" << std::endl;
|
|
3851
|
+
} else { // SST file
|
|
3852
|
+
std::cout << filename << " : level " << level << ", column family '"
|
|
3853
|
+
<< cf << "'" << std::endl;
|
|
3854
|
+
}
|
|
3855
|
+
}
|
|
3856
|
+
} else {
|
|
3857
|
+
for (const auto& column_metadata : metadata) {
|
|
3858
|
+
std::cout << "===== Column Family: " << column_metadata.name
|
|
3859
|
+
<< " =====" << std::endl;
|
|
3860
|
+
|
|
3861
|
+
std::cout << "Live SST Files:" << std::endl;
|
|
3862
|
+
// Iterate levels
|
|
3863
|
+
const auto& levels = column_metadata.levels;
|
|
3864
|
+
for (const auto& level_metadata : levels) {
|
|
3865
|
+
std::cout << "---------- level " << level_metadata.level
|
|
3866
|
+
<< " ----------" << std::endl;
|
|
3867
|
+
// Iterate SST files
|
|
3868
|
+
const auto& sst_files = level_metadata.files;
|
|
3869
|
+
for (const auto& sst_metadata : sst_files) {
|
|
3870
|
+
// The SstFileMetaData.name always starts with "/",
|
|
3871
|
+
// however SstFileMetaData.db_path is the string provided by
|
|
3872
|
+
// the user as an input. Therefore we check if we can
|
|
3873
|
+
// concantenate the two strings directly or if we need to
|
|
3874
|
+
// drop a possible extra "/" at the end of SstFileMetaData.db_path.
|
|
3875
|
+
std::string filename =
|
|
3876
|
+
NormalizePath(sst_metadata.db_path + "/" + sst_metadata.name);
|
|
3877
|
+
std::cout << filename << std::endl;
|
|
3878
|
+
} // End of for-loop over sst files
|
|
3879
|
+
} // End of for-loop over levels
|
|
3880
|
+
|
|
3881
|
+
std::cout << "Live Blob Files:" << std::endl;
|
|
3882
|
+
const auto& blob_files = column_metadata.blob_files;
|
|
3883
|
+
for (const auto& blob_metadata : blob_files) {
|
|
3884
|
+
// The BlobMetaData.blob_file_name always starts with "/",
|
|
3885
|
+
// however BlobMetaData.blob_file_path is the string provided by
|
|
3886
|
+
// the user as an input. Therefore we check if we can
|
|
3887
|
+
// concantenate the two strings directly or if we need to
|
|
3888
|
+
// drop a possible extra "/" at the end of BlobMetaData.blob_file_path.
|
|
3889
|
+
std::string filename = NormalizePath(
|
|
3890
|
+
blob_metadata.blob_file_path + "/" + blob_metadata.blob_file_name);
|
|
3891
|
+
std::cout << filename << std::endl;
|
|
3892
|
+
} // End of for-loop over blob files
|
|
3893
|
+
} // End of for-loop over column metadata
|
|
3894
|
+
} // End of else ("not sort_by_filename")
|
|
3895
|
+
std::cout << "------------------------------" << std::endl;
|
|
3896
|
+
}
|
|
3897
|
+
|
|
3898
|
+
void WriteExternalSstFilesCommand::Help(std::string& ret) {
|
|
3899
|
+
ret.append(" ");
|
|
3900
|
+
ret.append(WriteExternalSstFilesCommand::Name());
|
|
3901
|
+
ret.append(" <output_sst_path>");
|
|
3902
|
+
ret.append("\n");
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3905
|
+
WriteExternalSstFilesCommand::WriteExternalSstFilesCommand(
|
|
3906
|
+
const std::vector<std::string>& params,
|
|
3907
|
+
const std::map<std::string, std::string>& options,
|
|
3908
|
+
const std::vector<std::string>& flags)
|
|
3909
|
+
: LDBCommand(
|
|
3910
|
+
options, flags, false /* is_read_only */,
|
|
3911
|
+
BuildCmdLineOptions({ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX, ARG_FROM,
|
|
3912
|
+
ARG_TO, ARG_CREATE_IF_MISSING})) {
|
|
3913
|
+
create_if_missing_ =
|
|
3914
|
+
IsFlagPresent(flags, ARG_CREATE_IF_MISSING) ||
|
|
3915
|
+
ParseBooleanOption(options, ARG_CREATE_IF_MISSING, false);
|
|
3916
|
+
if (params.size() != 1) {
|
|
3917
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
3918
|
+
"output SST file path must be specified");
|
|
3919
|
+
} else {
|
|
3920
|
+
output_sst_path_ = params.at(0);
|
|
3921
|
+
}
|
|
3922
|
+
}
|
|
3923
|
+
|
|
3924
|
+
void WriteExternalSstFilesCommand::DoCommand() {
|
|
3925
|
+
if (!db_) {
|
|
3926
|
+
assert(GetExecuteState().IsFailed());
|
|
3927
|
+
return;
|
|
3928
|
+
}
|
|
3929
|
+
ColumnFamilyHandle* cfh = GetCfHandle();
|
|
3930
|
+
SstFileWriter sst_file_writer(EnvOptions(), db_->GetOptions(), cfh);
|
|
3931
|
+
Status status = sst_file_writer.Open(output_sst_path_);
|
|
3932
|
+
if (!status.ok()) {
|
|
3933
|
+
exec_state_ = LDBCommandExecuteResult::Failed("failed to open SST file: " +
|
|
3934
|
+
status.ToString());
|
|
3935
|
+
return;
|
|
3936
|
+
}
|
|
3937
|
+
|
|
3938
|
+
int bad_lines = 0;
|
|
3939
|
+
std::string line;
|
|
3940
|
+
std::ifstream ifs_stdin("/dev/stdin");
|
|
3941
|
+
std::istream* istream_p = ifs_stdin.is_open() ? &ifs_stdin : &std::cin;
|
|
3942
|
+
while (getline(*istream_p, line, '\n')) {
|
|
3943
|
+
std::string key;
|
|
3944
|
+
std::string value;
|
|
3945
|
+
if (ParseKeyValue(line, &key, &value, is_key_hex_, is_value_hex_)) {
|
|
3946
|
+
status = sst_file_writer.Put(key, value);
|
|
3947
|
+
if (!status.ok()) {
|
|
3948
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
3949
|
+
"failed to write record to file: " + status.ToString());
|
|
3950
|
+
return;
|
|
3951
|
+
}
|
|
3952
|
+
} else if (0 == line.find("Keys in range:")) {
|
|
3953
|
+
// ignore this line
|
|
3954
|
+
} else if (0 == line.find("Created bg thread 0x")) {
|
|
3955
|
+
// ignore this line
|
|
3956
|
+
} else {
|
|
3957
|
+
bad_lines++;
|
|
3958
|
+
}
|
|
3959
|
+
}
|
|
3960
|
+
|
|
3961
|
+
status = sst_file_writer.Finish();
|
|
3962
|
+
if (!status.ok()) {
|
|
3963
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
3964
|
+
"Failed to finish writing to file: " + status.ToString());
|
|
3965
|
+
return;
|
|
3966
|
+
}
|
|
3967
|
+
|
|
3968
|
+
if (bad_lines > 0) {
|
|
3969
|
+
fprintf(stderr, "Warning: %d bad lines ignored.\n", bad_lines);
|
|
3970
|
+
}
|
|
3971
|
+
exec_state_ = LDBCommandExecuteResult::Succeed(
|
|
3972
|
+
"external SST file written to " + output_sst_path_);
|
|
3973
|
+
}
|
|
3974
|
+
|
|
3975
|
+
void WriteExternalSstFilesCommand::OverrideBaseOptions() {
|
|
3976
|
+
LDBCommand::OverrideBaseOptions();
|
|
3977
|
+
options_.create_if_missing = create_if_missing_;
|
|
3978
|
+
}
|
|
3979
|
+
|
|
3980
|
+
const std::string IngestExternalSstFilesCommand::ARG_MOVE_FILES = "move_files";
|
|
3981
|
+
const std::string IngestExternalSstFilesCommand::ARG_SNAPSHOT_CONSISTENCY =
|
|
3982
|
+
"snapshot_consistency";
|
|
3983
|
+
const std::string IngestExternalSstFilesCommand::ARG_ALLOW_GLOBAL_SEQNO =
|
|
3984
|
+
"allow_global_seqno";
|
|
3985
|
+
const std::string IngestExternalSstFilesCommand::ARG_ALLOW_BLOCKING_FLUSH =
|
|
3986
|
+
"allow_blocking_flush";
|
|
3987
|
+
const std::string IngestExternalSstFilesCommand::ARG_INGEST_BEHIND =
|
|
3988
|
+
"ingest_behind";
|
|
3989
|
+
const std::string IngestExternalSstFilesCommand::ARG_WRITE_GLOBAL_SEQNO =
|
|
3990
|
+
"write_global_seqno";
|
|
3991
|
+
|
|
3992
|
+
void IngestExternalSstFilesCommand::Help(std::string& ret) {
|
|
3993
|
+
ret.append(" ");
|
|
3994
|
+
ret.append(IngestExternalSstFilesCommand::Name());
|
|
3995
|
+
ret.append(" <input_sst_path>");
|
|
3996
|
+
ret.append(" [--" + ARG_MOVE_FILES + "] ");
|
|
3997
|
+
ret.append(" [--" + ARG_SNAPSHOT_CONSISTENCY + "] ");
|
|
3998
|
+
ret.append(" [--" + ARG_ALLOW_GLOBAL_SEQNO + "] ");
|
|
3999
|
+
ret.append(" [--" + ARG_ALLOW_BLOCKING_FLUSH + "] ");
|
|
4000
|
+
ret.append(" [--" + ARG_INGEST_BEHIND + "] ");
|
|
4001
|
+
ret.append(" [--" + ARG_WRITE_GLOBAL_SEQNO + "] ");
|
|
4002
|
+
ret.append("\n");
|
|
4003
|
+
}
|
|
4004
|
+
|
|
4005
|
+
IngestExternalSstFilesCommand::IngestExternalSstFilesCommand(
|
|
4006
|
+
const std::vector<std::string>& params,
|
|
4007
|
+
const std::map<std::string, std::string>& options,
|
|
4008
|
+
const std::vector<std::string>& flags)
|
|
4009
|
+
: LDBCommand(
|
|
4010
|
+
options, flags, false /* is_read_only */,
|
|
4011
|
+
BuildCmdLineOptions({ARG_MOVE_FILES, ARG_SNAPSHOT_CONSISTENCY,
|
|
4012
|
+
ARG_ALLOW_GLOBAL_SEQNO, ARG_CREATE_IF_MISSING,
|
|
4013
|
+
ARG_ALLOW_BLOCKING_FLUSH, ARG_INGEST_BEHIND,
|
|
4014
|
+
ARG_WRITE_GLOBAL_SEQNO})),
|
|
4015
|
+
move_files_(false),
|
|
4016
|
+
snapshot_consistency_(true),
|
|
4017
|
+
allow_global_seqno_(true),
|
|
4018
|
+
allow_blocking_flush_(true),
|
|
4019
|
+
ingest_behind_(false),
|
|
4020
|
+
write_global_seqno_(true) {
|
|
4021
|
+
create_if_missing_ =
|
|
4022
|
+
IsFlagPresent(flags, ARG_CREATE_IF_MISSING) ||
|
|
4023
|
+
ParseBooleanOption(options, ARG_CREATE_IF_MISSING, false);
|
|
4024
|
+
move_files_ = IsFlagPresent(flags, ARG_MOVE_FILES) ||
|
|
4025
|
+
ParseBooleanOption(options, ARG_MOVE_FILES, false);
|
|
4026
|
+
snapshot_consistency_ =
|
|
4027
|
+
IsFlagPresent(flags, ARG_SNAPSHOT_CONSISTENCY) ||
|
|
4028
|
+
ParseBooleanOption(options, ARG_SNAPSHOT_CONSISTENCY, true);
|
|
4029
|
+
allow_global_seqno_ =
|
|
4030
|
+
IsFlagPresent(flags, ARG_ALLOW_GLOBAL_SEQNO) ||
|
|
4031
|
+
ParseBooleanOption(options, ARG_ALLOW_GLOBAL_SEQNO, true);
|
|
4032
|
+
allow_blocking_flush_ =
|
|
4033
|
+
IsFlagPresent(flags, ARG_ALLOW_BLOCKING_FLUSH) ||
|
|
4034
|
+
ParseBooleanOption(options, ARG_ALLOW_BLOCKING_FLUSH, true);
|
|
4035
|
+
ingest_behind_ = IsFlagPresent(flags, ARG_INGEST_BEHIND) ||
|
|
4036
|
+
ParseBooleanOption(options, ARG_INGEST_BEHIND, false);
|
|
4037
|
+
write_global_seqno_ =
|
|
4038
|
+
IsFlagPresent(flags, ARG_WRITE_GLOBAL_SEQNO) ||
|
|
4039
|
+
ParseBooleanOption(options, ARG_WRITE_GLOBAL_SEQNO, true);
|
|
4040
|
+
|
|
4041
|
+
if (allow_global_seqno_) {
|
|
4042
|
+
if (!write_global_seqno_) {
|
|
4043
|
+
fprintf(stderr,
|
|
4044
|
+
"Warning: not writing global_seqno to the ingested SST can\n"
|
|
4045
|
+
"prevent older versions of RocksDB from being able to open it\n");
|
|
4046
|
+
}
|
|
4047
|
+
} else {
|
|
4048
|
+
if (write_global_seqno_) {
|
|
4049
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
4050
|
+
"ldb cannot write global_seqno to the ingested SST when global_seqno "
|
|
4051
|
+
"is not allowed");
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
|
|
4055
|
+
if (params.size() != 1) {
|
|
4056
|
+
exec_state_ =
|
|
4057
|
+
LDBCommandExecuteResult::Failed("input SST path must be specified");
|
|
4058
|
+
} else {
|
|
4059
|
+
input_sst_path_ = params.at(0);
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
|
|
4063
|
+
void IngestExternalSstFilesCommand::DoCommand() {
|
|
4064
|
+
if (!db_) {
|
|
4065
|
+
assert(GetExecuteState().IsFailed());
|
|
4066
|
+
return;
|
|
4067
|
+
}
|
|
4068
|
+
if (GetExecuteState().IsFailed()) {
|
|
4069
|
+
return;
|
|
4070
|
+
}
|
|
4071
|
+
ColumnFamilyHandle* cfh = GetCfHandle();
|
|
4072
|
+
IngestExternalFileOptions ifo;
|
|
4073
|
+
ifo.move_files = move_files_;
|
|
4074
|
+
ifo.snapshot_consistency = snapshot_consistency_;
|
|
4075
|
+
ifo.allow_global_seqno = allow_global_seqno_;
|
|
4076
|
+
ifo.allow_blocking_flush = allow_blocking_flush_;
|
|
4077
|
+
ifo.ingest_behind = ingest_behind_;
|
|
4078
|
+
ifo.write_global_seqno = write_global_seqno_;
|
|
4079
|
+
Status status = db_->IngestExternalFile(cfh, {input_sst_path_}, ifo);
|
|
4080
|
+
if (!status.ok()) {
|
|
4081
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
4082
|
+
"failed to ingest external SST: " + status.ToString());
|
|
4083
|
+
} else {
|
|
4084
|
+
exec_state_ =
|
|
4085
|
+
LDBCommandExecuteResult::Succeed("external SST files ingested");
|
|
4086
|
+
}
|
|
4087
|
+
}
|
|
4088
|
+
|
|
4089
|
+
void IngestExternalSstFilesCommand::OverrideBaseOptions() {
|
|
4090
|
+
LDBCommand::OverrideBaseOptions();
|
|
4091
|
+
options_.create_if_missing = create_if_missing_;
|
|
4092
|
+
}
|
|
4093
|
+
|
|
4094
|
+
ListFileRangeDeletesCommand::ListFileRangeDeletesCommand(
|
|
4095
|
+
const std::map<std::string, std::string>& options,
|
|
4096
|
+
const std::vector<std::string>& flags)
|
|
4097
|
+
: LDBCommand(options, flags, true, BuildCmdLineOptions({ARG_MAX_KEYS})) {
|
|
4098
|
+
auto itr = options.find(ARG_MAX_KEYS);
|
|
4099
|
+
if (itr != options.end()) {
|
|
4100
|
+
try {
|
|
4101
|
+
#if defined(CYGWIN)
|
|
4102
|
+
max_keys_ = strtol(itr->second.c_str(), 0, 10);
|
|
4103
|
+
#else
|
|
4104
|
+
max_keys_ = std::stoi(itr->second);
|
|
4105
|
+
#endif
|
|
4106
|
+
} catch (const std::invalid_argument&) {
|
|
4107
|
+
exec_state_ = LDBCommandExecuteResult::Failed(ARG_MAX_KEYS +
|
|
4108
|
+
" has an invalid value");
|
|
4109
|
+
} catch (const std::out_of_range&) {
|
|
4110
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
4111
|
+
ARG_MAX_KEYS + " has a value out-of-range");
|
|
4112
|
+
}
|
|
4113
|
+
}
|
|
4114
|
+
}
|
|
4115
|
+
|
|
4116
|
+
void ListFileRangeDeletesCommand::Help(std::string& ret) {
|
|
4117
|
+
ret.append(" ");
|
|
4118
|
+
ret.append(ListFileRangeDeletesCommand::Name());
|
|
4119
|
+
ret.append(" [--" + ARG_MAX_KEYS + "=<N>]");
|
|
4120
|
+
ret.append(" : print tombstones in SST files.\n");
|
|
4121
|
+
}
|
|
4122
|
+
|
|
4123
|
+
void ListFileRangeDeletesCommand::DoCommand() {
|
|
4124
|
+
if (!db_) {
|
|
4125
|
+
assert(GetExecuteState().IsFailed());
|
|
4126
|
+
return;
|
|
4127
|
+
}
|
|
4128
|
+
|
|
4129
|
+
DBImpl* db_impl = static_cast_with_check<DBImpl>(db_->GetRootDB());
|
|
4130
|
+
|
|
4131
|
+
std::string out_str;
|
|
4132
|
+
|
|
4133
|
+
Status st =
|
|
4134
|
+
db_impl->TablesRangeTombstoneSummary(GetCfHandle(), max_keys_, &out_str);
|
|
4135
|
+
if (st.ok()) {
|
|
4136
|
+
TEST_SYNC_POINT_CALLBACK(
|
|
4137
|
+
"ListFileRangeDeletesCommand::DoCommand:BeforePrint", &out_str);
|
|
4138
|
+
fprintf(stdout, "%s\n", out_str.c_str());
|
|
4139
|
+
}
|
|
4140
|
+
}
|
|
4141
|
+
|
|
4142
|
+
void UnsafeRemoveSstFileCommand::Help(std::string& ret) {
|
|
4143
|
+
ret.append(" ");
|
|
4144
|
+
ret.append(UnsafeRemoveSstFileCommand::Name());
|
|
4145
|
+
ret.append(" <SST file number>");
|
|
4146
|
+
ret.append(" ");
|
|
4147
|
+
ret.append(" MUST NOT be used on a live DB.");
|
|
4148
|
+
ret.append("\n");
|
|
4149
|
+
}
|
|
4150
|
+
|
|
4151
|
+
UnsafeRemoveSstFileCommand::UnsafeRemoveSstFileCommand(
|
|
4152
|
+
const std::vector<std::string>& params,
|
|
4153
|
+
const std::map<std::string, std::string>& options,
|
|
4154
|
+
const std::vector<std::string>& flags)
|
|
4155
|
+
: LDBCommand(options, flags, false /* is_read_only */,
|
|
4156
|
+
BuildCmdLineOptions({})) {
|
|
4157
|
+
if (params.size() != 1) {
|
|
4158
|
+
exec_state_ =
|
|
4159
|
+
LDBCommandExecuteResult::Failed("SST file number must be specified");
|
|
4160
|
+
} else {
|
|
4161
|
+
char* endptr = nullptr;
|
|
4162
|
+
sst_file_number_ = strtoull(params.at(0).c_str(), &endptr, 10 /* base */);
|
|
4163
|
+
if (endptr == nullptr || *endptr != '\0') {
|
|
4164
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
4165
|
+
"Failed to parse SST file number " + params.at(0));
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
}
|
|
4169
|
+
|
|
4170
|
+
void UnsafeRemoveSstFileCommand::DoCommand() {
|
|
4171
|
+
// TODO: plumb Env::IOActivity
|
|
4172
|
+
const ReadOptions read_options;
|
|
4173
|
+
PrepareOptions();
|
|
4174
|
+
|
|
4175
|
+
OfflineManifestWriter w(options_, db_path_);
|
|
4176
|
+
if (column_families_.empty()) {
|
|
4177
|
+
column_families_.emplace_back(kDefaultColumnFamilyName, options_);
|
|
4178
|
+
}
|
|
4179
|
+
Status s = w.Recover(column_families_);
|
|
4180
|
+
|
|
4181
|
+
ColumnFamilyData* cfd = nullptr;
|
|
4182
|
+
int level = -1;
|
|
4183
|
+
if (s.ok()) {
|
|
4184
|
+
FileMetaData* metadata = nullptr;
|
|
4185
|
+
s = w.Versions().GetMetadataForFile(sst_file_number_, &level, &metadata,
|
|
4186
|
+
&cfd);
|
|
4187
|
+
}
|
|
4188
|
+
|
|
4189
|
+
if (s.ok()) {
|
|
4190
|
+
VersionEdit edit;
|
|
4191
|
+
edit.SetColumnFamily(cfd->GetID());
|
|
4192
|
+
edit.DeleteFile(level, sst_file_number_);
|
|
4193
|
+
std::unique_ptr<FSDirectory> db_dir;
|
|
4194
|
+
s = options_.env->GetFileSystem()->NewDirectory(db_path_, IOOptions(),
|
|
4195
|
+
&db_dir, nullptr);
|
|
4196
|
+
if (s.ok()) {
|
|
4197
|
+
s = w.LogAndApply(read_options, cfd, &edit, db_dir.get());
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
|
|
4201
|
+
if (!s.ok()) {
|
|
4202
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
4203
|
+
"failed to unsafely remove SST file: " + s.ToString());
|
|
4204
|
+
} else {
|
|
4205
|
+
exec_state_ = LDBCommandExecuteResult::Succeed("unsafely removed SST file");
|
|
4206
|
+
}
|
|
4207
|
+
}
|
|
4208
|
+
|
|
4209
|
+
const std::string UpdateManifestCommand::ARG_VERBOSE = "verbose";
|
|
4210
|
+
const std::string UpdateManifestCommand::ARG_UPDATE_TEMPERATURES =
|
|
4211
|
+
"update_temperatures";
|
|
4212
|
+
|
|
4213
|
+
void UpdateManifestCommand::Help(std::string& ret) {
|
|
4214
|
+
ret.append(" ");
|
|
4215
|
+
ret.append(UpdateManifestCommand::Name());
|
|
4216
|
+
ret.append(" [--update_temperatures]");
|
|
4217
|
+
ret.append(" ");
|
|
4218
|
+
ret.append(" MUST NOT be used on a live DB.");
|
|
4219
|
+
ret.append("\n");
|
|
4220
|
+
}
|
|
4221
|
+
|
|
4222
|
+
UpdateManifestCommand::UpdateManifestCommand(
|
|
4223
|
+
const std::vector<std::string>& /*params*/,
|
|
4224
|
+
const std::map<std::string, std::string>& options,
|
|
4225
|
+
const std::vector<std::string>& flags)
|
|
4226
|
+
: LDBCommand(options, flags, false /* is_read_only */,
|
|
4227
|
+
BuildCmdLineOptions({ARG_VERBOSE, ARG_UPDATE_TEMPERATURES})) {
|
|
4228
|
+
verbose_ = IsFlagPresent(flags, ARG_VERBOSE) ||
|
|
4229
|
+
ParseBooleanOption(options, ARG_VERBOSE, false);
|
|
4230
|
+
update_temperatures_ =
|
|
4231
|
+
IsFlagPresent(flags, ARG_UPDATE_TEMPERATURES) ||
|
|
4232
|
+
ParseBooleanOption(options, ARG_UPDATE_TEMPERATURES, false);
|
|
4233
|
+
|
|
4234
|
+
if (!update_temperatures_) {
|
|
4235
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
4236
|
+
"No action like --update_temperatures specified for update_manifest");
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
|
|
4240
|
+
void UpdateManifestCommand::DoCommand() {
|
|
4241
|
+
PrepareOptions();
|
|
4242
|
+
|
|
4243
|
+
auto level = verbose_ ? InfoLogLevel::INFO_LEVEL : InfoLogLevel::WARN_LEVEL;
|
|
4244
|
+
options_.info_log.reset(new StderrLogger(level));
|
|
4245
|
+
|
|
4246
|
+
experimental::UpdateManifestForFilesStateOptions opts;
|
|
4247
|
+
opts.update_temperatures = update_temperatures_;
|
|
4248
|
+
if (column_families_.empty()) {
|
|
4249
|
+
column_families_.emplace_back(kDefaultColumnFamilyName, options_);
|
|
4250
|
+
}
|
|
4251
|
+
Status s = experimental::UpdateManifestForFilesState(options_, db_path_,
|
|
4252
|
+
column_families_);
|
|
4253
|
+
|
|
4254
|
+
if (!s.ok()) {
|
|
4255
|
+
exec_state_ = LDBCommandExecuteResult::Failed(
|
|
4256
|
+
"failed to update manifest: " + s.ToString());
|
|
4257
|
+
} else {
|
|
4258
|
+
exec_state_ =
|
|
4259
|
+
LDBCommandExecuteResult::Succeed("Manifest updates successful");
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
|
|
4263
|
+
} // namespace ROCKSDB_NAMESPACE
|