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,3577 @@
|
|
|
1
|
+
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
2
|
+
// This source code is licensed under both the GPLv2 (found in the
|
|
3
|
+
// COPYING file in the root directory) and Apache 2.0 License
|
|
4
|
+
// (found in the LICENSE.Apache file in the root directory).
|
|
5
|
+
//
|
|
6
|
+
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
7
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
8
|
+
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
9
|
+
|
|
10
|
+
#ifndef OS_WIN
|
|
11
|
+
#include <sys/ioctl.h>
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#if defined(ROCKSDB_IOURING_PRESENT)
|
|
15
|
+
#include <liburing.h>
|
|
16
|
+
#include <sys/uio.h>
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#include <sys/types.h>
|
|
20
|
+
|
|
21
|
+
#include <atomic>
|
|
22
|
+
#include <list>
|
|
23
|
+
#include <mutex>
|
|
24
|
+
#include <unordered_set>
|
|
25
|
+
|
|
26
|
+
#ifdef OS_LINUX
|
|
27
|
+
#include <fcntl.h>
|
|
28
|
+
#include <linux/fs.h>
|
|
29
|
+
#include <stdlib.h>
|
|
30
|
+
#include <sys/stat.h>
|
|
31
|
+
#include <unistd.h>
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#ifdef ROCKSDB_FALLOCATE_PRESENT
|
|
35
|
+
#include <errno.h>
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#include "db/db_impl/db_impl.h"
|
|
39
|
+
#include "env/emulated_clock.h"
|
|
40
|
+
#include "env/env_chroot.h"
|
|
41
|
+
#include "env/env_encryption_ctr.h"
|
|
42
|
+
#include "env/fs_readonly.h"
|
|
43
|
+
#include "env/mock_env.h"
|
|
44
|
+
#include "env/unique_id_gen.h"
|
|
45
|
+
#include "logging/log_buffer.h"
|
|
46
|
+
#include "logging/logging.h"
|
|
47
|
+
#include "options/options_helper.h"
|
|
48
|
+
#include "port/malloc.h"
|
|
49
|
+
#include "port/port.h"
|
|
50
|
+
#include "port/stack_trace.h"
|
|
51
|
+
#include "rocksdb/convenience.h"
|
|
52
|
+
#include "rocksdb/env.h"
|
|
53
|
+
#include "rocksdb/env_encryption.h"
|
|
54
|
+
#include "rocksdb/file_system.h"
|
|
55
|
+
#include "rocksdb/system_clock.h"
|
|
56
|
+
#include "rocksdb/utilities/object_registry.h"
|
|
57
|
+
#include "test_util/mock_time_env.h"
|
|
58
|
+
#include "test_util/sync_point.h"
|
|
59
|
+
#include "test_util/testharness.h"
|
|
60
|
+
#include "test_util/testutil.h"
|
|
61
|
+
#include "util/coding.h"
|
|
62
|
+
#include "util/crc32c.h"
|
|
63
|
+
#include "util/mutexlock.h"
|
|
64
|
+
#include "util/random.h"
|
|
65
|
+
#include "util/string_util.h"
|
|
66
|
+
#include "utilities/counted_fs.h"
|
|
67
|
+
#include "utilities/env_timed.h"
|
|
68
|
+
#include "utilities/fault_injection_env.h"
|
|
69
|
+
#include "utilities/fault_injection_fs.h"
|
|
70
|
+
|
|
71
|
+
namespace ROCKSDB_NAMESPACE {
|
|
72
|
+
|
|
73
|
+
using port::kPageSize;
|
|
74
|
+
|
|
75
|
+
static const int kDelayMicros = 100000;
|
|
76
|
+
|
|
77
|
+
struct Deleter {
|
|
78
|
+
explicit Deleter(void (*fn)(void*)) : fn_(fn) {}
|
|
79
|
+
|
|
80
|
+
void operator()(void* ptr) {
|
|
81
|
+
assert(fn_);
|
|
82
|
+
assert(ptr);
|
|
83
|
+
(*fn_)(ptr);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
void (*fn_)(void*);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
extern "C" bool RocksDbIOUringEnable() { return true; }
|
|
90
|
+
|
|
91
|
+
std::unique_ptr<char, Deleter> NewAligned(const size_t size, const char ch) {
|
|
92
|
+
char* ptr = nullptr;
|
|
93
|
+
#ifdef OS_WIN
|
|
94
|
+
if (nullptr ==
|
|
95
|
+
(ptr = reinterpret_cast<char*>(_aligned_malloc(size, kPageSize)))) {
|
|
96
|
+
return std::unique_ptr<char, Deleter>(nullptr, Deleter(_aligned_free));
|
|
97
|
+
}
|
|
98
|
+
std::unique_ptr<char, Deleter> uptr(ptr, Deleter(_aligned_free));
|
|
99
|
+
#else
|
|
100
|
+
if (posix_memalign(reinterpret_cast<void**>(&ptr), kPageSize, size) != 0) {
|
|
101
|
+
return std::unique_ptr<char, Deleter>(nullptr, Deleter(free));
|
|
102
|
+
}
|
|
103
|
+
std::unique_ptr<char, Deleter> uptr(ptr, Deleter(free));
|
|
104
|
+
#endif
|
|
105
|
+
memset(uptr.get(), ch, size);
|
|
106
|
+
return uptr;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
class EnvPosixTest : public testing::Test {
|
|
110
|
+
private:
|
|
111
|
+
port::Mutex mu_;
|
|
112
|
+
std::string events_;
|
|
113
|
+
|
|
114
|
+
public:
|
|
115
|
+
Env* env_;
|
|
116
|
+
bool direct_io_;
|
|
117
|
+
EnvPosixTest() : env_(Env::Default()), direct_io_(false) {}
|
|
118
|
+
~EnvPosixTest() {
|
|
119
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
120
|
+
SyncPoint::GetInstance()->LoadDependency({});
|
|
121
|
+
SyncPoint::GetInstance()->ClearAllCallBacks();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
class EnvPosixTestWithParam
|
|
126
|
+
: public EnvPosixTest,
|
|
127
|
+
public ::testing::WithParamInterface<std::pair<Env*, bool>> {
|
|
128
|
+
public:
|
|
129
|
+
EnvPosixTestWithParam() {
|
|
130
|
+
std::pair<Env*, bool> param_pair = GetParam();
|
|
131
|
+
env_ = param_pair.first;
|
|
132
|
+
direct_io_ = param_pair.second;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
void WaitThreadPoolsEmpty() {
|
|
136
|
+
// Wait until the thread pools are empty.
|
|
137
|
+
while (env_->GetThreadPoolQueueLen(Env::Priority::LOW) != 0) {
|
|
138
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
139
|
+
}
|
|
140
|
+
while (env_->GetThreadPoolQueueLen(Env::Priority::HIGH) != 0) {
|
|
141
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
~EnvPosixTestWithParam() override { WaitThreadPoolsEmpty(); }
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
static void SetBool(void* ptr) {
|
|
149
|
+
reinterpret_cast<std::atomic<bool>*>(ptr)->store(true);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
TEST_F(EnvPosixTest, DISABLED_RunImmediately) {
|
|
153
|
+
for (int pri = Env::BOTTOM; pri < Env::TOTAL; ++pri) {
|
|
154
|
+
std::atomic<bool> called(false);
|
|
155
|
+
env_->SetBackgroundThreads(1, static_cast<Env::Priority>(pri));
|
|
156
|
+
env_->Schedule(&SetBool, &called, static_cast<Env::Priority>(pri));
|
|
157
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
158
|
+
ASSERT_TRUE(called.load());
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
TEST_F(EnvPosixTest, RunEventually) {
|
|
163
|
+
std::atomic<bool> called(false);
|
|
164
|
+
env_->StartThread(&SetBool, &called);
|
|
165
|
+
env_->WaitForJoin();
|
|
166
|
+
ASSERT_TRUE(called.load());
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
#ifdef OS_WIN
|
|
170
|
+
TEST_F(EnvPosixTest, AreFilesSame) {
|
|
171
|
+
{
|
|
172
|
+
bool tmp;
|
|
173
|
+
if (env_->AreFilesSame("", "", &tmp).IsNotSupported()) {
|
|
174
|
+
fprintf(stderr,
|
|
175
|
+
"skipping EnvBasicTestWithParam.AreFilesSame due to "
|
|
176
|
+
"unsupported Env::AreFilesSame\n");
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const EnvOptions soptions;
|
|
182
|
+
auto* env = Env::Default();
|
|
183
|
+
std::string same_file_name = test::PerThreadDBPath(env, "same_file");
|
|
184
|
+
std::string same_file_link_name = same_file_name + "_link";
|
|
185
|
+
|
|
186
|
+
std::unique_ptr<WritableFile> same_file;
|
|
187
|
+
ASSERT_OK(env->NewWritableFile(same_file_name, &same_file, soptions));
|
|
188
|
+
same_file->Append("random_data");
|
|
189
|
+
ASSERT_OK(same_file->Flush());
|
|
190
|
+
same_file.reset();
|
|
191
|
+
|
|
192
|
+
ASSERT_OK(env->LinkFile(same_file_name, same_file_link_name));
|
|
193
|
+
bool result = false;
|
|
194
|
+
ASSERT_OK(env->AreFilesSame(same_file_name, same_file_link_name, &result));
|
|
195
|
+
ASSERT_TRUE(result);
|
|
196
|
+
}
|
|
197
|
+
#endif
|
|
198
|
+
|
|
199
|
+
#ifdef OS_LINUX
|
|
200
|
+
TEST_F(EnvPosixTest, DISABLED_FilePermission) {
|
|
201
|
+
// Only works for Linux environment
|
|
202
|
+
if (env_ == Env::Default()) {
|
|
203
|
+
EnvOptions soptions;
|
|
204
|
+
std::vector<std::string> fileNames{
|
|
205
|
+
test::PerThreadDBPath(env_, "testfile"),
|
|
206
|
+
test::PerThreadDBPath(env_, "testfile1")};
|
|
207
|
+
std::unique_ptr<WritableFile> wfile;
|
|
208
|
+
ASSERT_OK(env_->NewWritableFile(fileNames[0], &wfile, soptions));
|
|
209
|
+
ASSERT_OK(env_->NewWritableFile(fileNames[1], &wfile, soptions));
|
|
210
|
+
wfile.reset();
|
|
211
|
+
std::unique_ptr<RandomRWFile> rwfile;
|
|
212
|
+
ASSERT_OK(env_->NewRandomRWFile(fileNames[1], &rwfile, soptions));
|
|
213
|
+
|
|
214
|
+
struct stat sb;
|
|
215
|
+
for (const auto& filename : fileNames) {
|
|
216
|
+
if (::stat(filename.c_str(), &sb) == 0) {
|
|
217
|
+
ASSERT_EQ(sb.st_mode & 0777, 0644);
|
|
218
|
+
}
|
|
219
|
+
ASSERT_OK(env_->DeleteFile(filename));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
env_->SetAllowNonOwnerAccess(false);
|
|
223
|
+
ASSERT_OK(env_->NewWritableFile(fileNames[0], &wfile, soptions));
|
|
224
|
+
ASSERT_OK(env_->NewWritableFile(fileNames[1], &wfile, soptions));
|
|
225
|
+
wfile.reset();
|
|
226
|
+
ASSERT_OK(env_->NewRandomRWFile(fileNames[1], &rwfile, soptions));
|
|
227
|
+
|
|
228
|
+
for (const auto& filename : fileNames) {
|
|
229
|
+
if (::stat(filename.c_str(), &sb) == 0) {
|
|
230
|
+
ASSERT_EQ(sb.st_mode & 0777, 0600);
|
|
231
|
+
}
|
|
232
|
+
ASSERT_OK(env_->DeleteFile(filename));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
TEST_F(EnvPosixTest, LowerThreadPoolCpuPriority) {
|
|
238
|
+
std::atomic<CpuPriority> from_priority(CpuPriority::kNormal);
|
|
239
|
+
std::atomic<CpuPriority> to_priority(CpuPriority::kNormal);
|
|
240
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
|
|
241
|
+
"ThreadPoolImpl::BGThread::BeforeSetCpuPriority", [&](void* pri) {
|
|
242
|
+
from_priority.store(*reinterpret_cast<CpuPriority*>(pri));
|
|
243
|
+
});
|
|
244
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
|
|
245
|
+
"ThreadPoolImpl::BGThread::AfterSetCpuPriority", [&](void* pri) {
|
|
246
|
+
to_priority.store(*reinterpret_cast<CpuPriority*>(pri));
|
|
247
|
+
});
|
|
248
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
|
249
|
+
|
|
250
|
+
env_->SetBackgroundThreads(1, Env::BOTTOM);
|
|
251
|
+
env_->SetBackgroundThreads(1, Env::HIGH);
|
|
252
|
+
|
|
253
|
+
auto RunTask = [&](Env::Priority pool) {
|
|
254
|
+
std::atomic<bool> called(false);
|
|
255
|
+
env_->Schedule(&SetBool, &called, pool);
|
|
256
|
+
for (int i = 0; i < kDelayMicros; i++) {
|
|
257
|
+
if (called.load()) {
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
Env::Default()->SleepForMicroseconds(1);
|
|
261
|
+
}
|
|
262
|
+
ASSERT_TRUE(called.load());
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
{
|
|
266
|
+
// Same priority, no-op.
|
|
267
|
+
env_->LowerThreadPoolCPUPriority(Env::Priority::BOTTOM,
|
|
268
|
+
CpuPriority::kNormal)
|
|
269
|
+
.PermitUncheckedError();
|
|
270
|
+
RunTask(Env::Priority::BOTTOM);
|
|
271
|
+
ASSERT_EQ(from_priority, CpuPriority::kNormal);
|
|
272
|
+
ASSERT_EQ(to_priority, CpuPriority::kNormal);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
{
|
|
276
|
+
// Higher priority, no-op.
|
|
277
|
+
env_->LowerThreadPoolCPUPriority(Env::Priority::BOTTOM, CpuPriority::kHigh)
|
|
278
|
+
.PermitUncheckedError();
|
|
279
|
+
RunTask(Env::Priority::BOTTOM);
|
|
280
|
+
ASSERT_EQ(from_priority, CpuPriority::kNormal);
|
|
281
|
+
ASSERT_EQ(to_priority, CpuPriority::kNormal);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
{
|
|
285
|
+
// Lower priority from kNormal -> kLow.
|
|
286
|
+
env_->LowerThreadPoolCPUPriority(Env::Priority::BOTTOM, CpuPriority::kLow)
|
|
287
|
+
.PermitUncheckedError();
|
|
288
|
+
RunTask(Env::Priority::BOTTOM);
|
|
289
|
+
ASSERT_EQ(from_priority, CpuPriority::kNormal);
|
|
290
|
+
ASSERT_EQ(to_priority, CpuPriority::kLow);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
{
|
|
294
|
+
// Lower priority from kLow -> kIdle.
|
|
295
|
+
env_->LowerThreadPoolCPUPriority(Env::Priority::BOTTOM, CpuPriority::kIdle)
|
|
296
|
+
.PermitUncheckedError();
|
|
297
|
+
RunTask(Env::Priority::BOTTOM);
|
|
298
|
+
ASSERT_EQ(from_priority, CpuPriority::kLow);
|
|
299
|
+
ASSERT_EQ(to_priority, CpuPriority::kIdle);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
{
|
|
303
|
+
// Lower priority from kNormal -> kIdle for another pool.
|
|
304
|
+
env_->LowerThreadPoolCPUPriority(Env::Priority::HIGH, CpuPriority::kIdle)
|
|
305
|
+
.PermitUncheckedError();
|
|
306
|
+
RunTask(Env::Priority::HIGH);
|
|
307
|
+
ASSERT_EQ(from_priority, CpuPriority::kNormal);
|
|
308
|
+
ASSERT_EQ(to_priority, CpuPriority::kIdle);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing();
|
|
312
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks();
|
|
313
|
+
}
|
|
314
|
+
#endif
|
|
315
|
+
|
|
316
|
+
TEST_F(EnvPosixTest, MemoryMappedFileBuffer) {
|
|
317
|
+
const int kFileBytes = 1 << 15; // 32 KB
|
|
318
|
+
std::string expected_data;
|
|
319
|
+
std::string fname = test::PerThreadDBPath(env_, "testfile");
|
|
320
|
+
{
|
|
321
|
+
std::unique_ptr<WritableFile> wfile;
|
|
322
|
+
const EnvOptions soptions;
|
|
323
|
+
ASSERT_OK(env_->NewWritableFile(fname, &wfile, soptions));
|
|
324
|
+
|
|
325
|
+
Random rnd(301);
|
|
326
|
+
expected_data = rnd.RandomString(kFileBytes);
|
|
327
|
+
ASSERT_OK(wfile->Append(expected_data));
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
std::unique_ptr<MemoryMappedFileBuffer> mmap_buffer;
|
|
331
|
+
Status status = env_->NewMemoryMappedFileBuffer(fname, &mmap_buffer);
|
|
332
|
+
// it should be supported at least on linux
|
|
333
|
+
#if !defined(OS_LINUX)
|
|
334
|
+
if (status.IsNotSupported()) {
|
|
335
|
+
fprintf(stderr,
|
|
336
|
+
"skipping EnvPosixTest.MemoryMappedFileBuffer due to "
|
|
337
|
+
"unsupported Env::NewMemoryMappedFileBuffer\n");
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
#endif // !defined(OS_LINUX)
|
|
341
|
+
|
|
342
|
+
ASSERT_OK(status);
|
|
343
|
+
ASSERT_NE(nullptr, mmap_buffer.get());
|
|
344
|
+
ASSERT_NE(nullptr, mmap_buffer->GetBase());
|
|
345
|
+
ASSERT_EQ(kFileBytes, mmap_buffer->GetLen());
|
|
346
|
+
std::string actual_data(reinterpret_cast<const char*>(mmap_buffer->GetBase()),
|
|
347
|
+
mmap_buffer->GetLen());
|
|
348
|
+
ASSERT_EQ(expected_data, actual_data);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
#ifndef ROCKSDB_NO_DYNAMIC_EXTENSION
|
|
352
|
+
TEST_F(EnvPosixTest, LoadRocksDBLibrary) {
|
|
353
|
+
std::shared_ptr<DynamicLibrary> library;
|
|
354
|
+
std::function<void*(void*, const char*)> function;
|
|
355
|
+
Status status = env_->LoadLibrary("no-such-library", "", &library);
|
|
356
|
+
ASSERT_NOK(status);
|
|
357
|
+
ASSERT_EQ(nullptr, library.get());
|
|
358
|
+
status = env_->LoadLibrary("rocksdb", "", &library);
|
|
359
|
+
if (status.ok()) { // If we have can find a rocksdb shared library
|
|
360
|
+
ASSERT_NE(nullptr, library.get());
|
|
361
|
+
ASSERT_OK(library->LoadFunction("rocksdb_create_default_env",
|
|
362
|
+
&function)); // from C definition
|
|
363
|
+
ASSERT_NE(nullptr, function);
|
|
364
|
+
ASSERT_NOK(library->LoadFunction("no-such-method", &function));
|
|
365
|
+
ASSERT_EQ(nullptr, function);
|
|
366
|
+
ASSERT_OK(env_->LoadLibrary(library->Name(), "", &library));
|
|
367
|
+
} else {
|
|
368
|
+
ASSERT_EQ(nullptr, library.get());
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
#endif // !ROCKSDB_NO_DYNAMIC_EXTENSION
|
|
372
|
+
|
|
373
|
+
#if !defined(OS_WIN) && !defined(ROCKSDB_NO_DYNAMIC_EXTENSION)
|
|
374
|
+
TEST_F(EnvPosixTest, LoadRocksDBLibraryWithSearchPath) {
|
|
375
|
+
std::shared_ptr<DynamicLibrary> library;
|
|
376
|
+
std::function<void*(void*, const char*)> function;
|
|
377
|
+
ASSERT_NOK(env_->LoadLibrary("no-such-library", "/tmp", &library));
|
|
378
|
+
ASSERT_EQ(nullptr, library.get());
|
|
379
|
+
ASSERT_NOK(env_->LoadLibrary("dl", "/tmp", &library));
|
|
380
|
+
ASSERT_EQ(nullptr, library.get());
|
|
381
|
+
Status status = env_->LoadLibrary("rocksdb", "/tmp:./", &library);
|
|
382
|
+
if (status.ok()) {
|
|
383
|
+
ASSERT_NE(nullptr, library.get());
|
|
384
|
+
ASSERT_OK(env_->LoadLibrary(library->Name(), "", &library));
|
|
385
|
+
}
|
|
386
|
+
char buff[1024];
|
|
387
|
+
std::string cwd = getcwd(buff, sizeof(buff));
|
|
388
|
+
|
|
389
|
+
status = env_->LoadLibrary("rocksdb", "/tmp:" + cwd, &library);
|
|
390
|
+
if (status.ok()) {
|
|
391
|
+
ASSERT_NE(nullptr, library.get());
|
|
392
|
+
ASSERT_OK(env_->LoadLibrary(library->Name(), "", &library));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
#endif // !OS_WIN && !ROCKSDB_NO_DYNAMIC_EXTENSION
|
|
396
|
+
|
|
397
|
+
TEST_P(EnvPosixTestWithParam, UnSchedule) {
|
|
398
|
+
std::atomic<bool> called(false);
|
|
399
|
+
env_->SetBackgroundThreads(1, Env::LOW);
|
|
400
|
+
|
|
401
|
+
/* Block the low priority queue */
|
|
402
|
+
test::SleepingBackgroundTask sleeping_task, sleeping_task1;
|
|
403
|
+
env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &sleeping_task,
|
|
404
|
+
Env::Priority::LOW);
|
|
405
|
+
|
|
406
|
+
/* Schedule another task */
|
|
407
|
+
env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &sleeping_task1,
|
|
408
|
+
Env::Priority::LOW, &sleeping_task1);
|
|
409
|
+
|
|
410
|
+
/* Remove it with a different tag */
|
|
411
|
+
ASSERT_EQ(0, env_->UnSchedule(&called, Env::Priority::LOW));
|
|
412
|
+
|
|
413
|
+
/* Remove it from the queue with the right tag */
|
|
414
|
+
ASSERT_EQ(1, env_->UnSchedule(&sleeping_task1, Env::Priority::LOW));
|
|
415
|
+
|
|
416
|
+
// Unblock background thread
|
|
417
|
+
sleeping_task.WakeUp();
|
|
418
|
+
|
|
419
|
+
/* Schedule another task */
|
|
420
|
+
env_->Schedule(&SetBool, &called);
|
|
421
|
+
for (int i = 0; i < kDelayMicros; i++) {
|
|
422
|
+
if (called.load()) {
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
Env::Default()->SleepForMicroseconds(1);
|
|
426
|
+
}
|
|
427
|
+
ASSERT_TRUE(called.load());
|
|
428
|
+
|
|
429
|
+
ASSERT_TRUE(!sleeping_task.IsSleeping() && !sleeping_task1.IsSleeping());
|
|
430
|
+
WaitThreadPoolsEmpty();
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// This tests assumes that the last scheduled
|
|
434
|
+
// task will run last. In fact, in the allotted
|
|
435
|
+
// sleeping time nothing may actually run or they may
|
|
436
|
+
// run in any order. The purpose of the test is unclear.
|
|
437
|
+
#ifndef OS_WIN
|
|
438
|
+
TEST_P(EnvPosixTestWithParam, RunMany) {
|
|
439
|
+
env_->SetBackgroundThreads(1, Env::LOW);
|
|
440
|
+
std::atomic<int> last_id(0);
|
|
441
|
+
|
|
442
|
+
struct CB {
|
|
443
|
+
std::atomic<int>* last_id_ptr; // Pointer to shared slot
|
|
444
|
+
int id; // Order# for the execution of this callback
|
|
445
|
+
|
|
446
|
+
CB(std::atomic<int>* p, int i) : last_id_ptr(p), id(i) {}
|
|
447
|
+
|
|
448
|
+
static void Run(void* v) {
|
|
449
|
+
CB* cb = reinterpret_cast<CB*>(v);
|
|
450
|
+
int cur = cb->last_id_ptr->load();
|
|
451
|
+
ASSERT_EQ(cb->id - 1, cur);
|
|
452
|
+
cb->last_id_ptr->store(cb->id);
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
// Schedule in different order than start time
|
|
457
|
+
CB cb1(&last_id, 1);
|
|
458
|
+
CB cb2(&last_id, 2);
|
|
459
|
+
CB cb3(&last_id, 3);
|
|
460
|
+
CB cb4(&last_id, 4);
|
|
461
|
+
env_->Schedule(&CB::Run, &cb1);
|
|
462
|
+
env_->Schedule(&CB::Run, &cb2);
|
|
463
|
+
env_->Schedule(&CB::Run, &cb3);
|
|
464
|
+
env_->Schedule(&CB::Run, &cb4);
|
|
465
|
+
// thread-pool pops a thread function and then run the function, which may
|
|
466
|
+
// cause threadpool is empty but the last function is still running. Add a
|
|
467
|
+
// dummy function at the end, to make sure the last callback is finished
|
|
468
|
+
// before threadpool is empty.
|
|
469
|
+
struct DummyCB {
|
|
470
|
+
static void Run(void*) {}
|
|
471
|
+
};
|
|
472
|
+
env_->Schedule(&DummyCB::Run, nullptr);
|
|
473
|
+
|
|
474
|
+
WaitThreadPoolsEmpty();
|
|
475
|
+
ASSERT_EQ(4, last_id.load(std::memory_order_acquire));
|
|
476
|
+
}
|
|
477
|
+
#endif
|
|
478
|
+
|
|
479
|
+
struct State {
|
|
480
|
+
port::Mutex mu;
|
|
481
|
+
int val;
|
|
482
|
+
int num_running;
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
static void ThreadBody(void* arg) {
|
|
486
|
+
State* s = reinterpret_cast<State*>(arg);
|
|
487
|
+
s->mu.Lock();
|
|
488
|
+
s->val += 1;
|
|
489
|
+
s->num_running -= 1;
|
|
490
|
+
s->mu.Unlock();
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
TEST_P(EnvPosixTestWithParam, StartThread) {
|
|
494
|
+
State state;
|
|
495
|
+
state.val = 0;
|
|
496
|
+
state.num_running = 3;
|
|
497
|
+
for (int i = 0; i < 3; i++) {
|
|
498
|
+
env_->StartThread(&ThreadBody, &state);
|
|
499
|
+
}
|
|
500
|
+
while (true) {
|
|
501
|
+
state.mu.Lock();
|
|
502
|
+
int num = state.num_running;
|
|
503
|
+
state.mu.Unlock();
|
|
504
|
+
if (num == 0) {
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
508
|
+
}
|
|
509
|
+
ASSERT_EQ(state.val, 3);
|
|
510
|
+
WaitThreadPoolsEmpty();
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
TEST_P(EnvPosixTestWithParam, TwoPools) {
|
|
514
|
+
// Data structures to signal tasks to run.
|
|
515
|
+
port::Mutex mutex;
|
|
516
|
+
port::CondVar cv(&mutex);
|
|
517
|
+
bool should_start = false;
|
|
518
|
+
|
|
519
|
+
class CB {
|
|
520
|
+
public:
|
|
521
|
+
CB(const std::string& pool_name, int pool_size, port::Mutex* trigger_mu,
|
|
522
|
+
port::CondVar* trigger_cv, bool* _should_start)
|
|
523
|
+
: mu_(),
|
|
524
|
+
num_running_(0),
|
|
525
|
+
num_finished_(0),
|
|
526
|
+
pool_size_(pool_size),
|
|
527
|
+
pool_name_(pool_name),
|
|
528
|
+
trigger_mu_(trigger_mu),
|
|
529
|
+
trigger_cv_(trigger_cv),
|
|
530
|
+
should_start_(_should_start) {}
|
|
531
|
+
|
|
532
|
+
static void Run(void* v) {
|
|
533
|
+
CB* cb = reinterpret_cast<CB*>(v);
|
|
534
|
+
cb->Run();
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
void Run() {
|
|
538
|
+
{
|
|
539
|
+
MutexLock l(&mu_);
|
|
540
|
+
num_running_++;
|
|
541
|
+
// make sure we don't have more than pool_size_ jobs running.
|
|
542
|
+
ASSERT_LE(num_running_, pool_size_.load());
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
{
|
|
546
|
+
MutexLock l(trigger_mu_);
|
|
547
|
+
while (!(*should_start_)) {
|
|
548
|
+
trigger_cv_->Wait();
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
{
|
|
553
|
+
MutexLock l(&mu_);
|
|
554
|
+
num_running_--;
|
|
555
|
+
num_finished_++;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
int NumFinished() {
|
|
560
|
+
MutexLock l(&mu_);
|
|
561
|
+
return num_finished_;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
void Reset(int pool_size) {
|
|
565
|
+
pool_size_.store(pool_size);
|
|
566
|
+
num_finished_ = 0;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
private:
|
|
570
|
+
port::Mutex mu_;
|
|
571
|
+
int num_running_;
|
|
572
|
+
int num_finished_;
|
|
573
|
+
std::atomic<int> pool_size_;
|
|
574
|
+
std::string pool_name_;
|
|
575
|
+
port::Mutex* trigger_mu_;
|
|
576
|
+
port::CondVar* trigger_cv_;
|
|
577
|
+
bool* should_start_;
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
const int kLowPoolSize = 2;
|
|
581
|
+
const int kHighPoolSize = 4;
|
|
582
|
+
const int kJobs = 8;
|
|
583
|
+
|
|
584
|
+
CB low_pool_job("low", kLowPoolSize, &mutex, &cv, &should_start);
|
|
585
|
+
CB high_pool_job("high", kHighPoolSize, &mutex, &cv, &should_start);
|
|
586
|
+
|
|
587
|
+
env_->SetBackgroundThreads(kLowPoolSize);
|
|
588
|
+
env_->SetBackgroundThreads(kHighPoolSize, Env::Priority::HIGH);
|
|
589
|
+
|
|
590
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
|
|
591
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
592
|
+
|
|
593
|
+
// schedule same number of jobs in each pool
|
|
594
|
+
for (int i = 0; i < kJobs; i++) {
|
|
595
|
+
env_->Schedule(&CB::Run, &low_pool_job);
|
|
596
|
+
env_->Schedule(&CB::Run, &high_pool_job, Env::Priority::HIGH);
|
|
597
|
+
}
|
|
598
|
+
// Wait a short while for the jobs to be dispatched.
|
|
599
|
+
int sleep_count = 0;
|
|
600
|
+
while ((unsigned int)(kJobs - kLowPoolSize) !=
|
|
601
|
+
env_->GetThreadPoolQueueLen(Env::Priority::LOW) ||
|
|
602
|
+
(unsigned int)(kJobs - kHighPoolSize) !=
|
|
603
|
+
env_->GetThreadPoolQueueLen(Env::Priority::HIGH)) {
|
|
604
|
+
env_->SleepForMicroseconds(kDelayMicros);
|
|
605
|
+
if (++sleep_count > 100) {
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
ASSERT_EQ((unsigned int)(kJobs - kLowPoolSize),
|
|
611
|
+
env_->GetThreadPoolQueueLen());
|
|
612
|
+
ASSERT_EQ((unsigned int)(kJobs - kLowPoolSize),
|
|
613
|
+
env_->GetThreadPoolQueueLen(Env::Priority::LOW));
|
|
614
|
+
ASSERT_EQ((unsigned int)(kJobs - kHighPoolSize),
|
|
615
|
+
env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
616
|
+
|
|
617
|
+
// Trigger jobs to run.
|
|
618
|
+
{
|
|
619
|
+
MutexLock l(&mutex);
|
|
620
|
+
should_start = true;
|
|
621
|
+
cv.SignalAll();
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// wait for all jobs to finish
|
|
625
|
+
while (low_pool_job.NumFinished() < kJobs ||
|
|
626
|
+
high_pool_job.NumFinished() < kJobs) {
|
|
627
|
+
env_->SleepForMicroseconds(kDelayMicros);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
|
|
631
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
632
|
+
|
|
633
|
+
// Hold jobs to schedule;
|
|
634
|
+
should_start = false;
|
|
635
|
+
|
|
636
|
+
// call IncBackgroundThreadsIfNeeded to two pools. One increasing and
|
|
637
|
+
// the other decreasing
|
|
638
|
+
env_->IncBackgroundThreadsIfNeeded(kLowPoolSize - 1, Env::Priority::LOW);
|
|
639
|
+
env_->IncBackgroundThreadsIfNeeded(kHighPoolSize + 1, Env::Priority::HIGH);
|
|
640
|
+
high_pool_job.Reset(kHighPoolSize + 1);
|
|
641
|
+
low_pool_job.Reset(kLowPoolSize);
|
|
642
|
+
|
|
643
|
+
// schedule same number of jobs in each pool
|
|
644
|
+
for (int i = 0; i < kJobs; i++) {
|
|
645
|
+
env_->Schedule(&CB::Run, &low_pool_job);
|
|
646
|
+
env_->Schedule(&CB::Run, &high_pool_job, Env::Priority::HIGH);
|
|
647
|
+
}
|
|
648
|
+
// Wait a short while for the jobs to be dispatched.
|
|
649
|
+
sleep_count = 0;
|
|
650
|
+
while ((unsigned int)(kJobs - kLowPoolSize) !=
|
|
651
|
+
env_->GetThreadPoolQueueLen(Env::Priority::LOW) ||
|
|
652
|
+
(unsigned int)(kJobs - (kHighPoolSize + 1)) !=
|
|
653
|
+
env_->GetThreadPoolQueueLen(Env::Priority::HIGH)) {
|
|
654
|
+
env_->SleepForMicroseconds(kDelayMicros);
|
|
655
|
+
if (++sleep_count > 100) {
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
ASSERT_EQ((unsigned int)(kJobs - kLowPoolSize),
|
|
660
|
+
env_->GetThreadPoolQueueLen());
|
|
661
|
+
ASSERT_EQ((unsigned int)(kJobs - kLowPoolSize),
|
|
662
|
+
env_->GetThreadPoolQueueLen(Env::Priority::LOW));
|
|
663
|
+
ASSERT_EQ((unsigned int)(kJobs - (kHighPoolSize + 1)),
|
|
664
|
+
env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
665
|
+
|
|
666
|
+
// Trigger jobs to run.
|
|
667
|
+
{
|
|
668
|
+
MutexLock l(&mutex);
|
|
669
|
+
should_start = true;
|
|
670
|
+
cv.SignalAll();
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// wait for all jobs to finish
|
|
674
|
+
while (low_pool_job.NumFinished() < kJobs ||
|
|
675
|
+
high_pool_job.NumFinished() < kJobs) {
|
|
676
|
+
env_->SleepForMicroseconds(kDelayMicros);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
env_->SetBackgroundThreads(kHighPoolSize, Env::Priority::HIGH);
|
|
680
|
+
WaitThreadPoolsEmpty();
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
TEST_P(EnvPosixTestWithParam, DecreaseNumBgThreads) {
|
|
684
|
+
constexpr int kWaitMicros = 60000000; // 1min
|
|
685
|
+
|
|
686
|
+
std::vector<test::SleepingBackgroundTask> tasks(10);
|
|
687
|
+
|
|
688
|
+
// Set number of thread to 1 first.
|
|
689
|
+
env_->SetBackgroundThreads(1, Env::Priority::HIGH);
|
|
690
|
+
|
|
691
|
+
// Schedule 3 tasks. 0 running; Task 1, 2 waiting.
|
|
692
|
+
for (size_t i = 0; i < 3; i++) {
|
|
693
|
+
env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &tasks[i],
|
|
694
|
+
Env::Priority::HIGH);
|
|
695
|
+
}
|
|
696
|
+
ASSERT_FALSE(tasks[0].TimedWaitUntilSleeping(kWaitMicros));
|
|
697
|
+
ASSERT_EQ(2U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
698
|
+
ASSERT_TRUE(tasks[0].IsSleeping());
|
|
699
|
+
ASSERT_TRUE(!tasks[1].IsSleeping());
|
|
700
|
+
ASSERT_TRUE(!tasks[2].IsSleeping());
|
|
701
|
+
|
|
702
|
+
// Increase to 2 threads. Task 0, 1 running; 2 waiting
|
|
703
|
+
env_->SetBackgroundThreads(2, Env::Priority::HIGH);
|
|
704
|
+
ASSERT_FALSE(tasks[1].TimedWaitUntilSleeping(kWaitMicros));
|
|
705
|
+
ASSERT_EQ(1U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
706
|
+
ASSERT_TRUE(tasks[0].IsSleeping());
|
|
707
|
+
ASSERT_TRUE(tasks[1].IsSleeping());
|
|
708
|
+
ASSERT_TRUE(!tasks[2].IsSleeping());
|
|
709
|
+
|
|
710
|
+
// Shrink back to 1 thread. Still task 0, 1 running, 2 waiting
|
|
711
|
+
env_->SetBackgroundThreads(1, Env::Priority::HIGH);
|
|
712
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
713
|
+
ASSERT_EQ(1U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
714
|
+
ASSERT_TRUE(tasks[0].IsSleeping());
|
|
715
|
+
ASSERT_TRUE(tasks[1].IsSleeping());
|
|
716
|
+
ASSERT_TRUE(!tasks[2].IsSleeping());
|
|
717
|
+
|
|
718
|
+
// The last task finishes. Task 0 running, 2 waiting.
|
|
719
|
+
tasks[1].WakeUp();
|
|
720
|
+
ASSERT_FALSE(tasks[1].TimedWaitUntilDone(kWaitMicros));
|
|
721
|
+
ASSERT_EQ(1U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
722
|
+
ASSERT_TRUE(tasks[0].IsSleeping());
|
|
723
|
+
ASSERT_TRUE(!tasks[1].IsSleeping());
|
|
724
|
+
ASSERT_TRUE(!tasks[2].IsSleeping());
|
|
725
|
+
|
|
726
|
+
// Increase to 5 threads. Task 0 and 2 running.
|
|
727
|
+
env_->SetBackgroundThreads(5, Env::Priority::HIGH);
|
|
728
|
+
ASSERT_FALSE(tasks[2].TimedWaitUntilSleeping(kWaitMicros));
|
|
729
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
730
|
+
ASSERT_TRUE(tasks[0].IsSleeping());
|
|
731
|
+
ASSERT_TRUE(!tasks[1].IsSleeping());
|
|
732
|
+
ASSERT_TRUE(tasks[2].IsSleeping());
|
|
733
|
+
|
|
734
|
+
// Change number of threads a couple of times while there is no sufficient
|
|
735
|
+
// tasks.
|
|
736
|
+
env_->SetBackgroundThreads(7, Env::Priority::HIGH);
|
|
737
|
+
tasks[2].WakeUp();
|
|
738
|
+
ASSERT_FALSE(tasks[2].TimedWaitUntilDone(kWaitMicros));
|
|
739
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
740
|
+
env_->SetBackgroundThreads(3, Env::Priority::HIGH);
|
|
741
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
742
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
743
|
+
env_->SetBackgroundThreads(4, Env::Priority::HIGH);
|
|
744
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
745
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
746
|
+
env_->SetBackgroundThreads(5, Env::Priority::HIGH);
|
|
747
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
748
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
749
|
+
env_->SetBackgroundThreads(4, Env::Priority::HIGH);
|
|
750
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
751
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
752
|
+
|
|
753
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros * 50);
|
|
754
|
+
|
|
755
|
+
// Enqueue 5 more tasks. Thread pool size now is 4.
|
|
756
|
+
// Task 0, 3, 4, 5 running;6, 7 waiting.
|
|
757
|
+
for (size_t i = 3; i < 8; i++) {
|
|
758
|
+
env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &tasks[i],
|
|
759
|
+
Env::Priority::HIGH);
|
|
760
|
+
}
|
|
761
|
+
for (size_t i = 3; i <= 5; i++) {
|
|
762
|
+
ASSERT_FALSE(tasks[i].TimedWaitUntilSleeping(kWaitMicros));
|
|
763
|
+
}
|
|
764
|
+
ASSERT_EQ(2U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
765
|
+
ASSERT_TRUE(tasks[0].IsSleeping());
|
|
766
|
+
ASSERT_TRUE(!tasks[1].IsSleeping());
|
|
767
|
+
ASSERT_TRUE(!tasks[2].IsSleeping());
|
|
768
|
+
ASSERT_TRUE(tasks[3].IsSleeping());
|
|
769
|
+
ASSERT_TRUE(tasks[4].IsSleeping());
|
|
770
|
+
ASSERT_TRUE(tasks[5].IsSleeping());
|
|
771
|
+
ASSERT_TRUE(!tasks[6].IsSleeping());
|
|
772
|
+
ASSERT_TRUE(!tasks[7].IsSleeping());
|
|
773
|
+
|
|
774
|
+
// Wake up task 0, 3 and 4. Task 5, 6, 7 running.
|
|
775
|
+
tasks[0].WakeUp();
|
|
776
|
+
tasks[3].WakeUp();
|
|
777
|
+
tasks[4].WakeUp();
|
|
778
|
+
|
|
779
|
+
for (size_t i = 5; i < 8; i++) {
|
|
780
|
+
ASSERT_FALSE(tasks[i].TimedWaitUntilSleeping(kWaitMicros));
|
|
781
|
+
}
|
|
782
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
783
|
+
for (size_t i = 5; i < 8; i++) {
|
|
784
|
+
ASSERT_TRUE(tasks[i].IsSleeping());
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
// Shrink back to 1 thread. Still task 5, 6, 7 running
|
|
788
|
+
env_->SetBackgroundThreads(1, Env::Priority::HIGH);
|
|
789
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
790
|
+
ASSERT_TRUE(tasks[5].IsSleeping());
|
|
791
|
+
ASSERT_TRUE(tasks[6].IsSleeping());
|
|
792
|
+
ASSERT_TRUE(tasks[7].IsSleeping());
|
|
793
|
+
|
|
794
|
+
// Wake up task 6. Task 5, 7 running
|
|
795
|
+
tasks[6].WakeUp();
|
|
796
|
+
ASSERT_FALSE(tasks[6].TimedWaitUntilDone(kWaitMicros));
|
|
797
|
+
ASSERT_TRUE(tasks[5].IsSleeping());
|
|
798
|
+
ASSERT_TRUE(!tasks[6].IsSleeping());
|
|
799
|
+
ASSERT_TRUE(tasks[7].IsSleeping());
|
|
800
|
+
|
|
801
|
+
// Wake up threads 7. Task 5 running
|
|
802
|
+
tasks[7].WakeUp();
|
|
803
|
+
ASSERT_FALSE(tasks[7].TimedWaitUntilDone(kWaitMicros));
|
|
804
|
+
ASSERT_TRUE(!tasks[7].IsSleeping());
|
|
805
|
+
|
|
806
|
+
// Enqueue thread 8 and 9. Task 5 running; one of 8, 9 might be running.
|
|
807
|
+
env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &tasks[8],
|
|
808
|
+
Env::Priority::HIGH);
|
|
809
|
+
env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &tasks[9],
|
|
810
|
+
Env::Priority::HIGH);
|
|
811
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
812
|
+
ASSERT_GT(env_->GetThreadPoolQueueLen(Env::Priority::HIGH), (unsigned int)0);
|
|
813
|
+
ASSERT_TRUE(!tasks[8].IsSleeping() || !tasks[9].IsSleeping());
|
|
814
|
+
|
|
815
|
+
// Increase to 4 threads. Task 5, 8, 9 running.
|
|
816
|
+
env_->SetBackgroundThreads(4, Env::Priority::HIGH);
|
|
817
|
+
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
|
818
|
+
ASSERT_EQ((unsigned int)0, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
819
|
+
ASSERT_TRUE(tasks[8].IsSleeping());
|
|
820
|
+
ASSERT_TRUE(tasks[9].IsSleeping());
|
|
821
|
+
|
|
822
|
+
// Shrink to 1 thread
|
|
823
|
+
env_->SetBackgroundThreads(1, Env::Priority::HIGH);
|
|
824
|
+
|
|
825
|
+
// Wake up thread 9.
|
|
826
|
+
tasks[9].WakeUp();
|
|
827
|
+
ASSERT_FALSE(tasks[9].TimedWaitUntilDone(kWaitMicros));
|
|
828
|
+
ASSERT_TRUE(!tasks[9].IsSleeping());
|
|
829
|
+
ASSERT_TRUE(tasks[8].IsSleeping());
|
|
830
|
+
|
|
831
|
+
// Wake up thread 8
|
|
832
|
+
tasks[8].WakeUp();
|
|
833
|
+
ASSERT_FALSE(tasks[8].TimedWaitUntilDone(kWaitMicros));
|
|
834
|
+
ASSERT_TRUE(!tasks[8].IsSleeping());
|
|
835
|
+
|
|
836
|
+
// Wake up the last thread
|
|
837
|
+
tasks[5].WakeUp();
|
|
838
|
+
ASSERT_FALSE(tasks[5].TimedWaitUntilDone(kWaitMicros));
|
|
839
|
+
WaitThreadPoolsEmpty();
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
TEST_P(EnvPosixTestWithParam, ReserveThreads) {
|
|
843
|
+
// Initialize the background thread to 1 in case other threads exist
|
|
844
|
+
// from the last unit test
|
|
845
|
+
env_->SetBackgroundThreads(1, Env::Priority::HIGH);
|
|
846
|
+
ASSERT_EQ(env_->GetBackgroundThreads(Env::HIGH), 1);
|
|
847
|
+
constexpr int kWaitMicros = 10000000; // 10seconds
|
|
848
|
+
std::vector<test::SleepingBackgroundTask> tasks(4);
|
|
849
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
|
850
|
+
// Set the sync point to ensure thread 0 can terminate
|
|
851
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency(
|
|
852
|
+
{{"ThreadPoolImpl::BGThread::Termination:th0",
|
|
853
|
+
"EnvTest::ReserveThreads:0"}});
|
|
854
|
+
// Empty the thread pool to ensure all the threads can start later
|
|
855
|
+
env_->SetBackgroundThreads(0, Env::Priority::HIGH);
|
|
856
|
+
TEST_SYNC_POINT("EnvTest::ReserveThreads:0");
|
|
857
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing();
|
|
858
|
+
// Set the sync point to ensure threads start and pass the sync point
|
|
859
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency(
|
|
860
|
+
{{"ThreadPoolImpl::BGThread::Start:th0", "EnvTest::ReserveThreads:1"},
|
|
861
|
+
{"ThreadPoolImpl::BGThread::Start:th1", "EnvTest::ReserveThreads:2"},
|
|
862
|
+
{"ThreadPoolImpl::BGThread::Start:th2", "EnvTest::ReserveThreads:3"},
|
|
863
|
+
{"ThreadPoolImpl::BGThread::Start:th3", "EnvTest::ReserveThreads:4"}});
|
|
864
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
|
865
|
+
|
|
866
|
+
// Set number of thread to 3 first.
|
|
867
|
+
env_->SetBackgroundThreads(3, Env::Priority::HIGH);
|
|
868
|
+
ASSERT_EQ(env_->GetBackgroundThreads(Env::HIGH), 3);
|
|
869
|
+
// Add sync points to ensure all 3 threads start
|
|
870
|
+
TEST_SYNC_POINT("EnvTest::ReserveThreads:1");
|
|
871
|
+
TEST_SYNC_POINT("EnvTest::ReserveThreads:2");
|
|
872
|
+
TEST_SYNC_POINT("EnvTest::ReserveThreads:3");
|
|
873
|
+
// Reserve 2 threads
|
|
874
|
+
ASSERT_EQ(2, env_->ReserveThreads(2, Env::Priority::HIGH));
|
|
875
|
+
|
|
876
|
+
// Schedule 3 tasks. Task 0 running (in this context, doing
|
|
877
|
+
// SleepingBackgroundTask); Task 1, 2 waiting; 3 reserved threads.
|
|
878
|
+
for (size_t i = 0; i < 3; i++) {
|
|
879
|
+
env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &tasks[i],
|
|
880
|
+
Env::Priority::HIGH);
|
|
881
|
+
}
|
|
882
|
+
ASSERT_FALSE(tasks[0].TimedWaitUntilSleeping(kWaitMicros));
|
|
883
|
+
ASSERT_EQ(2U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
884
|
+
ASSERT_TRUE(tasks[0].IsSleeping());
|
|
885
|
+
ASSERT_TRUE(!tasks[1].IsSleeping());
|
|
886
|
+
ASSERT_TRUE(!tasks[2].IsSleeping());
|
|
887
|
+
|
|
888
|
+
// Release 2 threads. Task 0, 1, 2 running; 0 reserved thread.
|
|
889
|
+
ASSERT_EQ(2, env_->ReleaseThreads(2, Env::Priority::HIGH));
|
|
890
|
+
ASSERT_FALSE(tasks[1].TimedWaitUntilSleeping(kWaitMicros));
|
|
891
|
+
ASSERT_FALSE(tasks[2].TimedWaitUntilSleeping(kWaitMicros));
|
|
892
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
893
|
+
ASSERT_TRUE(tasks[1].IsSleeping());
|
|
894
|
+
ASSERT_TRUE(tasks[2].IsSleeping());
|
|
895
|
+
// No more threads can be reserved
|
|
896
|
+
ASSERT_EQ(0, env_->ReserveThreads(3, Env::Priority::HIGH));
|
|
897
|
+
// Expand the number of background threads so that the last thread
|
|
898
|
+
// is waiting
|
|
899
|
+
env_->SetBackgroundThreads(4, Env::Priority::HIGH);
|
|
900
|
+
// Add sync point to ensure the 4th thread starts
|
|
901
|
+
TEST_SYNC_POINT("EnvTest::ReserveThreads:4");
|
|
902
|
+
// As the thread pool is expanded, we can reserve one more thread
|
|
903
|
+
ASSERT_EQ(1, env_->ReserveThreads(3, Env::Priority::HIGH));
|
|
904
|
+
// No more threads can be reserved
|
|
905
|
+
ASSERT_EQ(0, env_->ReserveThreads(3, Env::Priority::HIGH));
|
|
906
|
+
|
|
907
|
+
// Reset the sync points for the next iteration in BGThread or the
|
|
908
|
+
// next time Submit() is called
|
|
909
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing();
|
|
910
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency(
|
|
911
|
+
{{"ThreadPoolImpl::BGThread::WaitingThreadsInc",
|
|
912
|
+
"EnvTest::ReserveThreads:5"},
|
|
913
|
+
{"ThreadPoolImpl::BGThread::Termination", "EnvTest::ReserveThreads:6"},
|
|
914
|
+
{"ThreadPoolImpl::Submit::Enqueue", "EnvTest::ReserveThreads:7"}});
|
|
915
|
+
|
|
916
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
|
917
|
+
tasks[0].WakeUp();
|
|
918
|
+
ASSERT_FALSE(tasks[0].TimedWaitUntilDone(kWaitMicros));
|
|
919
|
+
// Add sync point to ensure the number of waiting threads increases
|
|
920
|
+
TEST_SYNC_POINT("EnvTest::ReserveThreads:5");
|
|
921
|
+
// 1 more thread can be reserved
|
|
922
|
+
ASSERT_EQ(1, env_->ReserveThreads(3, Env::Priority::HIGH));
|
|
923
|
+
// 2 reserved threads now
|
|
924
|
+
|
|
925
|
+
// Currently, two threads are blocked since the number of waiting
|
|
926
|
+
// threads is equal to the number of reserved threads (i.e., 2).
|
|
927
|
+
// If we reduce the number of background thread to 1, at least one thread
|
|
928
|
+
// will be the last excessive thread (here we have no control over the
|
|
929
|
+
// number of excessive threads because thread order does not
|
|
930
|
+
// necessarily follows the schedule order, but we ensure that the last thread
|
|
931
|
+
// shall not run any task by expanding the thread pool after we schedule
|
|
932
|
+
// the tasks), and thus they(it) become(s) unblocked, the number of waiting
|
|
933
|
+
// threads decreases to 0 or 1, but the number of reserved threads is still 2
|
|
934
|
+
env_->SetBackgroundThreads(1, Env::Priority::HIGH);
|
|
935
|
+
|
|
936
|
+
// Task 1,2 running; 2 reserved threads, however, in fact, we only have
|
|
937
|
+
// 0 or 1 waiting thread in the thread pool, proved by the
|
|
938
|
+
// following test, we CANNOT reserve 2 threads even though we just
|
|
939
|
+
// release 2
|
|
940
|
+
TEST_SYNC_POINT("EnvTest::ReserveThreads:6");
|
|
941
|
+
ASSERT_EQ(2, env_->ReleaseThreads(2, Env::Priority::HIGH));
|
|
942
|
+
ASSERT_GT(2, env_->ReserveThreads(2, Env::Priority::HIGH));
|
|
943
|
+
|
|
944
|
+
// Every new task will be put into the queue at this point
|
|
945
|
+
env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &tasks[3],
|
|
946
|
+
Env::Priority::HIGH);
|
|
947
|
+
TEST_SYNC_POINT("EnvTest::ReserveThreads:7");
|
|
948
|
+
ASSERT_EQ(1U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
949
|
+
ASSERT_TRUE(!tasks[3].IsSleeping());
|
|
950
|
+
|
|
951
|
+
// Set the number of threads to 3 so that Task 3 can dequeue
|
|
952
|
+
env_->SetBackgroundThreads(3, Env::Priority::HIGH);
|
|
953
|
+
// Wakup Task 1
|
|
954
|
+
tasks[1].WakeUp();
|
|
955
|
+
ASSERT_FALSE(tasks[1].TimedWaitUntilDone(kWaitMicros));
|
|
956
|
+
// Task 2, 3 running (Task 3 dequeue); 0 or 1 reserved thread
|
|
957
|
+
ASSERT_FALSE(tasks[3].TimedWaitUntilSleeping(kWaitMicros));
|
|
958
|
+
ASSERT_TRUE(tasks[3].IsSleeping());
|
|
959
|
+
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
|
960
|
+
|
|
961
|
+
// At most 1 thread can be released
|
|
962
|
+
ASSERT_GT(2, env_->ReleaseThreads(3, Env::Priority::HIGH));
|
|
963
|
+
tasks[2].WakeUp();
|
|
964
|
+
ASSERT_FALSE(tasks[2].TimedWaitUntilDone(kWaitMicros));
|
|
965
|
+
tasks[3].WakeUp();
|
|
966
|
+
ASSERT_FALSE(tasks[3].TimedWaitUntilDone(kWaitMicros));
|
|
967
|
+
WaitThreadPoolsEmpty();
|
|
968
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing();
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
#if (defined OS_LINUX || defined OS_WIN)
|
|
972
|
+
namespace {
|
|
973
|
+
bool IsSingleVarint(const std::string& s) {
|
|
974
|
+
Slice slice(s);
|
|
975
|
+
|
|
976
|
+
uint64_t v;
|
|
977
|
+
if (!GetVarint64(&slice, &v)) {
|
|
978
|
+
return false;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
return slice.size() == 0;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
bool IsUniqueIDValid(const std::string& s) {
|
|
985
|
+
return !s.empty() && !IsSingleVarint(s);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
const size_t MAX_ID_SIZE = 100;
|
|
989
|
+
char temp_id[MAX_ID_SIZE];
|
|
990
|
+
|
|
991
|
+
} // namespace
|
|
992
|
+
|
|
993
|
+
// Determine whether we can use the FS_IOC_GETVERSION ioctl
|
|
994
|
+
// on a file in directory DIR. Create a temporary file therein,
|
|
995
|
+
// try to apply the ioctl (save that result), cleanup and
|
|
996
|
+
// return the result. Return true if it is supported, and
|
|
997
|
+
// false if anything fails.
|
|
998
|
+
// Note that this function "knows" that dir has just been created
|
|
999
|
+
// and is empty, so we create a simply-named test file: "f".
|
|
1000
|
+
bool ioctl_support__FS_IOC_GETVERSION(const std::string& dir) {
|
|
1001
|
+
#ifdef OS_WIN
|
|
1002
|
+
return true;
|
|
1003
|
+
#else
|
|
1004
|
+
const std::string file = dir + "/f";
|
|
1005
|
+
int fd;
|
|
1006
|
+
do {
|
|
1007
|
+
fd = open(file.c_str(), O_CREAT | O_RDWR | O_TRUNC, 0644);
|
|
1008
|
+
} while (fd < 0 && errno == EINTR);
|
|
1009
|
+
long int version;
|
|
1010
|
+
bool ok = (fd >= 0 && ioctl(fd, FS_IOC_GETVERSION, &version) >= 0);
|
|
1011
|
+
|
|
1012
|
+
close(fd);
|
|
1013
|
+
unlink(file.c_str());
|
|
1014
|
+
|
|
1015
|
+
return ok;
|
|
1016
|
+
#endif
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
// To ensure that Env::GetUniqueId-related tests work correctly, the files
|
|
1020
|
+
// should be stored in regular storage like "hard disk" or "flash device",
|
|
1021
|
+
// and not on a tmpfs file system (like /dev/shm and /tmp on some systems).
|
|
1022
|
+
// Otherwise we cannot get the correct id.
|
|
1023
|
+
//
|
|
1024
|
+
// This function serves as the replacement for test::TmpDir(), which may be
|
|
1025
|
+
// customized to be on a file system that doesn't work with GetUniqueId().
|
|
1026
|
+
|
|
1027
|
+
class IoctlFriendlyTmpdir {
|
|
1028
|
+
public:
|
|
1029
|
+
explicit IoctlFriendlyTmpdir() {
|
|
1030
|
+
char dir_buf[100];
|
|
1031
|
+
|
|
1032
|
+
const char* fmt = "%s/rocksdb.XXXXXX";
|
|
1033
|
+
const char* tmp = getenv("TEST_IOCTL_FRIENDLY_TMPDIR");
|
|
1034
|
+
|
|
1035
|
+
#ifdef OS_WIN
|
|
1036
|
+
#define rmdir _rmdir
|
|
1037
|
+
if (tmp == nullptr) {
|
|
1038
|
+
tmp = getenv("TMP");
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
snprintf(dir_buf, sizeof dir_buf, fmt, tmp);
|
|
1042
|
+
auto result = _mktemp(dir_buf);
|
|
1043
|
+
assert(result != nullptr);
|
|
1044
|
+
BOOL ret = CreateDirectory(dir_buf, NULL);
|
|
1045
|
+
assert(ret == TRUE);
|
|
1046
|
+
dir_ = dir_buf;
|
|
1047
|
+
#else
|
|
1048
|
+
std::list<std::string> candidate_dir_list = {"/var/tmp", "/tmp"};
|
|
1049
|
+
|
|
1050
|
+
// If $TEST_IOCTL_FRIENDLY_TMPDIR/rocksdb.XXXXXX fits, use
|
|
1051
|
+
// $TEST_IOCTL_FRIENDLY_TMPDIR; subtract 2 for the "%s", and
|
|
1052
|
+
// add 1 for the trailing NUL byte.
|
|
1053
|
+
if (tmp && strlen(tmp) + strlen(fmt) - 2 + 1 <= sizeof dir_buf) {
|
|
1054
|
+
// use $TEST_IOCTL_FRIENDLY_TMPDIR value
|
|
1055
|
+
candidate_dir_list.push_front(tmp);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
for (const std::string& d : candidate_dir_list) {
|
|
1059
|
+
snprintf(dir_buf, sizeof dir_buf, fmt, d.c_str());
|
|
1060
|
+
if (mkdtemp(dir_buf)) {
|
|
1061
|
+
if (ioctl_support__FS_IOC_GETVERSION(dir_buf)) {
|
|
1062
|
+
dir_ = dir_buf;
|
|
1063
|
+
return;
|
|
1064
|
+
} else {
|
|
1065
|
+
// Diagnose ioctl-related failure only if this is the
|
|
1066
|
+
// directory specified via that envvar.
|
|
1067
|
+
if (tmp && tmp == d) {
|
|
1068
|
+
fprintf(stderr,
|
|
1069
|
+
"TEST_IOCTL_FRIENDLY_TMPDIR-specified directory is "
|
|
1070
|
+
"not suitable: %s\n",
|
|
1071
|
+
d.c_str());
|
|
1072
|
+
}
|
|
1073
|
+
rmdir(dir_buf); // ignore failure
|
|
1074
|
+
}
|
|
1075
|
+
} else {
|
|
1076
|
+
// mkdtemp failed: diagnose it, but don't give up.
|
|
1077
|
+
fprintf(stderr, "mkdtemp(%s/...) failed: %s\n", d.c_str(),
|
|
1078
|
+
errnoStr(errno).c_str());
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
// check if it's running test within a docker container, in which case, the
|
|
1083
|
+
// file system inside `overlayfs` may not support FS_IOC_GETVERSION
|
|
1084
|
+
// skip the tests
|
|
1085
|
+
struct stat buffer;
|
|
1086
|
+
if (stat("/.dockerenv", &buffer) == 0) {
|
|
1087
|
+
is_supported_ = false;
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
fprintf(stderr,
|
|
1092
|
+
"failed to find an ioctl-friendly temporary directory;"
|
|
1093
|
+
" specify one via the TEST_IOCTL_FRIENDLY_TMPDIR envvar\n");
|
|
1094
|
+
std::abort();
|
|
1095
|
+
#endif
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
~IoctlFriendlyTmpdir() { rmdir(dir_.c_str()); }
|
|
1099
|
+
|
|
1100
|
+
const std::string& name() const { return dir_; }
|
|
1101
|
+
|
|
1102
|
+
bool is_supported() const { return is_supported_; }
|
|
1103
|
+
|
|
1104
|
+
private:
|
|
1105
|
+
std::string dir_;
|
|
1106
|
+
|
|
1107
|
+
bool is_supported_ = true;
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1110
|
+
TEST_F(EnvPosixTest, PositionedAppend) {
|
|
1111
|
+
std::unique_ptr<WritableFile> writable_file;
|
|
1112
|
+
EnvOptions options;
|
|
1113
|
+
options.use_direct_writes = true;
|
|
1114
|
+
options.use_mmap_writes = false;
|
|
1115
|
+
std::string fname = test::PerThreadDBPath(env_, "positioned_append");
|
|
1116
|
+
SetupSyncPointsToMockDirectIO();
|
|
1117
|
+
|
|
1118
|
+
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, options));
|
|
1119
|
+
const size_t kBlockSize = 4096;
|
|
1120
|
+
const size_t kDataSize = kPageSize;
|
|
1121
|
+
// Write a page worth of 'a'
|
|
1122
|
+
auto data_ptr = NewAligned(kDataSize, 'a');
|
|
1123
|
+
Slice data_a(data_ptr.get(), kDataSize);
|
|
1124
|
+
ASSERT_OK(writable_file->PositionedAppend(data_a, 0U));
|
|
1125
|
+
// Write a page worth of 'b' right after the first sector
|
|
1126
|
+
data_ptr = NewAligned(kDataSize, 'b');
|
|
1127
|
+
Slice data_b(data_ptr.get(), kDataSize);
|
|
1128
|
+
ASSERT_OK(writable_file->PositionedAppend(data_b, kBlockSize));
|
|
1129
|
+
ASSERT_OK(writable_file->Close());
|
|
1130
|
+
// The file now has 1 sector worth of a followed by a page worth of b
|
|
1131
|
+
|
|
1132
|
+
// Verify the above
|
|
1133
|
+
std::unique_ptr<SequentialFile> seq_file;
|
|
1134
|
+
ASSERT_OK(env_->NewSequentialFile(fname, &seq_file, options));
|
|
1135
|
+
size_t scratch_len = kPageSize * 2;
|
|
1136
|
+
std::unique_ptr<char[]> scratch(new char[scratch_len]);
|
|
1137
|
+
Slice result;
|
|
1138
|
+
ASSERT_OK(seq_file->Read(scratch_len, &result, scratch.get()));
|
|
1139
|
+
ASSERT_EQ(kPageSize + kBlockSize, result.size());
|
|
1140
|
+
ASSERT_EQ('a', result[kBlockSize - 1]);
|
|
1141
|
+
ASSERT_EQ('b', result[kBlockSize]);
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
// `GetUniqueId()` temporarily returns zero on Windows. `BlockBasedTable` can
|
|
1145
|
+
// handle a return value of zero but this test case cannot.
|
|
1146
|
+
#ifndef OS_WIN
|
|
1147
|
+
TEST_P(EnvPosixTestWithParam, RandomAccessUniqueID) {
|
|
1148
|
+
// Create file.
|
|
1149
|
+
if (env_ == Env::Default()) {
|
|
1150
|
+
EnvOptions soptions;
|
|
1151
|
+
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
|
|
1152
|
+
IoctlFriendlyTmpdir ift;
|
|
1153
|
+
if (!ift.is_supported()) {
|
|
1154
|
+
ROCKSDB_GTEST_BYPASS(
|
|
1155
|
+
"FS_IOC_GETVERSION is not supported by the filesystem");
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
std::string fname = ift.name() + "/testfile";
|
|
1159
|
+
std::unique_ptr<WritableFile> wfile;
|
|
1160
|
+
ASSERT_OK(env_->NewWritableFile(fname, &wfile, soptions));
|
|
1161
|
+
|
|
1162
|
+
std::unique_ptr<RandomAccessFile> file;
|
|
1163
|
+
|
|
1164
|
+
// Get Unique ID
|
|
1165
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1166
|
+
size_t id_size = file->GetUniqueId(temp_id, MAX_ID_SIZE);
|
|
1167
|
+
ASSERT_TRUE(id_size > 0);
|
|
1168
|
+
std::string unique_id1(temp_id, id_size);
|
|
1169
|
+
ASSERT_TRUE(IsUniqueIDValid(unique_id1));
|
|
1170
|
+
|
|
1171
|
+
// Get Unique ID again
|
|
1172
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1173
|
+
id_size = file->GetUniqueId(temp_id, MAX_ID_SIZE);
|
|
1174
|
+
ASSERT_TRUE(id_size > 0);
|
|
1175
|
+
std::string unique_id2(temp_id, id_size);
|
|
1176
|
+
ASSERT_TRUE(IsUniqueIDValid(unique_id2));
|
|
1177
|
+
|
|
1178
|
+
// Get Unique ID again after waiting some time.
|
|
1179
|
+
env_->SleepForMicroseconds(1000000);
|
|
1180
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1181
|
+
id_size = file->GetUniqueId(temp_id, MAX_ID_SIZE);
|
|
1182
|
+
ASSERT_TRUE(id_size > 0);
|
|
1183
|
+
std::string unique_id3(temp_id, id_size);
|
|
1184
|
+
ASSERT_TRUE(IsUniqueIDValid(unique_id3));
|
|
1185
|
+
|
|
1186
|
+
// Check IDs are the same.
|
|
1187
|
+
ASSERT_EQ(unique_id1, unique_id2);
|
|
1188
|
+
ASSERT_EQ(unique_id2, unique_id3);
|
|
1189
|
+
|
|
1190
|
+
// Delete the file
|
|
1191
|
+
ASSERT_OK(env_->DeleteFile(fname));
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
#endif // !defined(OS_WIN)
|
|
1195
|
+
|
|
1196
|
+
// only works in linux platforms
|
|
1197
|
+
#ifdef ROCKSDB_FALLOCATE_PRESENT
|
|
1198
|
+
TEST_P(EnvPosixTestWithParam, AllocateTest) {
|
|
1199
|
+
if (env_ == Env::Default()) {
|
|
1200
|
+
SetupSyncPointsToMockDirectIO();
|
|
1201
|
+
std::string fname = test::PerThreadDBPath(env_, "preallocate_testfile");
|
|
1202
|
+
// Try fallocate in a file to see whether the target file system supports
|
|
1203
|
+
// it.
|
|
1204
|
+
// Skip the test if fallocate is not supported.
|
|
1205
|
+
std::string fname_test_fallocate =
|
|
1206
|
+
test::PerThreadDBPath(env_, "preallocate_testfile_2");
|
|
1207
|
+
int fd = -1;
|
|
1208
|
+
do {
|
|
1209
|
+
fd = open(fname_test_fallocate.c_str(), O_CREAT | O_RDWR | O_TRUNC, 0644);
|
|
1210
|
+
} while (fd < 0 && errno == EINTR);
|
|
1211
|
+
ASSERT_GT(fd, 0);
|
|
1212
|
+
|
|
1213
|
+
int alloc_status = fallocate(fd, 0, 0, 1);
|
|
1214
|
+
|
|
1215
|
+
int err_number = 0;
|
|
1216
|
+
if (alloc_status != 0) {
|
|
1217
|
+
err_number = errno;
|
|
1218
|
+
fprintf(stderr, "Warning: fallocate() fails, %s\n",
|
|
1219
|
+
errnoStr(err_number).c_str());
|
|
1220
|
+
}
|
|
1221
|
+
close(fd);
|
|
1222
|
+
ASSERT_OK(env_->DeleteFile(fname_test_fallocate));
|
|
1223
|
+
if (alloc_status != 0 && err_number == EOPNOTSUPP) {
|
|
1224
|
+
// The filesystem containing the file does not support fallocate
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
EnvOptions soptions;
|
|
1229
|
+
soptions.use_mmap_writes = false;
|
|
1230
|
+
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
|
|
1231
|
+
std::unique_ptr<WritableFile> wfile;
|
|
1232
|
+
ASSERT_OK(env_->NewWritableFile(fname, &wfile, soptions));
|
|
1233
|
+
|
|
1234
|
+
// allocate 100 MB
|
|
1235
|
+
size_t kPreallocateSize = 100 * 1024 * 1024;
|
|
1236
|
+
size_t kBlockSize = 512;
|
|
1237
|
+
size_t kDataSize = 1024 * 1024;
|
|
1238
|
+
auto data_ptr = NewAligned(kDataSize, 'A');
|
|
1239
|
+
Slice data(data_ptr.get(), kDataSize);
|
|
1240
|
+
wfile->SetPreallocationBlockSize(kPreallocateSize);
|
|
1241
|
+
wfile->PrepareWrite(wfile->GetFileSize(), kDataSize);
|
|
1242
|
+
ASSERT_OK(wfile->Append(data));
|
|
1243
|
+
ASSERT_OK(wfile->Flush());
|
|
1244
|
+
|
|
1245
|
+
struct stat f_stat;
|
|
1246
|
+
ASSERT_EQ(stat(fname.c_str(), &f_stat), 0);
|
|
1247
|
+
ASSERT_EQ((unsigned int)kDataSize, f_stat.st_size);
|
|
1248
|
+
// verify that blocks are preallocated
|
|
1249
|
+
// Note here that we don't check the exact number of blocks preallocated --
|
|
1250
|
+
// we only require that number of allocated blocks is at least what we
|
|
1251
|
+
// expect.
|
|
1252
|
+
// It looks like some FS give us more blocks that we asked for. That's fine.
|
|
1253
|
+
// It might be worth investigating further.
|
|
1254
|
+
ASSERT_LE((unsigned int)(kPreallocateSize / kBlockSize), f_stat.st_blocks);
|
|
1255
|
+
|
|
1256
|
+
// close the file, should deallocate the blocks
|
|
1257
|
+
wfile.reset();
|
|
1258
|
+
|
|
1259
|
+
stat(fname.c_str(), &f_stat);
|
|
1260
|
+
ASSERT_EQ((unsigned int)kDataSize, f_stat.st_size);
|
|
1261
|
+
// verify that preallocated blocks were deallocated on file close
|
|
1262
|
+
// Because the FS might give us more blocks, we add a full page to the size
|
|
1263
|
+
// and expect the number of blocks to be less or equal to that.
|
|
1264
|
+
ASSERT_GE((f_stat.st_size + kPageSize + kBlockSize - 1) / kBlockSize,
|
|
1265
|
+
(unsigned int)f_stat.st_blocks);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
#endif // ROCKSDB_FALLOCATE_PRESENT
|
|
1269
|
+
|
|
1270
|
+
// Returns true if any of the strings in ss are the prefix of another string.
|
|
1271
|
+
bool HasPrefix(const std::unordered_set<std::string>& ss) {
|
|
1272
|
+
for (const std::string& s : ss) {
|
|
1273
|
+
if (s.empty()) {
|
|
1274
|
+
return true;
|
|
1275
|
+
}
|
|
1276
|
+
for (size_t i = 1; i < s.size(); ++i) {
|
|
1277
|
+
if (ss.count(s.substr(0, i)) != 0) {
|
|
1278
|
+
return true;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
return false;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
// `GetUniqueId()` temporarily returns zero on Windows. `BlockBasedTable` can
|
|
1286
|
+
// handle a return value of zero but this test case cannot.
|
|
1287
|
+
#ifndef OS_WIN
|
|
1288
|
+
TEST_P(EnvPosixTestWithParam, RandomAccessUniqueIDConcurrent) {
|
|
1289
|
+
if (env_ == Env::Default()) {
|
|
1290
|
+
// Check whether a bunch of concurrently existing files have unique IDs.
|
|
1291
|
+
EnvOptions soptions;
|
|
1292
|
+
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
|
|
1293
|
+
|
|
1294
|
+
// Create the files
|
|
1295
|
+
IoctlFriendlyTmpdir ift;
|
|
1296
|
+
if (!ift.is_supported()) {
|
|
1297
|
+
ROCKSDB_GTEST_BYPASS(
|
|
1298
|
+
"FS_IOC_GETVERSION is not supported by the filesystem");
|
|
1299
|
+
return;
|
|
1300
|
+
}
|
|
1301
|
+
std::vector<std::string> fnames;
|
|
1302
|
+
for (int i = 0; i < 1000; ++i) {
|
|
1303
|
+
fnames.push_back(ift.name() + "/" + "testfile" + std::to_string(i));
|
|
1304
|
+
|
|
1305
|
+
// Create file.
|
|
1306
|
+
std::unique_ptr<WritableFile> wfile;
|
|
1307
|
+
ASSERT_OK(env_->NewWritableFile(fnames[i], &wfile, soptions));
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
// Collect and check whether the IDs are unique.
|
|
1311
|
+
std::unordered_set<std::string> ids;
|
|
1312
|
+
for (const std::string& fname : fnames) {
|
|
1313
|
+
std::unique_ptr<RandomAccessFile> file;
|
|
1314
|
+
std::string unique_id;
|
|
1315
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1316
|
+
size_t id_size = file->GetUniqueId(temp_id, MAX_ID_SIZE);
|
|
1317
|
+
ASSERT_TRUE(id_size > 0);
|
|
1318
|
+
unique_id = std::string(temp_id, id_size);
|
|
1319
|
+
ASSERT_TRUE(IsUniqueIDValid(unique_id));
|
|
1320
|
+
|
|
1321
|
+
ASSERT_TRUE(ids.count(unique_id) == 0);
|
|
1322
|
+
ids.insert(unique_id);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
// Delete the files
|
|
1326
|
+
for (const std::string& fname : fnames) {
|
|
1327
|
+
ASSERT_OK(env_->DeleteFile(fname));
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
ASSERT_TRUE(!HasPrefix(ids));
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
// TODO: Disable the flaky test, it's a known issue that ext4 may return same
|
|
1335
|
+
// key after file deletion. The issue is tracked in #7405, #7470.
|
|
1336
|
+
TEST_P(EnvPosixTestWithParam, DISABLED_RandomAccessUniqueIDDeletes) {
|
|
1337
|
+
if (env_ == Env::Default()) {
|
|
1338
|
+
EnvOptions soptions;
|
|
1339
|
+
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
|
|
1340
|
+
|
|
1341
|
+
IoctlFriendlyTmpdir ift;
|
|
1342
|
+
if (!ift.is_supported()) {
|
|
1343
|
+
ROCKSDB_GTEST_BYPASS(
|
|
1344
|
+
"FS_IOC_GETVERSION is not supported by the filesystem");
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
std::string fname = ift.name() + "/" + "testfile";
|
|
1348
|
+
|
|
1349
|
+
// Check that after file is deleted we don't get same ID again in a new
|
|
1350
|
+
// file.
|
|
1351
|
+
std::unordered_set<std::string> ids;
|
|
1352
|
+
for (int i = 0; i < 1000; ++i) {
|
|
1353
|
+
// Create file.
|
|
1354
|
+
{
|
|
1355
|
+
std::unique_ptr<WritableFile> wfile;
|
|
1356
|
+
ASSERT_OK(env_->NewWritableFile(fname, &wfile, soptions));
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
// Get Unique ID
|
|
1360
|
+
std::string unique_id;
|
|
1361
|
+
{
|
|
1362
|
+
std::unique_ptr<RandomAccessFile> file;
|
|
1363
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1364
|
+
size_t id_size = file->GetUniqueId(temp_id, MAX_ID_SIZE);
|
|
1365
|
+
ASSERT_TRUE(id_size > 0);
|
|
1366
|
+
unique_id = std::string(temp_id, id_size);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
ASSERT_TRUE(IsUniqueIDValid(unique_id));
|
|
1370
|
+
ASSERT_TRUE(ids.count(unique_id) == 0);
|
|
1371
|
+
ids.insert(unique_id);
|
|
1372
|
+
|
|
1373
|
+
// Delete the file
|
|
1374
|
+
ASSERT_OK(env_->DeleteFile(fname));
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
ASSERT_TRUE(!HasPrefix(ids));
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
#endif // !defined(OS_WIN)
|
|
1381
|
+
|
|
1382
|
+
TEST_P(EnvPosixTestWithParam, MultiRead) {
|
|
1383
|
+
EnvOptions soptions;
|
|
1384
|
+
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
|
|
1385
|
+
std::string fname = test::PerThreadDBPath(env_, "testfile");
|
|
1386
|
+
|
|
1387
|
+
const size_t kSectorSize = 4096;
|
|
1388
|
+
const size_t kNumSectors = 8;
|
|
1389
|
+
|
|
1390
|
+
// Create file.
|
|
1391
|
+
{
|
|
1392
|
+
std::unique_ptr<WritableFile> wfile;
|
|
1393
|
+
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \
|
|
1394
|
+
!defined(OS_AIX)
|
|
1395
|
+
if (soptions.use_direct_writes) {
|
|
1396
|
+
soptions.use_direct_writes = false;
|
|
1397
|
+
}
|
|
1398
|
+
#endif
|
|
1399
|
+
ASSERT_OK(env_->NewWritableFile(fname, &wfile, soptions));
|
|
1400
|
+
for (size_t i = 0; i < kNumSectors; ++i) {
|
|
1401
|
+
auto data = NewAligned(kSectorSize * 8, static_cast<char>(i + 1));
|
|
1402
|
+
Slice slice(data.get(), kSectorSize);
|
|
1403
|
+
ASSERT_OK(wfile->Append(slice));
|
|
1404
|
+
}
|
|
1405
|
+
ASSERT_OK(wfile->Close());
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
// More attempts to simulate more partial result sequences.
|
|
1409
|
+
for (uint32_t attempt = 0; attempt < 20; attempt++) {
|
|
1410
|
+
// Random Read
|
|
1411
|
+
Random rnd(301 + attempt);
|
|
1412
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
|
|
1413
|
+
"UpdateResults::io_uring_result", [&](void* arg) {
|
|
1414
|
+
if (attempt > 0) {
|
|
1415
|
+
// No failure in the first attempt.
|
|
1416
|
+
size_t& bytes_read = *static_cast<size_t*>(arg);
|
|
1417
|
+
if (rnd.OneIn(4)) {
|
|
1418
|
+
bytes_read = 0;
|
|
1419
|
+
} else if (rnd.OneIn(3)) {
|
|
1420
|
+
bytes_read = static_cast<size_t>(
|
|
1421
|
+
rnd.Uniform(static_cast<int>(bytes_read)));
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
});
|
|
1425
|
+
|
|
1426
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
|
1427
|
+
std::unique_ptr<RandomAccessFile> file;
|
|
1428
|
+
std::vector<ReadRequest> reqs(3);
|
|
1429
|
+
std::vector<std::unique_ptr<char, Deleter>> data;
|
|
1430
|
+
uint64_t offset = 0;
|
|
1431
|
+
for (size_t i = 0; i < reqs.size(); ++i) {
|
|
1432
|
+
reqs[i].offset = offset;
|
|
1433
|
+
offset += 2 * kSectorSize;
|
|
1434
|
+
reqs[i].len = kSectorSize;
|
|
1435
|
+
data.emplace_back(NewAligned(kSectorSize, 0));
|
|
1436
|
+
reqs[i].scratch = data.back().get();
|
|
1437
|
+
}
|
|
1438
|
+
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \
|
|
1439
|
+
!defined(OS_AIX)
|
|
1440
|
+
if (soptions.use_direct_reads) {
|
|
1441
|
+
soptions.use_direct_reads = false;
|
|
1442
|
+
}
|
|
1443
|
+
#endif
|
|
1444
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1445
|
+
ASSERT_OK(file->MultiRead(reqs.data(), reqs.size()));
|
|
1446
|
+
for (size_t i = 0; i < reqs.size(); ++i) {
|
|
1447
|
+
auto buf = NewAligned(kSectorSize * 8, static_cast<char>(i * 2 + 1));
|
|
1448
|
+
ASSERT_OK(reqs[i].status);
|
|
1449
|
+
ASSERT_EQ(memcmp(reqs[i].scratch, buf.get(), kSectorSize), 0);
|
|
1450
|
+
}
|
|
1451
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing();
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
TEST_F(EnvPosixTest, MultiReadNonAlignedLargeNum) {
|
|
1456
|
+
// In this test we don't do aligned read, so it doesn't work for
|
|
1457
|
+
// direct I/O case.
|
|
1458
|
+
EnvOptions soptions;
|
|
1459
|
+
soptions.use_direct_reads = soptions.use_direct_writes = false;
|
|
1460
|
+
std::string fname = test::PerThreadDBPath(env_, "testfile");
|
|
1461
|
+
|
|
1462
|
+
const size_t kTotalSize = 81920;
|
|
1463
|
+
Random rnd(301);
|
|
1464
|
+
std::string expected_data = rnd.RandomString(kTotalSize);
|
|
1465
|
+
|
|
1466
|
+
// Create file.
|
|
1467
|
+
{
|
|
1468
|
+
std::unique_ptr<WritableFile> wfile;
|
|
1469
|
+
ASSERT_OK(env_->NewWritableFile(fname, &wfile, soptions));
|
|
1470
|
+
ASSERT_OK(wfile->Append(expected_data));
|
|
1471
|
+
ASSERT_OK(wfile->Close());
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
// More attempts to simulate more partial result sequences.
|
|
1475
|
+
for (uint32_t attempt = 0; attempt < 25; attempt++) {
|
|
1476
|
+
// Right now kIoUringDepth is hard coded as 256, so we need very large
|
|
1477
|
+
// number of keys to cover the case of multiple rounds of submissions.
|
|
1478
|
+
// Right now the test latency is still acceptable. If it ends up with
|
|
1479
|
+
// too long, we can modify the io uring depth with SyncPoint here.
|
|
1480
|
+
const int num_reads = rnd.Uniform(512) + 1;
|
|
1481
|
+
|
|
1482
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
|
|
1483
|
+
"UpdateResults::io_uring_result", [&](void* arg) {
|
|
1484
|
+
if (attempt > 5) {
|
|
1485
|
+
// Improve partial result rates in second half of the run to
|
|
1486
|
+
// cover the case of repeated partial results.
|
|
1487
|
+
int odd = (attempt < 15) ? num_reads / 2 : 4;
|
|
1488
|
+
// No failure in first several attempts.
|
|
1489
|
+
size_t& bytes_read = *static_cast<size_t*>(arg);
|
|
1490
|
+
if (rnd.OneIn(odd)) {
|
|
1491
|
+
bytes_read = 0;
|
|
1492
|
+
} else if (rnd.OneIn(odd / 2)) {
|
|
1493
|
+
bytes_read = static_cast<size_t>(
|
|
1494
|
+
rnd.Uniform(static_cast<int>(bytes_read)));
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
|
1499
|
+
|
|
1500
|
+
// Generate (offset, len) pairs
|
|
1501
|
+
std::set<int> start_offsets;
|
|
1502
|
+
for (int i = 0; i < num_reads; i++) {
|
|
1503
|
+
int rnd_off;
|
|
1504
|
+
// No repeat offsets.
|
|
1505
|
+
while (start_offsets.find(rnd_off = rnd.Uniform(81920)) !=
|
|
1506
|
+
start_offsets.end()) {
|
|
1507
|
+
}
|
|
1508
|
+
start_offsets.insert(rnd_off);
|
|
1509
|
+
}
|
|
1510
|
+
std::vector<size_t> offsets;
|
|
1511
|
+
std::vector<size_t> lens;
|
|
1512
|
+
// std::set already sorted the offsets.
|
|
1513
|
+
for (int so : start_offsets) {
|
|
1514
|
+
offsets.push_back(so);
|
|
1515
|
+
}
|
|
1516
|
+
for (size_t i = 0; i + 1 < offsets.size(); i++) {
|
|
1517
|
+
lens.push_back(static_cast<size_t>(
|
|
1518
|
+
rnd.Uniform(static_cast<int>(offsets[i + 1] - offsets[i])) + 1));
|
|
1519
|
+
}
|
|
1520
|
+
lens.push_back(static_cast<size_t>(
|
|
1521
|
+
rnd.Uniform(static_cast<int>(kTotalSize - offsets.back())) + 1));
|
|
1522
|
+
ASSERT_EQ(num_reads, lens.size());
|
|
1523
|
+
|
|
1524
|
+
// Create requests
|
|
1525
|
+
std::vector<std::string> scratches;
|
|
1526
|
+
scratches.reserve(num_reads);
|
|
1527
|
+
std::vector<ReadRequest> reqs(num_reads);
|
|
1528
|
+
for (size_t i = 0; i < reqs.size(); ++i) {
|
|
1529
|
+
reqs[i].offset = offsets[i];
|
|
1530
|
+
reqs[i].len = lens[i];
|
|
1531
|
+
scratches.emplace_back(reqs[i].len, ' ');
|
|
1532
|
+
reqs[i].scratch = const_cast<char*>(scratches.back().data());
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
// Query the data
|
|
1536
|
+
std::unique_ptr<RandomAccessFile> file;
|
|
1537
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1538
|
+
ASSERT_OK(file->MultiRead(reqs.data(), reqs.size()));
|
|
1539
|
+
|
|
1540
|
+
// Validate results
|
|
1541
|
+
for (int i = 0; i < num_reads; ++i) {
|
|
1542
|
+
ASSERT_OK(reqs[i].status);
|
|
1543
|
+
ASSERT_EQ(
|
|
1544
|
+
Slice(expected_data.data() + offsets[i], lens[i]).ToString(true),
|
|
1545
|
+
reqs[i].result.ToString(true));
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing();
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
TEST_F(EnvPosixTest, NonAlignedDirectIOMultiReadBeyondFileSize) {
|
|
1553
|
+
EnvOptions soptions;
|
|
1554
|
+
soptions.use_direct_reads = true;
|
|
1555
|
+
soptions.use_direct_writes = false;
|
|
1556
|
+
std::string fname = test::PerThreadDBPath(env_, "testfile");
|
|
1557
|
+
|
|
1558
|
+
Random rnd(301);
|
|
1559
|
+
std::unique_ptr<WritableFile> wfile;
|
|
1560
|
+
size_t alignment = 0;
|
|
1561
|
+
// Create file.
|
|
1562
|
+
{
|
|
1563
|
+
ASSERT_OK(env_->NewWritableFile(fname, &wfile, soptions));
|
|
1564
|
+
auto data_ptr = NewAligned(4095, 'b');
|
|
1565
|
+
Slice data_b(data_ptr.get(), 4095);
|
|
1566
|
+
ASSERT_OK(wfile->PositionedAppend(data_b, 0U));
|
|
1567
|
+
ASSERT_OK(wfile->Close());
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \
|
|
1571
|
+
!defined(OS_AIX) && !defined(OS_OPENBSD) && !defined(OS_FREEBSD)
|
|
1572
|
+
if (soptions.use_direct_reads) {
|
|
1573
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
|
|
1574
|
+
"NewRandomAccessFile:O_DIRECT", [&](void* arg) {
|
|
1575
|
+
int* val = static_cast<int*>(arg);
|
|
1576
|
+
*val &= ~O_DIRECT;
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
#endif
|
|
1580
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
|
1581
|
+
|
|
1582
|
+
const int num_reads = 2;
|
|
1583
|
+
// Create requests
|
|
1584
|
+
std::vector<std::string> scratches;
|
|
1585
|
+
scratches.reserve(num_reads);
|
|
1586
|
+
std::vector<ReadRequest> reqs(num_reads);
|
|
1587
|
+
|
|
1588
|
+
std::unique_ptr<RandomAccessFile> file;
|
|
1589
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1590
|
+
alignment = file->GetRequiredBufferAlignment();
|
|
1591
|
+
ASSERT_EQ(num_reads, reqs.size());
|
|
1592
|
+
|
|
1593
|
+
std::vector<std::unique_ptr<char, Deleter>> data;
|
|
1594
|
+
|
|
1595
|
+
std::vector<size_t> offsets = {0, 2047};
|
|
1596
|
+
std::vector<size_t> lens = {2047, 4096 - 2047};
|
|
1597
|
+
|
|
1598
|
+
for (size_t i = 0; i < num_reads; i++) {
|
|
1599
|
+
// Do alignment
|
|
1600
|
+
reqs[i].offset = static_cast<uint64_t>(TruncateToPageBoundary(
|
|
1601
|
+
alignment, static_cast<size_t>(/*offset=*/offsets[i])));
|
|
1602
|
+
reqs[i].len =
|
|
1603
|
+
Roundup(static_cast<size_t>(/*offset=*/offsets[i]) + /*length=*/lens[i],
|
|
1604
|
+
alignment) -
|
|
1605
|
+
reqs[i].offset;
|
|
1606
|
+
|
|
1607
|
+
size_t new_capacity = Roundup(reqs[i].len, alignment);
|
|
1608
|
+
data.emplace_back(NewAligned(new_capacity, 0));
|
|
1609
|
+
reqs[i].scratch = data.back().get();
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
// Query the data
|
|
1613
|
+
ASSERT_OK(file->MultiRead(reqs.data(), reqs.size()));
|
|
1614
|
+
|
|
1615
|
+
// Validate results
|
|
1616
|
+
for (size_t i = 0; i < num_reads; ++i) {
|
|
1617
|
+
ASSERT_OK(reqs[i].status);
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing();
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
#if defined(ROCKSDB_IOURING_PRESENT)
|
|
1624
|
+
void GenerateFilesAndRequest(Env* env, const std::string& fname,
|
|
1625
|
+
std::vector<ReadRequest>* ret_reqs,
|
|
1626
|
+
std::vector<std::string>* scratches) {
|
|
1627
|
+
const size_t kTotalSize = 81920;
|
|
1628
|
+
Random rnd(301);
|
|
1629
|
+
std::string expected_data = rnd.RandomString(kTotalSize);
|
|
1630
|
+
|
|
1631
|
+
// Create file.
|
|
1632
|
+
{
|
|
1633
|
+
std::unique_ptr<WritableFile> wfile;
|
|
1634
|
+
ASSERT_OK(env->NewWritableFile(fname, &wfile, EnvOptions()));
|
|
1635
|
+
ASSERT_OK(wfile->Append(expected_data));
|
|
1636
|
+
ASSERT_OK(wfile->Close());
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
// Right now kIoUringDepth is hard coded as 256, so we need very large
|
|
1640
|
+
// number of keys to cover the case of multiple rounds of submissions.
|
|
1641
|
+
// Right now the test latency is still acceptable. If it ends up with
|
|
1642
|
+
// too long, we can modify the io uring depth with SyncPoint here.
|
|
1643
|
+
const int num_reads = 3;
|
|
1644
|
+
std::vector<size_t> offsets = {10000, 20000, 30000};
|
|
1645
|
+
std::vector<size_t> lens = {3000, 200, 100};
|
|
1646
|
+
|
|
1647
|
+
// Create requests
|
|
1648
|
+
scratches->reserve(num_reads);
|
|
1649
|
+
std::vector<ReadRequest>& reqs = *ret_reqs;
|
|
1650
|
+
reqs.resize(num_reads);
|
|
1651
|
+
for (int i = 0; i < num_reads; ++i) {
|
|
1652
|
+
reqs[i].offset = offsets[i];
|
|
1653
|
+
reqs[i].len = lens[i];
|
|
1654
|
+
scratches->emplace_back(reqs[i].len, ' ');
|
|
1655
|
+
reqs[i].scratch = const_cast<char*>(scratches->back().data());
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
TEST_F(EnvPosixTest, MultiReadIOUringError) {
|
|
1660
|
+
// In this test we don't do aligned read, so we can't do direct I/O.
|
|
1661
|
+
EnvOptions soptions;
|
|
1662
|
+
soptions.use_direct_reads = soptions.use_direct_writes = false;
|
|
1663
|
+
std::string fname = test::PerThreadDBPath(env_, "testfile");
|
|
1664
|
+
|
|
1665
|
+
std::vector<std::string> scratches;
|
|
1666
|
+
std::vector<ReadRequest> reqs;
|
|
1667
|
+
GenerateFilesAndRequest(env_, fname, &reqs, &scratches);
|
|
1668
|
+
// Query the data
|
|
1669
|
+
std::unique_ptr<RandomAccessFile> file;
|
|
1670
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1671
|
+
|
|
1672
|
+
bool io_uring_wait_cqe_called = false;
|
|
1673
|
+
SyncPoint::GetInstance()->SetCallBack(
|
|
1674
|
+
"PosixRandomAccessFile::MultiRead:io_uring_wait_cqe:return",
|
|
1675
|
+
[&](void* arg) {
|
|
1676
|
+
if (!io_uring_wait_cqe_called) {
|
|
1677
|
+
io_uring_wait_cqe_called = true;
|
|
1678
|
+
ssize_t& ret = *(static_cast<ssize_t*>(arg));
|
|
1679
|
+
ret = 1;
|
|
1680
|
+
}
|
|
1681
|
+
});
|
|
1682
|
+
SyncPoint::GetInstance()->EnableProcessing();
|
|
1683
|
+
|
|
1684
|
+
Status s = file->MultiRead(reqs.data(), reqs.size());
|
|
1685
|
+
if (io_uring_wait_cqe_called) {
|
|
1686
|
+
ASSERT_NOK(s);
|
|
1687
|
+
} else {
|
|
1688
|
+
s.PermitUncheckedError();
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
1692
|
+
SyncPoint::GetInstance()->ClearAllCallBacks();
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
TEST_F(EnvPosixTest, MultiReadIOUringError2) {
|
|
1696
|
+
// In this test we don't do aligned read, so we can't do direct I/O.
|
|
1697
|
+
EnvOptions soptions;
|
|
1698
|
+
soptions.use_direct_reads = soptions.use_direct_writes = false;
|
|
1699
|
+
std::string fname = test::PerThreadDBPath(env_, "testfile");
|
|
1700
|
+
|
|
1701
|
+
std::vector<std::string> scratches;
|
|
1702
|
+
std::vector<ReadRequest> reqs;
|
|
1703
|
+
GenerateFilesAndRequest(env_, fname, &reqs, &scratches);
|
|
1704
|
+
// Query the data
|
|
1705
|
+
std::unique_ptr<RandomAccessFile> file;
|
|
1706
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1707
|
+
|
|
1708
|
+
bool io_uring_submit_and_wait_called = false;
|
|
1709
|
+
SyncPoint::GetInstance()->SetCallBack(
|
|
1710
|
+
"PosixRandomAccessFile::MultiRead:io_uring_submit_and_wait:return1",
|
|
1711
|
+
[&](void* arg) {
|
|
1712
|
+
io_uring_submit_and_wait_called = true;
|
|
1713
|
+
ssize_t* ret = static_cast<ssize_t*>(arg);
|
|
1714
|
+
(*ret)--;
|
|
1715
|
+
});
|
|
1716
|
+
SyncPoint::GetInstance()->SetCallBack(
|
|
1717
|
+
"PosixRandomAccessFile::MultiRead:io_uring_submit_and_wait:return2",
|
|
1718
|
+
[&](void* arg) {
|
|
1719
|
+
struct io_uring* iu = static_cast<struct io_uring*>(arg);
|
|
1720
|
+
struct io_uring_cqe* cqe;
|
|
1721
|
+
assert(io_uring_wait_cqe(iu, &cqe) == 0);
|
|
1722
|
+
io_uring_cqe_seen(iu, cqe);
|
|
1723
|
+
});
|
|
1724
|
+
SyncPoint::GetInstance()->EnableProcessing();
|
|
1725
|
+
|
|
1726
|
+
Status s = file->MultiRead(reqs.data(), reqs.size());
|
|
1727
|
+
if (io_uring_submit_and_wait_called) {
|
|
1728
|
+
ASSERT_NOK(s);
|
|
1729
|
+
} else {
|
|
1730
|
+
s.PermitUncheckedError();
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
SyncPoint::GetInstance()->DisableProcessing();
|
|
1734
|
+
SyncPoint::GetInstance()->ClearAllCallBacks();
|
|
1735
|
+
}
|
|
1736
|
+
#endif // ROCKSDB_IOURING_PRESENT
|
|
1737
|
+
|
|
1738
|
+
// Only works in linux platforms
|
|
1739
|
+
#ifdef OS_WIN
|
|
1740
|
+
TEST_P(EnvPosixTestWithParam, DISABLED_InvalidateCache) {
|
|
1741
|
+
#else
|
|
1742
|
+
TEST_P(EnvPosixTestWithParam, InvalidateCache) {
|
|
1743
|
+
#endif
|
|
1744
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
|
1745
|
+
EnvOptions soptions;
|
|
1746
|
+
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
|
|
1747
|
+
std::string fname = test::PerThreadDBPath(env_, "testfile");
|
|
1748
|
+
|
|
1749
|
+
const size_t kSectorSize = 512;
|
|
1750
|
+
auto data = NewAligned(kSectorSize, 0);
|
|
1751
|
+
Slice slice(data.get(), kSectorSize);
|
|
1752
|
+
|
|
1753
|
+
// Create file.
|
|
1754
|
+
{
|
|
1755
|
+
std::unique_ptr<WritableFile> wfile;
|
|
1756
|
+
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \
|
|
1757
|
+
!defined(OS_AIX)
|
|
1758
|
+
if (soptions.use_direct_writes) {
|
|
1759
|
+
soptions.use_direct_writes = false;
|
|
1760
|
+
}
|
|
1761
|
+
#endif
|
|
1762
|
+
ASSERT_OK(env_->NewWritableFile(fname, &wfile, soptions));
|
|
1763
|
+
ASSERT_OK(wfile->Append(slice));
|
|
1764
|
+
ASSERT_OK(wfile->InvalidateCache(0, 0));
|
|
1765
|
+
ASSERT_OK(wfile->Close());
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
// Random Read
|
|
1769
|
+
{
|
|
1770
|
+
std::unique_ptr<RandomAccessFile> file;
|
|
1771
|
+
auto scratch = NewAligned(kSectorSize, 0);
|
|
1772
|
+
Slice result;
|
|
1773
|
+
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \
|
|
1774
|
+
!defined(OS_AIX)
|
|
1775
|
+
if (soptions.use_direct_reads) {
|
|
1776
|
+
soptions.use_direct_reads = false;
|
|
1777
|
+
}
|
|
1778
|
+
#endif
|
|
1779
|
+
ASSERT_OK(env_->NewRandomAccessFile(fname, &file, soptions));
|
|
1780
|
+
ASSERT_OK(file->Read(0, kSectorSize, &result, scratch.get()));
|
|
1781
|
+
ASSERT_EQ(memcmp(scratch.get(), data.get(), kSectorSize), 0);
|
|
1782
|
+
ASSERT_OK(file->InvalidateCache(0, 11));
|
|
1783
|
+
ASSERT_OK(file->InvalidateCache(0, 0));
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
// Sequential Read
|
|
1787
|
+
{
|
|
1788
|
+
std::unique_ptr<SequentialFile> file;
|
|
1789
|
+
auto scratch = NewAligned(kSectorSize, 0);
|
|
1790
|
+
Slice result;
|
|
1791
|
+
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \
|
|
1792
|
+
!defined(OS_AIX)
|
|
1793
|
+
if (soptions.use_direct_reads) {
|
|
1794
|
+
soptions.use_direct_reads = false;
|
|
1795
|
+
}
|
|
1796
|
+
#endif
|
|
1797
|
+
ASSERT_OK(env_->NewSequentialFile(fname, &file, soptions));
|
|
1798
|
+
if (file->use_direct_io()) {
|
|
1799
|
+
ASSERT_OK(file->PositionedRead(0, kSectorSize, &result, scratch.get()));
|
|
1800
|
+
} else {
|
|
1801
|
+
ASSERT_OK(file->Read(kSectorSize, &result, scratch.get()));
|
|
1802
|
+
}
|
|
1803
|
+
ASSERT_EQ(memcmp(scratch.get(), data.get(), kSectorSize), 0);
|
|
1804
|
+
ASSERT_OK(file->InvalidateCache(0, 11));
|
|
1805
|
+
ASSERT_OK(file->InvalidateCache(0, 0));
|
|
1806
|
+
}
|
|
1807
|
+
// Delete the file
|
|
1808
|
+
ASSERT_OK(env_->DeleteFile(fname));
|
|
1809
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace();
|
|
1810
|
+
}
|
|
1811
|
+
#endif // OS_LINUX || OS_WIN
|
|
1812
|
+
|
|
1813
|
+
class TestLogger : public Logger {
|
|
1814
|
+
public:
|
|
1815
|
+
using Logger::Logv;
|
|
1816
|
+
void Logv(const char* format, va_list ap) override {
|
|
1817
|
+
log_count++;
|
|
1818
|
+
|
|
1819
|
+
char new_format[550];
|
|
1820
|
+
std::fill_n(new_format, sizeof(new_format), '2');
|
|
1821
|
+
{
|
|
1822
|
+
va_list backup_ap;
|
|
1823
|
+
va_copy(backup_ap, ap);
|
|
1824
|
+
int n = vsnprintf(new_format, sizeof(new_format) - 1, format, backup_ap);
|
|
1825
|
+
// 48 bytes for extra information + bytes allocated
|
|
1826
|
+
|
|
1827
|
+
// When we have n == -1 there is not a terminating zero expected
|
|
1828
|
+
#ifdef OS_WIN
|
|
1829
|
+
if (n < 0) {
|
|
1830
|
+
char_0_count++;
|
|
1831
|
+
}
|
|
1832
|
+
#endif
|
|
1833
|
+
|
|
1834
|
+
if (new_format[0] == '[') {
|
|
1835
|
+
// "[DEBUG] "
|
|
1836
|
+
ASSERT_TRUE(n <= 56 + (512 - static_cast<int>(sizeof(port::TimeVal))));
|
|
1837
|
+
} else {
|
|
1838
|
+
ASSERT_TRUE(n <= 48 + (512 - static_cast<int>(sizeof(port::TimeVal))));
|
|
1839
|
+
}
|
|
1840
|
+
va_end(backup_ap);
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
for (size_t i = 0; i < sizeof(new_format); i++) {
|
|
1844
|
+
if (new_format[i] == 'x') {
|
|
1845
|
+
char_x_count++;
|
|
1846
|
+
} else if (new_format[i] == '\0') {
|
|
1847
|
+
char_0_count++;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
int log_count;
|
|
1852
|
+
int char_x_count;
|
|
1853
|
+
int char_0_count;
|
|
1854
|
+
};
|
|
1855
|
+
|
|
1856
|
+
TEST_P(EnvPosixTestWithParam, LogBufferTest) {
|
|
1857
|
+
TestLogger test_logger;
|
|
1858
|
+
test_logger.SetInfoLogLevel(InfoLogLevel::INFO_LEVEL);
|
|
1859
|
+
test_logger.log_count = 0;
|
|
1860
|
+
test_logger.char_x_count = 0;
|
|
1861
|
+
test_logger.char_0_count = 0;
|
|
1862
|
+
LogBuffer log_buffer(InfoLogLevel::INFO_LEVEL, &test_logger);
|
|
1863
|
+
LogBuffer log_buffer_debug(DEBUG_LEVEL, &test_logger);
|
|
1864
|
+
|
|
1865
|
+
char bytes200[200];
|
|
1866
|
+
std::fill_n(bytes200, sizeof(bytes200), '1');
|
|
1867
|
+
bytes200[sizeof(bytes200) - 1] = '\0';
|
|
1868
|
+
char bytes600[600];
|
|
1869
|
+
std::fill_n(bytes600, sizeof(bytes600), '1');
|
|
1870
|
+
bytes600[sizeof(bytes600) - 1] = '\0';
|
|
1871
|
+
char bytes9000[9000];
|
|
1872
|
+
std::fill_n(bytes9000, sizeof(bytes9000), '1');
|
|
1873
|
+
bytes9000[sizeof(bytes9000) - 1] = '\0';
|
|
1874
|
+
|
|
1875
|
+
ROCKS_LOG_BUFFER(&log_buffer, "x%sx", bytes200);
|
|
1876
|
+
ROCKS_LOG_BUFFER(&log_buffer, "x%sx", bytes600);
|
|
1877
|
+
ROCKS_LOG_BUFFER(&log_buffer, "x%sx%sx%sx", bytes200, bytes200, bytes200);
|
|
1878
|
+
ROCKS_LOG_BUFFER(&log_buffer, "x%sx%sx", bytes200, bytes600);
|
|
1879
|
+
ROCKS_LOG_BUFFER(&log_buffer, "x%sx%sx", bytes600, bytes9000);
|
|
1880
|
+
|
|
1881
|
+
ROCKS_LOG_BUFFER(&log_buffer_debug, "x%sx", bytes200);
|
|
1882
|
+
test_logger.SetInfoLogLevel(DEBUG_LEVEL);
|
|
1883
|
+
ROCKS_LOG_BUFFER(&log_buffer_debug, "x%sx%sx%sx", bytes600, bytes9000,
|
|
1884
|
+
bytes200);
|
|
1885
|
+
|
|
1886
|
+
ASSERT_EQ(0, test_logger.log_count);
|
|
1887
|
+
log_buffer.FlushBufferToLog();
|
|
1888
|
+
log_buffer_debug.FlushBufferToLog();
|
|
1889
|
+
ASSERT_EQ(6, test_logger.log_count);
|
|
1890
|
+
ASSERT_EQ(6, test_logger.char_0_count);
|
|
1891
|
+
ASSERT_EQ(10, test_logger.char_x_count);
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
class TestLogger2 : public Logger {
|
|
1895
|
+
public:
|
|
1896
|
+
explicit TestLogger2(size_t max_log_size) : max_log_size_(max_log_size) {}
|
|
1897
|
+
using Logger::Logv;
|
|
1898
|
+
void Logv(const char* format, va_list ap) override {
|
|
1899
|
+
char new_format[2000];
|
|
1900
|
+
std::fill_n(new_format, sizeof(new_format), '2');
|
|
1901
|
+
{
|
|
1902
|
+
va_list backup_ap;
|
|
1903
|
+
va_copy(backup_ap, ap);
|
|
1904
|
+
int n = vsnprintf(new_format, sizeof(new_format) - 1, format, backup_ap);
|
|
1905
|
+
// 48 bytes for extra information + bytes allocated
|
|
1906
|
+
ASSERT_TRUE(n <=
|
|
1907
|
+
48 + static_cast<int>(max_log_size_ - sizeof(port::TimeVal)));
|
|
1908
|
+
ASSERT_TRUE(n > static_cast<int>(max_log_size_ - sizeof(port::TimeVal)));
|
|
1909
|
+
va_end(backup_ap);
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
size_t max_log_size_;
|
|
1913
|
+
};
|
|
1914
|
+
|
|
1915
|
+
TEST_P(EnvPosixTestWithParam, LogBufferMaxSizeTest) {
|
|
1916
|
+
char bytes9000[9000];
|
|
1917
|
+
std::fill_n(bytes9000, sizeof(bytes9000), '1');
|
|
1918
|
+
bytes9000[sizeof(bytes9000) - 1] = '\0';
|
|
1919
|
+
|
|
1920
|
+
for (size_t max_log_size = 256; max_log_size <= 1024;
|
|
1921
|
+
max_log_size += 1024 - 256) {
|
|
1922
|
+
TestLogger2 test_logger(max_log_size);
|
|
1923
|
+
test_logger.SetInfoLogLevel(InfoLogLevel::INFO_LEVEL);
|
|
1924
|
+
LogBuffer log_buffer(InfoLogLevel::INFO_LEVEL, &test_logger);
|
|
1925
|
+
ROCKS_LOG_BUFFER_MAX_SZ(&log_buffer, max_log_size, "%s", bytes9000);
|
|
1926
|
+
log_buffer.FlushBufferToLog();
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
TEST_P(EnvPosixTestWithParam, Preallocation) {
|
|
1931
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
|
1932
|
+
const std::string src = test::PerThreadDBPath(env_, "testfile");
|
|
1933
|
+
std::unique_ptr<WritableFile> srcfile;
|
|
1934
|
+
EnvOptions soptions;
|
|
1935
|
+
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
|
|
1936
|
+
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \
|
|
1937
|
+
!defined(OS_AIX) && !defined(OS_OPENBSD) && !defined(OS_FREEBSD)
|
|
1938
|
+
if (soptions.use_direct_writes) {
|
|
1939
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
|
|
1940
|
+
"NewWritableFile:O_DIRECT", [&](void* arg) {
|
|
1941
|
+
int* val = static_cast<int*>(arg);
|
|
1942
|
+
*val &= ~O_DIRECT;
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
#endif
|
|
1946
|
+
ASSERT_OK(env_->NewWritableFile(src, &srcfile, soptions));
|
|
1947
|
+
srcfile->SetPreallocationBlockSize(1024 * 1024);
|
|
1948
|
+
|
|
1949
|
+
// No writes should mean no preallocation
|
|
1950
|
+
size_t block_size, last_allocated_block;
|
|
1951
|
+
srcfile->GetPreallocationStatus(&block_size, &last_allocated_block);
|
|
1952
|
+
ASSERT_EQ(last_allocated_block, 0UL);
|
|
1953
|
+
|
|
1954
|
+
// Small write should preallocate one block
|
|
1955
|
+
size_t kStrSize = 4096;
|
|
1956
|
+
auto data = NewAligned(kStrSize, 'A');
|
|
1957
|
+
Slice str(data.get(), kStrSize);
|
|
1958
|
+
srcfile->PrepareWrite(srcfile->GetFileSize(), kStrSize);
|
|
1959
|
+
ASSERT_OK(srcfile->Append(str));
|
|
1960
|
+
srcfile->GetPreallocationStatus(&block_size, &last_allocated_block);
|
|
1961
|
+
ASSERT_EQ(last_allocated_block, 1UL);
|
|
1962
|
+
|
|
1963
|
+
// Write an entire preallocation block, make sure we increased by two.
|
|
1964
|
+
{
|
|
1965
|
+
auto buf_ptr = NewAligned(block_size, ' ');
|
|
1966
|
+
Slice buf(buf_ptr.get(), block_size);
|
|
1967
|
+
srcfile->PrepareWrite(srcfile->GetFileSize(), block_size);
|
|
1968
|
+
ASSERT_OK(srcfile->Append(buf));
|
|
1969
|
+
srcfile->GetPreallocationStatus(&block_size, &last_allocated_block);
|
|
1970
|
+
ASSERT_EQ(last_allocated_block, 2UL);
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
// Write five more blocks at once, ensure we're where we need to be.
|
|
1974
|
+
{
|
|
1975
|
+
auto buf_ptr = NewAligned(block_size * 5, ' ');
|
|
1976
|
+
Slice buf = Slice(buf_ptr.get(), block_size * 5);
|
|
1977
|
+
srcfile->PrepareWrite(srcfile->GetFileSize(), buf.size());
|
|
1978
|
+
ASSERT_OK(srcfile->Append(buf));
|
|
1979
|
+
srcfile->GetPreallocationStatus(&block_size, &last_allocated_block);
|
|
1980
|
+
ASSERT_EQ(last_allocated_block, 7UL);
|
|
1981
|
+
}
|
|
1982
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace();
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
// Test that the two ways to get children file attributes (in bulk or
|
|
1986
|
+
// individually) behave consistently.
|
|
1987
|
+
TEST_P(EnvPosixTestWithParam, ConsistentChildrenAttributes) {
|
|
1988
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
|
1989
|
+
EnvOptions soptions;
|
|
1990
|
+
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
|
|
1991
|
+
const int kNumChildren = 10;
|
|
1992
|
+
|
|
1993
|
+
std::string data;
|
|
1994
|
+
std::string test_base_dir = test::PerThreadDBPath(env_, "env_test_chr_attr");
|
|
1995
|
+
env_->CreateDir(test_base_dir).PermitUncheckedError();
|
|
1996
|
+
for (int i = 0; i < kNumChildren; ++i) {
|
|
1997
|
+
const std::string path = test_base_dir + "/testfile_" + std::to_string(i);
|
|
1998
|
+
std::unique_ptr<WritableFile> file;
|
|
1999
|
+
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \
|
|
2000
|
+
!defined(OS_AIX) && !defined(OS_OPENBSD) && !defined(OS_FREEBSD)
|
|
2001
|
+
if (soptions.use_direct_writes) {
|
|
2002
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
|
|
2003
|
+
"NewWritableFile:O_DIRECT", [&](void* arg) {
|
|
2004
|
+
int* val = static_cast<int*>(arg);
|
|
2005
|
+
*val &= ~O_DIRECT;
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
#endif
|
|
2009
|
+
ASSERT_OK(env_->NewWritableFile(path, &file, soptions));
|
|
2010
|
+
auto buf_ptr = NewAligned(data.size(), 'T');
|
|
2011
|
+
Slice buf(buf_ptr.get(), data.size());
|
|
2012
|
+
ASSERT_OK(file->Append(buf));
|
|
2013
|
+
data.append(std::string(4096, 'T'));
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
std::vector<Env::FileAttributes> file_attrs;
|
|
2017
|
+
ASSERT_OK(env_->GetChildrenFileAttributes(test_base_dir, &file_attrs));
|
|
2018
|
+
for (int i = 0; i < kNumChildren; ++i) {
|
|
2019
|
+
const std::string name = "testfile_" + std::to_string(i);
|
|
2020
|
+
const std::string path = test_base_dir + "/" + name;
|
|
2021
|
+
|
|
2022
|
+
auto file_attrs_iter = std::find_if(
|
|
2023
|
+
file_attrs.begin(), file_attrs.end(),
|
|
2024
|
+
[&name](const Env::FileAttributes& fm) { return fm.name == name; });
|
|
2025
|
+
ASSERT_TRUE(file_attrs_iter != file_attrs.end());
|
|
2026
|
+
uint64_t size;
|
|
2027
|
+
ASSERT_OK(env_->GetFileSize(path, &size));
|
|
2028
|
+
ASSERT_EQ(size, 4096 * i);
|
|
2029
|
+
ASSERT_EQ(size, file_attrs_iter->size_bytes);
|
|
2030
|
+
}
|
|
2031
|
+
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace();
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
// Test that all WritableFileWrapper forwards all calls to WritableFile.
|
|
2035
|
+
TEST_P(EnvPosixTestWithParam, WritableFileWrapper) {
|
|
2036
|
+
class Base : public WritableFile {
|
|
2037
|
+
public:
|
|
2038
|
+
mutable int* step_;
|
|
2039
|
+
|
|
2040
|
+
void inc(int x) const { EXPECT_EQ(x, (*step_)++); }
|
|
2041
|
+
|
|
2042
|
+
explicit Base(int* step) : step_(step) { inc(0); }
|
|
2043
|
+
|
|
2044
|
+
Status Append(const Slice& /*data*/) override {
|
|
2045
|
+
inc(1);
|
|
2046
|
+
return Status::OK();
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
Status Append(
|
|
2050
|
+
const Slice& /*data*/,
|
|
2051
|
+
const DataVerificationInfo& /* verification_info */) override {
|
|
2052
|
+
inc(1);
|
|
2053
|
+
return Status::OK();
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
Status PositionedAppend(const Slice& /*data*/,
|
|
2057
|
+
uint64_t /*offset*/) override {
|
|
2058
|
+
inc(2);
|
|
2059
|
+
return Status::OK();
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
Status PositionedAppend(
|
|
2063
|
+
const Slice& /*data*/, uint64_t /*offset*/,
|
|
2064
|
+
const DataVerificationInfo& /* verification_info */) override {
|
|
2065
|
+
inc(2);
|
|
2066
|
+
return Status::OK();
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
Status Truncate(uint64_t /*size*/) override {
|
|
2070
|
+
inc(3);
|
|
2071
|
+
return Status::OK();
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
Status Close() override {
|
|
2075
|
+
inc(4);
|
|
2076
|
+
return Status::OK();
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
Status Flush() override {
|
|
2080
|
+
inc(5);
|
|
2081
|
+
return Status::OK();
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
Status Sync() override {
|
|
2085
|
+
inc(6);
|
|
2086
|
+
return Status::OK();
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
Status Fsync() override {
|
|
2090
|
+
inc(7);
|
|
2091
|
+
return Status::OK();
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
bool IsSyncThreadSafe() const override {
|
|
2095
|
+
inc(8);
|
|
2096
|
+
return true;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
bool use_direct_io() const override {
|
|
2100
|
+
inc(9);
|
|
2101
|
+
return true;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
size_t GetRequiredBufferAlignment() const override {
|
|
2105
|
+
inc(10);
|
|
2106
|
+
return 0;
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
void SetIOPriority(Env::IOPriority /*pri*/) override { inc(11); }
|
|
2110
|
+
|
|
2111
|
+
Env::IOPriority GetIOPriority() override {
|
|
2112
|
+
inc(12);
|
|
2113
|
+
return Env::IOPriority::IO_LOW;
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
void SetWriteLifeTimeHint(Env::WriteLifeTimeHint /*hint*/) override {
|
|
2117
|
+
inc(13);
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
Env::WriteLifeTimeHint GetWriteLifeTimeHint() override {
|
|
2121
|
+
inc(14);
|
|
2122
|
+
return Env::WriteLifeTimeHint::WLTH_NOT_SET;
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
uint64_t GetFileSize() override {
|
|
2126
|
+
inc(15);
|
|
2127
|
+
return 0;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
void SetPreallocationBlockSize(size_t /*size*/) override { inc(16); }
|
|
2131
|
+
|
|
2132
|
+
void GetPreallocationStatus(size_t* /*block_size*/,
|
|
2133
|
+
size_t* /*last_allocated_block*/) override {
|
|
2134
|
+
inc(17);
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
size_t GetUniqueId(char* /*id*/, size_t /*max_size*/) const override {
|
|
2138
|
+
inc(18);
|
|
2139
|
+
return 0;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
Status InvalidateCache(size_t /*offset*/, size_t /*length*/) override {
|
|
2143
|
+
inc(19);
|
|
2144
|
+
return Status::OK();
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
Status RangeSync(uint64_t /*offset*/, uint64_t /*nbytes*/) override {
|
|
2148
|
+
inc(20);
|
|
2149
|
+
return Status::OK();
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
void PrepareWrite(size_t /*offset*/, size_t /*len*/) override { inc(21); }
|
|
2153
|
+
|
|
2154
|
+
Status Allocate(uint64_t /*offset*/, uint64_t /*len*/) override {
|
|
2155
|
+
inc(22);
|
|
2156
|
+
return Status::OK();
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
public:
|
|
2160
|
+
~Base() override { inc(23); }
|
|
2161
|
+
};
|
|
2162
|
+
|
|
2163
|
+
class Wrapper : public WritableFileWrapper {
|
|
2164
|
+
public:
|
|
2165
|
+
explicit Wrapper(WritableFile* target) : WritableFileWrapper(target) {}
|
|
2166
|
+
};
|
|
2167
|
+
|
|
2168
|
+
int step = 0;
|
|
2169
|
+
|
|
2170
|
+
{
|
|
2171
|
+
Base b(&step);
|
|
2172
|
+
Wrapper w(&b);
|
|
2173
|
+
ASSERT_OK(w.Append(Slice()));
|
|
2174
|
+
ASSERT_OK(w.PositionedAppend(Slice(), 0));
|
|
2175
|
+
ASSERT_OK(w.Truncate(0));
|
|
2176
|
+
ASSERT_OK(w.Close());
|
|
2177
|
+
ASSERT_OK(w.Flush());
|
|
2178
|
+
ASSERT_OK(w.Sync());
|
|
2179
|
+
ASSERT_OK(w.Fsync());
|
|
2180
|
+
w.IsSyncThreadSafe();
|
|
2181
|
+
w.use_direct_io();
|
|
2182
|
+
w.GetRequiredBufferAlignment();
|
|
2183
|
+
w.SetIOPriority(Env::IOPriority::IO_HIGH);
|
|
2184
|
+
w.GetIOPriority();
|
|
2185
|
+
w.SetWriteLifeTimeHint(Env::WriteLifeTimeHint::WLTH_NOT_SET);
|
|
2186
|
+
w.GetWriteLifeTimeHint();
|
|
2187
|
+
w.GetFileSize();
|
|
2188
|
+
w.SetPreallocationBlockSize(0);
|
|
2189
|
+
w.GetPreallocationStatus(nullptr, nullptr);
|
|
2190
|
+
w.GetUniqueId(nullptr, 0);
|
|
2191
|
+
ASSERT_OK(w.InvalidateCache(0, 0));
|
|
2192
|
+
ASSERT_OK(w.RangeSync(0, 0));
|
|
2193
|
+
w.PrepareWrite(0, 0);
|
|
2194
|
+
ASSERT_OK(w.Allocate(0, 0));
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
EXPECT_EQ(24, step);
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
TEST_P(EnvPosixTestWithParam, PosixRandomRWFile) {
|
|
2201
|
+
const std::string path = test::PerThreadDBPath(env_, "random_rw_file");
|
|
2202
|
+
|
|
2203
|
+
env_->DeleteFile(path).PermitUncheckedError();
|
|
2204
|
+
|
|
2205
|
+
std::unique_ptr<RandomRWFile> file;
|
|
2206
|
+
|
|
2207
|
+
// Cannot open non-existing file.
|
|
2208
|
+
ASSERT_NOK(env_->NewRandomRWFile(path, &file, EnvOptions()));
|
|
2209
|
+
|
|
2210
|
+
// Create the file using WritableFile
|
|
2211
|
+
{
|
|
2212
|
+
std::unique_ptr<WritableFile> wf;
|
|
2213
|
+
ASSERT_OK(env_->NewWritableFile(path, &wf, EnvOptions()));
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
ASSERT_OK(env_->NewRandomRWFile(path, &file, EnvOptions()));
|
|
2217
|
+
|
|
2218
|
+
char buf[10000];
|
|
2219
|
+
Slice read_res;
|
|
2220
|
+
|
|
2221
|
+
ASSERT_OK(file->Write(0, "ABCD"));
|
|
2222
|
+
ASSERT_OK(file->Read(0, 10, &read_res, buf));
|
|
2223
|
+
ASSERT_EQ(read_res.ToString(), "ABCD");
|
|
2224
|
+
|
|
2225
|
+
ASSERT_OK(file->Write(2, "XXXX"));
|
|
2226
|
+
ASSERT_OK(file->Read(0, 10, &read_res, buf));
|
|
2227
|
+
ASSERT_EQ(read_res.ToString(), "ABXXXX");
|
|
2228
|
+
|
|
2229
|
+
ASSERT_OK(file->Write(10, "ZZZ"));
|
|
2230
|
+
ASSERT_OK(file->Read(10, 10, &read_res, buf));
|
|
2231
|
+
ASSERT_EQ(read_res.ToString(), "ZZZ");
|
|
2232
|
+
|
|
2233
|
+
ASSERT_OK(file->Write(11, "Y"));
|
|
2234
|
+
ASSERT_OK(file->Read(10, 10, &read_res, buf));
|
|
2235
|
+
ASSERT_EQ(read_res.ToString(), "ZYZ");
|
|
2236
|
+
|
|
2237
|
+
ASSERT_OK(file->Write(200, "FFFFF"));
|
|
2238
|
+
ASSERT_OK(file->Read(200, 10, &read_res, buf));
|
|
2239
|
+
ASSERT_EQ(read_res.ToString(), "FFFFF");
|
|
2240
|
+
|
|
2241
|
+
ASSERT_OK(file->Write(205, "XXXX"));
|
|
2242
|
+
ASSERT_OK(file->Read(200, 10, &read_res, buf));
|
|
2243
|
+
ASSERT_EQ(read_res.ToString(), "FFFFFXXXX");
|
|
2244
|
+
|
|
2245
|
+
ASSERT_OK(file->Write(5, "QQQQ"));
|
|
2246
|
+
ASSERT_OK(file->Read(0, 9, &read_res, buf));
|
|
2247
|
+
ASSERT_EQ(read_res.ToString(), "ABXXXQQQQ");
|
|
2248
|
+
|
|
2249
|
+
ASSERT_OK(file->Read(2, 4, &read_res, buf));
|
|
2250
|
+
ASSERT_EQ(read_res.ToString(), "XXXQ");
|
|
2251
|
+
|
|
2252
|
+
// Close file and reopen it
|
|
2253
|
+
ASSERT_OK(file->Close());
|
|
2254
|
+
ASSERT_OK(env_->NewRandomRWFile(path, &file, EnvOptions()));
|
|
2255
|
+
|
|
2256
|
+
ASSERT_OK(file->Read(0, 9, &read_res, buf));
|
|
2257
|
+
ASSERT_EQ(read_res.ToString(), "ABXXXQQQQ");
|
|
2258
|
+
|
|
2259
|
+
ASSERT_OK(file->Read(10, 3, &read_res, buf));
|
|
2260
|
+
ASSERT_EQ(read_res.ToString(), "ZYZ");
|
|
2261
|
+
|
|
2262
|
+
ASSERT_OK(file->Read(200, 9, &read_res, buf));
|
|
2263
|
+
ASSERT_EQ(read_res.ToString(), "FFFFFXXXX");
|
|
2264
|
+
|
|
2265
|
+
ASSERT_OK(file->Write(4, "TTTTTTTTTTTTTTTT"));
|
|
2266
|
+
ASSERT_OK(file->Read(0, 10, &read_res, buf));
|
|
2267
|
+
ASSERT_EQ(read_res.ToString(), "ABXXTTTTTT");
|
|
2268
|
+
|
|
2269
|
+
// Clean up
|
|
2270
|
+
ASSERT_OK(env_->DeleteFile(path));
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
class RandomRWFileWithMirrorString {
|
|
2274
|
+
public:
|
|
2275
|
+
explicit RandomRWFileWithMirrorString(RandomRWFile* _file) : file_(_file) {}
|
|
2276
|
+
|
|
2277
|
+
void Write(size_t offset, const std::string& data) {
|
|
2278
|
+
// Write to mirror string
|
|
2279
|
+
StringWrite(offset, data);
|
|
2280
|
+
|
|
2281
|
+
// Write to file
|
|
2282
|
+
Status s = file_->Write(offset, data);
|
|
2283
|
+
ASSERT_OK(s) << s.ToString();
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
void Read(size_t offset = 0, size_t n = 1000000) {
|
|
2287
|
+
Slice str_res(nullptr, 0);
|
|
2288
|
+
if (offset < file_mirror_.size()) {
|
|
2289
|
+
size_t str_res_sz = std::min(file_mirror_.size() - offset, n);
|
|
2290
|
+
str_res = Slice(file_mirror_.data() + offset, str_res_sz);
|
|
2291
|
+
StopSliceAtNull(&str_res);
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
Slice file_res;
|
|
2295
|
+
Status s = file_->Read(offset, n, &file_res, buf_);
|
|
2296
|
+
ASSERT_OK(s) << s.ToString();
|
|
2297
|
+
StopSliceAtNull(&file_res);
|
|
2298
|
+
|
|
2299
|
+
ASSERT_EQ(str_res.ToString(), file_res.ToString()) << offset << " " << n;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
void SetFile(RandomRWFile* _file) { file_ = _file; }
|
|
2303
|
+
|
|
2304
|
+
private:
|
|
2305
|
+
void StringWrite(size_t offset, const std::string& src) {
|
|
2306
|
+
if (offset + src.size() > file_mirror_.size()) {
|
|
2307
|
+
file_mirror_.resize(offset + src.size(), '\0');
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
char* pos = const_cast<char*>(file_mirror_.data() + offset);
|
|
2311
|
+
memcpy(pos, src.data(), src.size());
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
void StopSliceAtNull(Slice* slc) {
|
|
2315
|
+
for (size_t i = 0; i < slc->size(); i++) {
|
|
2316
|
+
if ((*slc)[i] == '\0') {
|
|
2317
|
+
*slc = Slice(slc->data(), i);
|
|
2318
|
+
break;
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
char buf_[10000];
|
|
2324
|
+
RandomRWFile* file_;
|
|
2325
|
+
std::string file_mirror_;
|
|
2326
|
+
};
|
|
2327
|
+
|
|
2328
|
+
TEST_P(EnvPosixTestWithParam, PosixRandomRWFileRandomized) {
|
|
2329
|
+
const std::string path = test::PerThreadDBPath(env_, "random_rw_file_rand");
|
|
2330
|
+
env_->DeleteFile(path).PermitUncheckedError();
|
|
2331
|
+
|
|
2332
|
+
std::unique_ptr<RandomRWFile> file;
|
|
2333
|
+
|
|
2334
|
+
#ifdef OS_LINUX
|
|
2335
|
+
// Cannot open non-existing file.
|
|
2336
|
+
ASSERT_NOK(env_->NewRandomRWFile(path, &file, EnvOptions()));
|
|
2337
|
+
#endif
|
|
2338
|
+
|
|
2339
|
+
// Create the file using WritableFile
|
|
2340
|
+
{
|
|
2341
|
+
std::unique_ptr<WritableFile> wf;
|
|
2342
|
+
ASSERT_OK(env_->NewWritableFile(path, &wf, EnvOptions()));
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
ASSERT_OK(env_->NewRandomRWFile(path, &file, EnvOptions()));
|
|
2346
|
+
RandomRWFileWithMirrorString file_with_mirror(file.get());
|
|
2347
|
+
|
|
2348
|
+
Random rnd(301);
|
|
2349
|
+
std::string buf;
|
|
2350
|
+
for (int i = 0; i < 10000; i++) {
|
|
2351
|
+
// Genrate random data
|
|
2352
|
+
buf = rnd.RandomString(10);
|
|
2353
|
+
|
|
2354
|
+
// Pick random offset for write
|
|
2355
|
+
size_t write_off = rnd.Next() % 1000;
|
|
2356
|
+
file_with_mirror.Write(write_off, buf);
|
|
2357
|
+
|
|
2358
|
+
// Pick random offset for read
|
|
2359
|
+
size_t read_off = rnd.Next() % 1000;
|
|
2360
|
+
size_t read_sz = rnd.Next() % 20;
|
|
2361
|
+
file_with_mirror.Read(read_off, read_sz);
|
|
2362
|
+
|
|
2363
|
+
if (i % 500 == 0) {
|
|
2364
|
+
// Reopen the file every 500 iters
|
|
2365
|
+
ASSERT_OK(env_->NewRandomRWFile(path, &file, EnvOptions()));
|
|
2366
|
+
file_with_mirror.SetFile(file.get());
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
// clean up
|
|
2371
|
+
ASSERT_OK(env_->DeleteFile(path));
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
class TestEnv : public EnvWrapper {
|
|
2375
|
+
public:
|
|
2376
|
+
explicit TestEnv() : EnvWrapper(Env::Default()), close_count(0) {}
|
|
2377
|
+
const char* Name() const override { return "TestEnv"; }
|
|
2378
|
+
class TestLogger : public Logger {
|
|
2379
|
+
public:
|
|
2380
|
+
using Logger::Logv;
|
|
2381
|
+
explicit TestLogger(TestEnv* env_ptr) : Logger() { env = env_ptr; }
|
|
2382
|
+
~TestLogger() override {
|
|
2383
|
+
if (!closed_) {
|
|
2384
|
+
Status s = CloseHelper();
|
|
2385
|
+
s.PermitUncheckedError();
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
void Logv(const char* /*format*/, va_list /*ap*/) override {}
|
|
2389
|
+
|
|
2390
|
+
protected:
|
|
2391
|
+
Status CloseImpl() override { return CloseHelper(); }
|
|
2392
|
+
|
|
2393
|
+
private:
|
|
2394
|
+
Status CloseHelper() {
|
|
2395
|
+
env->CloseCountInc();
|
|
2396
|
+
return Status::OK();
|
|
2397
|
+
}
|
|
2398
|
+
TestEnv* env;
|
|
2399
|
+
};
|
|
2400
|
+
|
|
2401
|
+
void CloseCountInc() { close_count++; }
|
|
2402
|
+
|
|
2403
|
+
int GetCloseCount() { return close_count; }
|
|
2404
|
+
|
|
2405
|
+
Status NewLogger(const std::string& /*fname*/,
|
|
2406
|
+
std::shared_ptr<Logger>* result) override {
|
|
2407
|
+
result->reset(new TestLogger(this));
|
|
2408
|
+
return Status::OK();
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
private:
|
|
2412
|
+
int close_count;
|
|
2413
|
+
};
|
|
2414
|
+
|
|
2415
|
+
class EnvTest : public testing::Test {
|
|
2416
|
+
public:
|
|
2417
|
+
EnvTest() : test_directory_(test::PerThreadDBPath("env_test")) {}
|
|
2418
|
+
|
|
2419
|
+
protected:
|
|
2420
|
+
const std::string test_directory_;
|
|
2421
|
+
};
|
|
2422
|
+
|
|
2423
|
+
TEST_F(EnvTest, Close) {
|
|
2424
|
+
TestEnv* env = new TestEnv();
|
|
2425
|
+
std::shared_ptr<Logger> logger;
|
|
2426
|
+
Status s;
|
|
2427
|
+
|
|
2428
|
+
s = env->NewLogger("", &logger);
|
|
2429
|
+
ASSERT_OK(s);
|
|
2430
|
+
ASSERT_OK(logger.get()->Close());
|
|
2431
|
+
ASSERT_EQ(env->GetCloseCount(), 1);
|
|
2432
|
+
// Call Close() again. CloseHelper() should not be called again
|
|
2433
|
+
ASSERT_OK(logger.get()->Close());
|
|
2434
|
+
ASSERT_EQ(env->GetCloseCount(), 1);
|
|
2435
|
+
logger.reset();
|
|
2436
|
+
ASSERT_EQ(env->GetCloseCount(), 1);
|
|
2437
|
+
|
|
2438
|
+
s = env->NewLogger("", &logger);
|
|
2439
|
+
ASSERT_OK(s);
|
|
2440
|
+
logger.reset();
|
|
2441
|
+
ASSERT_EQ(env->GetCloseCount(), 2);
|
|
2442
|
+
|
|
2443
|
+
delete env;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
class LogvWithInfoLogLevelLogger : public Logger {
|
|
2447
|
+
public:
|
|
2448
|
+
using Logger::Logv;
|
|
2449
|
+
void Logv(const InfoLogLevel /* log_level */, const char* /* format */,
|
|
2450
|
+
va_list /* ap */) override {}
|
|
2451
|
+
};
|
|
2452
|
+
|
|
2453
|
+
TEST_F(EnvTest, LogvWithInfoLogLevel) {
|
|
2454
|
+
// Verifies the log functions work on a `Logger` that only overrides the
|
|
2455
|
+
// `Logv()` overload including `InfoLogLevel`.
|
|
2456
|
+
const std::string kSampleMessage("sample log message");
|
|
2457
|
+
LogvWithInfoLogLevelLogger logger;
|
|
2458
|
+
ROCKS_LOG_HEADER(&logger, "%s", kSampleMessage.c_str());
|
|
2459
|
+
ROCKS_LOG_DEBUG(&logger, "%s", kSampleMessage.c_str());
|
|
2460
|
+
ROCKS_LOG_INFO(&logger, "%s", kSampleMessage.c_str());
|
|
2461
|
+
ROCKS_LOG_WARN(&logger, "%s", kSampleMessage.c_str());
|
|
2462
|
+
ROCKS_LOG_ERROR(&logger, "%s", kSampleMessage.c_str());
|
|
2463
|
+
ROCKS_LOG_FATAL(&logger, "%s", kSampleMessage.c_str());
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
INSTANTIATE_TEST_CASE_P(DefaultEnvWithoutDirectIO, EnvPosixTestWithParam,
|
|
2467
|
+
::testing::Values(std::pair<Env*, bool>(Env::Default(),
|
|
2468
|
+
false)));
|
|
2469
|
+
INSTANTIATE_TEST_CASE_P(DefaultEnvWithDirectIO, EnvPosixTestWithParam,
|
|
2470
|
+
::testing::Values(std::pair<Env*, bool>(Env::Default(),
|
|
2471
|
+
true)));
|
|
2472
|
+
|
|
2473
|
+
#if !defined(OS_WIN)
|
|
2474
|
+
static Env* GetChrootEnv() {
|
|
2475
|
+
static std::unique_ptr<Env> chroot_env(
|
|
2476
|
+
NewChrootEnv(Env::Default(), test::TmpDir(Env::Default())));
|
|
2477
|
+
return chroot_env.get();
|
|
2478
|
+
}
|
|
2479
|
+
INSTANTIATE_TEST_CASE_P(ChrootEnvWithoutDirectIO, EnvPosixTestWithParam,
|
|
2480
|
+
::testing::Values(std::pair<Env*, bool>(GetChrootEnv(),
|
|
2481
|
+
false)));
|
|
2482
|
+
INSTANTIATE_TEST_CASE_P(ChrootEnvWithDirectIO, EnvPosixTestWithParam,
|
|
2483
|
+
::testing::Values(std::pair<Env*, bool>(GetChrootEnv(),
|
|
2484
|
+
true)));
|
|
2485
|
+
#endif // !defined(OS_WIN)
|
|
2486
|
+
|
|
2487
|
+
class EnvFSTestWithParam
|
|
2488
|
+
: public ::testing::Test,
|
|
2489
|
+
public ::testing::WithParamInterface<std::tuple<bool, bool, bool>> {
|
|
2490
|
+
public:
|
|
2491
|
+
EnvFSTestWithParam() {
|
|
2492
|
+
bool env_non_null = std::get<0>(GetParam());
|
|
2493
|
+
bool env_default = std::get<1>(GetParam());
|
|
2494
|
+
bool fs_default = std::get<2>(GetParam());
|
|
2495
|
+
|
|
2496
|
+
env_ = env_non_null ? (env_default ? Env::Default() : nullptr) : nullptr;
|
|
2497
|
+
fs_ = fs_default
|
|
2498
|
+
? FileSystem::Default()
|
|
2499
|
+
: std::make_shared<FaultInjectionTestFS>(FileSystem::Default());
|
|
2500
|
+
if (env_non_null && env_default && !fs_default) {
|
|
2501
|
+
env_ptr_ = NewCompositeEnv(fs_);
|
|
2502
|
+
}
|
|
2503
|
+
if (env_non_null && !env_default && fs_default) {
|
|
2504
|
+
env_ptr_ =
|
|
2505
|
+
std::unique_ptr<Env>(new FaultInjectionTestEnv(Env::Default()));
|
|
2506
|
+
fs_.reset();
|
|
2507
|
+
}
|
|
2508
|
+
if (env_non_null && !env_default && !fs_default) {
|
|
2509
|
+
env_ptr_.reset(new FaultInjectionTestEnv(Env::Default()));
|
|
2510
|
+
composite_env_ptr_.reset(new CompositeEnvWrapper(env_ptr_.get(), fs_));
|
|
2511
|
+
env_ = composite_env_ptr_.get();
|
|
2512
|
+
} else {
|
|
2513
|
+
env_ = env_ptr_.get();
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
dbname1_ = test::PerThreadDBPath("env_fs_test1");
|
|
2517
|
+
dbname2_ = test::PerThreadDBPath("env_fs_test2");
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
~EnvFSTestWithParam() = default;
|
|
2521
|
+
|
|
2522
|
+
Env* env_;
|
|
2523
|
+
std::unique_ptr<Env> env_ptr_;
|
|
2524
|
+
std::unique_ptr<Env> composite_env_ptr_;
|
|
2525
|
+
std::shared_ptr<FileSystem> fs_;
|
|
2526
|
+
std::string dbname1_;
|
|
2527
|
+
std::string dbname2_;
|
|
2528
|
+
};
|
|
2529
|
+
|
|
2530
|
+
TEST_P(EnvFSTestWithParam, OptionsTest) {
|
|
2531
|
+
Options opts;
|
|
2532
|
+
opts.env = env_;
|
|
2533
|
+
opts.create_if_missing = true;
|
|
2534
|
+
std::string dbname = dbname1_;
|
|
2535
|
+
|
|
2536
|
+
if (env_) {
|
|
2537
|
+
if (fs_) {
|
|
2538
|
+
ASSERT_EQ(fs_.get(), env_->GetFileSystem().get());
|
|
2539
|
+
} else {
|
|
2540
|
+
ASSERT_NE(FileSystem::Default().get(), env_->GetFileSystem().get());
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
for (int i = 0; i < 2; ++i) {
|
|
2544
|
+
DB* db;
|
|
2545
|
+
Status s = DB::Open(opts, dbname, &db);
|
|
2546
|
+
ASSERT_OK(s);
|
|
2547
|
+
|
|
2548
|
+
WriteOptions wo;
|
|
2549
|
+
ASSERT_OK(db->Put(wo, "a", "a"));
|
|
2550
|
+
ASSERT_OK(db->Flush(FlushOptions()));
|
|
2551
|
+
ASSERT_OK(db->Put(wo, "b", "b"));
|
|
2552
|
+
ASSERT_OK(db->Flush(FlushOptions()));
|
|
2553
|
+
ASSERT_OK(db->CompactRange(CompactRangeOptions(), nullptr, nullptr));
|
|
2554
|
+
|
|
2555
|
+
std::string val;
|
|
2556
|
+
ASSERT_OK(db->Get(ReadOptions(), "a", &val));
|
|
2557
|
+
ASSERT_EQ("a", val);
|
|
2558
|
+
ASSERT_OK(db->Get(ReadOptions(), "b", &val));
|
|
2559
|
+
ASSERT_EQ("b", val);
|
|
2560
|
+
|
|
2561
|
+
ASSERT_OK(db->Close());
|
|
2562
|
+
delete db;
|
|
2563
|
+
ASSERT_OK(DestroyDB(dbname, opts));
|
|
2564
|
+
|
|
2565
|
+
dbname = dbname2_;
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
// The parameters are as follows -
|
|
2570
|
+
// 1. True means Options::env is non-null, false means null
|
|
2571
|
+
// 2. True means use Env::Default, false means custom
|
|
2572
|
+
// 3. True means use FileSystem::Default, false means custom
|
|
2573
|
+
INSTANTIATE_TEST_CASE_P(EnvFSTest, EnvFSTestWithParam,
|
|
2574
|
+
::testing::Combine(::testing::Bool(), ::testing::Bool(),
|
|
2575
|
+
::testing::Bool()));
|
|
2576
|
+
// This test ensures that default Env and those allocated by
|
|
2577
|
+
// NewCompositeEnv() all share the same threadpool
|
|
2578
|
+
TEST_F(EnvTest, MultipleCompositeEnv) {
|
|
2579
|
+
std::shared_ptr<FaultInjectionTestFS> fs1 =
|
|
2580
|
+
std::make_shared<FaultInjectionTestFS>(FileSystem::Default());
|
|
2581
|
+
std::shared_ptr<FaultInjectionTestFS> fs2 =
|
|
2582
|
+
std::make_shared<FaultInjectionTestFS>(FileSystem::Default());
|
|
2583
|
+
std::unique_ptr<Env> env1 = NewCompositeEnv(fs1);
|
|
2584
|
+
std::unique_ptr<Env> env2 = NewCompositeEnv(fs2);
|
|
2585
|
+
Env::Default()->SetBackgroundThreads(8, Env::HIGH);
|
|
2586
|
+
Env::Default()->SetBackgroundThreads(16, Env::LOW);
|
|
2587
|
+
ASSERT_EQ(env1->GetBackgroundThreads(Env::LOW), 16);
|
|
2588
|
+
ASSERT_EQ(env1->GetBackgroundThreads(Env::HIGH), 8);
|
|
2589
|
+
ASSERT_EQ(env2->GetBackgroundThreads(Env::LOW), 16);
|
|
2590
|
+
ASSERT_EQ(env2->GetBackgroundThreads(Env::HIGH), 8);
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
TEST_F(EnvTest, IsDirectory) {
|
|
2594
|
+
Status s = Env::Default()->CreateDirIfMissing(test_directory_);
|
|
2595
|
+
ASSERT_OK(s);
|
|
2596
|
+
const std::string test_sub_dir = test_directory_ + "sub1";
|
|
2597
|
+
const std::string test_file_path = test_directory_ + "file1";
|
|
2598
|
+
ASSERT_OK(Env::Default()->CreateDirIfMissing(test_sub_dir));
|
|
2599
|
+
bool is_dir = false;
|
|
2600
|
+
ASSERT_OK(Env::Default()->IsDirectory(test_sub_dir, &is_dir));
|
|
2601
|
+
ASSERT_TRUE(is_dir);
|
|
2602
|
+
{
|
|
2603
|
+
std::unique_ptr<FSWritableFile> wfile;
|
|
2604
|
+
s = Env::Default()->GetFileSystem()->NewWritableFile(
|
|
2605
|
+
test_file_path, FileOptions(), &wfile, /*dbg=*/nullptr);
|
|
2606
|
+
ASSERT_OK(s);
|
|
2607
|
+
std::unique_ptr<WritableFileWriter> fwriter;
|
|
2608
|
+
fwriter.reset(new WritableFileWriter(std::move(wfile), test_file_path,
|
|
2609
|
+
FileOptions(),
|
|
2610
|
+
SystemClock::Default().get()));
|
|
2611
|
+
constexpr char buf[] = "test";
|
|
2612
|
+
s = fwriter->Append(buf);
|
|
2613
|
+
ASSERT_OK(s);
|
|
2614
|
+
}
|
|
2615
|
+
ASSERT_OK(Env::Default()->IsDirectory(test_file_path, &is_dir));
|
|
2616
|
+
ASSERT_FALSE(is_dir);
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
TEST_F(EnvTest, EnvWriteVerificationTest) {
|
|
2620
|
+
Status s = Env::Default()->CreateDirIfMissing(test_directory_);
|
|
2621
|
+
const std::string test_file_path = test_directory_ + "file1";
|
|
2622
|
+
ASSERT_OK(s);
|
|
2623
|
+
std::shared_ptr<FaultInjectionTestFS> fault_fs(
|
|
2624
|
+
new FaultInjectionTestFS(FileSystem::Default()));
|
|
2625
|
+
fault_fs->SetChecksumHandoffFuncType(ChecksumType::kCRC32c);
|
|
2626
|
+
std::unique_ptr<Env> fault_fs_env(NewCompositeEnv(fault_fs));
|
|
2627
|
+
std::unique_ptr<WritableFile> file;
|
|
2628
|
+
s = fault_fs_env->NewWritableFile(test_file_path, &file, EnvOptions());
|
|
2629
|
+
ASSERT_OK(s);
|
|
2630
|
+
|
|
2631
|
+
DataVerificationInfo v_info;
|
|
2632
|
+
std::string test_data = "test";
|
|
2633
|
+
std::string checksum;
|
|
2634
|
+
uint32_t v_crc32c = crc32c::Extend(0, test_data.c_str(), test_data.size());
|
|
2635
|
+
PutFixed32(&checksum, v_crc32c);
|
|
2636
|
+
v_info.checksum = Slice(checksum);
|
|
2637
|
+
s = file->Append(Slice(test_data), v_info);
|
|
2638
|
+
ASSERT_OK(s);
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
class CreateEnvTest : public testing::Test {
|
|
2642
|
+
public:
|
|
2643
|
+
CreateEnvTest() {
|
|
2644
|
+
config_options_.ignore_unknown_options = false;
|
|
2645
|
+
config_options_.ignore_unsupported_options = false;
|
|
2646
|
+
}
|
|
2647
|
+
ConfigOptions config_options_;
|
|
2648
|
+
};
|
|
2649
|
+
|
|
2650
|
+
TEST_F(CreateEnvTest, LoadCTRProvider) {
|
|
2651
|
+
config_options_.invoke_prepare_options = false;
|
|
2652
|
+
std::string CTR = CTREncryptionProvider::kClassName();
|
|
2653
|
+
std::shared_ptr<EncryptionProvider> provider;
|
|
2654
|
+
// Test a provider with no cipher
|
|
2655
|
+
ASSERT_OK(
|
|
2656
|
+
EncryptionProvider::CreateFromString(config_options_, CTR, &provider));
|
|
2657
|
+
ASSERT_NE(provider, nullptr);
|
|
2658
|
+
ASSERT_EQ(provider->Name(), CTR);
|
|
2659
|
+
ASSERT_NOK(provider->PrepareOptions(config_options_));
|
|
2660
|
+
ASSERT_NOK(provider->ValidateOptions(DBOptions(), ColumnFamilyOptions()));
|
|
2661
|
+
auto cipher = provider->GetOptions<std::shared_ptr<BlockCipher>>("Cipher");
|
|
2662
|
+
ASSERT_NE(cipher, nullptr);
|
|
2663
|
+
ASSERT_EQ(cipher->get(), nullptr);
|
|
2664
|
+
provider.reset();
|
|
2665
|
+
|
|
2666
|
+
ASSERT_OK(EncryptionProvider::CreateFromString(config_options_,
|
|
2667
|
+
CTR + "://test", &provider));
|
|
2668
|
+
ASSERT_NE(provider, nullptr);
|
|
2669
|
+
ASSERT_EQ(provider->Name(), CTR);
|
|
2670
|
+
ASSERT_OK(provider->PrepareOptions(config_options_));
|
|
2671
|
+
ASSERT_OK(provider->ValidateOptions(DBOptions(), ColumnFamilyOptions()));
|
|
2672
|
+
cipher = provider->GetOptions<std::shared_ptr<BlockCipher>>("Cipher");
|
|
2673
|
+
ASSERT_NE(cipher, nullptr);
|
|
2674
|
+
ASSERT_NE(cipher->get(), nullptr);
|
|
2675
|
+
ASSERT_STREQ(cipher->get()->Name(), "ROT13");
|
|
2676
|
+
provider.reset();
|
|
2677
|
+
|
|
2678
|
+
ASSERT_OK(EncryptionProvider::CreateFromString(config_options_, "1://test",
|
|
2679
|
+
&provider));
|
|
2680
|
+
ASSERT_NE(provider, nullptr);
|
|
2681
|
+
ASSERT_EQ(provider->Name(), CTR);
|
|
2682
|
+
ASSERT_OK(provider->PrepareOptions(config_options_));
|
|
2683
|
+
ASSERT_OK(provider->ValidateOptions(DBOptions(), ColumnFamilyOptions()));
|
|
2684
|
+
cipher = provider->GetOptions<std::shared_ptr<BlockCipher>>("Cipher");
|
|
2685
|
+
ASSERT_NE(cipher, nullptr);
|
|
2686
|
+
ASSERT_NE(cipher->get(), nullptr);
|
|
2687
|
+
ASSERT_STREQ(cipher->get()->Name(), "ROT13");
|
|
2688
|
+
provider.reset();
|
|
2689
|
+
|
|
2690
|
+
ASSERT_OK(EncryptionProvider::CreateFromString(
|
|
2691
|
+
config_options_, "id=" + CTR + "; cipher=ROT13", &provider));
|
|
2692
|
+
ASSERT_NE(provider, nullptr);
|
|
2693
|
+
ASSERT_EQ(provider->Name(), CTR);
|
|
2694
|
+
cipher = provider->GetOptions<std::shared_ptr<BlockCipher>>("Cipher");
|
|
2695
|
+
ASSERT_NE(cipher, nullptr);
|
|
2696
|
+
ASSERT_NE(cipher->get(), nullptr);
|
|
2697
|
+
ASSERT_STREQ(cipher->get()->Name(), "ROT13");
|
|
2698
|
+
provider.reset();
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
TEST_F(CreateEnvTest, LoadROT13Cipher) {
|
|
2702
|
+
std::shared_ptr<BlockCipher> cipher;
|
|
2703
|
+
// Test a provider with no cipher
|
|
2704
|
+
ASSERT_OK(BlockCipher::CreateFromString(config_options_, "ROT13", &cipher));
|
|
2705
|
+
ASSERT_NE(cipher, nullptr);
|
|
2706
|
+
ASSERT_STREQ(cipher->Name(), "ROT13");
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
TEST_F(CreateEnvTest, CreateDefaultSystemClock) {
|
|
2710
|
+
std::shared_ptr<SystemClock> clock, copy;
|
|
2711
|
+
ASSERT_OK(SystemClock::CreateFromString(config_options_,
|
|
2712
|
+
SystemClock::kDefaultName(), &clock));
|
|
2713
|
+
ASSERT_NE(clock, nullptr);
|
|
2714
|
+
ASSERT_EQ(clock, SystemClock::Default());
|
|
2715
|
+
std::string opts_str = clock->ToString(config_options_);
|
|
2716
|
+
std::string mismatch;
|
|
2717
|
+
ASSERT_OK(SystemClock::CreateFromString(config_options_, opts_str, ©));
|
|
2718
|
+
ASSERT_TRUE(clock->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
TEST_F(CreateEnvTest, CreateMockSystemClock) {
|
|
2722
|
+
std::shared_ptr<SystemClock> mock, copy;
|
|
2723
|
+
|
|
2724
|
+
config_options_.registry->AddLibrary("test")->AddFactory<SystemClock>(
|
|
2725
|
+
MockSystemClock::kClassName(),
|
|
2726
|
+
[](const std::string& /*uri*/, std::unique_ptr<SystemClock>* guard,
|
|
2727
|
+
std::string* /* errmsg */) {
|
|
2728
|
+
guard->reset(new MockSystemClock(nullptr));
|
|
2729
|
+
return guard->get();
|
|
2730
|
+
});
|
|
2731
|
+
ASSERT_OK(SystemClock::CreateFromString(
|
|
2732
|
+
config_options_, EmulatedSystemClock::kClassName(), &mock));
|
|
2733
|
+
ASSERT_NE(mock, nullptr);
|
|
2734
|
+
ASSERT_STREQ(mock->Name(), EmulatedSystemClock::kClassName());
|
|
2735
|
+
ASSERT_EQ(mock->Inner(), SystemClock::Default().get());
|
|
2736
|
+
std::string opts_str = mock->ToString(config_options_);
|
|
2737
|
+
std::string mismatch;
|
|
2738
|
+
ASSERT_OK(SystemClock::CreateFromString(config_options_, opts_str, ©));
|
|
2739
|
+
ASSERT_TRUE(mock->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2740
|
+
|
|
2741
|
+
std::string id = std::string("id=") + EmulatedSystemClock::kClassName() +
|
|
2742
|
+
";target=" + MockSystemClock::kClassName();
|
|
2743
|
+
|
|
2744
|
+
ASSERT_OK(SystemClock::CreateFromString(config_options_, id, &mock));
|
|
2745
|
+
ASSERT_NE(mock, nullptr);
|
|
2746
|
+
ASSERT_STREQ(mock->Name(), EmulatedSystemClock::kClassName());
|
|
2747
|
+
ASSERT_NE(mock->Inner(), nullptr);
|
|
2748
|
+
ASSERT_STREQ(mock->Inner()->Name(), MockSystemClock::kClassName());
|
|
2749
|
+
ASSERT_EQ(mock->Inner()->Inner(), SystemClock::Default().get());
|
|
2750
|
+
opts_str = mock->ToString(config_options_);
|
|
2751
|
+
ASSERT_OK(SystemClock::CreateFromString(config_options_, opts_str, ©));
|
|
2752
|
+
ASSERT_TRUE(mock->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2753
|
+
ASSERT_OK(SystemClock::CreateFromString(
|
|
2754
|
+
config_options_, EmulatedSystemClock::kClassName(), &mock));
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
TEST_F(CreateEnvTest, CreateReadOnlyFileSystem) {
|
|
2758
|
+
std::shared_ptr<FileSystem> fs, copy;
|
|
2759
|
+
|
|
2760
|
+
ASSERT_OK(FileSystem::CreateFromString(
|
|
2761
|
+
config_options_, ReadOnlyFileSystem::kClassName(), &fs));
|
|
2762
|
+
ASSERT_NE(fs, nullptr);
|
|
2763
|
+
ASSERT_STREQ(fs->Name(), ReadOnlyFileSystem::kClassName());
|
|
2764
|
+
ASSERT_EQ(fs->Inner(), FileSystem::Default().get());
|
|
2765
|
+
|
|
2766
|
+
std::string opts_str = fs->ToString(config_options_);
|
|
2767
|
+
std::string mismatch;
|
|
2768
|
+
|
|
2769
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2770
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2771
|
+
|
|
2772
|
+
ASSERT_OK(FileSystem::CreateFromString(
|
|
2773
|
+
config_options_,
|
|
2774
|
+
std::string("id=") + ReadOnlyFileSystem::kClassName() +
|
|
2775
|
+
"; target=" + TimedFileSystem::kClassName(),
|
|
2776
|
+
&fs));
|
|
2777
|
+
ASSERT_NE(fs, nullptr);
|
|
2778
|
+
opts_str = fs->ToString(config_options_);
|
|
2779
|
+
ASSERT_STREQ(fs->Name(), ReadOnlyFileSystem::kClassName());
|
|
2780
|
+
ASSERT_NE(fs->Inner(), nullptr);
|
|
2781
|
+
ASSERT_STREQ(fs->Inner()->Name(), TimedFileSystem::kClassName());
|
|
2782
|
+
ASSERT_EQ(fs->Inner()->Inner(), FileSystem::Default().get());
|
|
2783
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2784
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
TEST_F(CreateEnvTest, CreateTimedFileSystem) {
|
|
2788
|
+
std::shared_ptr<FileSystem> fs, copy;
|
|
2789
|
+
|
|
2790
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_,
|
|
2791
|
+
TimedFileSystem::kClassName(), &fs));
|
|
2792
|
+
ASSERT_NE(fs, nullptr);
|
|
2793
|
+
ASSERT_STREQ(fs->Name(), TimedFileSystem::kClassName());
|
|
2794
|
+
ASSERT_EQ(fs->Inner(), FileSystem::Default().get());
|
|
2795
|
+
|
|
2796
|
+
std::string opts_str = fs->ToString(config_options_);
|
|
2797
|
+
std::string mismatch;
|
|
2798
|
+
|
|
2799
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2800
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2801
|
+
|
|
2802
|
+
ASSERT_OK(FileSystem::CreateFromString(
|
|
2803
|
+
config_options_,
|
|
2804
|
+
std::string("id=") + TimedFileSystem::kClassName() +
|
|
2805
|
+
"; target=" + ReadOnlyFileSystem::kClassName(),
|
|
2806
|
+
&fs));
|
|
2807
|
+
ASSERT_NE(fs, nullptr);
|
|
2808
|
+
opts_str = fs->ToString(config_options_);
|
|
2809
|
+
ASSERT_STREQ(fs->Name(), TimedFileSystem::kClassName());
|
|
2810
|
+
ASSERT_NE(fs->Inner(), nullptr);
|
|
2811
|
+
ASSERT_STREQ(fs->Inner()->Name(), ReadOnlyFileSystem::kClassName());
|
|
2812
|
+
ASSERT_EQ(fs->Inner()->Inner(), FileSystem::Default().get());
|
|
2813
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2814
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
TEST_F(CreateEnvTest, CreateCountedFileSystem) {
|
|
2818
|
+
std::shared_ptr<FileSystem> fs, copy;
|
|
2819
|
+
|
|
2820
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_,
|
|
2821
|
+
CountedFileSystem::kClassName(), &fs));
|
|
2822
|
+
ASSERT_NE(fs, nullptr);
|
|
2823
|
+
ASSERT_STREQ(fs->Name(), CountedFileSystem::kClassName());
|
|
2824
|
+
ASSERT_EQ(fs->Inner(), FileSystem::Default().get());
|
|
2825
|
+
|
|
2826
|
+
std::string opts_str = fs->ToString(config_options_);
|
|
2827
|
+
std::string mismatch;
|
|
2828
|
+
|
|
2829
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2830
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2831
|
+
|
|
2832
|
+
ASSERT_OK(FileSystem::CreateFromString(
|
|
2833
|
+
config_options_,
|
|
2834
|
+
std::string("id=") + CountedFileSystem::kClassName() +
|
|
2835
|
+
"; target=" + ReadOnlyFileSystem::kClassName(),
|
|
2836
|
+
&fs));
|
|
2837
|
+
ASSERT_NE(fs, nullptr);
|
|
2838
|
+
opts_str = fs->ToString(config_options_);
|
|
2839
|
+
ASSERT_STREQ(fs->Name(), CountedFileSystem::kClassName());
|
|
2840
|
+
ASSERT_NE(fs->Inner(), nullptr);
|
|
2841
|
+
ASSERT_STREQ(fs->Inner()->Name(), ReadOnlyFileSystem::kClassName());
|
|
2842
|
+
ASSERT_EQ(fs->Inner()->Inner(), FileSystem::Default().get());
|
|
2843
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2844
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
#ifndef OS_WIN
|
|
2848
|
+
TEST_F(CreateEnvTest, CreateChrootFileSystem) {
|
|
2849
|
+
std::shared_ptr<FileSystem> fs, copy;
|
|
2850
|
+
auto tmp_dir = test::TmpDir(Env::Default());
|
|
2851
|
+
// The Chroot FileSystem has a required "chroot_dir" option.
|
|
2852
|
+
ASSERT_NOK(FileSystem::CreateFromString(config_options_,
|
|
2853
|
+
ChrootFileSystem::kClassName(), &fs));
|
|
2854
|
+
|
|
2855
|
+
// ChrootFileSystem fails with an invalid directory
|
|
2856
|
+
ASSERT_NOK(FileSystem::CreateFromString(
|
|
2857
|
+
config_options_,
|
|
2858
|
+
std::string("chroot_dir=/No/Such/Directory; id=") +
|
|
2859
|
+
ChrootFileSystem::kClassName(),
|
|
2860
|
+
&fs));
|
|
2861
|
+
std::string chroot_opts = std::string("chroot_dir=") + tmp_dir +
|
|
2862
|
+
std::string("; id=") +
|
|
2863
|
+
ChrootFileSystem::kClassName();
|
|
2864
|
+
|
|
2865
|
+
// Create a valid ChrootFileSystem with an inner Default
|
|
2866
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, chroot_opts, &fs));
|
|
2867
|
+
ASSERT_NE(fs, nullptr);
|
|
2868
|
+
ASSERT_STREQ(fs->Name(), ChrootFileSystem::kClassName());
|
|
2869
|
+
ASSERT_EQ(fs->Inner(), FileSystem::Default().get());
|
|
2870
|
+
std::string opts_str = fs->ToString(config_options_);
|
|
2871
|
+
std::string mismatch;
|
|
2872
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2873
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2874
|
+
|
|
2875
|
+
// Create a valid ChrootFileSystem with an inner TimedFileSystem
|
|
2876
|
+
ASSERT_OK(FileSystem::CreateFromString(
|
|
2877
|
+
config_options_,
|
|
2878
|
+
chroot_opts + "; target=" + TimedFileSystem::kClassName(), &fs));
|
|
2879
|
+
ASSERT_NE(fs, nullptr);
|
|
2880
|
+
ASSERT_STREQ(fs->Name(), ChrootFileSystem::kClassName());
|
|
2881
|
+
ASSERT_NE(fs->Inner(), nullptr);
|
|
2882
|
+
ASSERT_STREQ(fs->Inner()->Name(), TimedFileSystem::kClassName());
|
|
2883
|
+
ASSERT_EQ(fs->Inner()->Inner(), FileSystem::Default().get());
|
|
2884
|
+
opts_str = fs->ToString(config_options_);
|
|
2885
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2886
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2887
|
+
|
|
2888
|
+
// Create a TimedFileSystem with an inner ChrootFileSystem
|
|
2889
|
+
ASSERT_OK(FileSystem::CreateFromString(
|
|
2890
|
+
config_options_,
|
|
2891
|
+
"target={" + chroot_opts + "}; id=" + TimedFileSystem::kClassName(),
|
|
2892
|
+
&fs));
|
|
2893
|
+
ASSERT_NE(fs, nullptr);
|
|
2894
|
+
ASSERT_STREQ(fs->Name(), TimedFileSystem::kClassName());
|
|
2895
|
+
ASSERT_NE(fs->Inner(), nullptr);
|
|
2896
|
+
ASSERT_STREQ(fs->Inner()->Name(), ChrootFileSystem::kClassName());
|
|
2897
|
+
ASSERT_EQ(fs->Inner()->Inner(), FileSystem::Default().get());
|
|
2898
|
+
opts_str = fs->ToString(config_options_);
|
|
2899
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2900
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2901
|
+
}
|
|
2902
|
+
#endif // OS_WIN
|
|
2903
|
+
|
|
2904
|
+
TEST_F(CreateEnvTest, CreateEncryptedFileSystem) {
|
|
2905
|
+
std::shared_ptr<FileSystem> fs, copy;
|
|
2906
|
+
|
|
2907
|
+
std::string base_opts =
|
|
2908
|
+
std::string("provider=1://test; id=") + EncryptedFileSystem::kClassName();
|
|
2909
|
+
// The EncryptedFileSystem requires a "provider" option.
|
|
2910
|
+
ASSERT_NOK(FileSystem::CreateFromString(
|
|
2911
|
+
config_options_, EncryptedFileSystem::kClassName(), &fs));
|
|
2912
|
+
|
|
2913
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, base_opts, &fs));
|
|
2914
|
+
|
|
2915
|
+
ASSERT_NE(fs, nullptr);
|
|
2916
|
+
ASSERT_STREQ(fs->Name(), EncryptedFileSystem::kClassName());
|
|
2917
|
+
ASSERT_EQ(fs->Inner(), FileSystem::Default().get());
|
|
2918
|
+
std::string opts_str = fs->ToString(config_options_);
|
|
2919
|
+
std::string mismatch;
|
|
2920
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2921
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2922
|
+
ASSERT_OK(FileSystem::CreateFromString(
|
|
2923
|
+
config_options_, base_opts + "; target=" + TimedFileSystem::kClassName(),
|
|
2924
|
+
&fs));
|
|
2925
|
+
ASSERT_NE(fs, nullptr);
|
|
2926
|
+
ASSERT_STREQ(fs->Name(), EncryptedFileSystem::kClassName());
|
|
2927
|
+
ASSERT_NE(fs->Inner(), nullptr);
|
|
2928
|
+
ASSERT_STREQ(fs->Inner()->Name(), TimedFileSystem::kClassName());
|
|
2929
|
+
ASSERT_EQ(fs->Inner()->Inner(), FileSystem::Default().get());
|
|
2930
|
+
opts_str = fs->ToString(config_options_);
|
|
2931
|
+
ASSERT_OK(FileSystem::CreateFromString(config_options_, opts_str, ©));
|
|
2932
|
+
ASSERT_TRUE(fs->AreEquivalent(config_options_, copy.get(), &mismatch));
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
|
|
2936
|
+
namespace {
|
|
2937
|
+
|
|
2938
|
+
constexpr size_t kThreads = 8;
|
|
2939
|
+
constexpr size_t kIdsPerThread = 1000;
|
|
2940
|
+
|
|
2941
|
+
// This is a mini-stress test to check for duplicates in functions like
|
|
2942
|
+
// GenerateUniqueId()
|
|
2943
|
+
template <typename IdType, class Hash = std::hash<IdType>>
|
|
2944
|
+
struct NoDuplicateMiniStressTest {
|
|
2945
|
+
std::unordered_set<IdType, Hash> ids;
|
|
2946
|
+
std::mutex mutex;
|
|
2947
|
+
Env* env;
|
|
2948
|
+
|
|
2949
|
+
NoDuplicateMiniStressTest() { env = Env::Default(); }
|
|
2950
|
+
|
|
2951
|
+
virtual ~NoDuplicateMiniStressTest() {}
|
|
2952
|
+
|
|
2953
|
+
void Run() {
|
|
2954
|
+
std::array<std::thread, kThreads> threads;
|
|
2955
|
+
for (size_t i = 0; i < kThreads; ++i) {
|
|
2956
|
+
threads[i] = std::thread([&]() { ThreadFn(); });
|
|
2957
|
+
}
|
|
2958
|
+
for (auto& thread : threads) {
|
|
2959
|
+
thread.join();
|
|
2960
|
+
}
|
|
2961
|
+
// All must be unique
|
|
2962
|
+
ASSERT_EQ(ids.size(), kThreads * kIdsPerThread);
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
void ThreadFn() {
|
|
2966
|
+
std::array<IdType, kIdsPerThread> my_ids;
|
|
2967
|
+
// Generate in parallel threads as fast as possible
|
|
2968
|
+
for (size_t i = 0; i < kIdsPerThread; ++i) {
|
|
2969
|
+
my_ids[i] = Generate();
|
|
2970
|
+
}
|
|
2971
|
+
// Now collate
|
|
2972
|
+
std::lock_guard<std::mutex> lock(mutex);
|
|
2973
|
+
for (auto& id : my_ids) {
|
|
2974
|
+
ids.insert(id);
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
virtual IdType Generate() = 0;
|
|
2979
|
+
};
|
|
2980
|
+
|
|
2981
|
+
void VerifyRfcUuids(const std::unordered_set<std::string>& uuids) {
|
|
2982
|
+
if (uuids.empty()) {
|
|
2983
|
+
return;
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
using uint64_pair_t = std::pair<uint64_t, uint64_t>;
|
|
2988
|
+
struct HashUint64Pair {
|
|
2989
|
+
std::size_t operator()(
|
|
2990
|
+
std::pair<uint64_t, uint64_t> const& u) const noexcept {
|
|
2991
|
+
// Assume suitable distribution already
|
|
2992
|
+
return static_cast<size_t>(u.first ^ u.second);
|
|
2993
|
+
}
|
|
2994
|
+
};
|
|
2995
|
+
|
|
2996
|
+
} // namespace
|
|
2997
|
+
|
|
2998
|
+
TEST_F(EnvTest, GenerateUniqueId) {
|
|
2999
|
+
struct MyStressTest : public NoDuplicateMiniStressTest<std::string> {
|
|
3000
|
+
std::string Generate() override { return env->GenerateUniqueId(); }
|
|
3001
|
+
};
|
|
3002
|
+
|
|
3003
|
+
MyStressTest t;
|
|
3004
|
+
t.Run();
|
|
3005
|
+
|
|
3006
|
+
// Basically verify RFC-4122 format
|
|
3007
|
+
for (auto& uuid : t.ids) {
|
|
3008
|
+
ASSERT_EQ(36U, uuid.size());
|
|
3009
|
+
ASSERT_EQ('-', uuid[8]);
|
|
3010
|
+
ASSERT_EQ('-', uuid[13]);
|
|
3011
|
+
ASSERT_EQ('-', uuid[18]);
|
|
3012
|
+
ASSERT_EQ('-', uuid[23]);
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
|
|
3016
|
+
TEST_F(EnvTest, GenerateDbSessionId) {
|
|
3017
|
+
struct MyStressTest : public NoDuplicateMiniStressTest<std::string> {
|
|
3018
|
+
std::string Generate() override { return DBImpl::GenerateDbSessionId(env); }
|
|
3019
|
+
};
|
|
3020
|
+
|
|
3021
|
+
MyStressTest t;
|
|
3022
|
+
t.Run();
|
|
3023
|
+
|
|
3024
|
+
// Basically verify session ID
|
|
3025
|
+
for (auto& id : t.ids) {
|
|
3026
|
+
ASSERT_EQ(20U, id.size());
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3030
|
+
constexpr bool kRequirePortGenerateRfcUuid =
|
|
3031
|
+
#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN)
|
|
3032
|
+
true;
|
|
3033
|
+
#else
|
|
3034
|
+
false;
|
|
3035
|
+
#endif
|
|
3036
|
+
|
|
3037
|
+
TEST_F(EnvTest, PortGenerateRfcUuid) {
|
|
3038
|
+
if (!kRequirePortGenerateRfcUuid) {
|
|
3039
|
+
ROCKSDB_GTEST_SKIP("Not supported/expected on this platform");
|
|
3040
|
+
return;
|
|
3041
|
+
}
|
|
3042
|
+
struct MyStressTest : public NoDuplicateMiniStressTest<std::string> {
|
|
3043
|
+
std::string Generate() override {
|
|
3044
|
+
std::string u;
|
|
3045
|
+
assert(port::GenerateRfcUuid(&u));
|
|
3046
|
+
return u;
|
|
3047
|
+
}
|
|
3048
|
+
};
|
|
3049
|
+
|
|
3050
|
+
MyStressTest t;
|
|
3051
|
+
t.Run();
|
|
3052
|
+
|
|
3053
|
+
// Extra verification on versions and variants
|
|
3054
|
+
VerifyRfcUuids(t.ids);
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
// Test the atomic, linear generation of GenerateRawUuid
|
|
3058
|
+
TEST_F(EnvTest, GenerateRawUniqueId) {
|
|
3059
|
+
struct MyStressTest
|
|
3060
|
+
: public NoDuplicateMiniStressTest<uint64_pair_t, HashUint64Pair> {
|
|
3061
|
+
uint64_pair_t Generate() override {
|
|
3062
|
+
uint64_pair_t p;
|
|
3063
|
+
GenerateRawUniqueId(&p.first, &p.second);
|
|
3064
|
+
return p;
|
|
3065
|
+
}
|
|
3066
|
+
};
|
|
3067
|
+
|
|
3068
|
+
MyStressTest t;
|
|
3069
|
+
t.Run();
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
// Test that each entropy source ("track") is at least adequate
|
|
3073
|
+
TEST_F(EnvTest, GenerateRawUniqueIdTrackPortUuidOnly) {
|
|
3074
|
+
if (!kRequirePortGenerateRfcUuid) {
|
|
3075
|
+
ROCKSDB_GTEST_SKIP("Not supported/expected on this platform");
|
|
3076
|
+
return;
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
struct MyStressTest
|
|
3080
|
+
: public NoDuplicateMiniStressTest<uint64_pair_t, HashUint64Pair> {
|
|
3081
|
+
uint64_pair_t Generate() override {
|
|
3082
|
+
uint64_pair_t p;
|
|
3083
|
+
TEST_GenerateRawUniqueId(&p.first, &p.second, false, true, true);
|
|
3084
|
+
return p;
|
|
3085
|
+
}
|
|
3086
|
+
};
|
|
3087
|
+
|
|
3088
|
+
MyStressTest t;
|
|
3089
|
+
t.Run();
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
TEST_F(EnvTest, GenerateRawUniqueIdTrackEnvDetailsOnly) {
|
|
3093
|
+
struct MyStressTest
|
|
3094
|
+
: public NoDuplicateMiniStressTest<uint64_pair_t, HashUint64Pair> {
|
|
3095
|
+
uint64_pair_t Generate() override {
|
|
3096
|
+
uint64_pair_t p;
|
|
3097
|
+
TEST_GenerateRawUniqueId(&p.first, &p.second, true, false, true);
|
|
3098
|
+
return p;
|
|
3099
|
+
}
|
|
3100
|
+
};
|
|
3101
|
+
|
|
3102
|
+
MyStressTest t;
|
|
3103
|
+
t.Run();
|
|
3104
|
+
}
|
|
3105
|
+
|
|
3106
|
+
TEST_F(EnvTest, GenerateRawUniqueIdTrackRandomDeviceOnly) {
|
|
3107
|
+
struct MyStressTest
|
|
3108
|
+
: public NoDuplicateMiniStressTest<uint64_pair_t, HashUint64Pair> {
|
|
3109
|
+
uint64_pair_t Generate() override {
|
|
3110
|
+
uint64_pair_t p;
|
|
3111
|
+
TEST_GenerateRawUniqueId(&p.first, &p.second, true, true, false);
|
|
3112
|
+
return p;
|
|
3113
|
+
}
|
|
3114
|
+
};
|
|
3115
|
+
|
|
3116
|
+
MyStressTest t;
|
|
3117
|
+
t.Run();
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
TEST_F(EnvTest, SemiStructuredUniqueIdGenTest) {
|
|
3121
|
+
// Must be thread safe and usable as a static
|
|
3122
|
+
static SemiStructuredUniqueIdGen gen;
|
|
3123
|
+
|
|
3124
|
+
struct MyStressTest
|
|
3125
|
+
: public NoDuplicateMiniStressTest<uint64_pair_t, HashUint64Pair> {
|
|
3126
|
+
uint64_pair_t Generate() override {
|
|
3127
|
+
uint64_pair_t p;
|
|
3128
|
+
gen.GenerateNext(&p.first, &p.second);
|
|
3129
|
+
return p;
|
|
3130
|
+
}
|
|
3131
|
+
};
|
|
3132
|
+
|
|
3133
|
+
MyStressTest t;
|
|
3134
|
+
t.Run();
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
TEST_F(EnvTest, SemiStructuredUniqueIdGenTestSmaller) {
|
|
3138
|
+
// For small generated types, will cycle through all the possible values.
|
|
3139
|
+
SemiStructuredUniqueIdGen gen;
|
|
3140
|
+
std::vector<bool> hit(256);
|
|
3141
|
+
for (int i = 0; i < 256; ++i) {
|
|
3142
|
+
auto val = gen.GenerateNext<uint8_t>();
|
|
3143
|
+
ASSERT_FALSE(hit[val]);
|
|
3144
|
+
hit[val] = true;
|
|
3145
|
+
}
|
|
3146
|
+
for (int i = 0; i < 256; ++i) {
|
|
3147
|
+
ASSERT_TRUE(hit[i]);
|
|
3148
|
+
}
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
TEST_F(EnvTest, FailureToCreateLockFile) {
|
|
3152
|
+
auto env = Env::Default();
|
|
3153
|
+
auto fs = env->GetFileSystem();
|
|
3154
|
+
std::string dir = test::PerThreadDBPath(env, "lockdir");
|
|
3155
|
+
std::string file = dir + "/lockfile";
|
|
3156
|
+
|
|
3157
|
+
// Ensure directory doesn't exist
|
|
3158
|
+
ASSERT_OK(DestroyDir(env, dir));
|
|
3159
|
+
|
|
3160
|
+
// Make sure that we can acquire a file lock after the first attempt fails
|
|
3161
|
+
FileLock* lock = nullptr;
|
|
3162
|
+
ASSERT_NOK(fs->LockFile(file, IOOptions(), &lock, /*dbg*/ nullptr));
|
|
3163
|
+
ASSERT_FALSE(lock);
|
|
3164
|
+
|
|
3165
|
+
ASSERT_OK(fs->CreateDir(dir, IOOptions(), /*dbg*/ nullptr));
|
|
3166
|
+
ASSERT_OK(fs->LockFile(file, IOOptions(), &lock, /*dbg*/ nullptr));
|
|
3167
|
+
ASSERT_OK(fs->UnlockFile(lock, IOOptions(), /*dbg*/ nullptr));
|
|
3168
|
+
|
|
3169
|
+
// Clean up
|
|
3170
|
+
ASSERT_OK(DestroyDir(env, dir));
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
TEST_F(CreateEnvTest, CreateDefaultEnv) {
|
|
3174
|
+
ConfigOptions options;
|
|
3175
|
+
options.ignore_unsupported_options = false;
|
|
3176
|
+
|
|
3177
|
+
std::shared_ptr<Env> guard;
|
|
3178
|
+
Env* env = nullptr;
|
|
3179
|
+
ASSERT_OK(Env::CreateFromString(options, "", &env));
|
|
3180
|
+
ASSERT_EQ(env, Env::Default());
|
|
3181
|
+
|
|
3182
|
+
env = nullptr;
|
|
3183
|
+
ASSERT_OK(Env::CreateFromString(options, Env::kDefaultName(), &env));
|
|
3184
|
+
ASSERT_EQ(env, Env::Default());
|
|
3185
|
+
|
|
3186
|
+
env = nullptr;
|
|
3187
|
+
ASSERT_OK(Env::CreateFromString(options, "", &env, &guard));
|
|
3188
|
+
ASSERT_EQ(env, Env::Default());
|
|
3189
|
+
ASSERT_EQ(guard, nullptr);
|
|
3190
|
+
|
|
3191
|
+
env = nullptr;
|
|
3192
|
+
ASSERT_OK(Env::CreateFromString(options, Env::kDefaultName(), &env, &guard));
|
|
3193
|
+
ASSERT_EQ(env, Env::Default());
|
|
3194
|
+
ASSERT_EQ(guard, nullptr);
|
|
3195
|
+
|
|
3196
|
+
std::string opt_str = env->ToString(options);
|
|
3197
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env));
|
|
3198
|
+
ASSERT_EQ(env, Env::Default());
|
|
3199
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, &guard));
|
|
3200
|
+
ASSERT_EQ(env, Env::Default());
|
|
3201
|
+
ASSERT_EQ(guard, nullptr);
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
namespace {
|
|
3205
|
+
class WrappedEnv : public EnvWrapper {
|
|
3206
|
+
public:
|
|
3207
|
+
explicit WrappedEnv(Env* t) : EnvWrapper(t) {}
|
|
3208
|
+
explicit WrappedEnv(const std::shared_ptr<Env>& t) : EnvWrapper(t) {}
|
|
3209
|
+
static const char* kClassName() { return "WrappedEnv"; }
|
|
3210
|
+
const char* Name() const override { return kClassName(); }
|
|
3211
|
+
static void Register(ObjectLibrary& lib, const std::string& /*arg*/) {
|
|
3212
|
+
lib.AddFactory<Env>(
|
|
3213
|
+
WrappedEnv::kClassName(),
|
|
3214
|
+
[](const std::string& /*uri*/, std::unique_ptr<Env>* guard,
|
|
3215
|
+
std::string* /* errmsg */) {
|
|
3216
|
+
guard->reset(new WrappedEnv(nullptr));
|
|
3217
|
+
return guard->get();
|
|
3218
|
+
});
|
|
3219
|
+
}
|
|
3220
|
+
};
|
|
3221
|
+
} // namespace
|
|
3222
|
+
TEST_F(CreateEnvTest, CreateMockEnv) {
|
|
3223
|
+
ConfigOptions options;
|
|
3224
|
+
options.ignore_unsupported_options = false;
|
|
3225
|
+
WrappedEnv::Register(*(options.registry->AddLibrary("test")), "");
|
|
3226
|
+
std::shared_ptr<Env> guard, copy;
|
|
3227
|
+
std::string opt_str;
|
|
3228
|
+
|
|
3229
|
+
Env* env = nullptr;
|
|
3230
|
+
ASSERT_NOK(Env::CreateFromString(options, MockEnv::kClassName(), &env));
|
|
3231
|
+
ASSERT_OK(
|
|
3232
|
+
Env::CreateFromString(options, MockEnv::kClassName(), &env, &guard));
|
|
3233
|
+
ASSERT_NE(env, nullptr);
|
|
3234
|
+
ASSERT_NE(env, Env::Default());
|
|
3235
|
+
opt_str = env->ToString(options);
|
|
3236
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, ©));
|
|
3237
|
+
ASSERT_NE(copy, guard);
|
|
3238
|
+
std::string mismatch;
|
|
3239
|
+
ASSERT_TRUE(guard->AreEquivalent(options, copy.get(), &mismatch));
|
|
3240
|
+
guard.reset(MockEnv::Create(Env::Default(), SystemClock::Default()));
|
|
3241
|
+
opt_str = guard->ToString(options);
|
|
3242
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, ©));
|
|
3243
|
+
std::unique_ptr<Env> wrapped_env(new WrappedEnv(Env::Default()));
|
|
3244
|
+
guard.reset(MockEnv::Create(wrapped_env.get(), SystemClock::Default()));
|
|
3245
|
+
opt_str = guard->ToString(options);
|
|
3246
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, ©));
|
|
3247
|
+
opt_str = copy->ToString(options);
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
TEST_F(CreateEnvTest, CreateWrappedEnv) {
|
|
3251
|
+
ConfigOptions options;
|
|
3252
|
+
options.ignore_unsupported_options = false;
|
|
3253
|
+
WrappedEnv::Register(*(options.registry->AddLibrary("test")), "");
|
|
3254
|
+
Env* env = nullptr;
|
|
3255
|
+
std::shared_ptr<Env> guard, copy;
|
|
3256
|
+
std::string opt_str;
|
|
3257
|
+
std::string mismatch;
|
|
3258
|
+
|
|
3259
|
+
ASSERT_NOK(Env::CreateFromString(options, WrappedEnv::kClassName(), &env));
|
|
3260
|
+
ASSERT_OK(
|
|
3261
|
+
Env::CreateFromString(options, WrappedEnv::kClassName(), &env, &guard));
|
|
3262
|
+
ASSERT_NE(env, nullptr);
|
|
3263
|
+
ASSERT_NE(env, Env::Default());
|
|
3264
|
+
ASSERT_FALSE(guard->AreEquivalent(options, Env::Default(), &mismatch));
|
|
3265
|
+
|
|
3266
|
+
opt_str = env->ToString(options);
|
|
3267
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, ©));
|
|
3268
|
+
ASSERT_NE(copy, guard);
|
|
3269
|
+
ASSERT_TRUE(guard->AreEquivalent(options, copy.get(), &mismatch));
|
|
3270
|
+
|
|
3271
|
+
guard.reset(new WrappedEnv(std::make_shared<WrappedEnv>(Env::Default())));
|
|
3272
|
+
ASSERT_NE(guard.get(), env);
|
|
3273
|
+
opt_str = guard->ToString(options);
|
|
3274
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, ©));
|
|
3275
|
+
ASSERT_NE(copy, guard);
|
|
3276
|
+
ASSERT_TRUE(guard->AreEquivalent(options, copy.get(), &mismatch));
|
|
3277
|
+
|
|
3278
|
+
guard.reset(new WrappedEnv(std::make_shared<WrappedEnv>(
|
|
3279
|
+
std::make_shared<WrappedEnv>(Env::Default()))));
|
|
3280
|
+
ASSERT_NE(guard.get(), env);
|
|
3281
|
+
opt_str = guard->ToString(options);
|
|
3282
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, ©));
|
|
3283
|
+
ASSERT_NE(copy, guard);
|
|
3284
|
+
ASSERT_TRUE(guard->AreEquivalent(options, copy.get(), &mismatch));
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
TEST_F(CreateEnvTest, CreateCompositeEnv) {
|
|
3288
|
+
ConfigOptions options;
|
|
3289
|
+
options.ignore_unsupported_options = false;
|
|
3290
|
+
std::shared_ptr<Env> guard, copy;
|
|
3291
|
+
Env* env = nullptr;
|
|
3292
|
+
std::string mismatch, opt_str;
|
|
3293
|
+
|
|
3294
|
+
WrappedEnv::Register(*(options.registry->AddLibrary("test")), "");
|
|
3295
|
+
std::unique_ptr<Env> base(NewCompositeEnv(FileSystem::Default()));
|
|
3296
|
+
std::unique_ptr<Env> wrapped(new WrappedEnv(Env::Default()));
|
|
3297
|
+
std::shared_ptr<FileSystem> timed_fs =
|
|
3298
|
+
std::make_shared<TimedFileSystem>(FileSystem::Default());
|
|
3299
|
+
std::shared_ptr<SystemClock> clock =
|
|
3300
|
+
std::make_shared<EmulatedSystemClock>(SystemClock::Default());
|
|
3301
|
+
|
|
3302
|
+
opt_str = base->ToString(options);
|
|
3303
|
+
ASSERT_NOK(Env::CreateFromString(options, opt_str, &env));
|
|
3304
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, &guard));
|
|
3305
|
+
ASSERT_NE(env, nullptr);
|
|
3306
|
+
ASSERT_NE(env, Env::Default());
|
|
3307
|
+
ASSERT_EQ(env->GetFileSystem(), FileSystem::Default());
|
|
3308
|
+
ASSERT_EQ(env->GetSystemClock(), SystemClock::Default());
|
|
3309
|
+
|
|
3310
|
+
base = NewCompositeEnv(timed_fs);
|
|
3311
|
+
opt_str = base->ToString(options);
|
|
3312
|
+
ASSERT_NOK(Env::CreateFromString(options, opt_str, &env));
|
|
3313
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, &guard));
|
|
3314
|
+
ASSERT_NE(env, nullptr);
|
|
3315
|
+
ASSERT_NE(env, Env::Default());
|
|
3316
|
+
ASSERT_NE(env->GetFileSystem(), FileSystem::Default());
|
|
3317
|
+
ASSERT_EQ(env->GetSystemClock(), SystemClock::Default());
|
|
3318
|
+
|
|
3319
|
+
env = nullptr;
|
|
3320
|
+
guard.reset(new CompositeEnvWrapper(wrapped.get(), timed_fs));
|
|
3321
|
+
opt_str = guard->ToString(options);
|
|
3322
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, ©));
|
|
3323
|
+
ASSERT_NE(env, nullptr);
|
|
3324
|
+
ASSERT_NE(env, Env::Default());
|
|
3325
|
+
ASSERT_TRUE(guard->AreEquivalent(options, copy.get(), &mismatch));
|
|
3326
|
+
|
|
3327
|
+
env = nullptr;
|
|
3328
|
+
guard.reset(new CompositeEnvWrapper(wrapped.get(), clock));
|
|
3329
|
+
opt_str = guard->ToString(options);
|
|
3330
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, ©));
|
|
3331
|
+
ASSERT_NE(env, nullptr);
|
|
3332
|
+
ASSERT_NE(env, Env::Default());
|
|
3333
|
+
ASSERT_TRUE(guard->AreEquivalent(options, copy.get(), &mismatch));
|
|
3334
|
+
|
|
3335
|
+
env = nullptr;
|
|
3336
|
+
guard.reset(new CompositeEnvWrapper(wrapped.get(), timed_fs, clock));
|
|
3337
|
+
opt_str = guard->ToString(options);
|
|
3338
|
+
ASSERT_OK(Env::CreateFromString(options, opt_str, &env, ©));
|
|
3339
|
+
ASSERT_NE(env, nullptr);
|
|
3340
|
+
ASSERT_NE(env, Env::Default());
|
|
3341
|
+
ASSERT_TRUE(guard->AreEquivalent(options, copy.get(), &mismatch));
|
|
3342
|
+
|
|
3343
|
+
guard.reset(new CompositeEnvWrapper(nullptr, timed_fs, clock));
|
|
3344
|
+
ColumnFamilyOptions cf_opts;
|
|
3345
|
+
DBOptions db_opts;
|
|
3346
|
+
db_opts.env = guard.get();
|
|
3347
|
+
auto comp = db_opts.env->CheckedCast<CompositeEnvWrapper>();
|
|
3348
|
+
ASSERT_NE(comp, nullptr);
|
|
3349
|
+
ASSERT_EQ(comp->Inner(), nullptr);
|
|
3350
|
+
ASSERT_NOK(ValidateOptions(db_opts, cf_opts));
|
|
3351
|
+
ASSERT_OK(db_opts.env->PrepareOptions(options));
|
|
3352
|
+
ASSERT_NE(comp->Inner(), nullptr);
|
|
3353
|
+
ASSERT_OK(ValidateOptions(db_opts, cf_opts));
|
|
3354
|
+
}
|
|
3355
|
+
|
|
3356
|
+
// Forward declaration
|
|
3357
|
+
class ReadAsyncFS;
|
|
3358
|
+
|
|
3359
|
+
struct MockIOHandle {
|
|
3360
|
+
std::function<void(const FSReadRequest&, void*)> cb;
|
|
3361
|
+
void* cb_arg;
|
|
3362
|
+
bool create_io_error;
|
|
3363
|
+
};
|
|
3364
|
+
|
|
3365
|
+
// ReadAsyncFS and ReadAsyncRandomAccessFile mocks the FS doing asynchronous
|
|
3366
|
+
// reads by creating threads that submit read requests and then calling Poll API
|
|
3367
|
+
// to obtain those results.
|
|
3368
|
+
class ReadAsyncRandomAccessFile : public FSRandomAccessFileOwnerWrapper {
|
|
3369
|
+
public:
|
|
3370
|
+
ReadAsyncRandomAccessFile(ReadAsyncFS& fs,
|
|
3371
|
+
std::unique_ptr<FSRandomAccessFile>& file)
|
|
3372
|
+
: FSRandomAccessFileOwnerWrapper(std::move(file)), fs_(fs) {}
|
|
3373
|
+
|
|
3374
|
+
IOStatus ReadAsync(FSReadRequest& req, const IOOptions& opts,
|
|
3375
|
+
std::function<void(const FSReadRequest&, void*)> cb,
|
|
3376
|
+
void* cb_arg, void** io_handle, IOHandleDeleter* del_fn,
|
|
3377
|
+
IODebugContext* dbg) override;
|
|
3378
|
+
|
|
3379
|
+
private:
|
|
3380
|
+
ReadAsyncFS& fs_;
|
|
3381
|
+
std::unique_ptr<FSRandomAccessFile> file_;
|
|
3382
|
+
int counter = 0;
|
|
3383
|
+
};
|
|
3384
|
+
|
|
3385
|
+
class ReadAsyncFS : public FileSystemWrapper {
|
|
3386
|
+
public:
|
|
3387
|
+
explicit ReadAsyncFS(const std::shared_ptr<FileSystem>& wrapped)
|
|
3388
|
+
: FileSystemWrapper(wrapped) {}
|
|
3389
|
+
|
|
3390
|
+
static const char* kClassName() { return "ReadAsyncFS"; }
|
|
3391
|
+
const char* Name() const override { return kClassName(); }
|
|
3392
|
+
|
|
3393
|
+
IOStatus NewRandomAccessFile(const std::string& fname,
|
|
3394
|
+
const FileOptions& opts,
|
|
3395
|
+
std::unique_ptr<FSRandomAccessFile>* result,
|
|
3396
|
+
IODebugContext* dbg) override {
|
|
3397
|
+
std::unique_ptr<FSRandomAccessFile> file;
|
|
3398
|
+
IOStatus s = target()->NewRandomAccessFile(fname, opts, &file, dbg);
|
|
3399
|
+
EXPECT_OK(s);
|
|
3400
|
+
result->reset(new ReadAsyncRandomAccessFile(*this, file));
|
|
3401
|
+
return s;
|
|
3402
|
+
}
|
|
3403
|
+
|
|
3404
|
+
IOStatus Poll(std::vector<void*>& io_handles,
|
|
3405
|
+
size_t /*min_completions*/) override {
|
|
3406
|
+
// Wait for the threads completion.
|
|
3407
|
+
for (auto& t : workers) {
|
|
3408
|
+
t.join();
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
for (size_t i = 0; i < io_handles.size(); i++) {
|
|
3412
|
+
MockIOHandle* handle = static_cast<MockIOHandle*>(io_handles[i]);
|
|
3413
|
+
if (handle->create_io_error) {
|
|
3414
|
+
FSReadRequest req;
|
|
3415
|
+
req.status = IOStatus::IOError();
|
|
3416
|
+
handle->cb(req, handle->cb_arg);
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
return IOStatus::OK();
|
|
3420
|
+
}
|
|
3421
|
+
|
|
3422
|
+
std::vector<std::thread> workers;
|
|
3423
|
+
};
|
|
3424
|
+
|
|
3425
|
+
IOStatus ReadAsyncRandomAccessFile::ReadAsync(
|
|
3426
|
+
FSReadRequest& req, const IOOptions& opts,
|
|
3427
|
+
std::function<void(const FSReadRequest&, void*)> cb, void* cb_arg,
|
|
3428
|
+
void** io_handle, IOHandleDeleter* del_fn, IODebugContext* dbg) {
|
|
3429
|
+
IOHandleDeleter deletefn = [](void* args) -> void {
|
|
3430
|
+
delete (static_cast<MockIOHandle*>(args));
|
|
3431
|
+
args = nullptr;
|
|
3432
|
+
};
|
|
3433
|
+
*del_fn = deletefn;
|
|
3434
|
+
|
|
3435
|
+
// Allocate and populate io_handle.
|
|
3436
|
+
MockIOHandle* mock_handle = new MockIOHandle();
|
|
3437
|
+
bool create_io_error = false;
|
|
3438
|
+
if (counter % 2) {
|
|
3439
|
+
create_io_error = true;
|
|
3440
|
+
}
|
|
3441
|
+
mock_handle->create_io_error = create_io_error;
|
|
3442
|
+
mock_handle->cb = cb;
|
|
3443
|
+
mock_handle->cb_arg = cb_arg;
|
|
3444
|
+
*io_handle = static_cast<void*>(mock_handle);
|
|
3445
|
+
counter++;
|
|
3446
|
+
|
|
3447
|
+
// Submit read request asynchronously.
|
|
3448
|
+
std::function<void(FSReadRequest)> submit_request =
|
|
3449
|
+
[&opts, cb, cb_arg, dbg, create_io_error, this](FSReadRequest _req) {
|
|
3450
|
+
if (!create_io_error) {
|
|
3451
|
+
_req.status = target()->Read(_req.offset, _req.len, opts,
|
|
3452
|
+
&(_req.result), _req.scratch, dbg);
|
|
3453
|
+
cb(_req, cb_arg);
|
|
3454
|
+
}
|
|
3455
|
+
};
|
|
3456
|
+
|
|
3457
|
+
fs_.workers.emplace_back(submit_request, req);
|
|
3458
|
+
return IOStatus::OK();
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
class TestAsyncRead : public testing::Test {
|
|
3462
|
+
public:
|
|
3463
|
+
TestAsyncRead() { env_ = Env::Default(); }
|
|
3464
|
+
Env* env_;
|
|
3465
|
+
};
|
|
3466
|
+
|
|
3467
|
+
// Tests the default implementation of ReadAsync API.
|
|
3468
|
+
TEST_F(TestAsyncRead, ReadAsync) {
|
|
3469
|
+
EnvOptions soptions;
|
|
3470
|
+
std::shared_ptr<ReadAsyncFS> fs =
|
|
3471
|
+
std::make_shared<ReadAsyncFS>(env_->GetFileSystem());
|
|
3472
|
+
|
|
3473
|
+
std::string fname = test::PerThreadDBPath(env_, "testfile");
|
|
3474
|
+
|
|
3475
|
+
const size_t kSectorSize = 4096;
|
|
3476
|
+
const size_t kNumSectors = 8;
|
|
3477
|
+
|
|
3478
|
+
// 1. create & write to a file.
|
|
3479
|
+
{
|
|
3480
|
+
std::unique_ptr<FSWritableFile> wfile;
|
|
3481
|
+
ASSERT_OK(
|
|
3482
|
+
fs->NewWritableFile(fname, FileOptions(), &wfile, nullptr /*dbg*/));
|
|
3483
|
+
|
|
3484
|
+
for (size_t i = 0; i < kNumSectors; ++i) {
|
|
3485
|
+
auto data = NewAligned(kSectorSize * 8, static_cast<char>(i + 1));
|
|
3486
|
+
Slice slice(data.get(), kSectorSize);
|
|
3487
|
+
ASSERT_OK(wfile->Append(slice, IOOptions(), nullptr));
|
|
3488
|
+
}
|
|
3489
|
+
ASSERT_OK(wfile->Close(IOOptions(), nullptr));
|
|
3490
|
+
}
|
|
3491
|
+
// 2. Read file
|
|
3492
|
+
{
|
|
3493
|
+
std::unique_ptr<FSRandomAccessFile> file;
|
|
3494
|
+
ASSERT_OK(fs->NewRandomAccessFile(fname, FileOptions(), &file, nullptr));
|
|
3495
|
+
|
|
3496
|
+
IOOptions opts;
|
|
3497
|
+
std::vector<void*> io_handles(kNumSectors);
|
|
3498
|
+
std::vector<FSReadRequest> reqs(kNumSectors);
|
|
3499
|
+
std::vector<std::unique_ptr<char, Deleter>> data;
|
|
3500
|
+
std::vector<size_t> vals;
|
|
3501
|
+
IOHandleDeleter del_fn;
|
|
3502
|
+
uint64_t offset = 0;
|
|
3503
|
+
|
|
3504
|
+
// Initialize read requests
|
|
3505
|
+
for (size_t i = 0; i < kNumSectors; i++) {
|
|
3506
|
+
reqs[i].offset = offset;
|
|
3507
|
+
reqs[i].len = kSectorSize;
|
|
3508
|
+
data.emplace_back(NewAligned(kSectorSize, 0));
|
|
3509
|
+
reqs[i].scratch = data.back().get();
|
|
3510
|
+
vals.push_back(i);
|
|
3511
|
+
offset += kSectorSize;
|
|
3512
|
+
}
|
|
3513
|
+
|
|
3514
|
+
// callback function passed to async read.
|
|
3515
|
+
std::function<void(const FSReadRequest&, void*)> callback =
|
|
3516
|
+
[&](const FSReadRequest& req, void* cb_arg) {
|
|
3517
|
+
assert(cb_arg != nullptr);
|
|
3518
|
+
size_t i = *(reinterpret_cast<size_t*>(cb_arg));
|
|
3519
|
+
reqs[i].offset = req.offset;
|
|
3520
|
+
reqs[i].result = req.result;
|
|
3521
|
+
reqs[i].status = req.status;
|
|
3522
|
+
};
|
|
3523
|
+
|
|
3524
|
+
// Submit asynchronous read requests.
|
|
3525
|
+
for (size_t i = 0; i < kNumSectors; i++) {
|
|
3526
|
+
void* cb_arg = static_cast<void*>(&(vals[i]));
|
|
3527
|
+
ASSERT_OK(file->ReadAsync(reqs[i], opts, callback, cb_arg,
|
|
3528
|
+
&(io_handles[i]), &del_fn, nullptr));
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3531
|
+
// Poll for the submitted requests.
|
|
3532
|
+
fs->Poll(io_handles, kNumSectors);
|
|
3533
|
+
|
|
3534
|
+
// Check the status of read requests.
|
|
3535
|
+
for (size_t i = 0; i < kNumSectors; i++) {
|
|
3536
|
+
if (i % 2) {
|
|
3537
|
+
ASSERT_EQ(reqs[i].status, IOStatus::IOError());
|
|
3538
|
+
} else {
|
|
3539
|
+
auto buf = NewAligned(kSectorSize * 8, static_cast<char>(i + 1));
|
|
3540
|
+
Slice expected_data(buf.get(), kSectorSize);
|
|
3541
|
+
|
|
3542
|
+
ASSERT_EQ(reqs[i].offset, i * kSectorSize);
|
|
3543
|
+
ASSERT_OK(reqs[i].status);
|
|
3544
|
+
ASSERT_EQ(expected_data.ToString(), reqs[i].result.ToString());
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
|
|
3548
|
+
// Delete io_handles.
|
|
3549
|
+
for (size_t i = 0; i < io_handles.size(); i++) {
|
|
3550
|
+
del_fn(io_handles[i]);
|
|
3551
|
+
}
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
struct StaticDestructionTester {
|
|
3556
|
+
bool activated = false;
|
|
3557
|
+
~StaticDestructionTester() {
|
|
3558
|
+
if (activated && !kMustFreeHeapAllocations) {
|
|
3559
|
+
// Make sure we can still call some things on default Env.
|
|
3560
|
+
std::string hostname;
|
|
3561
|
+
Env::Default()->GetHostNameString(&hostname);
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
} static_destruction_tester;
|
|
3565
|
+
|
|
3566
|
+
TEST(EnvTestMisc, StaticDestruction) {
|
|
3567
|
+
// Check for any crashes during static destruction.
|
|
3568
|
+
static_destruction_tester.activated = true;
|
|
3569
|
+
}
|
|
3570
|
+
|
|
3571
|
+
} // namespace ROCKSDB_NAMESPACE
|
|
3572
|
+
|
|
3573
|
+
int main(int argc, char** argv) {
|
|
3574
|
+
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
|
3575
|
+
::testing::InitGoogleTest(&argc, argv);
|
|
3576
|
+
return RUN_ALL_TESTS();
|
|
3577
|
+
}
|