From fdf882ded218344c136c97daf76dfb59e4bc155f Mon Sep 17 00:00:00 2001 From: sdong Date: Thu, 20 Feb 2020 12:07:53 -0800 Subject: [PATCH] Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) Summary: When dynamically linking two binaries together, different builds of RocksDB from two sources might cause errors. To provide a tool for user to solve the problem, the RocksDB namespace is changed to a flag which can be overridden in build time. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6433 Test Plan: Build release, all and jtest. Try to build with ROCKSDB_NAMESPACE with another flag. Differential Revision: D19977691 fbshipit-source-id: aa7f2d0972e1c31d75339ac48478f34f6cfcfb3e --- .travis.yml | 2 +- HISTORY.md | 1 + cache/cache_bench.cc | 8 +- cache/cache_test.cc | 4 +- cache/clock_cache.cc | 8 +- cache/lru_cache.cc | 4 +- cache/lru_cache.h | 4 +- cache/lru_cache_test.cc | 4 +- cache/sharded_cache.cc | 4 +- cache/sharded_cache.h | 4 +- db/arena_wrapped_db_iter.cc | 4 +- db/arena_wrapped_db_iter.h | 4 +- db/blob_index.h | 4 +- db/builder.cc | 4 +- db/builder.h | 4 +- db/c.cc | 215 +- db/column_family.cc | 4 +- db/column_family.h | 4 +- db/column_family_test.cc | 176 +- db/compact_files_test.cc | 30 +- db/compacted_db_impl.cc | 4 +- db/compacted_db_impl.h | 4 +- db/compaction/compaction.cc | 4 +- db/compaction/compaction.h | 4 +- db/compaction/compaction_iteration_stats.h | 2 + db/compaction/compaction_iterator.cc | 4 +- db/compaction/compaction_iterator.h | 4 +- db/compaction/compaction_iterator_test.cc | 8 +- db/compaction/compaction_job.cc | 4 +- db/compaction/compaction_job.h | 4 +- db/compaction/compaction_job_stats_test.cc | 24 +- db/compaction/compaction_job_test.cc | 4 +- db/compaction/compaction_picker.cc | 4 +- db/compaction/compaction_picker.h | 4 +- db/compaction/compaction_picker_fifo.cc | 4 +- db/compaction/compaction_picker_fifo.h | 4 +- db/compaction/compaction_picker_level.cc | 4 +- db/compaction/compaction_picker_level.h | 4 +- db/compaction/compaction_picker_test.cc | 4 +- db/compaction/compaction_picker_universal.cc | 4 +- db/compaction/compaction_picker_universal.h | 4 +- db/comparator_db_test.cc | 6 +- db/convenience.cc | 4 +- db/corruption_test.cc | 6 +- db/cuckoo_table_db_test.cc | 9 +- db/db_basic_test.cc | 50 +- db/db_blob_index_test.cc | 6 +- db/db_block_cache_test.cc | 20 +- db/db_bloom_filter_test.cc | 56 +- db/db_compaction_filter_test.cc | 6 +- db/db_compaction_test.cc | 300 +- db/db_dynamic_level_test.cc | 40 +- db/db_encryption_test.cc | 6 +- db/db_filesnapshot.cc | 4 +- db/db_flush_test.cc | 6 +- db/db_impl/db_impl.cc | 16 +- db/db_impl/db_impl.h | 8 +- db/db_impl/db_impl_compaction_flush.cc | 4 +- db/db_impl/db_impl_debug.cc | 4 +- db/db_impl/db_impl_experimental.cc | 4 +- db/db_impl/db_impl_files.cc | 4 +- db/db_impl/db_impl_open.cc | 4 +- db/db_impl/db_impl_readonly.cc | 4 +- db/db_impl/db_impl_readonly.h | 4 +- db/db_impl/db_impl_secondary.cc | 4 +- db/db_impl/db_impl_secondary.h | 4 +- db/db_impl/db_impl_write.cc | 4 +- db/db_impl/db_secondary_test.cc | 6 +- db/db_info_dumper.cc | 4 +- db/db_info_dumper.h | 4 +- db/db_inplace_update_test.cc | 14 +- db/db_io_failure_test.cc | 42 +- db/db_iter.cc | 16 +- db/db_iter.h | 4 +- db/db_iter_stress_test.cc | 4 +- db/db_iter_test.cc | 60 +- db/db_iterator_test.cc | 28 +- db/db_log_iter_test.cc | 22 +- db/db_memtable_test.cc | 14 +- db/db_merge_operand_test.cc | 6 +- db/db_merge_operator_test.cc | 16 +- db/db_options_test.cc | 30 +- db/db_properties_test.cc | 14 +- db/db_range_del_test.cc | 13 +- db/db_sst_test.cc | 80 +- db/db_statistics_test.cc | 14 +- db/db_table_properties_test.cc | 6 +- db/db_tailing_iter_test.cc | 26 +- db/db_test.cc | 179 +- db/db_test2.cc | 231 +- db/db_test_util.cc | 23 +- db/db_test_util.h | 4 +- db/db_universal_compaction_test.cc | 117 +- db/db_wal_test.cc | 71 +- db/db_write_test.cc | 53 +- db/dbformat.cc | 4 +- db/dbformat.h | 4 +- db/dbformat_test.cc | 4 +- db/deletefile_test.cc | 12 +- db/error_handler.cc | 4 +- db/error_handler.h | 4 +- db/error_handler_test.cc | 82 +- db/event_helpers.cc | 4 +- db/event_helpers.h | 4 +- db/experimental.cc | 4 +- db/external_sst_file_basic_test.cc | 12 +- db/external_sst_file_ingestion_job.cc | 4 +- db/external_sst_file_ingestion_job.h | 4 +- db/external_sst_file_test.cc | 88 +- db/fault_injection_test.cc | 24 +- db/file_indexer.cc | 4 +- db/file_indexer.h | 6 +- db/file_indexer_test.cc | 6 +- db/filename_test.cc | 4 +- db/flush_job.cc | 4 +- db/flush_job.h | 4 +- db/flush_job_test.cc | 6 +- db/flush_scheduler.cc | 4 +- db/flush_scheduler.h | 4 +- db/forward_iterator.cc | 4 +- db/forward_iterator.h | 4 +- db/forward_iterator_bench.cc | 72 +- db/import_column_family_job.cc | 4 +- db/import_column_family_job.h | 4 +- db/import_column_family_test.cc | 6 +- db/internal_stats.cc | 4 +- db/internal_stats.h | 4 +- db/job_context.h | 4 +- db/listener_test.cc | 31 +- db/log_format.h | 7 +- db/log_reader.cc | 4 +- db/log_reader.h | 4 +- db/log_test.cc | 4 +- db/log_writer.cc | 4 +- db/log_writer.h | 4 +- db/logs_with_prep_tracker.cc | 4 +- db/logs_with_prep_tracker.h | 6 +- db/lookup_key.h | 4 +- db/malloc_stats.cc | 5 +- db/malloc_stats.h | 4 +- db/manual_compaction_test.cc | 33 +- db/memtable.cc | 14 +- db/memtable.h | 4 +- db/memtable_list.cc | 4 +- db/memtable_list.h | 4 +- db/memtable_list_test.cc | 4 +- db/merge_context.h | 4 +- db/merge_helper.cc | 4 +- db/merge_helper.h | 4 +- db/merge_helper_test.cc | 4 +- db/merge_operator.cc | 4 +- db/merge_test.cc | 12 +- db/obsolete_files_test.cc | 6 +- db/options_file_test.cc | 4 +- db/perf_context_test.cc | 12 +- db/pinned_iterators_manager.h | 4 +- db/plain_table_db_test.cc | 10 +- db/pre_release_callback.h | 4 +- db/prefix_test.cc | 7 +- db/range_del_aggregator.cc | 4 +- db/range_del_aggregator.h | 4 +- db/range_del_aggregator_bench.cc | 54 +- db/range_del_aggregator_test.cc | 4 +- db/range_tombstone_fragmenter.cc | 4 +- db/range_tombstone_fragmenter.h | 4 +- db/range_tombstone_fragmenter_test.cc | 4 +- db/read_callback.h | 4 +- db/repair.cc | 4 +- db/repair_test.cc | 4 +- db/snapshot_checker.h | 4 +- db/snapshot_impl.cc | 4 +- db/snapshot_impl.h | 4 +- db/table_cache.cc | 4 +- db/table_cache.h | 4 +- db/table_properties_collector.cc | 4 +- db/table_properties_collector.h | 4 +- db/table_properties_collector_test.cc | 4 +- db/transaction_log_impl.cc | 4 +- db/transaction_log_impl.h | 4 +- db/trim_history_scheduler.cc | 4 +- db/trim_history_scheduler.h | 4 +- db/version_builder.cc | 4 +- db/version_builder.h | 4 +- db/version_builder_test.cc | 4 +- db/version_edit.cc | 4 +- db/version_edit.h | 4 +- db/version_edit_test.cc | 16 +- db/version_set.cc | 8 +- db/version_set.h | 8 +- db/version_set_test.cc | 4 +- db/wal_manager.cc | 4 +- db/wal_manager.h | 4 +- db/wal_manager_test.cc | 4 +- db/write_batch.cc | 4 +- db/write_batch_base.cc | 4 +- db/write_batch_internal.h | 4 +- db/write_batch_test.cc | 4 +- db/write_callback.h | 4 +- db/write_callback_test.cc | 14 +- db/write_controller.cc | 4 +- db/write_controller.h | 4 +- db/write_controller_test.cc | 4 +- db/write_thread.cc | 4 +- db/write_thread.h | 4 +- db_stress_tool/batched_ops_stress.cc | 4 +- db_stress_tool/cf_consistency_stress.cc | 4 +- db_stress_tool/db_stress.cc | 4 +- db_stress_tool/db_stress_common.cc | 18 +- db_stress_tool/db_stress_common.h | 62 +- db_stress_tool/db_stress_driver.cc | 4 +- db_stress_tool/db_stress_driver.h | 4 +- db_stress_tool/db_stress_env_wrapper.h | 4 +- db_stress_tool/db_stress_gflags.cc | 106 +- db_stress_tool/db_stress_listener.h | 4 +- db_stress_tool/db_stress_shared_state.cc | 4 +- db_stress_tool/db_stress_shared_state.h | 4 +- db_stress_tool/db_stress_stat.h | 8 +- db_stress_tool/db_stress_test_base.cc | 8 +- db_stress_tool/db_stress_test_base.h | 4 +- db_stress_tool/db_stress_tool.cc | 22 +- db_stress_tool/no_batched_ops_stress.cc | 4 +- env/composite_env_wrapper.h | 4 +- env/env.cc | 4 +- env/env_basic_test.cc | 4 +- env/env_chroot.cc | 4 +- env/env_chroot.h | 4 +- env/env_encryption.cc | 4 +- env/env_hdfs.cc | 8 +- env/env_posix.cc | 4 +- env/env_test.cc | 54 +- env/file_system.cc | 4 +- env/fs_posix.cc | 6 +- env/io_posix.cc | 4 +- env/io_posix.h | 4 +- env/mock_env.cc | 4 +- env/mock_env.h | 4 +- env/mock_env_test.cc | 4 +- examples/column_families_example.cc | 2 +- examples/compact_files_example.cc | 2 +- examples/compaction_filter_example.cc | 31 +- examples/multi_processes_example.cc | 28 +- examples/optimistic_transaction_example.cc | 2 +- examples/options_file_example.cc | 2 +- examples/simple_example.cc | 2 +- examples/transaction_example.cc | 2 +- file/delete_scheduler.cc | 4 +- file/delete_scheduler.h | 4 +- file/delete_scheduler_test.cc | 111 +- file/file_prefetch_buffer.cc | 4 +- file/file_prefetch_buffer.h | 4 +- file/file_util.cc | 4 +- file/file_util.h | 4 +- file/filename.cc | 4 +- file/filename.h | 4 +- file/random_access_file_reader.cc | 4 +- file/random_access_file_reader.h | 4 +- file/read_write_util.cc | 4 +- file/read_write_util.h | 4 +- file/readahead_raf.cc | 4 +- file/readahead_raf.h | 4 +- file/sequence_file_reader.cc | 4 +- file/sequence_file_reader.h | 4 +- file/sst_file_manager_impl.cc | 4 +- file/sst_file_manager_impl.h | 4 +- file/writable_file_writer.cc | 4 +- file/writable_file_writer.h | 4 +- hdfs/env_hdfs.h | 9 +- include/rocksdb/advanced_options.h | 4 +- include/rocksdb/cache.h | 4 +- include/rocksdb/cleanable.h | 6 +- include/rocksdb/compaction_filter.h | 6 +- include/rocksdb/compaction_job_stats.h | 6 +- include/rocksdb/comparator.h | 6 +- include/rocksdb/concurrent_task_limiter.h | 4 +- include/rocksdb/convenience.h | 4 +- include/rocksdb/db.h | 8 +- include/rocksdb/db_bench_tool.h | 6 +- include/rocksdb/db_dump_tool.h | 8 +- include/rocksdb/db_stress_tool.h | 6 +- include/rocksdb/env.h | 14 +- include/rocksdb/env_encryption.h | 4 +- include/rocksdb/experimental.h | 4 +- include/rocksdb/file_checksum.h | 4 +- include/rocksdb/file_system.h | 14 +- include/rocksdb/filter_policy.h | 4 +- include/rocksdb/flush_block_policy.h | 4 +- include/rocksdb/io_status.h | 4 +- include/rocksdb/iostats_context.h | 4 +- include/rocksdb/iterator.h | 4 +- include/rocksdb/ldb_tool.h | 4 +- include/rocksdb/listener.h | 4 +- include/rocksdb/memory_allocator.h | 4 +- include/rocksdb/memtablerep.h | 6 +- include/rocksdb/merge_operator.h | 4 +- include/rocksdb/metadata.h | 4 +- include/rocksdb/options.h | 4 +- include/rocksdb/perf_context.h | 4 +- include/rocksdb/perf_level.h | 6 +- include/rocksdb/persistent_cache.h | 4 +- include/rocksdb/rate_limiter.h | 4 +- include/rocksdb/rocksdb_namespace.h | 10 + include/rocksdb/slice.h | 4 +- include/rocksdb/slice_transform.h | 6 +- include/rocksdb/snapshot.h | 4 +- include/rocksdb/sst_dump_tool.h | 4 +- include/rocksdb/sst_file_manager.h | 4 +- include/rocksdb/sst_file_reader.h | 4 +- include/rocksdb/sst_file_writer.h | 4 +- include/rocksdb/statistics.h | 6 +- include/rocksdb/stats_history.h | 4 +- include/rocksdb/status.h | 4 +- include/rocksdb/table.h | 4 +- include/rocksdb/table_properties.h | 8 +- include/rocksdb/thread_status.h | 6 +- include/rocksdb/threadpool.h | 6 +- include/rocksdb/trace_reader_writer.h | 4 +- include/rocksdb/transaction_log.h | 4 +- include/rocksdb/types.h | 4 +- include/rocksdb/universal_compaction.h | 4 +- include/rocksdb/utilities/backupable_db.h | 4 +- include/rocksdb/utilities/checkpoint.h | 4 +- include/rocksdb/utilities/db_ttl.h | 4 +- include/rocksdb/utilities/debug.h | 4 +- include/rocksdb/utilities/env_librados.h | 4 +- include/rocksdb/utilities/env_mirror.h | 4 +- include/rocksdb/utilities/info_log_finder.h | 4 +- include/rocksdb/utilities/ldb_cmd.h | 4 +- .../utilities/ldb_cmd_execute_result.h | 4 +- include/rocksdb/utilities/leveldb_options.h | 6 +- .../utilities/lua/rocks_lua_custom_library.h | 4 +- .../rocksdb/utilities/lua/rocks_lua_util.h | 4 +- include/rocksdb/utilities/memory_util.h | 4 +- include/rocksdb/utilities/object_registry.h | 4 +- .../utilities/optimistic_transaction_db.h | 4 +- .../utilities/option_change_migration.h | 4 +- include/rocksdb/utilities/options_util.h | 4 +- include/rocksdb/utilities/sim_cache.h | 4 +- include/rocksdb/utilities/stackable_db.h | 4 +- .../utilities/table_properties_collectors.h | 4 +- include/rocksdb/utilities/transaction.h | 4 +- include/rocksdb/utilities/transaction_db.h | 4 +- .../rocksdb/utilities/transaction_db_mutex.h | 4 +- include/rocksdb/utilities/utility_db.h | 4 +- .../utilities/write_batch_with_index.h | 4 +- include/rocksdb/wal_filter.h | 6 +- include/rocksdb/write_batch.h | 4 +- include/rocksdb/write_batch_base.h | 6 +- include/rocksdb/write_buffer_manager.h | 4 +- java/rocksjni/backupablejni.cc | 88 +- java/rocksjni/backupenginejni.cc | 90 +- .../rocksjni/cassandra_compactionfilterjni.cc | 5 +- java/rocksjni/cassandra_value_operator.cc | 7 +- java/rocksjni/checkpoint.cc | 17 +- java/rocksjni/clock_cache.cc | 8 +- java/rocksjni/columnfamilyhandle.cc | 20 +- java/rocksjni/compact_range_options.cc | 55 +- java/rocksjni/compaction_filter.cc | 4 +- java/rocksjni/compaction_filter_factory.cc | 12 +- .../compaction_filter_factory_jnicallback.cc | 6 +- .../compaction_filter_factory_jnicallback.h | 6 +- java/rocksjni/compaction_job_info.cc | 97 +- java/rocksjni/compaction_job_stats.cc | 68 +- java/rocksjni/compaction_options.cc | 24 +- java/rocksjni/compaction_options_fifo.cc | 18 +- java/rocksjni/compaction_options_universal.cc | 56 +- java/rocksjni/comparator.cc | 14 +- java/rocksjni/comparatorjnicallback.cc | 15 +- java/rocksjni/comparatorjnicallback.h | 6 +- java/rocksjni/compression_options.cc | 30 +- java/rocksjni/env.cc | 74 +- java/rocksjni/env_options.cc | 31 +- java/rocksjni/filter.cc | 11 +- java/rocksjni/ingest_external_file_options.cc | 34 +- java/rocksjni/iterator.cc | 71 +- java/rocksjni/jnicallback.cc | 4 +- java/rocksjni/jnicallback.h | 26 +- java/rocksjni/loggerjnicallback.cc | 42 +- java/rocksjni/loggerjnicallback.h | 52 +- java/rocksjni/lru_cache.cc | 8 +- java/rocksjni/memory_util.cc | 39 +- java/rocksjni/memtablejni.cc | 38 +- java/rocksjni/merge_operator.cc | 19 +- .../native_comparator_wrapper_test.cc | 7 +- java/rocksjni/optimistic_transaction_db.cc | 82 +- .../optimistic_transaction_options.cc | 21 +- java/rocksjni/options.cc | 1857 ++++++----- java/rocksjni/options_util.cc | 50 +- java/rocksjni/persistent_cache.cc | 20 +- java/rocksjni/portal.h | 2887 +++++++++-------- java/rocksjni/ratelimiterjni.cc | 28 +- .../remove_emptyvalue_compactionfilterjni.cc | 3 +- java/rocksjni/restorejni.cc | 6 +- java/rocksjni/rocks_callback_object.cc | 2 +- java/rocksjni/rocksdb_exception_test.cc | 26 +- java/rocksjni/rocksjni.cc | 1352 ++++---- java/rocksjni/slice.cc | 58 +- java/rocksjni/snapshot.cc | 3 +- java/rocksjni/sst_file_manager.cc | 71 +- java/rocksjni/sst_file_reader_iterator.cc | 81 +- java/rocksjni/sst_file_readerjni.cc | 36 +- java/rocksjni/sst_file_writerjni.cc | 135 +- java/rocksjni/statistics.cc | 75 +- java/rocksjni/statisticsjni.cc | 6 +- java/rocksjni/statisticsjni.h | 22 +- java/rocksjni/table.cc | 56 +- java/rocksjni/table_filter.cc | 4 +- java/rocksjni/table_filter_jnicallback.cc | 60 +- java/rocksjni/table_filter_jnicallback.h | 14 +- java/rocksjni/thread_status.cc | 50 +- java/rocksjni/trace_writer.cc | 4 +- java/rocksjni/trace_writer_jnicallback.cc | 6 +- java/rocksjni/trace_writer_jnicallback.h | 6 +- java/rocksjni/transaction.cc | 674 ++-- java/rocksjni/transaction_db.cc | 152 +- java/rocksjni/transaction_db_options.cc | 42 +- java/rocksjni/transaction_log.cc | 23 +- java/rocksjni/transaction_notifier.cc | 11 +- .../transaction_notifier_jnicallback.cc | 6 +- .../transaction_notifier_jnicallback.h | 6 +- java/rocksjni/transaction_options.cc | 42 +- java/rocksjni/ttl.cc | 54 +- java/rocksjni/wal_filter.cc | 6 +- java/rocksjni/wal_filter_jnicallback.cc | 10 +- java/rocksjni/wal_filter_jnicallback.h | 6 +- java/rocksjni/write_batch.cc | 234 +- java/rocksjni/write_batch_test.cc | 74 +- java/rocksjni/write_batch_with_index.cc | 356 +- java/rocksjni/write_buffer_manager.cc | 22 +- java/rocksjni/writebatchhandlerjnicallback.cc | 142 +- java/rocksjni/writebatchhandlerjnicallback.h | 19 +- logging/auto_roll_logger.cc | 4 +- logging/auto_roll_logger.h | 4 +- logging/auto_roll_logger_test.cc | 18 +- logging/env_logger.h | 4 +- logging/env_logger_test.cc | 4 +- logging/event_logger.cc | 10 +- logging/event_logger.h | 4 +- logging/event_logger_test.cc | 4 +- logging/log_buffer.cc | 4 +- logging/log_buffer.h | 4 +- logging/logging.h | 53 +- logging/posix_logger.h | 4 +- memory/allocator.h | 4 +- memory/arena.cc | 4 +- memory/arena.h | 4 +- memory/arena_test.cc | 4 +- memory/concurrent_arena.cc | 4 +- memory/concurrent_arena.h | 4 +- memory/jemalloc_nodump_allocator.cc | 4 +- memory/jemalloc_nodump_allocator.h | 4 +- memory/memory_allocator.h | 4 +- memory/memory_usage.h | 4 +- memtable/alloc_tracker.cc | 4 +- memtable/hash_linklist_rep.cc | 4 +- memtable/hash_linklist_rep.h | 4 +- memtable/hash_skiplist_rep.cc | 4 +- memtable/hash_skiplist_rep.h | 4 +- memtable/inlineskiplist.h | 4 +- memtable/inlineskiplist_test.cc | 4 +- memtable/memtablerep_bench.cc | 108 +- memtable/skiplist.h | 4 +- memtable/skiplist_test.cc | 4 +- memtable/skiplistrep.cc | 4 +- memtable/stl_wrappers.h | 4 +- memtable/vectorrep.cc | 4 +- memtable/write_buffer_manager.cc | 4 +- memtable/write_buffer_manager_test.cc | 4 +- monitoring/file_read_sample.h | 4 +- monitoring/histogram.cc | 4 +- monitoring/histogram.h | 4 +- monitoring/histogram_test.cc | 4 +- monitoring/histogram_windowing.cc | 4 +- monitoring/histogram_windowing.h | 4 +- monitoring/in_memory_stats_history.cc | 4 +- monitoring/in_memory_stats_history.h | 4 +- monitoring/instrumented_mutex.cc | 4 +- monitoring/instrumented_mutex.h | 4 +- monitoring/iostats_context.cc | 4 +- monitoring/iostats_context_imp.h | 4 +- monitoring/iostats_context_test.cc | 4 +- monitoring/perf_context.cc | 4 +- monitoring/perf_context_imp.h | 4 +- monitoring/perf_level.cc | 4 +- monitoring/perf_level_imp.h | 4 +- monitoring/perf_step_timer.h | 4 +- monitoring/persistent_stats_history.cc | 4 +- monitoring/persistent_stats_history.h | 4 +- monitoring/statistics.cc | 4 +- monitoring/statistics.h | 4 +- monitoring/statistics_test.cc | 6 +- monitoring/stats_history_test.cc | 100 +- monitoring/thread_status_impl.cc | 4 +- monitoring/thread_status_updater.cc | 4 +- monitoring/thread_status_updater.h | 4 +- monitoring/thread_status_updater_debug.cc | 4 +- monitoring/thread_status_util.cc | 4 +- monitoring/thread_status_util.h | 4 +- monitoring/thread_status_util_debug.cc | 4 +- options/cf_options.cc | 4 +- options/cf_options.h | 4 +- options/db_options.cc | 4 +- options/db_options.h | 4 +- options/options.cc | 8 +- options/options_helper.cc | 4 +- options/options_helper.h | 4 +- options/options_parser.cc | 4 +- options/options_parser.h | 4 +- options/options_sanity_check.cc | 4 +- options/options_sanity_check.h | 6 +- options/options_settable_test.cc | 4 +- options/options_test.cc | 4 +- port/port_dirent.h | 4 +- port/port_example.h | 4 +- port/port_posix.cc | 4 +- port/port_posix.h | 7 +- port/stack_trace.cc | 8 +- port/stack_trace.h | 7 +- port/sys_time.h | 6 +- port/win/env_default.cc | 4 +- port/win/env_win.cc | 9 +- port/win/env_win.h | 4 +- port/win/io_win.cc | 4 +- port/win/io_win.h | 5 +- port/win/port_win.cc | 6 +- port/win/port_win.h | 8 +- port/win/win_jemalloc.cc | 8 +- port/win/win_logger.cc | 4 +- port/win/win_logger.h | 9 +- port/win/win_thread.cc | 4 +- port/win/win_thread.h | 15 +- port/win/xpress_win.cc | 4 +- port/win/xpress_win.h | 7 +- table/adaptive/adaptive_table_factory.cc | 4 +- table/adaptive/adaptive_table_factory.h | 4 +- table/block_based/block.cc | 4 +- table/block_based/block.h | 11 +- table/block_based/block_based_filter_block.cc | 11 +- table/block_based/block_based_filter_block.h | 4 +- .../block_based_filter_block_test.cc | 4 +- .../block_based/block_based_table_builder.cc | 4 +- table/block_based/block_based_table_builder.h | 4 +- .../block_based/block_based_table_factory.cc | 4 +- table/block_based/block_based_table_factory.h | 4 +- table/block_based/block_based_table_reader.cc | 35 +- table/block_based/block_based_table_reader.h | 11 +- table/block_based/block_builder.cc | 4 +- table/block_based/block_builder.h | 4 +- table/block_based/block_prefix_index.cc | 6 +- table/block_based/block_prefix_index.h | 4 +- table/block_based/block_test.cc | 14 +- table/block_based/block_type.h | 4 +- table/block_based/cachable_entry.h | 4 +- table/block_based/data_block_footer.cc | 4 +- table/block_based/data_block_footer.h | 4 +- table/block_based/data_block_hash_index.cc | 4 +- table/block_based/data_block_hash_index.h | 4 +- .../block_based/data_block_hash_index_test.cc | 4 +- table/block_based/filter_block.h | 4 +- .../block_based/filter_block_reader_common.cc | 4 +- .../block_based/filter_block_reader_common.h | 4 +- table/block_based/filter_policy.cc | 4 +- table/block_based/filter_policy_internal.h | 4 +- table/block_based/flush_block_policy.cc | 4 +- table/block_based/flush_block_policy.h | 4 +- table/block_based/full_filter_block.cc | 4 +- table/block_based/full_filter_block.h | 4 +- table/block_based/full_filter_block_test.cc | 4 +- table/block_based/index_builder.cc | 4 +- table/block_based/index_builder.h | 8 +- table/block_based/mock_block_based_table.h | 4 +- table/block_based/parsed_full_filter_block.cc | 4 +- table/block_based/parsed_full_filter_block.h | 4 +- table/block_based/partitioned_filter_block.cc | 4 +- table/block_based/partitioned_filter_block.h | 4 +- .../partitioned_filter_block_test.cc | 10 +- .../block_based/uncompression_dict_reader.cc | 4 +- table/block_based/uncompression_dict_reader.h | 4 +- table/block_fetcher.cc | 4 +- table/block_fetcher.h | 6 +- table/cleanable_test.cc | 6 +- table/cuckoo/cuckoo_table_builder.cc | 4 +- table/cuckoo/cuckoo_table_builder.h | 4 +- table/cuckoo/cuckoo_table_builder_test.cc | 4 +- table/cuckoo/cuckoo_table_factory.cc | 4 +- table/cuckoo/cuckoo_table_factory.h | 4 +- table/cuckoo/cuckoo_table_reader.cc | 4 +- table/cuckoo/cuckoo_table_reader.h | 4 +- table/cuckoo/cuckoo_table_reader_test.cc | 9 +- table/format.cc | 14 +- table/format.h | 4 +- table/get_context.cc | 4 +- table/get_context.h | 4 +- table/internal_iterator.h | 4 +- table/iter_heap.h | 4 +- table/iterator.cc | 4 +- table/iterator_wrapper.h | 4 +- table/merger_test.cc | 4 +- table/merging_iterator.cc | 4 +- table/merging_iterator.h | 4 +- table/meta_blocks.cc | 7 +- table/meta_blocks.h | 4 +- table/mock_table.cc | 4 +- table/mock_table.h | 4 +- table/multiget_context.h | 4 +- table/persistent_cache_helper.cc | 4 +- table/persistent_cache_helper.h | 4 +- table/persistent_cache_options.h | 4 +- table/plain/plain_table_bloom.cc | 4 +- table/plain/plain_table_bloom.h | 4 +- table/plain/plain_table_builder.cc | 4 +- table/plain/plain_table_builder.h | 4 +- table/plain/plain_table_factory.cc | 4 +- table/plain/plain_table_factory.h | 4 +- table/plain/plain_table_index.cc | 4 +- table/plain/plain_table_index.h | 4 +- table/plain/plain_table_key_coding.cc | 4 +- table/plain/plain_table_key_coding.h | 4 +- table/plain/plain_table_reader.cc | 4 +- table/plain/plain_table_reader.h | 4 +- table/scoped_arena_iterator.h | 4 +- table/sst_file_reader.cc | 4 +- table/sst_file_reader_test.cc | 4 +- table/sst_file_writer.cc | 4 +- table/sst_file_writer_collectors.h | 4 +- table/table_builder.h | 4 +- table/table_properties.cc | 11 +- table/table_properties_internal.h | 4 +- table/table_reader.h | 4 +- table/table_reader_bench.cc | 42 +- table/table_reader_caller.h | 4 +- table/table_test.cc | 53 +- table/two_level_iterator.cc | 4 +- table/two_level_iterator.h | 4 +- test_util/fault_injection_test_env.cc | 6 +- test_util/fault_injection_test_env.h | 4 +- test_util/mock_time_env.h | 4 +- test_util/sync_point.cc | 4 +- test_util/sync_point.h | 22 +- test_util/sync_point_impl.cc | 4 +- test_util/sync_point_impl.h | 4 +- test_util/testharness.cc | 4 +- test_util/testharness.h | 10 +- test_util/testutil.cc | 4 +- test_util/testutil.h | 13 +- test_util/transaction_test_util.cc | 4 +- test_util/transaction_test_util.h | 4 +- tools/blob_dump.cc | 4 +- .../block_cache_trace_analyzer.cc | 6 +- .../block_cache_trace_analyzer.h | 6 +- .../block_cache_trace_analyzer_test.cc | 9 +- .../block_cache_trace_analyzer_tool.cc | 2 +- tools/db_bench.cc | 4 +- tools/db_bench_tool.cc | 339 +- tools/db_bench_tool_test.cc | 4 +- tools/db_repl_stress.cc | 2 +- tools/db_sanity_test.cc | 6 +- tools/dump/db_dump_tool.cc | 78 +- tools/dump/rocksdb_dump.cc | 10 +- tools/dump/rocksdb_undump.cc | 10 +- tools/ldb.cc | 2 +- tools/ldb_cmd.cc | 18 +- tools/ldb_cmd_impl.h | 4 +- tools/ldb_cmd_test.cc | 32 +- tools/ldb_tool.cc | 4 +- tools/rdb/db_wrapper.cc | 82 +- tools/rdb/db_wrapper.h | 17 +- tools/reduce_levels_test.cc | 14 +- tools/sst_dump.cc | 2 +- tools/sst_dump_test.cc | 32 +- tools/sst_dump_tool.cc | 40 +- tools/sst_dump_tool_imp.h | 4 +- tools/trace_analyzer.cc | 2 +- tools/trace_analyzer_test.cc | 10 +- tools/trace_analyzer_tool.cc | 28 +- tools/trace_analyzer_tool.h | 47 +- tools/write_stress.cc | 6 +- trace_replay/block_cache_tracer.cc | 7 +- trace_replay/block_cache_tracer.h | 9 +- trace_replay/block_cache_tracer_test.cc | 6 +- trace_replay/trace_replay.cc | 4 +- trace_replay/trace_replay.h | 4 +- util/aligned_buffer.h | 4 +- util/autovector.h | 6 +- util/autovector_test.cc | 6 +- util/bloom_impl.h | 4 +- util/bloom_test.cc | 4 +- util/cast_util.h | 4 +- util/channel.h | 4 +- util/coding.cc | 4 +- util/coding.h | 4 +- util/coding_test.cc | 4 +- util/compaction_job_stats_impl.cc | 4 +- util/comparator.cc | 4 +- util/compression.h | 12 +- util/compression_context_cache.cc | 4 +- util/compression_context_cache.h | 6 +- util/concurrent_task_limiter_impl.cc | 4 +- util/concurrent_task_limiter_impl.h | 4 +- util/core_local.h | 4 +- util/crc32c.cc | 4 +- util/crc32c.h | 6 +- util/crc32c_test.cc | 16 +- util/defer.h | 4 +- util/defer_test.cc | 6 +- util/duplicate_detector.h | 4 +- util/dynamic_bloom.cc | 4 +- util/dynamic_bloom.h | 4 +- util/dynamic_bloom_test.cc | 4 +- util/file_checksum_helper.cc | 4 +- util/file_checksum_helper.h | 4 +- util/file_reader_writer_test.cc | 4 +- util/filelock_test.cc | 8 +- util/filter_bench.cc | 50 +- util/hash.cc | 4 +- util/hash.h | 4 +- util/hash_map.h | 4 +- util/hash_test.cc | 22 +- util/heap.h | 4 +- util/heap_test.cc | 4 +- util/kv_map.h | 4 +- util/log_write_bench.cc | 6 +- util/murmurhash.h | 4 +- util/mutexlock.h | 4 +- util/random.cc | 4 +- util/random.h | 8 +- util/random_test.cc | 2 +- util/rate_limiter.cc | 4 +- util/rate_limiter.h | 4 +- util/rate_limiter_test.cc | 14 +- util/repeatable_thread.h | 4 +- util/repeatable_thread_test.cc | 29 +- util/set_comparator.h | 4 +- util/slice.cc | 4 +- util/slice_test.cc | 6 +- util/slice_transform_test.cc | 6 +- util/status.cc | 4 +- util/stderr_logger.h | 4 +- util/stop_watch.h | 4 +- util/string_util.cc | 4 +- util/string_util.h | 6 +- util/thread_list_test.cc | 4 +- util/thread_local.cc | 4 +- util/thread_local.h | 4 +- util/thread_local_test.cc | 8 +- util/thread_operation.h | 4 +- util/threadpool_imp.cc | 4 +- util/threadpool_imp.h | 5 +- util/timer_queue.h | 2 +- util/user_comparator_wrapper.h | 4 +- util/vector_iterator.h | 4 +- utilities/backupable/backupable_db.cc | 16 +- utilities/backupable/backupable_db_test.cc | 20 +- utilities/blob_db/blob_compaction_filter.cc | 4 +- utilities/blob_db/blob_compaction_filter.h | 4 +- utilities/blob_db/blob_db.cc | 4 +- utilities/blob_db/blob_db.h | 20 +- utilities/blob_db/blob_db_gc_stats.h | 4 +- utilities/blob_db/blob_db_impl.cc | 4 +- utilities/blob_db/blob_db_impl.h | 4 +- .../blob_db/blob_db_impl_filesnapshot.cc | 4 +- utilities/blob_db/blob_db_iterator.h | 6 +- utilities/blob_db/blob_db_listener.h | 4 +- utilities/blob_db/blob_db_test.cc | 12 +- utilities/blob_db/blob_dump_tool.cc | 4 +- utilities/blob_db/blob_dump_tool.h | 4 +- utilities/blob_db/blob_file.cc | 4 +- utilities/blob_db/blob_file.h | 4 +- utilities/blob_db/blob_log_format.cc | 4 +- utilities/blob_db/blob_log_format.h | 4 +- utilities/blob_db/blob_log_reader.cc | 4 +- utilities/blob_db/blob_log_reader.h | 4 +- utilities/blob_db/blob_log_writer.cc | 4 +- utilities/blob_db/blob_log_writer.h | 4 +- .../cassandra/cassandra_compaction_filter.cc | 5 +- .../cassandra/cassandra_compaction_filter.h | 4 +- utilities/cassandra/cassandra_format_test.cc | 6 +- .../cassandra/cassandra_functional_test.cc | 6 +- .../cassandra/cassandra_row_merge_test.cc | 4 +- .../cassandra/cassandra_serialize_test.cc | 6 +- utilities/cassandra/format.cc | 58 +- utilities/cassandra/format.h | 4 +- utilities/cassandra/merge_operator.cc | 4 +- utilities/cassandra/merge_operator.h | 4 +- utilities/cassandra/serialize.h | 4 +- utilities/cassandra/test_utils.cc | 4 +- utilities/cassandra/test_utils.h | 4 +- utilities/checkpoint/checkpoint_impl.cc | 6 +- utilities/checkpoint/checkpoint_impl.h | 4 +- utilities/checkpoint/checkpoint_test.cc | 46 +- .../remove_emptyvalue_compactionfilter.cc | 4 +- .../remove_emptyvalue_compactionfilter.h | 4 +- utilities/convenience/info_log_finder.cc | 4 +- utilities/debug.cc | 4 +- utilities/env_librados.cc | 4 +- utilities/env_librados_test.cc | 25 +- utilities/env_mirror.cc | 4 +- utilities/env_mirror_test.cc | 4 +- utilities/env_timed.cc | 4 +- utilities/env_timed_test.cc | 4 +- utilities/leveldb_options/leveldb_options.cc | 4 +- utilities/memory/memory_test.cc | 4 +- utilities/memory/memory_util.cc | 4 +- utilities/merge_operators.h | 4 +- utilities/merge_operators/bytesxor.cc | 4 +- utilities/merge_operators/bytesxor.h | 4 +- utilities/merge_operators/max.cc | 10 +- utilities/merge_operators/put.cc | 6 +- utilities/merge_operators/sortlist.cc | 10 +- utilities/merge_operators/sortlist.h | 4 +- .../string_append/stringappend.cc | 4 +- .../string_append/stringappend.h | 4 +- .../string_append/stringappend2.cc | 4 +- .../string_append/stringappend2.h | 4 +- .../string_append/stringappend_test.cc | 15 +- utilities/merge_operators/uint64add.cc | 6 +- utilities/object_registry.cc | 4 +- utilities/object_registry_test.cc | 4 +- .../option_change_migration.cc | 8 +- .../option_change_migration_test.cc | 6 +- utilities/options/options_util.cc | 4 +- utilities/options/options_util_test.cc | 4 +- .../persistent_cache/block_cache_tier.cc | 4 +- utilities/persistent_cache/block_cache_tier.h | 6 +- .../persistent_cache/block_cache_tier_file.cc | 4 +- .../persistent_cache/block_cache_tier_file.h | 4 +- .../block_cache_tier_file_buffer.h | 4 +- .../block_cache_tier_metadata.cc | 4 +- .../block_cache_tier_metadata.h | 4 +- utilities/persistent_cache/hash_table.h | 4 +- .../persistent_cache/hash_table_bench.cc | 18 +- .../persistent_cache/hash_table_evictable.h | 4 +- utilities/persistent_cache/hash_table_test.cc | 4 +- utilities/persistent_cache/lrulist.h | 4 +- .../persistent_cache_bench.cc | 16 +- .../persistent_cache/persistent_cache_test.cc | 38 +- .../persistent_cache/persistent_cache_test.h | 4 +- .../persistent_cache/persistent_cache_tier.cc | 4 +- .../persistent_cache/persistent_cache_tier.h | 4 +- .../persistent_cache/persistent_cache_util.h | 4 +- .../persistent_cache/volatile_tier_impl.cc | 4 +- .../persistent_cache/volatile_tier_impl.h | 4 +- utilities/simulator_cache/cache_simulator.cc | 4 +- utilities/simulator_cache/cache_simulator.h | 4 +- .../simulator_cache/cache_simulator_test.cc | 6 +- utilities/simulator_cache/sim_cache.cc | 4 +- utilities/simulator_cache/sim_cache_test.cc | 8 +- .../compact_on_deletion_collector.cc | 4 +- .../compact_on_deletion_collector.h | 4 +- .../compact_on_deletion_collector_test.cc | 36 +- utilities/trace/file_trace_reader_writer.cc | 4 +- utilities/trace/file_trace_reader_writer.h | 4 +- .../transactions/optimistic_transaction.cc | 4 +- .../transactions/optimistic_transaction.h | 4 +- .../optimistic_transaction_db_impl.cc | 4 +- .../optimistic_transaction_db_impl.h | 4 +- .../optimistic_transaction_test.cc | 10 +- .../transactions/pessimistic_transaction.cc | 4 +- .../transactions/pessimistic_transaction.h | 4 +- .../pessimistic_transaction_db.cc | 4 +- .../transactions/pessimistic_transaction_db.h | 4 +- utilities/transactions/snapshot_checker.cc | 4 +- utilities/transactions/transaction_base.cc | 4 +- utilities/transactions/transaction_base.h | 4 +- .../transactions/transaction_db_mutex_impl.cc | 4 +- .../transactions/transaction_db_mutex_impl.h | 4 +- .../transactions/transaction_lock_mgr.cc | 4 +- utilities/transactions/transaction_lock_mgr.h | 4 +- utilities/transactions/transaction_test.cc | 60 +- utilities/transactions/transaction_test.h | 4 +- utilities/transactions/transaction_util.cc | 5 +- utilities/transactions/transaction_util.h | 4 +- .../write_prepared_transaction_test.cc | 143 +- utilities/transactions/write_prepared_txn.cc | 4 +- utilities/transactions/write_prepared_txn.h | 4 +- .../transactions/write_prepared_txn_db.cc | 4 +- .../transactions/write_prepared_txn_db.h | 4 +- .../write_unprepared_transaction_test.cc | 5 +- .../transactions/write_unprepared_txn.cc | 4 +- utilities/transactions/write_unprepared_txn.h | 4 +- .../transactions/write_unprepared_txn_db.cc | 4 +- .../transactions/write_unprepared_txn_db.h | 4 +- utilities/ttl/db_ttl_impl.cc | 4 +- utilities/ttl/db_ttl_impl.h | 5 +- utilities/ttl/ttl_test.cc | 4 +- utilities/util_merge_operators_test.cc | 4 +- .../write_batch_with_index.cc | 4 +- .../write_batch_with_index_internal.cc | 4 +- .../write_batch_with_index_internal.h | 4 +- .../write_batch_with_index_test.cc | 6 +- 889 files changed, 9546 insertions(+), 8442 deletions(-) create mode 100644 include/rocksdb/rocksdb_namespace.h diff --git a/.travis.yml b/.travis.yml index 6f8f77ee48..feca073a55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -103,7 +103,7 @@ script: OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=db_block_cache_test ROCKSDBTESTS_END=db_iter_test make -j4 check_some ;; 2) - OPT=-DTRAVIS V=1 make -j4 tools && OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=db_iter_test ROCKSDBTESTS_END=options_file_test make -j4 check_some + OPT="-DTRAVIS -DROCKSDB_NAMESPACE=alternative_rocksdb_ns" V=1 make -j4 tools && OPT="-DTRAVIS -DROCKSDB_NAMESPACE=alternative_rocksdb_ns" V=1 ROCKSDBTESTS_START=db_iter_test ROCKSDBTESTS_END=options_file_test make -j4 check_some ;; 3) OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=options_file_test ROCKSDBTESTS_END=write_prepared_transaction_test make -j4 check_some diff --git a/HISTORY.md b/HISTORY.md index 9c954b4963..f8355ef72a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -23,6 +23,7 @@ ### New Features * Added the checksum for each SST file generated by Flush or Compaction. Added sst_file_checksum_func to Options such that user can plugin their own SST file checksum function via override the FileChecksumFunc class. If user does not set the sst_file_checksum_func, SST file checksum calculation will not be enabled. The checksum information inlcuding uint32_t checksum value and a checksum function name (string). The checksum information is stored in FileMetadata in version store and also logged to MANIFEST. A new tool is added to LDB such that user can dump out a list of file checksum information from MANIFEST (stored in an unordered_map). * `db_bench` now supports `value_size_distribution_type`, `value_size_min`, `value_size_max` options for generating random variable sized value. Added `blob_db_compression_type` option for BlobDB to enable blob compression. +* Replace RocksDB namespace "rocksdb" with flag "ROCKSDB_NAMESPACE" which if is not defined, defined as "rocksdb". ## 6.7.0 (01/21/2020) ### Public API Change diff --git a/cache/cache_bench.cc b/cache/cache_bench.cc index 288662ad9d..6ff36a32d4 100644 --- a/cache/cache_bench.cc +++ b/cache/cache_bench.cc @@ -45,7 +45,7 @@ DEFINE_int32(erase_percent, 10, DEFINE_bool(use_clock_cache, false, ""); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CacheBench; namespace { @@ -154,7 +154,7 @@ class CacheBench { } bool Run() { - rocksdb::Env* env = rocksdb::Env::Default(); + ROCKSDB_NAMESPACE::Env* env = ROCKSDB_NAMESPACE::Env::Default(); PrintEnv(); SharedState shared(this); @@ -257,7 +257,7 @@ class CacheBench { printf("----------------------------\n"); } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ParseCommandLineFlags(&argc, &argv, true); @@ -267,7 +267,7 @@ int main(int argc, char** argv) { exit(1); } - rocksdb::CacheBench bench; + ROCKSDB_NAMESPACE::CacheBench bench; if (FLAGS_populate_cache) { bench.PopulateCache(); } diff --git a/cache/cache_test.cc b/cache/cache_test.cc index a0f75bfdc4..ceafefe6f1 100644 --- a/cache/cache_test.cc +++ b/cache/cache_test.cc @@ -20,7 +20,7 @@ #include "util/coding.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Conversions between numeric keys/values and the types expected by Cache. static std::string EncodeKey(int k) { @@ -765,7 +765,7 @@ INSTANTIATE_TEST_CASE_P(CacheTestInstance, CacheTest, testing::Values(kLRU)); #endif // SUPPORT_CLOCK_CACHE INSTANTIATE_TEST_CASE_P(CacheTestInstance, LRUCacheTest, testing::Values(kLRU)); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/cache/clock_cache.cc b/cache/clock_cache.cc index 9165ad5dd1..797a44fd9d 100644 --- a/cache/clock_cache.cc +++ b/cache/clock_cache.cc @@ -11,7 +11,7 @@ #ifndef SUPPORT_CLOCK_CACHE -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::shared_ptr NewClockCache( size_t /*capacity*/, int /*num_shard_bits*/, bool /*strict_capacity_limit*/, @@ -20,7 +20,7 @@ std::shared_ptr NewClockCache( return nullptr; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #else @@ -41,7 +41,7 @@ std::shared_ptr NewClockCache( #include "util/autovector.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -756,6 +756,6 @@ std::shared_ptr NewClockCache( capacity, num_shard_bits, strict_capacity_limit, metadata_charge_policy); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // SUPPORT_CLOCK_CACHE diff --git a/cache/lru_cache.cc b/cache/lru_cache.cc index 0e49167ed5..9874178063 100644 --- a/cache/lru_cache.cc +++ b/cache/lru_cache.cc @@ -16,7 +16,7 @@ #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { LRUHandleTable::LRUHandleTable() : list_(nullptr), length_(0), elems_(0) { Resize(); @@ -571,4 +571,4 @@ std::shared_ptr NewLRUCache( std::move(memory_allocator), use_adaptive_mutex, metadata_charge_policy); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/cache/lru_cache.h b/cache/lru_cache.h index 1d9c8935c9..827e0bece2 100644 --- a/cache/lru_cache.h +++ b/cache/lru_cache.h @@ -16,7 +16,7 @@ #include "port/port.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // LRU cache implementation. This class is not thread-safe. @@ -336,4 +336,4 @@ class LRUCache int num_shards_ = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/cache/lru_cache_test.cc b/cache/lru_cache_test.cc index f4f4dee69c..f777711f14 100644 --- a/cache/lru_cache_test.cc +++ b/cache/lru_cache_test.cc @@ -10,7 +10,7 @@ #include "port/port.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class LRUCacheTest : public testing::Test { public: @@ -190,7 +190,7 @@ TEST_F(LRUCacheTest, EntriesWithPriority) { ValidateLRUList({"e", "f", "g", "Z", "d"}, 2); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/cache/sharded_cache.cc b/cache/sharded_cache.cc index 8fc0a7a17a..6c915df8cc 100644 --- a/cache/sharded_cache.cc +++ b/cache/sharded_cache.cc @@ -13,7 +13,7 @@ #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { ShardedCache::ShardedCache(size_t capacity, int num_shard_bits, bool strict_capacity_limit, @@ -159,4 +159,4 @@ int GetDefaultCacheShardBits(size_t capacity) { return num_shard_bits; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/cache/sharded_cache.h b/cache/sharded_cache.h index 4a396bd47f..ce9e459dc1 100644 --- a/cache/sharded_cache.h +++ b/cache/sharded_cache.h @@ -16,7 +16,7 @@ #include "rocksdb/cache.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Single cache shard interface. class CacheShard { @@ -108,4 +108,4 @@ class ShardedCache : public Cache { extern int GetDefaultCacheShardBits(size_t capacity); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/arena_wrapped_db_iter.cc b/db/arena_wrapped_db_iter.cc index c2de8db9e5..f43282a75b 100644 --- a/db/arena_wrapped_db_iter.cc +++ b/db/arena_wrapped_db_iter.cc @@ -16,7 +16,7 @@ #include "table/iterator_wrapper.h" #include "util/user_comparator_wrapper.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status ArenaWrappedDBIter::GetProperty(std::string prop_name, std::string* prop) { @@ -103,4 +103,4 @@ ArenaWrappedDBIter* NewArenaWrappedDbIterator( return iter; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/arena_wrapped_db_iter.h b/db/arena_wrapped_db_iter.h index 6dbd64521b..d0eedcb357 100644 --- a/db/arena_wrapped_db_iter.h +++ b/db/arena_wrapped_db_iter.h @@ -20,7 +20,7 @@ #include "rocksdb/iterator.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Arena; @@ -109,4 +109,4 @@ extern ArenaWrappedDBIter* NewArenaWrappedDbIterator( ReadCallback* read_callback, DBImpl* db_impl = nullptr, ColumnFamilyData* cfd = nullptr, bool allow_blob = false, bool allow_refresh = true); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/blob_index.h b/db/blob_index.h index eb23e223e5..483a7b97bf 100644 --- a/db/blob_index.h +++ b/db/blob_index.h @@ -12,7 +12,7 @@ #include "util/coding.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // BlobIndex is a pointer to the blob and metadata of the blob. The index is // stored in base DB as ValueType::kTypeBlobIndex. @@ -175,5 +175,5 @@ class BlobIndex { CompressionType compression_ = kNoCompression; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/builder.cc b/db/builder.cc index 1f25e1c6fa..fdb814cbba 100644 --- a/db/builder.cc +++ b/db/builder.cc @@ -37,7 +37,7 @@ #include "test_util/sync_point.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TableFactory; @@ -260,4 +260,4 @@ Status BuildTable( return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/builder.h b/db/builder.h index 74012b3378..062f1fb80f 100644 --- a/db/builder.h +++ b/db/builder.h @@ -22,7 +22,7 @@ #include "rocksdb/types.h" #include "table/scoped_arena_iterator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct Options; struct FileMetaData; @@ -85,4 +85,4 @@ extern Status BuildTable( Env::WriteLifeTimeHint write_hint = Env::WLTH_NOT_SET, const uint64_t file_creation_time = 0); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/c.cc b/db/c.cc index b14a367424..83d35a29eb 100644 --- a/db/c.cc +++ b/db/c.cc @@ -46,74 +46,74 @@ #include #include -using rocksdb::BytewiseComparator; -using rocksdb::Cache; -using rocksdb::ColumnFamilyDescriptor; -using rocksdb::ColumnFamilyHandle; -using rocksdb::ColumnFamilyOptions; -using rocksdb::CompactionFilter; -using rocksdb::CompactionFilterFactory; -using rocksdb::CompactionFilterContext; -using rocksdb::CompactionOptionsFIFO; -using rocksdb::Comparator; -using rocksdb::CompressionType; -using rocksdb::WALRecoveryMode; -using rocksdb::DB; -using rocksdb::DBOptions; -using rocksdb::DbPath; -using rocksdb::Env; -using rocksdb::EnvOptions; -using rocksdb::InfoLogLevel; -using rocksdb::FileLock; -using rocksdb::FilterPolicy; -using rocksdb::FlushOptions; -using rocksdb::IngestExternalFileOptions; -using rocksdb::Iterator; -using rocksdb::Logger; -using rocksdb::MergeOperator; -using rocksdb::MergeOperators; -using rocksdb::NewBloomFilterPolicy; -using rocksdb::NewLRUCache; -using rocksdb::Options; -using rocksdb::BlockBasedTableOptions; -using rocksdb::CuckooTableOptions; -using rocksdb::RandomAccessFile; -using rocksdb::Range; -using rocksdb::ReadOptions; -using rocksdb::SequentialFile; -using rocksdb::Slice; -using rocksdb::SliceParts; -using rocksdb::SliceTransform; -using rocksdb::Snapshot; -using rocksdb::SstFileWriter; -using rocksdb::Status; -using rocksdb::WritableFile; -using rocksdb::WriteBatch; -using rocksdb::WriteBatchWithIndex; -using rocksdb::WriteOptions; -using rocksdb::LiveFileMetaData; -using rocksdb::BackupEngine; -using rocksdb::BackupableDBOptions; -using rocksdb::BackupInfo; -using rocksdb::BackupID; -using rocksdb::RestoreOptions; -using rocksdb::CompactRangeOptions; -using rocksdb::BottommostLevelCompaction; -using rocksdb::RateLimiter; -using rocksdb::NewGenericRateLimiter; -using rocksdb::PinnableSlice; -using rocksdb::TransactionDBOptions; -using rocksdb::TransactionDB; -using rocksdb::TransactionOptions; -using rocksdb::OptimisticTransactionDB; -using rocksdb::OptimisticTransactionOptions; -using rocksdb::Transaction; -using rocksdb::Checkpoint; -using rocksdb::TransactionLogIterator; -using rocksdb::BatchResult; -using rocksdb::PerfLevel; -using rocksdb::PerfContext; -using rocksdb::MemoryUtil; +using ROCKSDB_NAMESPACE::BackupableDBOptions; +using ROCKSDB_NAMESPACE::BackupEngine; +using ROCKSDB_NAMESPACE::BackupID; +using ROCKSDB_NAMESPACE::BackupInfo; +using ROCKSDB_NAMESPACE::BatchResult; +using ROCKSDB_NAMESPACE::BlockBasedTableOptions; +using ROCKSDB_NAMESPACE::BottommostLevelCompaction; +using ROCKSDB_NAMESPACE::BytewiseComparator; +using ROCKSDB_NAMESPACE::Cache; +using ROCKSDB_NAMESPACE::Checkpoint; +using ROCKSDB_NAMESPACE::ColumnFamilyDescriptor; +using ROCKSDB_NAMESPACE::ColumnFamilyHandle; +using ROCKSDB_NAMESPACE::ColumnFamilyOptions; +using ROCKSDB_NAMESPACE::CompactionFilter; +using ROCKSDB_NAMESPACE::CompactionFilterContext; +using ROCKSDB_NAMESPACE::CompactionFilterFactory; +using ROCKSDB_NAMESPACE::CompactionOptionsFIFO; +using ROCKSDB_NAMESPACE::CompactRangeOptions; +using ROCKSDB_NAMESPACE::Comparator; +using ROCKSDB_NAMESPACE::CompressionType; +using ROCKSDB_NAMESPACE::CuckooTableOptions; +using ROCKSDB_NAMESPACE::DB; +using ROCKSDB_NAMESPACE::DBOptions; +using ROCKSDB_NAMESPACE::DbPath; +using ROCKSDB_NAMESPACE::Env; +using ROCKSDB_NAMESPACE::EnvOptions; +using ROCKSDB_NAMESPACE::FileLock; +using ROCKSDB_NAMESPACE::FilterPolicy; +using ROCKSDB_NAMESPACE::FlushOptions; +using ROCKSDB_NAMESPACE::InfoLogLevel; +using ROCKSDB_NAMESPACE::IngestExternalFileOptions; +using ROCKSDB_NAMESPACE::Iterator; +using ROCKSDB_NAMESPACE::LiveFileMetaData; +using ROCKSDB_NAMESPACE::Logger; +using ROCKSDB_NAMESPACE::MemoryUtil; +using ROCKSDB_NAMESPACE::MergeOperator; +using ROCKSDB_NAMESPACE::MergeOperators; +using ROCKSDB_NAMESPACE::NewBloomFilterPolicy; +using ROCKSDB_NAMESPACE::NewGenericRateLimiter; +using ROCKSDB_NAMESPACE::NewLRUCache; +using ROCKSDB_NAMESPACE::OptimisticTransactionDB; +using ROCKSDB_NAMESPACE::OptimisticTransactionOptions; +using ROCKSDB_NAMESPACE::Options; +using ROCKSDB_NAMESPACE::PerfContext; +using ROCKSDB_NAMESPACE::PerfLevel; +using ROCKSDB_NAMESPACE::PinnableSlice; +using ROCKSDB_NAMESPACE::RandomAccessFile; +using ROCKSDB_NAMESPACE::Range; +using ROCKSDB_NAMESPACE::RateLimiter; +using ROCKSDB_NAMESPACE::ReadOptions; +using ROCKSDB_NAMESPACE::RestoreOptions; +using ROCKSDB_NAMESPACE::SequentialFile; +using ROCKSDB_NAMESPACE::Slice; +using ROCKSDB_NAMESPACE::SliceParts; +using ROCKSDB_NAMESPACE::SliceTransform; +using ROCKSDB_NAMESPACE::Snapshot; +using ROCKSDB_NAMESPACE::SstFileWriter; +using ROCKSDB_NAMESPACE::Status; +using ROCKSDB_NAMESPACE::Transaction; +using ROCKSDB_NAMESPACE::TransactionDB; +using ROCKSDB_NAMESPACE::TransactionDBOptions; +using ROCKSDB_NAMESPACE::TransactionLogIterator; +using ROCKSDB_NAMESPACE::TransactionOptions; +using ROCKSDB_NAMESPACE::WALRecoveryMode; +using ROCKSDB_NAMESPACE::WritableFile; +using ROCKSDB_NAMESPACE::WriteBatch; +using ROCKSDB_NAMESPACE::WriteBatchWithIndex; +using ROCKSDB_NAMESPACE::WriteOptions; using std::shared_ptr; using std::vector; @@ -452,7 +452,7 @@ struct rocksdb_slicetransform_t : public SliceTransform { }; struct rocksdb_universal_compaction_options_t { - rocksdb::CompactionOptionsUniversal *rep; + ROCKSDB_NAMESPACE::CompactionOptionsUniversal* rep; }; static bool SaveError(char** errptr, const Status& s) { @@ -494,8 +494,9 @@ rocksdb_t* rocksdb_open_with_ttl( const char* name, int ttl, char** errptr) { - rocksdb::DBWithTTL* db; - if (SaveError(errptr, rocksdb::DBWithTTL::Open(options->rep, std::string(name), &db, ttl))) { + ROCKSDB_NAMESPACE::DBWithTTL* db; + if (SaveError(errptr, ROCKSDB_NAMESPACE::DBWithTTL::Open( + options->rep, std::string(name), &db, ttl))) { return nullptr; } rocksdb_t* result = new rocksdb_t; @@ -664,7 +665,8 @@ void rocksdb_close(rocksdb_t* db) { } void rocksdb_options_set_uint64add_merge_operator(rocksdb_options_t* opt) { - opt->rep.merge_operator = rocksdb::MergeOperators::CreateUInt64AddOperator(); + opt->rep.merge_operator = + ROCKSDB_NAMESPACE::MergeOperators::CreateUInt64AddOperator(); } rocksdb_t* rocksdb_open_column_families( @@ -2078,7 +2080,7 @@ void rocksdb_options_set_block_based_table_factory( rocksdb_block_based_table_options_t* table_options) { if (table_options) { opt->rep.table_factory.reset( - rocksdb::NewBlockBasedTableFactory(table_options->rep)); + ROCKSDB_NAMESPACE::NewBlockBasedTableFactory(table_options->rep)); } } @@ -2122,7 +2124,7 @@ void rocksdb_options_set_cuckoo_table_factory( rocksdb_cuckoo_table_options_t* table_options) { if (table_options) { opt->rep.table_factory.reset( - rocksdb::NewCuckooTableFactory(table_options->rep)); + ROCKSDB_NAMESPACE::NewCuckooTableFactory(table_options->rep)); } } @@ -2312,7 +2314,7 @@ void rocksdb_options_set_max_bytes_for_level_multiplier_additional( } void rocksdb_options_enable_statistics(rocksdb_options_t* opt) { - opt->rep.statistics = rocksdb::CreateDBStatistics(); + opt->rep.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); } void rocksdb_options_set_skip_stats_update_on_db_open(rocksdb_options_t* opt, @@ -2468,16 +2470,20 @@ void rocksdb_options_set_access_hint_on_compaction_start( rocksdb_options_t* opt, int v) { switch(v) { case 0: - opt->rep.access_hint_on_compaction_start = rocksdb::Options::NONE; + opt->rep.access_hint_on_compaction_start = + ROCKSDB_NAMESPACE::Options::NONE; break; case 1: - opt->rep.access_hint_on_compaction_start = rocksdb::Options::NORMAL; + opt->rep.access_hint_on_compaction_start = + ROCKSDB_NAMESPACE::Options::NORMAL; break; case 2: - opt->rep.access_hint_on_compaction_start = rocksdb::Options::SEQUENTIAL; + opt->rep.access_hint_on_compaction_start = + ROCKSDB_NAMESPACE::Options::SEQUENTIAL; break; case 3: - opt->rep.access_hint_on_compaction_start = rocksdb::Options::WILLNEED; + opt->rep.access_hint_on_compaction_start = + ROCKSDB_NAMESPACE::Options::WILLNEED; break; } } @@ -2643,7 +2649,7 @@ void rocksdb_options_prepare_for_bulk_load(rocksdb_options_t* opt) { } void rocksdb_options_set_memtable_vector_rep(rocksdb_options_t *opt) { - opt->rep.memtable_factory.reset(new rocksdb::VectorRepFactory); + opt->rep.memtable_factory.reset(new ROCKSDB_NAMESPACE::VectorRepFactory); } void rocksdb_options_set_memtable_prefix_bloom_size_ratio( @@ -2659,26 +2665,29 @@ void rocksdb_options_set_memtable_huge_page_size(rocksdb_options_t* opt, void rocksdb_options_set_hash_skip_list_rep( rocksdb_options_t *opt, size_t bucket_count, int32_t skiplist_height, int32_t skiplist_branching_factor) { - rocksdb::MemTableRepFactory* factory = rocksdb::NewHashSkipListRepFactory( - bucket_count, skiplist_height, skiplist_branching_factor); + ROCKSDB_NAMESPACE::MemTableRepFactory* factory = + ROCKSDB_NAMESPACE::NewHashSkipListRepFactory( + bucket_count, skiplist_height, skiplist_branching_factor); opt->rep.memtable_factory.reset(factory); } void rocksdb_options_set_hash_link_list_rep( rocksdb_options_t *opt, size_t bucket_count) { - opt->rep.memtable_factory.reset(rocksdb::NewHashLinkListRepFactory(bucket_count)); + opt->rep.memtable_factory.reset( + ROCKSDB_NAMESPACE::NewHashLinkListRepFactory(bucket_count)); } void rocksdb_options_set_plain_table_factory( rocksdb_options_t *opt, uint32_t user_key_len, int bloom_bits_per_key, double hash_table_ratio, size_t index_sparseness) { - rocksdb::PlainTableOptions options; + ROCKSDB_NAMESPACE::PlainTableOptions options; options.user_key_len = user_key_len; options.bloom_bits_per_key = bloom_bits_per_key; options.hash_table_ratio = hash_table_ratio; options.index_sparseness = index_sparseness; - rocksdb::TableFactory* factory = rocksdb::NewPlainTableFactory(options); + ROCKSDB_NAMESPACE::TableFactory* factory = + ROCKSDB_NAMESPACE::NewPlainTableFactory(options); opt->rep.table_factory.reset(factory); } @@ -2708,7 +2717,8 @@ void rocksdb_options_set_report_bg_io_stats( } void rocksdb_options_set_compaction_style(rocksdb_options_t *opt, int style) { - opt->rep.compaction_style = static_cast(style); + opt->rep.compaction_style = + static_cast(style); } void rocksdb_options_set_universal_compaction_options(rocksdb_options_t *opt, rocksdb_universal_compaction_options_t *uco) { @@ -2722,7 +2732,7 @@ void rocksdb_options_set_fifo_compaction_options( } char *rocksdb_options_statistics_get_string(rocksdb_options_t *opt) { - rocksdb::Statistics *statistics = opt->rep.statistics.get(); + ROCKSDB_NAMESPACE::Statistics* statistics = opt->rep.statistics.get(); if (statistics) { return strdup(statistics->ToString().c_str()); } @@ -2762,7 +2772,7 @@ void rocksdb_set_perf_level(int v) { rocksdb_perfcontext_t* rocksdb_perfcontext_create() { rocksdb_perfcontext_t* context = new rocksdb_perfcontext_t; - context->rep = rocksdb::get_perf_context(); + context->rep = ROCKSDB_NAMESPACE::get_perf_context(); return context; } @@ -3064,11 +3074,12 @@ rocksdb_filterpolicy_t* rocksdb_filterpolicy_create_bloom_format(int bits_per_ke return rep_->KeyMayMatch(key, filter); } // No need to override GetFilterBitsBuilder if this one is overridden - rocksdb::FilterBitsBuilder* GetBuilderWithContext( - const rocksdb::FilterBuildingContext& context) const override { + ROCKSDB_NAMESPACE::FilterBitsBuilder* GetBuilderWithContext( + const ROCKSDB_NAMESPACE::FilterBuildingContext& context) + const override { return rep_->GetBuilderWithContext(context); } - rocksdb::FilterBitsReader* GetFilterBitsReader( + ROCKSDB_NAMESPACE::FilterBitsReader* GetFilterBitsReader( const Slice& contents) const override { return rep_->GetFilterBitsReader(contents); } @@ -3170,7 +3181,7 @@ void rocksdb_readoptions_set_iterate_lower_bound( void rocksdb_readoptions_set_read_tier( rocksdb_readoptions_t* opt, int v) { - opt->rep.read_tier = static_cast(v); + opt->rep.read_tier = static_cast(v); } void rocksdb_readoptions_set_tailing( @@ -3342,7 +3353,7 @@ rocksdb_env_t* rocksdb_create_default_env() { rocksdb_env_t* rocksdb_create_mem_env() { rocksdb_env_t* result = new rocksdb_env_t; - result->rep = rocksdb::NewMemEnv(Env::Default()); + result->rep = ROCKSDB_NAMESPACE::NewMemEnv(Env::Default()); result->is_default = false; return result; } @@ -3557,7 +3568,7 @@ struct Wrapper : public rocksdb_slicetransform_t { rocksdb_slicetransform_t* rocksdb_slicetransform_create_fixed_prefix(size_t prefixLen) { Wrapper* wrapper = new Wrapper; - wrapper->rep_ = rocksdb::NewFixedPrefixTransform(prefixLen); + wrapper->rep_ = ROCKSDB_NAMESPACE::NewFixedPrefixTransform(prefixLen); wrapper->state_ = nullptr; wrapper->destructor_ = &Wrapper::DoNothing; return wrapper; @@ -3565,7 +3576,7 @@ rocksdb_slicetransform_t* rocksdb_slicetransform_create_fixed_prefix(size_t pref rocksdb_slicetransform_t* rocksdb_slicetransform_create_noop() { Wrapper* wrapper = new Wrapper; - wrapper->rep_ = rocksdb::NewNoopTransform(); + wrapper->rep_ = ROCKSDB_NAMESPACE::NewNoopTransform(); wrapper->state_ = nullptr; wrapper->destructor_ = &Wrapper::DoNothing; return wrapper; @@ -3573,7 +3584,7 @@ rocksdb_slicetransform_t* rocksdb_slicetransform_create_noop() { rocksdb_universal_compaction_options_t* rocksdb_universal_compaction_options_create() { rocksdb_universal_compaction_options_t* result = new rocksdb_universal_compaction_options_t; - result->rep = new rocksdb::CompactionOptionsUniversal; + result->rep = new ROCKSDB_NAMESPACE::CompactionOptionsUniversal; return result; } @@ -3604,7 +3615,8 @@ void rocksdb_universal_compaction_options_set_compression_size_percent( void rocksdb_universal_compaction_options_set_stop_style( rocksdb_universal_compaction_options_t* uco, int style) { - uco->rep->stop_style = static_cast(style); + uco->rep->stop_style = + static_cast(style); } void rocksdb_universal_compaction_options_destroy( @@ -3634,7 +3646,7 @@ void rocksdb_options_set_min_level_to_compress(rocksdb_options_t* opt, int level assert(level <= opt->rep.num_levels); opt->rep.compression_per_level.resize(opt->rep.num_levels); for (int i = 0; i < level; i++) { - opt->rep.compression_per_level[i] = rocksdb::kNoCompression; + opt->rep.compression_per_level[i] = ROCKSDB_NAMESPACE::kNoCompression; } for (int i = level; i < opt->rep.num_levels; i++) { opt->rep.compression_per_level[i] = opt->rep.compression; @@ -4336,7 +4348,8 @@ const char* rocksdb_pinnableslice_value(const rocksdb_pinnableslice_t* v, return v->rep.data(); } -// container to keep databases and caches in order to use rocksdb::MemoryUtil +// container to keep databases and caches in order to use +// ROCKSDB_NAMESPACE::MemoryUtil struct rocksdb_memory_consumers_t { std::vector dbs; std::unordered_set caches; @@ -4364,7 +4377,7 @@ void rocksdb_memory_consumers_destroy(rocksdb_memory_consumers_t* consumers) { delete consumers; } -// contains memory usage statistics provided by rocksdb::MemoryUtil +// contains memory usage statistics provided by ROCKSDB_NAMESPACE::MemoryUtil struct rocksdb_memory_usage_t { uint64_t mem_table_total; uint64_t mem_table_unflushed; @@ -4386,7 +4399,7 @@ rocksdb_memory_usage_t* rocksdb_approximate_memory_usage_create( cache_set.insert(const_cast(cache->rep.get())); } - std::map usage_by_type; + std::map usage_by_type; auto status = MemoryUtil::GetApproximateMemoryUsageByType(dbs, cache_set, &usage_by_type); diff --git a/db/column_family.cc b/db/column_family.cc index 135f0c9b0f..928a02a1fd 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -36,7 +36,7 @@ #include "util/autovector.h" #include "util/compression.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { ColumnFamilyHandleImpl::ColumnFamilyHandleImpl( ColumnFamilyData* column_family_data, DBImpl* db, InstrumentedMutex* mutex) @@ -1520,4 +1520,4 @@ const Comparator* GetColumnFamilyUserComparator( return nullptr; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/column_family.h b/db/column_family.h index 3518198398..fcc8ea2cf6 100644 --- a/db/column_family.h +++ b/db/column_family.h @@ -27,7 +27,7 @@ #include "trace_replay/block_cache_tracer.h" #include "util/thread_local.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Version; class VersionSet; @@ -754,4 +754,4 @@ extern uint32_t GetColumnFamilyID(ColumnFamilyHandle* column_family); extern const Comparator* GetColumnFamilyUserComparator( ColumnFamilyHandle* column_family); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/column_family_test.cc b/db/column_family_test.cc index b289da7316..24ff4e08b8 100644 --- a/db/column_family_test.cc +++ b/db/column_family_test.cc @@ -30,7 +30,7 @@ #include "util/string_util.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const int kValueSize = 1000; @@ -91,7 +91,7 @@ class ColumnFamilyTestBase : public testing::Test { column_families.push_back(cfdescriptor); } Close(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); Destroy(column_families); delete env_; } @@ -595,14 +595,15 @@ TEST_P(ColumnFamilyTest, DontReuseColumnFamilyID) { TEST_P(ColumnFamilyTest, CreateCFRaceWithGetAggProperty) { Open(); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::WriteOptionsFile:1", "ColumnFamilyTest.CreateCFRaceWithGetAggProperty:1"}, {"ColumnFamilyTest.CreateCFRaceWithGetAggProperty:2", "DBImpl::WriteOptionsFile:2"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread thread([&] { CreateColumnFamilies({"one"}); }); + ROCKSDB_NAMESPACE::port::Thread thread( + [&] { CreateColumnFamilies({"one"}); }); TEST_SYNC_POINT("ColumnFamilyTest.CreateCFRaceWithGetAggProperty:1"); uint64_t pv; @@ -611,7 +612,7 @@ TEST_P(ColumnFamilyTest, CreateCFRaceWithGetAggProperty) { thread.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } #endif // !ROCKSDB_LITE @@ -1253,13 +1254,14 @@ TEST_P(ColumnFamilyTest, DifferentWriteBufferSizes) { // #endif // !ROCKSDB_LITE class TestComparator : public Comparator { - int Compare(const rocksdb::Slice& /*a*/, - const rocksdb::Slice& /*b*/) const override { + int Compare(const ROCKSDB_NAMESPACE::Slice& /*a*/, + const ROCKSDB_NAMESPACE::Slice& /*b*/) const override { return 0; } const char* Name() const override { return "Test"; } - void FindShortestSeparator(std::string* /*start*/, - const rocksdb::Slice& /*limit*/) const override {} + void FindShortestSeparator( + std::string* /*start*/, + const ROCKSDB_NAMESPACE::Slice& /*limit*/) const override {} void FindShortSuccessor(std::string* /*key*/) const override {} }; @@ -1427,11 +1429,11 @@ TEST_P(ColumnFamilyTest, MultipleManualCompactions) { AssertFilesPerLevel(ToString(i + 1), 1); } bool cf_1_1 = true; - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"ColumnFamilyTest::MultiManual:4", "ColumnFamilyTest::MultiManual:1"}, {"ColumnFamilyTest::MultiManual:2", "ColumnFamilyTest::MultiManual:5"}, {"ColumnFamilyTest::MultiManual:2", "ColumnFamilyTest::MultiManual:3"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::MultiManual:4"); @@ -1440,7 +1442,7 @@ TEST_P(ColumnFamilyTest, MultipleManualCompactions) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); std::vector threads; threads.emplace_back([&] { CompactRangeOptions compact_options; @@ -1483,8 +1485,8 @@ TEST_P(ColumnFamilyTest, MultipleManualCompactions) { ASSERT_NE("NOT_FOUND", Get(1, *key_iter)); key_iter++; } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); Close(); } @@ -1523,11 +1525,11 @@ TEST_P(ColumnFamilyTest, AutomaticAndManualCompactions) { dbfull()->TEST_write_controler().GetCompactionPressureToken(); bool cf_1_1 = true; - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"ColumnFamilyTest::AutoManual:4", "ColumnFamilyTest::AutoManual:1"}, {"ColumnFamilyTest::AutoManual:2", "ColumnFamilyTest::AutoManual:5"}, {"ColumnFamilyTest::AutoManual:2", "ColumnFamilyTest::AutoManual:3"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { cf_1_1 = false; @@ -1535,7 +1537,7 @@ TEST_P(ColumnFamilyTest, AutomaticAndManualCompactions) { TEST_SYNC_POINT("ColumnFamilyTest::AutoManual:3"); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // SETUP column family "one" -- universal style for (int i = 0; i < one.level0_file_num_compaction_trigger; ++i) { PutRandomData(1, 10, 12000, true); @@ -1553,7 +1555,7 @@ TEST_P(ColumnFamilyTest, AutomaticAndManualCompactions) { WaitForFlush(2); AssertFilesPerLevel(ToString(i + 1), 2); } - rocksdb::port::Thread threads([&] { + ROCKSDB_NAMESPACE::port::Thread threads([&] { CompactRangeOptions compact_options; compact_options.exclusive_manual_compaction = false; ASSERT_OK( @@ -1580,8 +1582,8 @@ TEST_P(ColumnFamilyTest, AutomaticAndManualCompactions) { ASSERT_NE("NOT_FOUND", Get(1, *key_iter)); key_iter++; } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } TEST_P(ColumnFamilyTest, ManualAndAutomaticCompactions) { @@ -1627,11 +1629,11 @@ TEST_P(ColumnFamilyTest, ManualAndAutomaticCompactions) { } bool cf_1_1 = true; bool cf_1_2 = true; - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"ColumnFamilyTest::ManualAuto:4", "ColumnFamilyTest::ManualAuto:1"}, {"ColumnFamilyTest::ManualAuto:5", "ColumnFamilyTest::ManualAuto:2"}, {"ColumnFamilyTest::ManualAuto:2", "ColumnFamilyTest::ManualAuto:3"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::ManualAuto:4"); @@ -1643,8 +1645,8 @@ TEST_P(ColumnFamilyTest, ManualAndAutomaticCompactions) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread threads([&] { + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::port::Thread threads([&] { CompactRangeOptions compact_options; compact_options.exclusive_manual_compaction = false; ASSERT_OK( @@ -1679,8 +1681,8 @@ TEST_P(ColumnFamilyTest, ManualAndAutomaticCompactions) { ASSERT_NE("NOT_FOUND", Get(1, *key_iter)); key_iter++; } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } TEST_P(ColumnFamilyTest, SameCFManualManualCompactions) { @@ -1721,13 +1723,13 @@ TEST_P(ColumnFamilyTest, SameCFManualManualCompactions) { } bool cf_1_1 = true; bool cf_1_2 = true; - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"ColumnFamilyTest::ManualManual:4", "ColumnFamilyTest::ManualManual:2"}, {"ColumnFamilyTest::ManualManual:4", "ColumnFamilyTest::ManualManual:5"}, {"ColumnFamilyTest::ManualManual:1", "ColumnFamilyTest::ManualManual:2"}, {"ColumnFamilyTest::ManualManual:1", "ColumnFamilyTest::ManualManual:3"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::ManualManual:4"); @@ -1739,8 +1741,8 @@ TEST_P(ColumnFamilyTest, SameCFManualManualCompactions) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread threads([&] { + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::port::Thread threads([&] { CompactRangeOptions compact_options; compact_options.exclusive_manual_compaction = true; ASSERT_OK( @@ -1760,7 +1762,7 @@ TEST_P(ColumnFamilyTest, SameCFManualManualCompactions) { 1); } - rocksdb::port::Thread threads1([&] { + ROCKSDB_NAMESPACE::port::Thread threads1([&] { CompactRangeOptions compact_options; compact_options.exclusive_manual_compaction = false; ASSERT_OK( @@ -1781,8 +1783,8 @@ TEST_P(ColumnFamilyTest, SameCFManualManualCompactions) { ASSERT_NE("NOT_FOUND", Get(1, *key_iter)); key_iter++; } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } TEST_P(ColumnFamilyTest, SameCFManualAutomaticCompactions) { @@ -1823,12 +1825,12 @@ TEST_P(ColumnFamilyTest, SameCFManualAutomaticCompactions) { } bool cf_1_1 = true; bool cf_1_2 = true; - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"ColumnFamilyTest::ManualAuto:4", "ColumnFamilyTest::ManualAuto:2"}, {"ColumnFamilyTest::ManualAuto:4", "ColumnFamilyTest::ManualAuto:5"}, {"ColumnFamilyTest::ManualAuto:1", "ColumnFamilyTest::ManualAuto:2"}, {"ColumnFamilyTest::ManualAuto:1", "ColumnFamilyTest::ManualAuto:3"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::ManualAuto:4"); @@ -1840,8 +1842,8 @@ TEST_P(ColumnFamilyTest, SameCFManualAutomaticCompactions) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread threads([&] { + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::port::Thread threads([&] { CompactRangeOptions compact_options; compact_options.exclusive_manual_compaction = false; ASSERT_OK( @@ -1874,8 +1876,8 @@ TEST_P(ColumnFamilyTest, SameCFManualAutomaticCompactions) { ASSERT_NE("NOT_FOUND", Get(1, *key_iter)); key_iter++; } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } TEST_P(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) { @@ -1916,14 +1918,14 @@ TEST_P(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) { } bool cf_1_1 = true; bool cf_1_2 = true; - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"ColumnFamilyTest::ManualAuto:4", "ColumnFamilyTest::ManualAuto:2"}, {"ColumnFamilyTest::ManualAuto:4", "ColumnFamilyTest::ManualAuto:5"}, {"ColumnFamilyTest::ManualAuto:3", "ColumnFamilyTest::ManualAuto:2"}, {"LevelCompactionPicker::PickCompactionBySize:0", "ColumnFamilyTest::ManualAuto:3"}, {"ColumnFamilyTest::ManualAuto:1", "ColumnFamilyTest::ManualAuto:3"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::ManualAuto:4"); @@ -1935,8 +1937,8 @@ TEST_P(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread threads([&] { + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::port::Thread threads([&] { CompactRangeOptions compact_options; compact_options.exclusive_manual_compaction = false; ASSERT_OK( @@ -1967,8 +1969,8 @@ TEST_P(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) { ASSERT_NE("NOT_FOUND", Get(1, *key_iter)); key_iter++; } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } // In this test, we generate enough files to trigger automatic compactions. @@ -2008,12 +2010,12 @@ TEST_P(ColumnFamilyTest, SameCFAutomaticManualCompactions) { bool cf_1_1 = true; bool cf_1_2 = true; - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"ColumnFamilyTest::AutoManual:4", "ColumnFamilyTest::AutoManual:2"}, {"ColumnFamilyTest::AutoManual:4", "ColumnFamilyTest::AutoManual:5"}, {"CompactionPicker::CompactRange:Conflict", "ColumnFamilyTest::AutoManual:3"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::AutoManual:4"); @@ -2025,7 +2027,7 @@ TEST_P(ColumnFamilyTest, SameCFAutomaticManualCompactions) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // SETUP column family "one" -- universal style for (int i = 0; i < one.level0_file_num_compaction_trigger; ++i) { @@ -2059,8 +2061,8 @@ TEST_P(ColumnFamilyTest, SameCFAutomaticManualCompactions) { ASSERT_NE("NOT_FOUND", Get(1, *key_iter)); key_iter++; } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } #endif // !ROCKSDB_LITE @@ -2415,7 +2417,7 @@ TEST_P(ColumnFamilyTest, FlushAndDropRaceCondition) { options.write_buffer_size = 100000; // small write buffer size Reopen({options, options}); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"VersionSet::LogAndApply::ColumnFamilyDrop:0", "FlushJob::WriteLevel0Table"}, {"VersionSet::LogAndApply::ColumnFamilyDrop:1", @@ -2423,7 +2425,7 @@ TEST_P(ColumnFamilyTest, FlushAndDropRaceCondition) { {"FlushJob::InstallResults", "VersionSet::LogAndApply::ColumnFamilyDrop:2"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); test::SleepingBackgroundTask sleeping_task; env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &sleeping_task, @@ -2502,21 +2504,21 @@ TEST_P(ColumnFamilyTest, CreateAndDropRace) { auto main_thread_id = std::this_thread::get_id(); - rocksdb::SyncPoint::GetInstance()->SetCallBack("PersistRocksDBOptions:start", - [&](void* /*arg*/) { - auto current_thread_id = std::this_thread::get_id(); - // If it's the main thread hitting this sync-point, then it - // will be blocked until some other thread update the test_stage. - if (main_thread_id == current_thread_id) { - test_stage = kMainThreadStartPersistingOptionsFile; - while (test_stage < kChildThreadFinishDroppingColumnFamily && - !ordered_by_writethread) { - Env::Default()->SleepForMicroseconds(100); - } - } - }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "PersistRocksDBOptions:start", [&](void* /*arg*/) { + auto current_thread_id = std::this_thread::get_id(); + // If it's the main thread hitting this sync-point, then it + // will be blocked until some other thread update the test_stage. + if (main_thread_id == current_thread_id) { + test_stage = kMainThreadStartPersistingOptionsFile; + while (test_stage < kChildThreadFinishDroppingColumnFamily && + !ordered_by_writethread) { + Env::Default()->SleepForMicroseconds(100); + } + } + }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WriteThread::EnterUnbatched:Wait", [&](void* /*arg*/) { // This means a thread doing DropColumnFamily() is waiting for // other thread to finish persisting options. @@ -2528,12 +2530,12 @@ TEST_P(ColumnFamilyTest, CreateAndDropRace) { Open({"default", "one", "two", "three"}, {cf_opts[0], cf_opts[1], cf_opts[2], cf_opts[3]}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Start a thread that will drop the first column family // and its comparator - rocksdb::port::Thread drop_cf_thread(DropSingleColumnFamily, this, 1, - &comparators); + ROCKSDB_NAMESPACE::port::Thread drop_cf_thread(DropSingleColumnFamily, this, + 1, &comparators); DropColumnFamilies({2}); @@ -2546,8 +2548,8 @@ TEST_P(ColumnFamilyTest, CreateAndDropRace) { } } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } #endif // !ROCKSDB_LITE @@ -2982,10 +2984,10 @@ TEST_P(ColumnFamilyTest, FlushCloseWALFiles) { ASSERT_OK(Put(0, "fodor", "mirko")); ASSERT_OK(Put(1, "fodor", "mirko")); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DBImpl::BGWorkFlush:done", "FlushCloseWALFiles:0"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Block flush jobs from running test::SleepingBackgroundTask sleeping_task; @@ -3001,7 +3003,7 @@ TEST_P(ColumnFamilyTest, FlushCloseWALFiles) { sleeping_task.WakeUp(); sleeping_task.WaitUntilDone(); TEST_SYNC_POINT("FlushCloseWALFiles:0"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_EQ(1, env.num_open_wal_file_.load()); Reopen(); @@ -3079,14 +3081,14 @@ TEST_P(ColumnFamilyTest, IteratorCloseWALFile2) { ASSERT_OK(Put(0, "fodor", "mirko")); ASSERT_OK(Put(1, "fodor", "mirko")); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"ColumnFamilyTest::IteratorCloseWALFile2:0", "DBImpl::BGWorkPurge:start"}, {"ColumnFamilyTest::IteratorCloseWALFile2:2", "DBImpl::BackgroundCallFlush:start"}, {"DBImpl::BGWorkPurge:end", "ColumnFamilyTest::IteratorCloseWALFile2:1"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); WriteOptions wo; wo.sync = true; @@ -3104,7 +3106,7 @@ TEST_P(ColumnFamilyTest, IteratorCloseWALFile2) { TEST_SYNC_POINT("ColumnFamilyTest::IteratorCloseWALFile2:2"); WaitForFlush(1); ASSERT_EQ(1, env.num_open_wal_file_.load()); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); Reopen(); ASSERT_EQ("mirko", Get(0, "fodor")); @@ -3148,14 +3150,14 @@ TEST_P(ColumnFamilyTest, ForwardIteratorCloseWALFile) { ASSERT_OK(Put(0, "fodor", "mirko")); ASSERT_OK(Put(1, "fodor", "mirko")); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"ColumnFamilyTest::IteratorCloseWALFile2:0", "DBImpl::BGWorkPurge:start"}, {"ColumnFamilyTest::IteratorCloseWALFile2:2", "DBImpl::BackgroundCallFlush:start"}, {"DBImpl::BGWorkPurge:end", "ColumnFamilyTest::IteratorCloseWALFile2:1"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); WriteOptions wo; wo.sync = true; @@ -3179,7 +3181,7 @@ TEST_P(ColumnFamilyTest, ForwardIteratorCloseWALFile) { ASSERT_EQ(1, env.delete_count_.load()); delete it; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); Reopen(); ASSERT_EQ("mirko", Get(0, "fodor")); @@ -3199,15 +3201,15 @@ TEST_P(ColumnFamilyTest, LogSyncConflictFlush) { Put(0, "", ""); Put(1, "foo", "bar"); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::SyncWAL:BeforeMarkLogsSynced:1", "ColumnFamilyTest::LogSyncConflictFlush:1"}, {"ColumnFamilyTest::LogSyncConflictFlush:2", "DBImpl::SyncWAL:BeforeMarkLogsSynced:2"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread thread([&] { db_->SyncWAL(); }); + ROCKSDB_NAMESPACE::port::Thread thread([&] { db_->SyncWAL(); }); TEST_SYNC_POINT("ColumnFamilyTest::LogSyncConflictFlush:1"); Flush(1); @@ -3218,7 +3220,7 @@ TEST_P(ColumnFamilyTest, LogSyncConflictFlush) { thread.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); Close(); } #endif @@ -3367,7 +3369,7 @@ TEST_P(ColumnFamilyTest, MultipleCFPathsTest) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS extern "C" { @@ -3378,7 +3380,7 @@ void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {} #endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/db/compact_files_test.cc b/db/compact_files_test.cc index 4152cb3793..948ada675c 100644 --- a/db/compact_files_test.cc +++ b/db/compact_files_test.cc @@ -18,7 +18,7 @@ #include "test_util/testharness.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CompactFilesTest : public testing::Test { public: @@ -81,11 +81,11 @@ TEST_F(CompactFilesTest, L0ConflictsFiles) { assert(s.ok()); assert(db); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"CompactFilesImpl:0", "BackgroundCallCompaction:0"}, {"BackgroundCallCompaction:1", "CompactFilesImpl:1"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // create couple files // Background compaction starts and waits in BackgroundCallCompaction:0 @@ -95,7 +95,7 @@ TEST_F(CompactFilesTest, L0ConflictsFiles) { db->Flush(FlushOptions()); } - rocksdb::ColumnFamilyMetaData meta; + ROCKSDB_NAMESPACE::ColumnFamilyMetaData meta; db->GetColumnFamilyMetaData(&meta); std::string file1; for (auto& file : meta.levels[0].files) { @@ -108,12 +108,12 @@ TEST_F(CompactFilesTest, L0ConflictsFiles) { // The background compaction then notices that there is an L0 compaction // already in progress and doesn't do an L0 compaction // Once the background compaction finishes, the compact files finishes - ASSERT_OK( - db->CompactFiles(rocksdb::CompactionOptions(), {file1, file2}, 0)); + ASSERT_OK(db->CompactFiles(ROCKSDB_NAMESPACE::CompactionOptions(), + {file1, file2}, 0)); break; } } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); delete db; } @@ -224,14 +224,14 @@ TEST_F(CompactFilesTest, CapturingPendingFiles) { auto l0_files = collector->GetFlushedFiles(); EXPECT_EQ(5, l0_files.size()); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"CompactFilesImpl:2", "CompactFilesTest.CapturingPendingFiles:0"}, {"CompactFilesTest.CapturingPendingFiles:1", "CompactFilesImpl:3"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Start compacting files. - rocksdb::port::Thread compaction_thread( + ROCKSDB_NAMESPACE::port::Thread compaction_thread( [&] { EXPECT_OK(db->CompactFiles(CompactionOptions(), l0_files, 1)); }); // In the meantime flush another file. @@ -242,7 +242,7 @@ TEST_F(CompactFilesTest, CapturingPendingFiles) { compaction_thread.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); delete db; @@ -296,12 +296,12 @@ TEST_F(CompactFilesTest, CompactionFilterWithGetSv) { db->Flush(FlushOptions()); // Compact all L0 files using CompactFiles - rocksdb::ColumnFamilyMetaData meta; + ROCKSDB_NAMESPACE::ColumnFamilyMetaData meta; db->GetColumnFamilyMetaData(&meta); for (auto& file : meta.levels[0].files) { std::string fname = file.db_path + "/" + file.name; ASSERT_OK( - db->CompactFiles(rocksdb::CompactionOptions(), {fname}, 0)); + db->CompactFiles(ROCKSDB_NAMESPACE::CompactionOptions(), {fname}, 0)); } @@ -347,7 +347,7 @@ TEST_F(CompactFilesTest, SentinelCompressionType) { compaction_opts.compression = CompressionType::kDisableCompressionOption; ASSERT_OK(db->CompactFiles(compaction_opts, l0_files, 1)); - rocksdb::TablePropertiesCollection all_tables_props; + ROCKSDB_NAMESPACE::TablePropertiesCollection all_tables_props; ASSERT_OK(db->GetPropertiesOfAllTables(&all_tables_props)); for (const auto& name_and_table_props : all_tables_props) { ASSERT_EQ(CompressionTypeToString(CompressionType::kZlibCompression), @@ -402,7 +402,7 @@ TEST_F(CompactFilesTest, GetCompactionJobInfo) { delete db; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/compacted_db_impl.cc b/db/compacted_db_impl.cc index 13cccbd774..47d6ecced9 100644 --- a/db/compacted_db_impl.cc +++ b/db/compacted_db_impl.cc @@ -9,7 +9,7 @@ #include "db/version_set.h" #include "table/get_context.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern void MarkKeyMayExist(void* arg); extern bool SaveValue(void* arg, const ParsedInternalKey& parsed_key, @@ -156,5 +156,5 @@ Status CompactedDBImpl::Open(const Options& options, return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/compacted_db_impl.h b/db/compacted_db_impl.h index 8a57c5b77e..7099566fc8 100644 --- a/db/compacted_db_impl.h +++ b/db/compacted_db_impl.h @@ -9,7 +9,7 @@ #include #include "db/db_impl/db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CompactedDBImpl : public DBImpl { public: @@ -109,5 +109,5 @@ class CompactedDBImpl : public DBImpl { const Comparator* user_comparator_; LevelFilesBrief files_; }; -} +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/compaction/compaction.cc b/db/compaction/compaction.cc index f884502713..5c34fdcaa8 100644 --- a/db/compaction/compaction.cc +++ b/db/compaction/compaction.cc @@ -16,7 +16,7 @@ #include "test_util/sync_point.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const uint64_t kRangeTombstoneSentinel = PackSequenceAndType(kMaxSequenceNumber, kTypeRangeDeletion); @@ -561,4 +561,4 @@ int Compaction::GetInputBaseLevel() const { return input_vstorage_->base_level(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/compaction/compaction.h b/db/compaction/compaction.h index dec5e607e1..9358e50fff 100644 --- a/db/compaction/compaction.h +++ b/db/compaction/compaction.h @@ -13,7 +13,7 @@ #include "options/cf_options.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // The file contains class Compaction, as well as some helper functions // and data structures used by the class. @@ -381,4 +381,4 @@ class Compaction { // Return sum of sizes of all files in `files`. extern uint64_t TotalFileSize(const std::vector& files); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/compaction/compaction_iteration_stats.h b/db/compaction/compaction_iteration_stats.h index ddb534622a..963c1d8eb4 100644 --- a/db/compaction/compaction_iteration_stats.h +++ b/db/compaction/compaction_iteration_stats.h @@ -5,6 +5,8 @@ #pragma once +#include "rocksdb/rocksdb_namespace.h" + struct CompactionIterationStats { // Compaction statistics diff --git a/db/compaction/compaction_iterator.cc b/db/compaction/compaction_iterator.cc index a5846349cb..1bebfc7174 100644 --- a/db/compaction/compaction_iterator.cc +++ b/db/compaction/compaction_iterator.cc @@ -28,7 +28,7 @@ ((seq) <= earliest_snapshot_ && \ (snapshot_checker_ == nullptr || LIKELY(IsInEarliestSnapshot(seq)))) -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { CompactionIterator::CompactionIterator( InternalIterator* input, const Comparator* cmp, MergeHelper* merge_helper, @@ -771,4 +771,4 @@ bool CompactionIterator::IsInEarliestSnapshot(SequenceNumber sequence) { return in_snapshot == SnapshotCheckerResult::kInSnapshot; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/compaction/compaction_iterator.h b/db/compaction/compaction_iterator.h index 1e08b407d2..8be60eb9e8 100644 --- a/db/compaction/compaction_iterator.h +++ b/db/compaction/compaction_iterator.h @@ -19,7 +19,7 @@ #include "options/cf_options.h" #include "rocksdb/compaction_filter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CompactionIterator { public: @@ -237,4 +237,4 @@ class CompactionIterator { manual_compaction_paused_->load(std::memory_order_relaxed); } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/compaction/compaction_iterator_test.cc b/db/compaction/compaction_iterator_test.cc index 94f297961e..0c50fb9ba0 100644 --- a/db/compaction/compaction_iterator_test.cc +++ b/db/compaction/compaction_iterator_test.cc @@ -14,7 +14,7 @@ #include "util/string_util.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Expects no merging attempts. class NoMergingMergeOp : public MergeOperator { @@ -494,7 +494,7 @@ TEST_P(CompactionIteratorTest, ShuttingDownInFilter) { compaction_proxy_->key_not_exists_beyond_output_level = true; std::atomic seek_done{false}; - rocksdb::port::Thread compaction_thread([&] { + ROCKSDB_NAMESPACE::port::Thread compaction_thread([&] { c_iter_->SeekToFirst(); EXPECT_FALSE(c_iter_->Valid()); EXPECT_TRUE(c_iter_->status().IsShutdownInProgress()); @@ -531,7 +531,7 @@ TEST_P(CompactionIteratorTest, ShuttingDownInMerge) { compaction_proxy_->key_not_exists_beyond_output_level = true; std::atomic seek_done{false}; - rocksdb::port::Thread compaction_thread([&] { + ROCKSDB_NAMESPACE::port::Thread compaction_thread([&] { c_iter_->SeekToFirst(); ASSERT_FALSE(c_iter_->Valid()); ASSERT_TRUE(c_iter_->status().IsShutdownInProgress()); @@ -968,7 +968,7 @@ TEST_F(CompactionIteratorWithSnapshotCheckerTest, CompactionFilter_FullMerge) { compaction_filter.get()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/compaction/compaction_job.cc b/db/compaction/compaction_job.cc index dcebd7c74a..576ec7b459 100644 --- a/db/compaction/compaction_job.cc +++ b/db/compaction/compaction_job.cc @@ -59,7 +59,7 @@ #include "util/stop_watch.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const char* GetCompactionReasonString(CompactionReason compaction_reason) { switch (compaction_reason) { @@ -1697,4 +1697,4 @@ void CompactionJob::LogCompaction() { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/compaction/compaction_job.h b/db/compaction/compaction_job.h index e7da29f539..c15f502a12 100644 --- a/db/compaction/compaction_job.h +++ b/db/compaction/compaction_job.h @@ -44,7 +44,7 @@ #include "util/stop_watch.h" #include "util/thread_local.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Arena; class ErrorHandler; @@ -195,4 +195,4 @@ class CompactionJob { Env::Priority thread_pri_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/compaction/compaction_job_stats_test.cc b/db/compaction/compaction_job_stats_test.cc index f25a38ec65..51a6657972 100644 --- a/db/compaction/compaction_job_stats_test.cc +++ b/db/compaction/compaction_job_stats_test.cc @@ -61,7 +61,7 @@ #if !defined(IOS_CROSS_COMPILE) #ifndef ROCKSDB_LITE -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static std::string RandomString(Random* rnd, int len, double ratio) { std::string r; @@ -110,9 +110,9 @@ class CompactionJobStatsTest : public testing::Test, } ~CompactionJobStatsTest() override { - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->LoadDependency({}); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({}); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); Close(); Options options; options.db_paths.emplace_back(dbname_, 0); @@ -801,7 +801,7 @@ TEST_P(CompactionJobStatsTest, CompactionJobStatsTest) { stats_checker->set_verify_next_comp_io_stats(true); std::atomic first_prepare_write(true); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WritableFileWriter::Append:BeforePrepareWrite", [&](void* /*arg*/) { if (first_prepare_write.load()) { options.env->SleepForMicroseconds(3); @@ -810,7 +810,7 @@ TEST_P(CompactionJobStatsTest, CompactionJobStatsTest) { }); std::atomic first_flush(true); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WritableFileWriter::Flush:BeforeAppend", [&](void* /*arg*/) { if (first_flush.load()) { options.env->SleepForMicroseconds(3); @@ -819,7 +819,7 @@ TEST_P(CompactionJobStatsTest, CompactionJobStatsTest) { }); std::atomic first_sync(true); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WritableFileWriter::SyncInternal:0", [&](void* /*arg*/) { if (first_sync.load()) { options.env->SleepForMicroseconds(3); @@ -828,14 +828,14 @@ TEST_P(CompactionJobStatsTest, CompactionJobStatsTest) { }); std::atomic first_range_sync(true); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WritableFileWriter::RangeSync:0", [&](void* /*arg*/) { if (first_range_sync.load()) { options.env->SleepForMicroseconds(3); first_range_sync.store(false); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Compact(1, smallest_key, largest_key); @@ -844,7 +844,7 @@ TEST_P(CompactionJobStatsTest, CompactionJobStatsTest) { ASSERT_TRUE(!first_flush.load()); ASSERT_TRUE(!first_sync.load()); ASSERT_TRUE(!first_range_sync.load()); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } ASSERT_EQ(stats_checker->NumberOfUnverifiedStats(), 0U); } @@ -1019,10 +1019,10 @@ TEST_P(CompactionJobStatsTest, UniversalCompactionTest) { INSTANTIATE_TEST_CASE_P(CompactionJobStatsTest, CompactionJobStatsTest, ::testing::Values(1, 4)); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/compaction/compaction_job_test.cc b/db/compaction/compaction_job_test.cc index 31dae59b5c..e7b46ef97b 100644 --- a/db/compaction/compaction_job_test.cc +++ b/db/compaction/compaction_job_test.cc @@ -29,7 +29,7 @@ #include "util/string_util.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -1063,7 +1063,7 @@ TEST_F(CompactionJobTest, OldestBlobFileNumber) { /* expected_oldest_blob_file_number */ 19); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/compaction/compaction_picker.cc b/db/compaction/compaction_picker.cc index 0461ff32d1..4355d4b915 100644 --- a/db/compaction/compaction_picker.cc +++ b/db/compaction/compaction_picker.cc @@ -23,7 +23,7 @@ #include "util/random.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { uint64_t TotalCompensatedFileSize(const std::vector& files) { @@ -1128,4 +1128,4 @@ bool CompactionPicker::GetOverlappingL0Files( return true; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/compaction/compaction_picker.h b/db/compaction/compaction_picker.h index ae158059a1..36d570e688 100644 --- a/db/compaction/compaction_picker.h +++ b/db/compaction/compaction_picker.h @@ -22,7 +22,7 @@ #include "rocksdb/options.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // The file contains an abstract class CompactionPicker, and its two // sub-classes LevelCompactionPicker and NullCompactionPicker, as @@ -310,4 +310,4 @@ CompressionOptions GetCompressionOptions(const ImmutableCFOptions& ioptions, int level, const bool enable_compression = true); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/compaction/compaction_picker_fifo.cc b/db/compaction/compaction_picker_fifo.cc index cdf5e46dab..030da619c2 100644 --- a/db/compaction/compaction_picker_fifo.cc +++ b/db/compaction/compaction_picker_fifo.cc @@ -17,7 +17,7 @@ #include "logging/log_buffer.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { uint64_t GetTotalFilesSize(const std::vector& files) { uint64_t total_size = 0; @@ -238,5 +238,5 @@ Compaction* FIFOCompactionPicker::CompactRange( return c; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/db/compaction/compaction_picker_fifo.h b/db/compaction/compaction_picker_fifo.h index 065faef139..eb786e5ac5 100644 --- a/db/compaction/compaction_picker_fifo.h +++ b/db/compaction/compaction_picker_fifo.h @@ -12,7 +12,7 @@ #include "db/compaction/compaction_picker.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class FIFOCompactionPicker : public CompactionPicker { public: FIFOCompactionPicker(const ImmutableCFOptions& ioptions, @@ -49,5 +49,5 @@ class FIFOCompactionPicker : public CompactionPicker { VersionStorageInfo* version, LogBuffer* log_buffer); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/db/compaction/compaction_picker_level.cc b/db/compaction/compaction_picker_level.cc index 4c2afa6670..012edd080c 100644 --- a/db/compaction/compaction_picker_level.cc +++ b/db/compaction/compaction_picker_level.cc @@ -15,7 +15,7 @@ #include "logging/log_buffer.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { bool LevelCompactionPicker::NeedsCompaction( const VersionStorageInfo* vstorage) const { @@ -555,4 +555,4 @@ Compaction* LevelCompactionPicker::PickCompaction( log_buffer, mutable_cf_options, ioptions_); return builder.PickCompaction(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/compaction/compaction_picker_level.h b/db/compaction/compaction_picker_level.h index c8d905ef90..b82070e141 100644 --- a/db/compaction/compaction_picker_level.h +++ b/db/compaction/compaction_picker_level.h @@ -11,7 +11,7 @@ #include "db/compaction/compaction_picker.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Picking compactions for leveled compaction. See wiki page // https://github.com/facebook/rocksdb/wiki/Leveled-Compaction // for description of Leveled compaction. @@ -29,4 +29,4 @@ class LevelCompactionPicker : public CompactionPicker { const VersionStorageInfo* vstorage) const override; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/compaction/compaction_picker_test.cc b/db/compaction/compaction_picker_test.cc index dbf9962fef..278bdb06a3 100644 --- a/db/compaction/compaction_picker_test.cc +++ b/db/compaction/compaction_picker_test.cc @@ -17,7 +17,7 @@ #include "test_util/testutil.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CountingLogger : public Logger { public: @@ -1733,7 +1733,7 @@ TEST_F(CompactionPickerTest, IntraL0ForEarliestSeqno) { ASSERT_EQ(0, compaction->output_level()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/compaction/compaction_picker_universal.cc b/db/compaction/compaction_picker_universal.cc index b1c9d0469d..d8b63956e1 100644 --- a/db/compaction/compaction_picker_universal.cc +++ b/db/compaction/compaction_picker_universal.cc @@ -23,7 +23,7 @@ #include "util/random.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { // A helper class that form universal compactions. The class is used by // UniversalCompactionPicker::PickCompaction(). @@ -1100,6 +1100,6 @@ Compaction* UniversalCompactionBuilder::PickPeriodicCompaction() { return c; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/db/compaction/compaction_picker_universal.h b/db/compaction/compaction_picker_universal.h index 150b6bd79c..c3f55f5d33 100644 --- a/db/compaction/compaction_picker_universal.h +++ b/db/compaction/compaction_picker_universal.h @@ -12,7 +12,7 @@ #include "db/compaction/compaction_picker.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class UniversalCompactionPicker : public CompactionPicker { public: UniversalCompactionPicker(const ImmutableCFOptions& ioptions, @@ -27,5 +27,5 @@ class UniversalCompactionPicker : public CompactionPicker { virtual bool NeedsCompaction( const VersionStorageInfo* vstorage) const override; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/db/comparator_db_test.cc b/db/comparator_db_test.cc index 53322fd159..49f287a97c 100644 --- a/db/comparator_db_test.cc +++ b/db/comparator_db_test.cc @@ -18,7 +18,7 @@ using std::unique_ptr; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { static const Comparator* kTestComparator = nullptr; @@ -268,7 +268,7 @@ class ComparatorDBTest BlockBasedTableOptions toptions; toptions.format_version = GetParam(); last_options_.table_factory.reset( - rocksdb::NewBlockBasedTableFactory(toptions)); + ROCKSDB_NAMESPACE::NewBlockBasedTableFactory(toptions)); EXPECT_OK(DestroyDB(dbname_, last_options_)); } @@ -652,7 +652,7 @@ TEST_P(ComparatorDBTest, SeparatorSuccessorRandomizeTest) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/convenience.cc b/db/convenience.cc index 78396cf4a4..206f1f8756 100644 --- a/db/convenience.cc +++ b/db/convenience.cc @@ -11,7 +11,7 @@ #include "db/db_impl/db_impl.h" #include "util/cast_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void CancelAllBackgroundWork(DB* db, bool wait) { (static_cast_with_check(db->GetRootDB())) @@ -72,6 +72,6 @@ Status VerifySstFileChecksum(const Options& options, return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/corruption_test.cc b/db/corruption_test.cc index 5cc0e574cd..203c34fa40 100644 --- a/db/corruption_test.cc +++ b/db/corruption_test.cc @@ -33,7 +33,7 @@ #include "test_util/testutil.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const int kValueSize = 1000; @@ -98,7 +98,7 @@ class CorruptionTest : public testing::Test { void RepairDB() { delete db_; db_ = nullptr; - ASSERT_OK(::rocksdb::RepairDB(dbname_, options_)); + ASSERT_OK(::ROCKSDB_NAMESPACE::RepairDB(dbname_, options_)); } void Build(int n, int flush_every = 0) { @@ -595,7 +595,7 @@ TEST_F(CorruptionTest, FileSystemStateCorrupted) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/cuckoo_table_db_test.cc b/db/cuckoo_table_db_test.cc index 2bdbaae88a..9467840ff9 100644 --- a/db/cuckoo_table_db_test.cc +++ b/db/cuckoo_table_db_test.cc @@ -15,7 +15,7 @@ #include "test_util/testutil.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CuckooTableDBTest : public testing::Test { private: @@ -328,14 +328,13 @@ TEST_F(CuckooTableDBTest, AdaptiveTable) { ASSERT_EQ("v4", Get("key4")); ASSERT_EQ("v6", Get("key5")); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - if (rocksdb::port::kLittleEndian) { + if (ROCKSDB_NAMESPACE::port::kLittleEndian) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); - } - else { + } else { fprintf(stderr, "SKIPPED as Cuckoo table doesn't support Big Endian\n"); return 0; } diff --git a/db/db_basic_test.cc b/db/db_basic_test.cc index 5294c1a607..7573a01b4a 100644 --- a/db/db_basic_test.cc +++ b/db/db_basic_test.cc @@ -17,7 +17,7 @@ #include "test_util/sync_point.h" #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBBasicTest : public DBTestBase { public: @@ -27,8 +27,8 @@ class DBBasicTest : public DBTestBase { TEST_F(DBBasicTest, OpenWhenOpen) { Options options = CurrentOptions(); options.env = env_; - rocksdb::DB* db2 = nullptr; - rocksdb::Status s = DB::Open(options, dbname_, &db2); + ROCKSDB_NAMESPACE::DB* db2 = nullptr; + ROCKSDB_NAMESPACE::Status s = DB::Open(options, dbname_, &db2); ASSERT_EQ(Status::Code::kIOError, s.code()); ASSERT_EQ(Status::SubCode::kNone, s.subcode()); @@ -1048,8 +1048,8 @@ TEST_P(DBMultiGetTestWithParam, MultiGetMultiCF) { } int get_sv_count = 0; - rocksdb::DBImpl* db = reinterpret_cast(db_); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::DBImpl* db = reinterpret_cast(db_); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::MultiGet::AfterRefSV", [&](void* /*arg*/) { if (++get_sv_count == 2) { // After MultiGet refs a couple of CFs, flush all CFs so MultiGet @@ -1073,7 +1073,7 @@ TEST_P(DBMultiGetTestWithParam, MultiGetMultiCF) { } } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); std::vector cfs; std::vector keys; @@ -1139,12 +1139,12 @@ TEST_P(DBMultiGetTestWithParam, MultiGetMultiCFMutex) { int get_sv_count = 0; int retries = 0; bool last_try = false; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::MultiGet::LastTry", [&](void* /*arg*/) { last_try = true; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::MultiGet::AfterRefSV", [&](void* /*arg*/) { if (last_try) { return; @@ -1160,7 +1160,7 @@ TEST_P(DBMultiGetTestWithParam, MultiGetMultiCFMutex) { } } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); std::vector cfs; std::vector keys; @@ -1198,8 +1198,8 @@ TEST_P(DBMultiGetTestWithParam, MultiGetMultiCFSnapshot) { } int get_sv_count = 0; - rocksdb::DBImpl* db = reinterpret_cast(db_); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::DBImpl* db = reinterpret_cast(db_); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::MultiGet::AfterRefSV", [&](void* /*arg*/) { if (++get_sv_count == 2) { for (int i = 0; i < 8; ++i) { @@ -1219,7 +1219,7 @@ TEST_P(DBMultiGetTestWithParam, MultiGetMultiCFSnapshot) { } } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); std::vector cfs; std::vector keys; @@ -1558,7 +1558,7 @@ TEST_P(DBMultiGetRowCacheTest, MultiGetBatched) { do { option_config_ = kRowCache; Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); CreateAndReopenWithCF({"pikachu"}, options); SetPerfLevel(kEnableCount); ASSERT_OK(Put(1, "k1", "v1")); @@ -1664,13 +1664,13 @@ TEST_F(DBBasicTest, GetAllKeyVersions) { ASSERT_OK(Delete(std::to_string(i))); } std::vector key_versions; - ASSERT_OK(rocksdb::GetAllKeyVersions(db_, Slice(), Slice(), - std::numeric_limits::max(), - &key_versions)); + ASSERT_OK(ROCKSDB_NAMESPACE::GetAllKeyVersions( + db_, Slice(), Slice(), std::numeric_limits::max(), + &key_versions)); ASSERT_EQ(kNumInserts + kNumDeletes + kNumUpdates, key_versions.size()); - ASSERT_OK(rocksdb::GetAllKeyVersions(db_, handles_[0], Slice(), Slice(), - std::numeric_limits::max(), - &key_versions)); + ASSERT_OK(ROCKSDB_NAMESPACE::GetAllKeyVersions( + db_, handles_[0], Slice(), Slice(), std::numeric_limits::max(), + &key_versions)); ASSERT_EQ(kNumInserts + kNumDeletes + kNumUpdates, key_versions.size()); // Check non-default column family @@ -1683,9 +1683,9 @@ TEST_F(DBBasicTest, GetAllKeyVersions) { for (size_t i = 0; i != kNumDeletes - 1; ++i) { ASSERT_OK(Delete(1, std::to_string(i))); } - ASSERT_OK(rocksdb::GetAllKeyVersions(db_, handles_[1], Slice(), Slice(), - std::numeric_limits::max(), - &key_versions)); + ASSERT_OK(ROCKSDB_NAMESPACE::GetAllKeyVersions( + db_, handles_[1], Slice(), Slice(), std::numeric_limits::max(), + &key_versions)); ASSERT_EQ(kNumInserts + kNumDeletes + kNumUpdates - 3, key_versions.size()); } #endif // !ROCKSDB_LITE @@ -2527,7 +2527,7 @@ TEST_P(DBBasicTestWithTimestampWithParam, PutAndGet) { INSTANTIATE_TEST_CASE_P(Timestamp, DBBasicTestWithTimestampWithParam, ::testing::Bool()); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS extern "C" { @@ -2538,7 +2538,7 @@ void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {} #endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/db/db_blob_index_test.cc b/db/db_blob_index_test.cc index 30e44e5bac..24862f7715 100644 --- a/db/db_blob_index_test.cc +++ b/db/db_blob_index_test.cc @@ -23,7 +23,7 @@ #include "util/string_util.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // kTypeBlobIndex is a value type used by BlobDB only. The base rocksdb // should accept the value type on write, and report not supported value @@ -427,10 +427,10 @@ TEST_F(DBBlobIndexTest, Iterate) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_block_cache_test.cc b/db/db_block_cache_test.cc index b89369c8fd..3031e56bbb 100644 --- a/db/db_block_cache_test.cc +++ b/db/db_block_cache_test.cc @@ -12,7 +12,7 @@ #include "port/stack_trace.h" #include "util/compression.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBBlockCacheTest : public DBTestBase { private: @@ -46,7 +46,7 @@ class DBBlockCacheTest : public DBTestBase { options.create_if_missing = true; options.avoid_flush_during_recovery = false; // options.compression = kNoCompression; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.table_factory.reset(new BlockBasedTableFactory(table_options)); return options; } @@ -292,7 +292,7 @@ TEST_F(DBBlockCacheTest, TestWithCompressedBlockCache) { TEST_F(DBBlockCacheTest, IndexAndFilterBlocksOfNewTableAddedToCache) { Options options = CurrentOptions(); options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; table_options.cache_index_and_filter_blocks = true; table_options.filter_policy.reset(NewBloomFilterPolicy(20)); @@ -378,7 +378,7 @@ TEST_F(DBBlockCacheTest, FillCacheAndIterateDB) { TEST_F(DBBlockCacheTest, IndexAndFilterBlocksStats) { Options options = CurrentOptions(); options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; table_options.cache_index_and_filter_blocks = true; LRUCacheOptions co; @@ -464,7 +464,7 @@ TEST_F(DBBlockCacheTest, IndexAndFilterBlocksCachePriority) { for (auto priority : {Cache::Priority::LOW, Cache::Priority::HIGH}) { Options options = CurrentOptions(); options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; table_options.cache_index_and_filter_blocks = true; table_options.block_cache.reset(new MockCache()); @@ -520,7 +520,7 @@ TEST_F(DBBlockCacheTest, IndexAndFilterBlocksCachePriority) { TEST_F(DBBlockCacheTest, ParanoidFileChecks) { Options options = CurrentOptions(); options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.level0_file_num_compaction_trigger = 2; options.paranoid_file_checks = true; BlockBasedTableOptions table_options; @@ -576,7 +576,7 @@ TEST_F(DBBlockCacheTest, CompressedCache) { for (int iter = 0; iter < 4; iter++) { Options options = CurrentOptions(); options.write_buffer_size = 64 * 1024; // small write buffer - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; switch (iter) { @@ -705,7 +705,7 @@ TEST_F(DBBlockCacheTest, CacheCompressionDict) { options.compression_opts.max_dict_bytes = 4096; options.create_if_missing = true; options.num_levels = 2; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.target_file_size_base = kNumEntriesPerFile * kNumBytesPerEntry; BlockBasedTableOptions table_options; table_options.cache_index_and_filter_blocks = true; @@ -752,10 +752,10 @@ TEST_F(DBBlockCacheTest, CacheCompressionDict) { #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_bloom_filter_test.cc b/db/db_bloom_filter_test.cc index 417552ad86..dcad003279 100644 --- a/db/db_bloom_filter_test.cc +++ b/db/db_bloom_filter_test.cc @@ -12,7 +12,7 @@ #include "rocksdb/perf_context.h" #include "table/block_based/filter_policy_internal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { using BFP = BloomFilterPolicy; @@ -88,7 +88,7 @@ TEST_P(DBBloomFilterTestDefFormatVersion, KeyMayExist) { // indexes continue; } - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); CreateAndReopenWithCF({"pikachu"}, options); ASSERT_TRUE(!db_->KeyMayExist(ropts, handles_[1], "a", &value)); @@ -150,7 +150,7 @@ TEST_F(DBBloomFilterTest, GetFilterByPrefixBloomCustomPrefixExtractor) { Options options = last_options_; options.prefix_extractor = std::make_shared(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); get_perf_context()->EnablePerLevelPerfContext(); BlockBasedTableOptions bbto; bbto.filter_policy.reset(NewBloomFilterPolicy(10, false)); @@ -216,7 +216,7 @@ TEST_F(DBBloomFilterTest, GetFilterByPrefixBloom) { for (bool partition_filters : {true, false}) { Options options = last_options_; options.prefix_extractor.reset(NewFixedPrefixTransform(8)); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); get_perf_context()->EnablePerLevelPerfContext(); BlockBasedTableOptions bbto; bbto.filter_policy.reset(NewBloomFilterPolicy(10, false)); @@ -267,7 +267,7 @@ TEST_F(DBBloomFilterTest, WholeKeyFilterProp) { for (bool partition_filters : {true, false}) { Options options = last_options_; options.prefix_extractor.reset(NewFixedPrefixTransform(3)); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); get_perf_context()->EnablePerLevelPerfContext(); BlockBasedTableOptions bbto; @@ -531,7 +531,7 @@ INSTANTIATE_TEST_CASE_P( TEST_F(DBBloomFilterTest, BloomFilterRate) { while (ChangeFilterOptions()) { Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); get_perf_context()->EnablePerLevelPerfContext(); CreateAndReopenWithCF({"pikachu"}, options); @@ -563,7 +563,7 @@ TEST_F(DBBloomFilterTest, BloomFilterRate) { TEST_F(DBBloomFilterTest, BloomFilterCompatibility) { Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; table_options.filter_policy.reset(NewBloomFilterPolicy(10, true)); options.table_factory.reset(NewBlockBasedTableFactory(table_options)); @@ -607,7 +607,7 @@ TEST_F(DBBloomFilterTest, BloomFilterCompatibility) { TEST_F(DBBloomFilterTest, BloomFilterReverseCompatibility) { for (bool partition_filters : {true, false}) { Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; if (partition_filters) { table_options.partition_filters = true; @@ -654,17 +654,18 @@ class TestingWrappedBlockBasedFilterPolicy : public FilterPolicy { return "TestingWrappedBlockBasedFilterPolicy"; } - void CreateFilter(const rocksdb::Slice* keys, int n, + void CreateFilter(const ROCKSDB_NAMESPACE::Slice* keys, int n, std::string* dst) const override { - std::unique_ptr user_keys(new rocksdb::Slice[n]); + std::unique_ptr user_keys( + new ROCKSDB_NAMESPACE::Slice[n]); for (int i = 0; i < n; ++i) { user_keys[i] = convertKey(keys[i]); } return filter_->CreateFilter(user_keys.get(), n, dst); } - bool KeyMayMatch(const rocksdb::Slice& key, - const rocksdb::Slice& filter) const override { + bool KeyMayMatch(const ROCKSDB_NAMESPACE::Slice& key, + const ROCKSDB_NAMESPACE::Slice& filter) const override { counter_++; return filter_->KeyMayMatch(convertKey(key), filter); } @@ -675,13 +676,16 @@ class TestingWrappedBlockBasedFilterPolicy : public FilterPolicy { const FilterPolicy* filter_; mutable uint32_t counter_; - rocksdb::Slice convertKey(const rocksdb::Slice& key) const { return key; } + ROCKSDB_NAMESPACE::Slice convertKey( + const ROCKSDB_NAMESPACE::Slice& key) const { + return key; + } }; } // namespace TEST_F(DBBloomFilterTest, WrappedBlockBasedFilterPolicy) { Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; TestingWrappedBlockBasedFilterPolicy* policy = @@ -797,7 +801,7 @@ class TestingContextCustomFilterPolicy TEST_F(DBBloomFilterTest, ContextCustomFilterPolicy) { for (bool fifo : {true, false}) { Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.compaction_style = fifo ? kCompactionStyleFIFO : kCompactionStyleLevel; @@ -896,7 +900,7 @@ class SliceTransformLimitedDomain : public SliceTransform { TEST_F(DBBloomFilterTest, PrefixExtractorFullFilter) { BlockBasedTableOptions bbto; // Full Filter Block - bbto.filter_policy.reset(rocksdb::NewBloomFilterPolicy(10, false)); + bbto.filter_policy.reset(ROCKSDB_NAMESPACE::NewBloomFilterPolicy(10, false)); bbto.whole_key_filtering = false; Options options = CurrentOptions(); @@ -925,7 +929,7 @@ TEST_F(DBBloomFilterTest, PrefixExtractorFullFilter) { TEST_F(DBBloomFilterTest, PrefixExtractorBlockFilter) { BlockBasedTableOptions bbto; // Block Filter Block - bbto.filter_policy.reset(rocksdb::NewBloomFilterPolicy(10, true)); + bbto.filter_policy.reset(ROCKSDB_NAMESPACE::NewBloomFilterPolicy(10, true)); Options options = CurrentOptions(); options.prefix_extractor = std::make_shared(); @@ -964,7 +968,8 @@ TEST_F(DBBloomFilterTest, MemtableWholeKeyBloomFilter) { Options options = CurrentOptions(); options.memtable_prefix_bloom_size_ratio = static_cast(kMemtablePrefixFilterSize) / kMemtableSize; - options.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform(kPrefixLen)); + options.prefix_extractor.reset( + ROCKSDB_NAMESPACE::NewFixedPrefixTransform(kPrefixLen)); options.write_buffer_size = kMemtableSize; options.memtable_whole_key_filtering = false; Reopen(options); @@ -1042,7 +1047,8 @@ class BloomStatsTestWithParam partition_filters_ = std::get<1>(GetParam()); options_.create_if_missing = true; - options_.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform(4)); + options_.prefix_extractor.reset( + ROCKSDB_NAMESPACE::NewFixedPrefixTransform(4)); options_.memtable_prefix_bloom_size_ratio = 8.0 * 1024.0 / static_cast(options_.write_buffer_size); if (bfp_impl_ == BFP2::kPlainTable) { @@ -1323,7 +1329,7 @@ TEST_F(DBBloomFilterTest, OptimizeFiltersForHits) { bbto.whole_key_filtering = true; options.table_factory.reset(NewBlockBasedTableFactory(bbto)); options.optimize_filters_for_hits = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); get_perf_context()->Reset(); get_perf_context()->EnablePerLevelPerfContext(); CreateAndReopenWithCF({"mypikachu"}, options); @@ -1449,13 +1455,13 @@ TEST_F(DBBloomFilterTest, OptimizeFiltersForHits) { int32_t trivial_move = 0; int32_t non_trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* /*arg*/) { non_trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); CompactRangeOptions compact_options; compact_options.bottommost_level_compaction = @@ -1895,10 +1901,10 @@ TEST_F(DBBloomFilterTest, DynamicBloomFilterOptions) { #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_compaction_filter_test.cc b/db/db_compaction_filter_test.cc index 745d0d051e..a708c0b1a5 100644 --- a/db/db_compaction_filter_test.cc +++ b/db/db_compaction_filter_test.cc @@ -10,7 +10,7 @@ #include "db/db_test_util.h" #include "port/stack_trace.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static int cfilter_count = 0; static int cfilter_skips = 0; @@ -863,10 +863,10 @@ TEST_F(DBTestCompactionFilter, IgnoreSnapshotsFalse) { delete options.compaction_filter; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_compaction_test.cc b/db/db_compaction_test.cc index 17193b706d..635aca135e 100644 --- a/db/db_compaction_test.cc +++ b/db/db_compaction_test.cc @@ -18,7 +18,7 @@ #include "test_util/sync_point.h" #include "util/concurrent_task_limiter_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // SYNC_POINT is not supported in released Windows mode. #if !defined(ROCKSDB_LITE) @@ -417,7 +417,7 @@ TEST_F(DBCompactionTest, SkipStatsUpdateTest) { Close(); int update_acc_stats_called = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "VersionStorageInfo::UpdateAccumulatedStats", [&](void* /* arg */) { ++update_acc_stats_called; }); SyncPoint::GetInstance()->EnableProcessing(); @@ -451,7 +451,7 @@ TEST_F(DBCompactionTest, TestTableReaderForCompaction) { int num_table_cache_lookup = 0; int num_new_table_reader = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "TableCache::FindTable:0", [&](void* arg) { assert(arg != nullptr); bool no_io = *(reinterpret_cast(arg)); @@ -460,10 +460,10 @@ TEST_F(DBCompactionTest, TestTableReaderForCompaction) { num_table_cache_lookup++; } }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "TableCache::GetTableReader:0", [&](void* /*arg*/) { num_new_table_reader++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); for (int k = 0; k < options.level0_file_num_compaction_trigger; ++k) { ASSERT_OK(Put(Key(k), Key(k))); @@ -533,7 +533,7 @@ TEST_F(DBCompactionTest, TestTableReaderForCompaction) { ASSERT_EQ(num_table_cache_lookup + old_num_table_cache_lookup2, 3); ASSERT_EQ(num_new_table_reader, 0); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } TEST_P(DBCompactionTestWithParam, CompactionDeletionTriggerReopen) { @@ -1023,10 +1023,10 @@ TEST_F(DBCompactionTest, RecoverDuringMemtableCompaction) { TEST_P(DBCompactionTestWithParam, TrivialMoveOneFile) { int32_t trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.write_buffer_size = 100000000; @@ -1074,19 +1074,19 @@ TEST_P(DBCompactionTestWithParam, TrivialMoveOneFile) { } ASSERT_EQ(trivial_move, 1); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_P(DBCompactionTestWithParam, TrivialMoveNonOverlappingFiles) { int32_t trivial_move = 0; int32_t non_trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* /*arg*/) { non_trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.disable_auto_compactions = true; @@ -1173,19 +1173,19 @@ TEST_P(DBCompactionTestWithParam, TrivialMoveNonOverlappingFiles) { ASSERT_EQ(trivial_move, 0); ASSERT_EQ(non_trivial_move, 1); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_P(DBCompactionTestWithParam, TrivialMoveTargetLevel) { int32_t trivial_move = 0; int32_t non_trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* /*arg*/) { non_trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.disable_auto_compactions = true; @@ -1238,10 +1238,10 @@ TEST_P(DBCompactionTestWithParam, TrivialMoveTargetLevel) { TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) { int32_t trivial_move = 0; int32_t non_trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* /*arg*/) { non_trivial_move++; }); bool first = true; @@ -1249,11 +1249,11 @@ TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) { // 4 -> 1: ensure the order of two non-trivial compactions // 5 -> 2 and 5 -> 3: ensure we do a check before two non-trivial compactions // are installed - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBCompaction::ManualPartial:4", "DBCompaction::ManualPartial:1"}, {"DBCompaction::ManualPartial:5", "DBCompaction::ManualPartial:2"}, {"DBCompaction::ManualPartial:5", "DBCompaction::ManualPartial:3"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (first) { first = false; @@ -1264,7 +1264,7 @@ TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.write_buffer_size = 10 * 1024 * 1024; @@ -1329,7 +1329,7 @@ TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) { ASSERT_EQ(trivial_move, 6); ASSERT_EQ(non_trivial_move, 0); - rocksdb::port::Thread threads([&] { + ROCKSDB_NAMESPACE::port::Thread threads([&] { compact_options.change_level = false; compact_options.exclusive_manual_compaction = false; std::string begin_string = Key(0); @@ -1383,18 +1383,18 @@ TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) { TEST_F(DBCompactionTest, DISABLED_ManualPartialFill) { int32_t trivial_move = 0; int32_t non_trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* /*arg*/) { non_trivial_move++; }); bool first = true; bool second = true; - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBCompaction::PartialFill:4", "DBCompaction::PartialFill:1"}, {"DBCompaction::PartialFill:2", "DBCompaction::PartialFill:3"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (first) { TEST_SYNC_POINT("DBCompaction::PartialFill:4"); @@ -1404,7 +1404,7 @@ TEST_F(DBCompactionTest, DISABLED_ManualPartialFill) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.write_buffer_size = 10 * 1024 * 1024; @@ -1465,7 +1465,7 @@ TEST_F(DBCompactionTest, DISABLED_ManualPartialFill) { ASSERT_EQ(trivial_move, 2); ASSERT_EQ(non_trivial_move, 0); - rocksdb::port::Thread threads([&] { + ROCKSDB_NAMESPACE::port::Thread threads([&] { compact_options.change_level = false; compact_options.exclusive_manual_compaction = false; std::string begin_string = Key(0); @@ -1507,7 +1507,7 @@ TEST_F(DBCompactionTest, DISABLED_ManualPartialFill) { } TEST_F(DBCompactionTest, ManualCompactionWithUnorderedWrite) { - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::WriteImpl:UnorderedWriteAfterWriteWAL", "DBCompactionTest::ManualCompactionWithUnorderedWrite:WaitWriteWAL"}, {"DBImpl::WaitForPendingWrites:BeforeBlock", @@ -1520,7 +1520,7 @@ TEST_F(DBCompactionTest, ManualCompactionWithUnorderedWrite) { ASSERT_OK(Flush()); Put("bar", "v1"); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); port::Thread writer([&]() { Put("foo", "v2"); }); TEST_SYNC_POINT( @@ -1831,13 +1831,13 @@ TEST_F(DBCompactionTest, DeleteFileRangeFileEndpointsOverlapBug) { TEST_P(DBCompactionTestWithParam, TrivialMoveToLastLevelWithFiles) { int32_t trivial_move = 0; int32_t non_trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* /*arg*/) { non_trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.write_buffer_size = 100000000; @@ -1886,7 +1886,7 @@ TEST_P(DBCompactionTestWithParam, TrivialMoveToLastLevelWithFiles) { ASSERT_EQ(Get(Key(i)), values[i]); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_P(DBCompactionTestWithParam, LevelCompactionThirdPath) { @@ -2399,12 +2399,12 @@ TEST_F(DBCompactionTest, L0_CompactionBug_Issue44_b) { TEST_F(DBCompactionTest, ManualAutoRace) { CreateAndReopenWithCF({"pikachu"}, CurrentOptions()); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::BGWorkCompaction", "DBCompactionTest::ManualAutoRace:1"}, {"DBImpl::RunManualCompaction:WaitScheduled", "BackgroundCallCompaction:0"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Put(1, "foo", ""); Put(1, "bar", ""); @@ -2435,13 +2435,13 @@ TEST_F(DBCompactionTest, ManualAutoRace) { // Eventually the cancelled compaction will be rescheduled and executed. dbfull()->TEST_WaitForCompact(); ASSERT_EQ("0,1", FilesPerLevel(0)); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_P(DBCompactionTestWithParam, ManualCompaction) { Options options = CurrentOptions(); options.max_subcompactions = max_subcompactions_; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); CreateAndReopenWithCF({"pikachu"}, options); // iter - 0 with 7 levels @@ -2489,7 +2489,7 @@ TEST_P(DBCompactionTestWithParam, ManualCompaction) { options = CurrentOptions(); options.num_levels = 3; options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); CreateAndReopenWithCF({"pikachu"}, options); } @@ -2836,19 +2836,19 @@ TEST_P(DBCompactionTestWithParam, CompressLevelCompaction) { kZlibCompression}; int matches = 0, didnt_match = 0, trivial_move = 0, non_trivial = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "Compaction::InputCompressionMatchesOutput:Matches", [&](void* /*arg*/) { matches++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "Compaction::InputCompressionMatchesOutput:DidntMatch", [&](void* /*arg*/) { didnt_match++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* /*arg*/) { non_trivial++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Reopen(options); @@ -2909,7 +2909,7 @@ TEST_P(DBCompactionTestWithParam, CompressLevelCompaction) { ASSERT_EQ(trivial_move, 12); ASSERT_EQ(non_trivial, 8); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); for (int i = 0; i < key_idx; i++) { auto v = Get(Key(i)); @@ -2971,13 +2971,13 @@ TEST_F(DBCompactionTest, SuggestCompactRangeNoTwoLevel0Compactions) { } db_->CompactRange(CompactRangeOptions(), nullptr, nullptr); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"CompactionJob::Run():Start", "DBCompactionTest::SuggestCompactRangeNoTwoLevel0Compactions:1"}, {"DBCompactionTest::SuggestCompactRangeNoTwoLevel0Compactions:2", "CompactionJob::Run():End"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // trigger L0 compaction for (int num = 0; num < options.level0_file_num_compaction_trigger + 1; @@ -3013,25 +3013,26 @@ static std::string ShortKey(int i) { TEST_P(DBCompactionTestWithParam, ForceBottommostLevelCompaction) { int32_t trivial_move = 0; int32_t non_trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* /*arg*/) { non_trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // The key size is guaranteed to be <= 8 class ShortKeyComparator : public Comparator { - int Compare(const rocksdb::Slice& a, - const rocksdb::Slice& b) const override { + int Compare(const ROCKSDB_NAMESPACE::Slice& a, + const ROCKSDB_NAMESPACE::Slice& b) const override { assert(a.size() <= 8); assert(b.size() <= 8); return BytewiseComparator()->Compare(a, b); } const char* Name() const override { return "ShortKeyComparator"; } - void FindShortestSeparator(std::string* start, - const rocksdb::Slice& limit) const override { + void FindShortestSeparator( + std::string* start, + const ROCKSDB_NAMESPACE::Slice& limit) const override { return BytewiseComparator()->FindShortestSeparator(start, limit); } void FindShortSuccessor(std::string* key) const override { @@ -3108,7 +3109,7 @@ TEST_P(DBCompactionTestWithParam, ForceBottommostLevelCompaction) { ASSERT_EQ(Get(ShortKey(i)), values[i]); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_P(DBCompactionTestWithParam, IntraL0Compaction) { @@ -3123,10 +3124,10 @@ TEST_P(DBCompactionTestWithParam, IntraL0Compaction) { Random rnd(301); std::string value(RandomString(&rnd, kValueSize)); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"LevelCompactionPicker::PickCompactionBySize:0", "CompactionJob::Run():Start"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // index: 0 1 2 3 4 5 6 7 8 9 // size: 1MB 1MB 1MB 1MB 1MB 2MB 1MB 1MB 1MB 1MB @@ -3149,7 +3150,7 @@ TEST_P(DBCompactionTestWithParam, IntraL0Compaction) { ASSERT_OK(Flush()); } dbfull()->TEST_WaitForCompact(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); std::vector> level_to_files; dbfull()->TEST_GetFilesMetaData(dbfull()->DefaultColumnFamily(), @@ -3177,10 +3178,10 @@ TEST_P(DBCompactionTestWithParam, IntraL0CompactionDoesNotObsoleteDeletions) { Random rnd(301); std::string value(RandomString(&rnd, kValueSize)); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"LevelCompactionPicker::PickCompactionBySize:0", "CompactionJob::Run():Start"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // index: 0 1 2 3 4 5 6 7 8 9 // size: 1MB 1MB 1MB 1MB 1MB 1MB 1MB 1MB 1MB 1MB @@ -3206,7 +3207,7 @@ TEST_P(DBCompactionTestWithParam, IntraL0CompactionDoesNotObsoleteDeletions) { ASSERT_OK(Flush()); } dbfull()->TEST_WaitForCompact(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); std::vector> level_to_files; dbfull()->TEST_GetFilesMetaData(dbfull()->DefaultColumnFamily(), @@ -3259,7 +3260,7 @@ TEST_P(DBCompactionTestWithParam, FullCompactionInBottomPriThreadPool) { // Verify that size amplification did occur ASSERT_EQ(NumSortedRuns(), 1); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } Env::Default()->SetBackgroundThreads(0, Env::Priority::BOTTOM); } @@ -3270,7 +3271,7 @@ TEST_F(DBCompactionTest, OptimizedDeletionObsoleting) { const int kNumL0Files = 4; Options options = CurrentOptions(); options.level0_file_num_compaction_trigger = kNumL0Files; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); // put key 1 and 3 in separate L1, L2 files. @@ -3315,12 +3316,12 @@ TEST_F(DBCompactionTest, CompactFilesPendingL0Bug) { options.max_background_compactions = 2; DestroyAndReopen(options); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"LevelCompactionPicker::PickCompaction:Return", "DBCompactionTest::CompactFilesPendingL0Bug:Picked"}, {"DBCompactionTest::CompactFilesPendingL0Bug:ManualCompacted", "DBImpl::BackgroundCompaction:NonTrivial:AfterRun"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); auto schedule_multi_compaction_token = dbfull()->TEST_write_controler().GetCompactionPressureToken(); @@ -3350,7 +3351,7 @@ TEST_F(DBCompactionTest, CompactFilesPendingL0Bug) { ->CompactFiles(CompactionOptions(), input_filenames, 0 /* output_level */)); TEST_SYNC_POINT("DBCompactionTest::CompactFilesPendingL0Bug:ManualCompacted"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBCompactionTest, CompactFilesOverlapInL0Bug) { @@ -3424,13 +3425,13 @@ TEST_F(DBCompactionTest, CompactBottomLevelFilesWithDeletions) { // file without changing file count. db_->ReleaseSnapshot(snapshot); ASSERT_EQ(kMaxSequenceNumber, dbfull()->bottommost_files_mark_threshold_); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); ASSERT_TRUE(compaction->compaction_reason() == CompactionReason::kBottommostFiles); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); dbfull()->TEST_WaitForCompact(); db_->GetLiveFilesMetaData(&post_release_metadata); ASSERT_EQ(pre_release_metadata.size(), post_release_metadata.size()); @@ -3444,7 +3445,7 @@ TEST_F(DBCompactionTest, CompactBottomLevelFilesWithDeletions) { // deletion markers/deleted keys. ASSERT_LT(post_file.size, pre_file.size); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBCompactionTest, LevelCompactExpiredTtlFiles) { @@ -3493,16 +3494,16 @@ TEST_F(DBCompactionTest, LevelCompactExpiredTtlFiles) { // compacted. ASSERT_OK(Put("a", "1")); Flush(); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); ASSERT_TRUE(compaction->compaction_reason() == CompactionReason::kTtl); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); dbfull()->TEST_WaitForCompact(); // All non-L0 files are deleted, as they contained only deleted data. ASSERT_EQ("1", FilesPerLevel()); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); // Test dynamically changing ttl. @@ -3540,12 +3541,12 @@ TEST_F(DBCompactionTest, LevelCompactExpiredTtlFiles) { dbfull()->TEST_WaitForCompact(); ASSERT_EQ("1,2,0,2", FilesPerLevel()); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); ASSERT_TRUE(compaction->compaction_reason() == CompactionReason::kTtl); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Dynamically change ttl to 10 hours. // This should trigger a ttl compaction, as 12 hours have already passed. @@ -3553,7 +3554,7 @@ TEST_F(DBCompactionTest, LevelCompactExpiredTtlFiles) { dbfull()->TEST_WaitForCompact(); // All non-L0 files are deleted, as they contained only deleted data. ASSERT_EQ("1", FilesPerLevel()); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBCompactionTest, LevelTtlCascadingCompactions) { @@ -3570,7 +3571,7 @@ TEST_F(DBCompactionTest, LevelTtlCascadingCompactions) { options.max_open_files = 20; } // RocksDB sanitize max open files to at least 20. Modify it back. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SanitizeOptions::AfterChangeMaxOpenFiles", [&](void* arg) { int* max_open_files = static_cast(arg); *max_open_files = 2; @@ -3578,7 +3579,7 @@ TEST_F(DBCompactionTest, LevelTtlCascadingCompactions) { // In the case where all files are opened and doing DB restart // forcing the oldest ancester time in manifest file to be 0 to // simulate the case of reading from an old version. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "VersionEdit::EncodeTo:VarintOldestAncesterTime", [&](void* arg) { if (if_restart && if_open_all_files) { std::string* encoded_fieled = static_cast(arg); @@ -3594,7 +3595,7 @@ TEST_F(DBCompactionTest, LevelTtlCascadingCompactions) { DestroyAndReopen(options); int ttl_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); auto compaction_reason = compaction->compaction_reason(); @@ -3602,7 +3603,7 @@ TEST_F(DBCompactionTest, LevelTtlCascadingCompactions) { ttl_compactions++; } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Add two L6 files with key ranges: [1 .. 100], [101 .. 200]. Random rnd(301); @@ -3697,7 +3698,7 @@ TEST_F(DBCompactionTest, LevelTtlCascadingCompactions) { ASSERT_EQ("1,0,0,0,0,0,1", FilesPerLevel()); ASSERT_GE(ttl_compactions, 6); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } } @@ -3717,7 +3718,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompaction) { options.max_open_files = 20; } // RocksDB sanitize max open files to at least 20. Modify it back. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SanitizeOptions::AfterChangeMaxOpenFiles", [&](void* arg) { int* max_open_files = static_cast(arg); *max_open_files = 0; @@ -3725,7 +3726,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompaction) { // In the case where all files are opened and doing DB restart // forcing the file creation time in manifest file to be 0 to // simulate the case of reading from an old version. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "VersionEdit::EncodeTo:VarintFileCreationTime", [&](void* arg) { if (if_restart && if_open_all_files) { std::string* encoded_fieled = static_cast(arg); @@ -3741,7 +3742,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompaction) { DestroyAndReopen(options); int periodic_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); auto compaction_reason = compaction->compaction_reason(); @@ -3749,7 +3750,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompaction) { periodic_compactions++; } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); for (int i = 0; i < kNumLevelFiles; ++i) { @@ -3801,7 +3802,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompaction) { // + 4. ASSERT_EQ(9, periodic_compactions); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } } @@ -3825,7 +3826,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompactionWithOldDB) { int periodic_compactions = 0; bool set_file_creation_time_to_zero = true; bool set_creation_time_to_zero = true; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); auto compaction_reason = compaction->compaction_reason(); @@ -3833,7 +3834,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompactionWithOldDB) { periodic_compactions++; } }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "PropertyBlockBuilder::AddTableProperty:Start", [&](void* arg) { TableProperties* props = reinterpret_cast(arg); if (set_file_creation_time_to_zero) { @@ -3843,7 +3844,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompactionWithOldDB) { props->creation_time = 0; } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); for (int i = 0; i < kNumFiles; ++i) { @@ -3876,7 +3877,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompactionWithOldDB) { // Make sure that all files go through periodic compaction. ASSERT_EQ(kNumFiles, periodic_compactions); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBCompactionTest, LevelPeriodicAndTtlCompaction) { @@ -3896,7 +3897,7 @@ TEST_F(DBCompactionTest, LevelPeriodicAndTtlCompaction) { int periodic_compactions = 0; int ttl_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); auto compaction_reason = compaction->compaction_reason(); @@ -3906,7 +3907,7 @@ TEST_F(DBCompactionTest, LevelPeriodicAndTtlCompaction) { ttl_compactions++; } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); for (int i = 0; i < kNumLevelFiles; ++i) { @@ -3957,7 +3958,7 @@ TEST_F(DBCompactionTest, LevelPeriodicAndTtlCompaction) { ASSERT_EQ(6, periodic_compactions); ASSERT_EQ(6, ttl_compactions); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBCompactionTest, LevelPeriodicCompactionWithCompactionFilters) { @@ -4010,7 +4011,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompactionWithCompactionFilters) { dbfull()->GetOptions().periodic_compaction_seconds); int periodic_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); auto compaction_reason = compaction->compaction_reason(); @@ -4018,7 +4019,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompactionWithCompactionFilters) { periodic_compactions++; } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); for (int i = 0; i < kNumLevelFiles; ++i) { for (int j = 0; j < kNumKeysPerFile; ++j) { @@ -4042,7 +4043,7 @@ TEST_F(DBCompactionTest, LevelPeriodicCompactionWithCompactionFilters) { // The two old files go through the periodic compaction process ASSERT_EQ(2, periodic_compactions); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } @@ -4068,16 +4069,17 @@ TEST_F(DBCompactionTest, CompactRangeDelayedByL0FileCount) { if (i == 0) { // ensure the auto compaction doesn't finish until manual compaction has // had a chance to be delayed. - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::WaitUntilFlushWouldNotStallWrites:StallWait", "CompactionJob::Run():End"}}); } else { // ensure the auto-compaction doesn't finish until manual compaction has // continued without delay. - rocksdb::SyncPoint::GetInstance()->LoadDependency( - {{"DBImpl::FlushMemTable:StallWaitDone", "CompactionJob::Run():End"}}); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( + {{"DBImpl::FlushMemTable:StallWaitDone", + "CompactionJob::Run():End"}}); } - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); for (int j = 0; j < kNumL0FilesLimit - 1; ++j) { @@ -4096,7 +4098,7 @@ TEST_F(DBCompactionTest, CompactRangeDelayedByL0FileCount) { dbfull()->TEST_WaitForCompact(); ASSERT_EQ(0, NumTableFilesAtLevel(0)); ASSERT_GT(NumTableFilesAtLevel(1), 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } @@ -4122,17 +4124,17 @@ TEST_F(DBCompactionTest, CompactRangeDelayedByImmMemTableCount) { if (i == 0) { // ensure the flush doesn't finish until manual compaction has had a // chance to be delayed. - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::WaitUntilFlushWouldNotStallWrites:StallWait", "FlushJob::WriteLevel0Table"}}); } else { // ensure the flush doesn't finish until manual compaction has continued // without delay. - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::FlushMemTable:StallWaitDone", "FlushJob::WriteLevel0Table"}}); } - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); for (int j = 0; j < kNumImmMemTableLimit - 1; ++j) { @@ -4153,7 +4155,7 @@ TEST_F(DBCompactionTest, CompactRangeDelayedByImmMemTableCount) { dbfull()->TEST_WaitForFlushMemTable(); ASSERT_EQ(0, NumTableFilesAtLevel(0)); ASSERT_GT(NumTableFilesAtLevel(1), 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } @@ -4174,12 +4176,12 @@ TEST_F(DBCompactionTest, CompactRangeShutdownWhileDelayed) { // The calls to close CF/DB wait until the manual compaction stalls. // The auto-compaction waits until the manual compaction finishes to ensure // the signal comes from closing CF/DB, not from compaction making progress. - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::WaitUntilFlushWouldNotStallWrites:StallWait", "DBCompactionTest::CompactRangeShutdownWhileDelayed:PreShutdown"}, {"DBCompactionTest::CompactRangeShutdownWhileDelayed:PostManual", "CompactionJob::Run():End"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); for (int j = 0; j < kNumL0FilesLimit - 1; ++j) { @@ -4212,7 +4214,7 @@ TEST_F(DBCompactionTest, CompactRangeShutdownWhileDelayed) { TEST_SYNC_POINT( "DBCompactionTest::CompactRangeShutdownWhileDelayed:PostManual"); dbfull()->TEST_WaitForCompact(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } @@ -4231,13 +4233,13 @@ TEST_F(DBCompactionTest, CompactRangeSkipFlushAfterDelay) { // The manual flush includes the memtable that was active when CompactRange // began. So it unblocks CompactRange and precludes its flush. Throughout the // test, stall conditions are upheld via high L0 file count. - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::WaitUntilFlushWouldNotStallWrites:StallWait", "DBCompactionTest::CompactRangeSkipFlushAfterDelay:PreFlush"}, {"DBCompactionTest::CompactRangeSkipFlushAfterDelay:PostFlush", "DBImpl::FlushMemTable:StallWaitDone"}, {"DBImpl::FlushMemTable:StallWaitDone", "CompactionJob::Run():End"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); //used for the delayable flushes FlushOptions flush_opts; @@ -4267,7 +4269,7 @@ TEST_F(DBCompactionTest, CompactRangeSkipFlushAfterDelay) { db_->GetProperty(DB::Properties::kNumEntriesActiveMemTable, &num_keys_in_memtable); ASSERT_EQ(ToString(1), num_keys_in_memtable); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBCompactionTest, CompactRangeFlushOverlappingMemtable) { @@ -4509,29 +4511,29 @@ TEST_F(DBCompactionTest, CompactionLimiter) { port::Mutex mutex; - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:BeforeCompaction", [&](void* arg) { - const auto& cf_name = static_cast(arg)->GetName(); - auto iter = cf_to_limiter.find(cf_name); - if (iter != cf_to_limiter.end()) { - MutexLock l(&mutex); - ASSERT_GE(iter->second->limit_tasks, ++iter->second->tasks); - iter->second->max_tasks = std::max(iter->second->max_tasks, - iter->second->limit_tasks); - } - }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "DBImpl::BackgroundCompaction:BeforeCompaction", [&](void* arg) { + const auto& cf_name = static_cast(arg)->GetName(); + auto iter = cf_to_limiter.find(cf_name); + if (iter != cf_to_limiter.end()) { + MutexLock l(&mutex); + ASSERT_GE(iter->second->limit_tasks, ++iter->second->tasks); + iter->second->max_tasks = + std::max(iter->second->max_tasks, iter->second->limit_tasks); + } + }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:AfterCompaction", [&](void* arg) { - const auto& cf_name = static_cast(arg)->GetName(); - auto iter = cf_to_limiter.find(cf_name); - if (iter != cf_to_limiter.end()) { - MutexLock l(&mutex); - ASSERT_GE(--iter->second->tasks, 0); - } - }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "DBImpl::BackgroundCompaction:AfterCompaction", [&](void* arg) { + const auto& cf_name = static_cast(arg)->GetName(); + auto iter = cf_to_limiter.find(cf_name); + if (iter != cf_to_limiter.end()) { + MutexLock l(&mutex); + ASSERT_GE(--iter->second->tasks, 0); + } + }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Block all compact threads in thread pool. const size_t kTotalFlushTasks = kMaxBackgroundThreads / 4; @@ -4869,12 +4871,10 @@ TEST_F(DBCompactionTest, CompactionDuringShutdown) { Flush(); } - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:BeforeRun", - [&](void* /*arg*/) { - dbfull()->shutting_down_.store(true); - }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + [&](void* /*arg*/) { dbfull()->shutting_down_.store(true); }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); dbfull()->CompactRange(CompactRangeOptions(), nullptr, nullptr); ASSERT_OK(dbfull()->error_handler_.GetBGError()); } @@ -4960,7 +4960,7 @@ TEST_F(DBCompactionTest, ConsistencyFailTest) { Options options = CurrentOptions(); DestroyAndReopen(options); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "VersionBuilder::CheckConsistency", [&](void* arg) { auto p = reinterpret_cast*>(arg); @@ -4971,7 +4971,7 @@ TEST_F(DBCompactionTest, ConsistencyFailTest) { *(p->second) = temp; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); for (int k = 0; k < 2; ++k) { ASSERT_OK(Put("foo", "bar")); @@ -4979,7 +4979,7 @@ TEST_F(DBCompactionTest, ConsistencyFailTest) { } ASSERT_NOK(Put("foo", "bar")); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } void IngestOneKeyValue(DBImpl* db, const std::string& key, @@ -4987,7 +4987,7 @@ void IngestOneKeyValue(DBImpl* db, const std::string& key, ExternalSstFileInfo info; std::string f = test::PerThreadDBPath("sst_file" + key); EnvOptions env; - rocksdb::SstFileWriter writer(env, options); + ROCKSDB_NAMESPACE::SstFileWriter writer(env, options); auto s = writer.Open(f); ASSERT_OK(s); // ASSERT_OK(writer.Put(Key(), "")); @@ -5014,14 +5014,14 @@ TEST_P(DBCompactionTestWithParam, std::atomic pick_intra_l0_count(0); std::string value(RandomString(&rnd, kValueSize)); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBCompactionTestWithParam::FlushAfterIntraL0:1", "CompactionJob::Run():Start"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "FindIntraL0Compaction", [&](void* /*arg*/) { pick_intra_l0_count.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // prevents trivial move for (int i = 0; i < 10; ++i) { @@ -5056,7 +5056,7 @@ TEST_P(DBCompactionTestWithParam, ASSERT_OK(Put(Key(2), "b")); ASSERT_EQ(10, NumTableFilesAtLevel(0)); dbfull()->TEST_WaitForCompact(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); std::vector> level_to_files; dbfull()->TEST_GetFilesMetaData(dbfull()->DefaultColumnFamily(), &level_to_files); @@ -5093,13 +5093,13 @@ TEST_P(DBCompactionTestWithParam, ASSERT_EQ(0, NumTableFilesAtLevel(0)); std::atomic pick_intra_l0_count(0); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBCompactionTestWithParam::IntraL0CompactionAfterFlush:1", "CompactionJob::Run():Start"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "FindIntraL0Compaction", [&](void* /*arg*/) { pick_intra_l0_count.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Make 6 L0 sst. for (int i = 0; i < 6; ++i) { if (i % 2 == 0) { @@ -5137,7 +5137,7 @@ TEST_P(DBCompactionTestWithParam, sleeping_tasks.WaitUntilDone(); TEST_SYNC_POINT("DBCompactionTestWithParam::IntraL0CompactionAfterFlush:1"); dbfull()->TEST_WaitForCompact(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); uint64_t error_count = 0; db_->GetIntProperty("rocksdb.background-errors", &error_count); @@ -5152,11 +5152,11 @@ TEST_P(DBCompactionTestWithParam, } #endif // !defined(ROCKSDB_LITE) -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { #if !defined(ROCKSDB_LITE) - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); #else diff --git a/db/db_dynamic_level_test.cc b/db/db_dynamic_level_test.cc index 8fac82851e..c266577015 100644 --- a/db/db_dynamic_level_test.cc +++ b/db/db_dynamic_level_test.cc @@ -16,7 +16,7 @@ #include "port/port.h" #include "port/stack_trace.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBTestDynamicLevel : public DBTestBase { public: DBTestDynamicLevel() : DBTestBase("/db_dynamic_level_test") {} @@ -221,10 +221,10 @@ TEST_F(DBTestDynamicLevel, DynamicLevelMaxBytesBase2) { // Make sure that the compaction starts before the last bit of data is // flushed, so that the base level isn't raised to L1. - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"CompactionJob::Run():Start", "DynamicLevelMaxBytesBase2:0"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(dbfull()->SetOptions({ {"disable_auto_compactions", "false"}, @@ -235,20 +235,20 @@ TEST_F(DBTestDynamicLevel, DynamicLevelMaxBytesBase2) { dbfull()->TEST_WaitForCompact(); ASSERT_TRUE(db_->GetIntProperty("rocksdb.base-level", &int_prop)); ASSERT_EQ(2U, int_prop); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); // Write more data until the base level changes to L1. There will be // a manual compaction going on at the same time. - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"CompactionJob::Run():Start", "DynamicLevelMaxBytesBase2:1"}, {"DynamicLevelMaxBytesBase2:2", "CompactionJob::Run():End"}, {"DynamicLevelMaxBytesBase2:compact_range_finish", "FlushJob::WriteLevel0Table"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread thread([this] { + ROCKSDB_NAMESPACE::port::Thread thread([this] { TEST_SYNC_POINT("DynamicLevelMaxBytesBase2:compact_range_start"); ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr)); TEST_SYNC_POINT("DynamicLevelMaxBytesBase2:compact_range_finish"); @@ -265,8 +265,8 @@ TEST_F(DBTestDynamicLevel, DynamicLevelMaxBytesBase2) { thread.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); ASSERT_TRUE(db_->GetIntProperty("rocksdb.base-level", &int_prop)); ASSERT_EQ(1U, int_prop); @@ -329,16 +329,16 @@ TEST_F(DBTestDynamicLevel, DynamicLevelMaxBytesCompactRange) { ASSERT_TRUE(db_->GetProperty("rocksdb.num-files-at-level2", &str_prop)); ASSERT_EQ("0", str_prop); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); std::set output_levels; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactionPicker::CompactRange:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); output_levels.insert(compaction->output_level()); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); dbfull()->CompactRange(CompactRangeOptions(), nullptr, nullptr); ASSERT_EQ(output_levels.size(), 2); @@ -373,10 +373,10 @@ TEST_F(DBTestDynamicLevel, DynamicLevelMaxBytesBaseInc) { DestroyAndReopen(options); int non_trivial = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* /*arg*/) { non_trivial++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); const int total_keys = 3000; @@ -388,7 +388,7 @@ TEST_F(DBTestDynamicLevel, DynamicLevelMaxBytesBaseInc) { } Flush(); dbfull()->TEST_WaitForCompact(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_EQ(non_trivial, 0); @@ -457,7 +457,7 @@ TEST_F(DBTestDynamicLevel, DISABLED_MigrateToDynamicLevelMaxBytesBase) { compaction_finished = false; // Issue manual compaction in one thread and still verify DB state // in main thread. - rocksdb::port::Thread t([&]() { + ROCKSDB_NAMESPACE::port::Thread t([&]() { CompactRangeOptions compact_options; compact_options.change_level = true; compact_options.target_level = options.num_levels - 1; @@ -488,13 +488,13 @@ TEST_F(DBTestDynamicLevel, DISABLED_MigrateToDynamicLevelMaxBytesBase) { ASSERT_EQ(NumTableFilesAtLevel(1), 0); ASSERT_EQ(NumTableFilesAtLevel(2), 0); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !defined(ROCKSDB_LITE) int main(int argc, char** argv) { #if !defined(ROCKSDB_LITE) - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); #else diff --git a/db/db_encryption_test.cc b/db/db_encryption_test.cc index bc72744656..b1f3ce23f0 100644 --- a/db/db_encryption_test.cc +++ b/db/db_encryption_test.cc @@ -12,7 +12,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBEncryptionTest : public DBTestBase { public: @@ -113,10 +113,10 @@ TEST_F(DBEncryptionTest, ReadEmptyFile) { #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_filesnapshot.cc b/db/db_filesnapshot.cc index 8717b3559f..f0f22cb47e 100644 --- a/db/db_filesnapshot.cc +++ b/db/db_filesnapshot.cc @@ -21,7 +21,7 @@ #include "test_util/sync_point.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status DBImpl::DisableFileDeletions() { InstrumentedMutexLock l(&mutex_); @@ -172,6 +172,6 @@ Status DBImpl::GetCurrentWalFile(std::unique_ptr* current_log_file) { return wal_manager_.GetLiveWalFile(current_logfile_number, current_log_file); } -} +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/db_flush_test.cc b/db/db_flush_test.cc index 5a24226ea0..bab206d3d0 100644 --- a/db/db_flush_test.cc +++ b/db/db_flush_test.cc @@ -18,7 +18,7 @@ #include "util/cast_util.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBFlushTest : public DBTestBase { public: @@ -775,10 +775,10 @@ INSTANTIATE_TEST_CASE_P(DBFlushDirectIOTest, DBFlushDirectIOTest, INSTANTIATE_TEST_CASE_P(DBAtomicFlushTest, DBAtomicFlushTest, testing::Bool()); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index 404fd215dd..c6fa3c16ef 100644 --- a/db/db_impl/db_impl.cc +++ b/db/db_impl/db_impl.cc @@ -102,7 +102,7 @@ #include "util/stop_watch.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const std::string kDefaultColumnFamilyName("default"); const std::string kPersistentStatsColumnFamilyName( @@ -644,7 +644,7 @@ void DBImpl::StartTimedTasks() { stats_dump_period_sec = mutable_db_options_.stats_dump_period_sec; if (stats_dump_period_sec > 0) { if (!thread_dump_stats_) { - thread_dump_stats_.reset(new rocksdb::RepeatableThread( + thread_dump_stats_.reset(new ROCKSDB_NAMESPACE::RepeatableThread( [this]() { DBImpl::DumpStats(); }, "dump_st", env_, static_cast(stats_dump_period_sec) * kMicrosInSecond)); } @@ -652,7 +652,7 @@ void DBImpl::StartTimedTasks() { stats_persist_period_sec = mutable_db_options_.stats_persist_period_sec; if (stats_persist_period_sec > 0) { if (!thread_persist_stats_) { - thread_persist_stats_.reset(new rocksdb::RepeatableThread( + thread_persist_stats_.reset(new ROCKSDB_NAMESPACE::RepeatableThread( [this]() { DBImpl::PersistStats(); }, "pst_st", env_, static_cast(stats_persist_period_sec) * kMicrosInSecond)); } @@ -1043,7 +1043,7 @@ Status DBImpl::SetDBOptions( mutex_.Lock(); } if (new_options.stats_dump_period_sec > 0) { - thread_dump_stats_.reset(new rocksdb::RepeatableThread( + thread_dump_stats_.reset(new ROCKSDB_NAMESPACE::RepeatableThread( [this]() { DBImpl::DumpStats(); }, "dump_st", env_, static_cast(new_options.stats_dump_period_sec) * kMicrosInSecond)); @@ -1059,7 +1059,7 @@ Status DBImpl::SetDBOptions( mutex_.Lock(); } if (new_options.stats_persist_period_sec > 0) { - thread_persist_stats_.reset(new rocksdb::RepeatableThread( + thread_persist_stats_.reset(new ROCKSDB_NAMESPACE::RepeatableThread( [this]() { DBImpl::PersistStats(); }, "pst_st", env_, static_cast(new_options.stats_persist_period_sec) * kMicrosInSecond)); @@ -4376,8 +4376,8 @@ Status DBImpl::VerifyChecksum(const ReadOptions& read_options) { const auto& fd = vstorage->LevelFilesBrief(i).files[j].fd; std::string fname = TableFileName(cfd->ioptions()->cf_paths, fd.GetNumber(), fd.GetPathId()); - s = rocksdb::VerifySstFileChecksum(opts, file_options_, read_options, - fname); + s = ROCKSDB_NAMESPACE::VerifySstFileChecksum(opts, file_options_, + read_options, fname); } } if (!s.ok()) { @@ -4539,4 +4539,4 @@ Status DBImpl::GetCreationTimeOfOldestFile(uint64_t* creation_time) { } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_impl/db_impl.h b/db/db_impl/db_impl.h index 7041f7e658..119555cb4c 100644 --- a/db/db_impl/db_impl.h +++ b/db/db_impl/db_impl.h @@ -62,7 +62,7 @@ #include "util/stop_watch.h" #include "util/thread_local.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Arena; class ArenaWrappedDBIter; @@ -2015,11 +2015,11 @@ class DBImpl : public DB { // handle for scheduling stats dumping at fixed intervals // REQUIRES: mutex locked - std::unique_ptr thread_dump_stats_; + std::unique_ptr thread_dump_stats_; // handle for scheduling stats snapshoting at fixed intervals // REQUIRES: mutex locked - std::unique_ptr thread_persist_stats_; + std::unique_ptr thread_persist_stats_; // When set, we use a separate queue for writes that dont write to memtable. // In 2PC these are the writes at Prepare phase. @@ -2104,4 +2104,4 @@ static void ClipToRange(T* ptr, V minvalue, V maxvalue) { if (static_cast(*ptr) < minvalue) *ptr = minvalue; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_impl/db_impl_compaction_flush.cc b/db/db_impl/db_impl_compaction_flush.cc index 38172981c0..c7b3510c3e 100644 --- a/db/db_impl/db_impl_compaction_flush.cc +++ b/db/db_impl/db_impl_compaction_flush.cc @@ -22,7 +22,7 @@ #include "util/cast_util.h" #include "util/concurrent_task_limiter_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { bool DBImpl::EnoughRoomForCompaction( ColumnFamilyData* cfd, const std::vector& inputs, @@ -3113,4 +3113,4 @@ void DBImpl::GetSnapshotContext( } *snapshot_seqs = snapshots_.GetAll(earliest_write_conflict_snapshot); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_impl/db_impl_debug.cc b/db/db_impl/db_impl_debug.cc index c3a4c35251..610b57d396 100644 --- a/db/db_impl/db_impl_debug.cc +++ b/db/db_impl/db_impl_debug.cc @@ -15,7 +15,7 @@ #include "monitoring/thread_status_updater.h" #include "util/cast_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { uint64_t DBImpl::TEST_GetLevel0TotalSize() { InstrumentedMutexLock l(&mutex_); return default_cf_handle_->cfd()->current()->storage_info()->NumLevelBytes(0); @@ -290,5 +290,5 @@ bool DBImpl::TEST_IsPersistentStatsEnabled() const { size_t DBImpl::TEST_EstimateInMemoryStatsHistorySize() const { return EstimateInMemoryStatsHistorySize(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // NDEBUG diff --git a/db/db_impl/db_impl_experimental.cc b/db/db_impl/db_impl_experimental.cc index 97585c12d5..f0c17ce952 100644 --- a/db/db_impl/db_impl_experimental.cc +++ b/db/db_impl/db_impl_experimental.cc @@ -17,7 +17,7 @@ #include "db/version_set.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE Status DBImpl::SuggestCompactRange(ColumnFamilyHandle* column_family, @@ -148,4 +148,4 @@ Status DBImpl::PromoteL0(ColumnFamilyHandle* column_family, int target_level) { } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_impl/db_impl_files.cc b/db/db_impl/db_impl_files.cc index b52500fc64..c5d07dd01f 100644 --- a/db/db_impl/db_impl_files.cc +++ b/db/db_impl/db_impl_files.cc @@ -17,7 +17,7 @@ #include "file/sst_file_manager_impl.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { uint64_t DBImpl::MinLogNumberToKeep() { if (allow_2pc()) { @@ -664,4 +664,4 @@ uint64_t PrecomputeMinLogNumberToKeep( return min_log_number_to_keep; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_impl/db_impl_open.cc b/db/db_impl/db_impl_open.cc index de703138f6..6ae4ead542 100644 --- a/db/db_impl/db_impl_open.cc +++ b/db/db_impl/db_impl_open.cc @@ -23,7 +23,7 @@ #include "test_util/sync_point.h" #include "util/rate_limiter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Options SanitizeOptions(const std::string& dbname, const Options& src) { auto db_options = SanitizeOptions(dbname, DBOptions(src)); ImmutableDBOptions immutable_db_options(db_options); @@ -1648,4 +1648,4 @@ Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname, } return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_impl/db_impl_readonly.cc b/db/db_impl/db_impl_readonly.cc index 8a8a9c9d05..a4242bfe10 100644 --- a/db/db_impl/db_impl_readonly.cc +++ b/db/db_impl/db_impl_readonly.cc @@ -12,7 +12,7 @@ #include "db/merge_context.h" #include "monitoring/perf_context_imp.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE @@ -218,4 +218,4 @@ Status DB::OpenForReadOnly( } #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_impl/db_impl_readonly.h b/db/db_impl/db_impl_readonly.h index 9f7ad17a47..04d06b4a10 100644 --- a/db/db_impl/db_impl_readonly.h +++ b/db/db_impl/db_impl_readonly.h @@ -11,7 +11,7 @@ #include #include "db/db_impl/db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBImplReadOnly : public DBImpl { public: @@ -132,6 +132,6 @@ class DBImplReadOnly : public DBImpl { private: friend class DB; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/db/db_impl/db_impl_secondary.cc b/db/db_impl/db_impl_secondary.cc index 937b6e90e4..f0ec27c320 100644 --- a/db/db_impl/db_impl_secondary.cc +++ b/db/db_impl/db_impl_secondary.cc @@ -13,7 +13,7 @@ #include "monitoring/perf_context_imp.h" #include "util/cast_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE DBImplSecondary::DBImplSecondary(const DBOptions& db_options, @@ -668,4 +668,4 @@ Status DB::OpenAsSecondary( } #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_impl/db_impl_secondary.h b/db/db_impl/db_impl_secondary.h index cde664c58c..24f2e77670 100644 --- a/db/db_impl/db_impl_secondary.h +++ b/db/db_impl/db_impl_secondary.h @@ -11,7 +11,7 @@ #include #include "db/db_impl/db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A wrapper class to hold log reader, log reporter, log status. class LogReaderContainer { @@ -328,6 +328,6 @@ class DBImplSecondary : public DBImpl { std::unordered_map cfd_to_current_log_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/db/db_impl/db_impl_write.cc b/db/db_impl/db_impl_write.cc index 08468935d2..8f6f685e48 100644 --- a/db/db_impl/db_impl_write.cc +++ b/db/db_impl/db_impl_write.cc @@ -15,7 +15,7 @@ #include "options/options_helper.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Convenience methods Status DBImpl::Put(const WriteOptions& o, ColumnFamilyHandle* column_family, const Slice& key, const Slice& val) { @@ -1836,4 +1836,4 @@ Status DB::Merge(const WriteOptions& opt, ColumnFamilyHandle* column_family, } return Write(opt, &batch); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_impl/db_secondary_test.cc b/db/db_impl/db_secondary_test.cc index c04f6e66f8..0b34181de0 100644 --- a/db/db_impl/db_secondary_test.cc +++ b/db/db_impl/db_secondary_test.cc @@ -13,7 +13,7 @@ #include "test_util/fault_injection_test_env.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE class DBSecondaryTest : public DBTestBase { @@ -860,10 +860,10 @@ TEST_F(DBSecondaryTest, CheckConsistencyWhenOpen) { } #endif //! ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_info_dumper.cc b/db/db_info_dumper.cc index 7ab7e3337a..7008ca6ff7 100644 --- a/db/db_info_dumper.cc +++ b/db/db_info_dumper.cc @@ -14,7 +14,7 @@ #include "file/filename.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void DumpDBFileSummary(const ImmutableDBOptions& options, const std::string& dbname) { @@ -120,4 +120,4 @@ void DumpDBFileSummary(const ImmutableDBOptions& options, Header(options.info_log, "Write Ahead Log file in %s: %s\n", options.wal_dir.c_str(), wal_info.c_str()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_info_dumper.h b/db/db_info_dumper.h index acff8f1b8f..91404cbd75 100644 --- a/db/db_info_dumper.h +++ b/db/db_info_dumper.h @@ -8,7 +8,7 @@ #include "options/db_options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void DumpDBFileSummary(const ImmutableDBOptions& options, const std::string& dbname); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_inplace_update_test.cc b/db/db_inplace_update_test.cc index c1f1b51e30..26405864e3 100644 --- a/db/db_inplace_update_test.cc +++ b/db/db_inplace_update_test.cc @@ -9,7 +9,7 @@ #include "db/db_test_util.h" #include "port/stack_trace.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBTestInPlaceUpdate : public DBTestBase { public: @@ -73,7 +73,7 @@ TEST_F(DBTestInPlaceUpdate, InPlaceUpdateCallbackSmallerSize) { options.env = env_; options.write_buffer_size = 100000; options.inplace_callback = - rocksdb::DBTestInPlaceUpdate::updateInPlaceSmallerSize; + ROCKSDB_NAMESPACE::DBTestInPlaceUpdate::updateInPlaceSmallerSize; options.allow_concurrent_memtable_write = false; Reopen(options); CreateAndReopenWithCF({"pikachu"}, options); @@ -102,7 +102,7 @@ TEST_F(DBTestInPlaceUpdate, InPlaceUpdateCallbackSmallerVarintSize) { options.env = env_; options.write_buffer_size = 100000; options.inplace_callback = - rocksdb::DBTestInPlaceUpdate::updateInPlaceSmallerVarintSize; + ROCKSDB_NAMESPACE::DBTestInPlaceUpdate::updateInPlaceSmallerVarintSize; options.allow_concurrent_memtable_write = false; Reopen(options); CreateAndReopenWithCF({"pikachu"}, options); @@ -131,7 +131,7 @@ TEST_F(DBTestInPlaceUpdate, InPlaceUpdateCallbackLargeNewValue) { options.env = env_; options.write_buffer_size = 100000; options.inplace_callback = - rocksdb::DBTestInPlaceUpdate::updateInPlaceLargerSize; + ROCKSDB_NAMESPACE::DBTestInPlaceUpdate::updateInPlaceLargerSize; options.allow_concurrent_memtable_write = false; Reopen(options); CreateAndReopenWithCF({"pikachu"}, options); @@ -158,7 +158,7 @@ TEST_F(DBTestInPlaceUpdate, InPlaceUpdateCallbackNoAction) { options.env = env_; options.write_buffer_size = 100000; options.inplace_callback = - rocksdb::DBTestInPlaceUpdate::updateInPlaceNoAction; + ROCKSDB_NAMESPACE::DBTestInPlaceUpdate::updateInPlaceNoAction; options.allow_concurrent_memtable_write = false; Reopen(options); CreateAndReopenWithCF({"pikachu"}, options); @@ -168,10 +168,10 @@ TEST_F(DBTestInPlaceUpdate, InPlaceUpdateCallbackNoAction) { ASSERT_EQ(Get(1, "key"), "NOT_FOUND"); } while (ChangeCompactOptions()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_io_failure_test.cc b/db/db_io_failure_test.cc index ba8f197596..f8d5624475 100644 --- a/db/db_io_failure_test.cc +++ b/db/db_io_failure_test.cc @@ -10,7 +10,7 @@ #include "db/db_test_util.h" #include "port/stack_trace.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBIOFailureTest : public DBTestBase { public: @@ -270,14 +270,14 @@ TEST_F(DBIOFailureTest, FlushSstRangeSyncError) { Status s; std::atomic range_sync_called(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SpecialEnv::SStableFile::RangeSync", [&](void* arg) { if (range_sync_called.fetch_add(1) == 0) { Status* st = static_cast(arg); *st = Status::IOError("range sync dummy error"); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); std::string rnd_str = @@ -302,7 +302,7 @@ TEST_F(DBIOFailureTest, FlushSstRangeSyncError) { ASSERT_NOK(Put(1, "foo2", "bar3")); ASSERT_EQ("bar", Get(1, "foo")); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_GE(1, range_sync_called.load()); ReopenWithColumnFamilies({"default", "pikachu"}, options); @@ -350,14 +350,14 @@ TEST_F(DBIOFailureTest, CompactSstRangeSyncError) { dbfull()->TEST_WaitForFlushMemTable(handles_[1]); std::atomic range_sync_called(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SpecialEnv::SStableFile::RangeSync", [&](void* arg) { if (range_sync_called.fetch_add(1) == 0) { Status* st = static_cast(arg); *st = Status::IOError("range sync dummy error"); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(dbfull()->SetOptions(handles_[1], { @@ -369,7 +369,7 @@ TEST_F(DBIOFailureTest, CompactSstRangeSyncError) { ASSERT_NOK(Put(1, "foo2", "bar3")); ASSERT_EQ("bar", Get(1, "foo")); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_GE(1, range_sync_called.load()); ReopenWithColumnFamilies({"default", "pikachu"}, options); @@ -389,7 +389,7 @@ TEST_F(DBIOFailureTest, FlushSstCloseError) { CreateAndReopenWithCF({"pikachu"}, options); Status s; std::atomic close_called(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SpecialEnv::SStableFile::Close", [&](void* arg) { if (close_called.fetch_add(1) == 0) { Status* st = static_cast(arg); @@ -397,7 +397,7 @@ TEST_F(DBIOFailureTest, FlushSstCloseError) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(Put(1, "foo", "bar")); ASSERT_OK(Put(1, "foo1", "bar1")); @@ -409,7 +409,7 @@ TEST_F(DBIOFailureTest, FlushSstCloseError) { ASSERT_EQ("bar2", Get(1, "foo")); ASSERT_EQ("bar1", Get(1, "foo1")); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ReopenWithColumnFamilies({"default", "pikachu"}, options); ASSERT_EQ("bar2", Get(1, "foo")); @@ -441,7 +441,7 @@ TEST_F(DBIOFailureTest, CompactionSstCloseError) { dbfull()->TEST_WaitForCompact(); std::atomic close_called(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SpecialEnv::SStableFile::Close", [&](void* arg) { if (close_called.fetch_add(1) == 0) { Status* st = static_cast(arg); @@ -449,7 +449,7 @@ TEST_F(DBIOFailureTest, CompactionSstCloseError) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(dbfull()->SetOptions(handles_[1], { {"disable_auto_compactions", "false"}, @@ -460,7 +460,7 @@ TEST_F(DBIOFailureTest, CompactionSstCloseError) { ASSERT_NOK(Put(1, "foo2", "bar3")); ASSERT_EQ("bar3", Get(1, "foo")); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ReopenWithColumnFamilies({"default", "pikachu"}, options); ASSERT_EQ("bar3", Get(1, "foo")); @@ -480,7 +480,7 @@ TEST_F(DBIOFailureTest, FlushSstSyncError) { CreateAndReopenWithCF({"pikachu"}, options); Status s; std::atomic sync_called(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SpecialEnv::SStableFile::Sync", [&](void* arg) { if (sync_called.fetch_add(1) == 0) { Status* st = static_cast(arg); @@ -488,7 +488,7 @@ TEST_F(DBIOFailureTest, FlushSstSyncError) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(Put(1, "foo", "bar")); ASSERT_OK(Put(1, "foo1", "bar1")); @@ -500,7 +500,7 @@ TEST_F(DBIOFailureTest, FlushSstSyncError) { ASSERT_EQ("bar2", Get(1, "foo")); ASSERT_EQ("bar1", Get(1, "foo1")); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ReopenWithColumnFamilies({"default", "pikachu"}, options); ASSERT_EQ("bar2", Get(1, "foo")); @@ -533,7 +533,7 @@ TEST_F(DBIOFailureTest, CompactionSstSyncError) { dbfull()->TEST_WaitForCompact(); std::atomic sync_called(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SpecialEnv::SStableFile::Sync", [&](void* arg) { if (sync_called.fetch_add(1) == 0) { Status* st = static_cast(arg); @@ -541,7 +541,7 @@ TEST_F(DBIOFailureTest, CompactionSstSyncError) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(dbfull()->SetOptions(handles_[1], { {"disable_auto_compactions", "false"}, @@ -552,17 +552,17 @@ TEST_F(DBIOFailureTest, CompactionSstSyncError) { ASSERT_NOK(Put(1, "foo2", "bar3")); ASSERT_EQ("bar3", Get(1, "foo")); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ReopenWithColumnFamilies({"default", "pikachu"}, options); ASSERT_EQ("bar3", Get(1, "foo")); } #endif // !(defined NDEBUG) || !defined(OS_WIN) #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_iter.cc b/db/db_iter.cc index 0e181d9bf4..4d850abee8 100644 --- a/db/db_iter.cc +++ b/db/db_iter.cc @@ -31,7 +31,7 @@ #include "util/string_util.h" #include "util/user_comparator_wrapper.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #if 0 static void DumpInternalIter(Iterator* iter) { @@ -325,7 +325,7 @@ bool DBIter::FindNextUserEntryInternal(bool skipping_saved_key, ROCKS_LOG_ERROR(logger_, "Encounter unexpected blob index."); status_ = Status::NotSupported( "Encounter unexpected blob index. Please open DB with " - "rocksdb::blob_db::BlobDB instead."); + "ROCKSDB_NAMESPACE::blob_db::BlobDB instead."); valid_ = false; return false; } @@ -497,7 +497,7 @@ bool DBIter::MergeValuesNewToOld() { ROCKS_LOG_ERROR(logger_, "Encounter unexpected blob index."); status_ = Status::NotSupported( "Encounter unexpected blob index. Please open DB with " - "rocksdb::blob_db::BlobDB instead."); + "ROCKSDB_NAMESPACE::blob_db::BlobDB instead."); } else { status_ = Status::NotSupported("Blob DB does not support merge operator."); @@ -798,7 +798,7 @@ bool DBIter::FindValueForCurrentKey() { ROCKS_LOG_ERROR(logger_, "Encounter unexpected blob index."); status_ = Status::NotSupported( "Encounter unexpected blob index. Please open DB with " - "rocksdb::blob_db::BlobDB instead."); + "ROCKSDB_NAMESPACE::blob_db::BlobDB instead."); } else { status_ = Status::NotSupported("Blob DB does not support merge operator."); @@ -821,7 +821,7 @@ bool DBIter::FindValueForCurrentKey() { ROCKS_LOG_ERROR(logger_, "Encounter unexpected blob index."); status_ = Status::NotSupported( "Encounter unexpected blob index. Please open DB with " - "rocksdb::blob_db::BlobDB instead."); + "ROCKSDB_NAMESPACE::blob_db::BlobDB instead."); valid_ = false; return false; } @@ -892,7 +892,7 @@ bool DBIter::FindValueForCurrentKeyUsingSeek() { ROCKS_LOG_ERROR(logger_, "Encounter unexpected blob index."); status_ = Status::NotSupported( "Encounter unexpected blob index. Please open DB with " - "rocksdb::blob_db::BlobDB instead."); + "ROCKSDB_NAMESPACE::blob_db::BlobDB instead."); valid_ = false; return false; } @@ -954,7 +954,7 @@ bool DBIter::FindValueForCurrentKeyUsingSeek() { ROCKS_LOG_ERROR(logger_, "Encounter unexpected blob index."); status_ = Status::NotSupported( "Encounter unexpected blob index. Please open DB with " - "rocksdb::blob_db::BlobDB instead."); + "ROCKSDB_NAMESPACE::blob_db::BlobDB instead."); } else { status_ = Status::NotSupported("Blob DB does not support merge operator."); @@ -1324,4 +1324,4 @@ Iterator* NewDBIterator(Env* env, const ReadOptions& read_options, return db_iter; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_iter.h b/db/db_iter.h index 39e52fe948..74430f0d38 100644 --- a/db/db_iter.h +++ b/db/db_iter.h @@ -20,7 +20,7 @@ #include "table/iterator_wrapper.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This file declares the factory functions of DBIter, in its original form // or a wrapped form with class ArenaWrappedDBIter, which is defined here. @@ -342,4 +342,4 @@ extern Iterator* NewDBIterator( ReadCallback* read_callback, DBImpl* db_impl = nullptr, ColumnFamilyData* cfd = nullptr, bool allow_blob = false); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_iter_stress_test.cc b/db/db_iter_stress_test.cc index b864ac4eae..57cd9866e4 100644 --- a/db/db_iter_stress_test.cc +++ b/db/db_iter_stress_test.cc @@ -29,7 +29,7 @@ bool FLAGS_verbose = false; #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBIteratorStressTest : public testing::Test { public: @@ -645,7 +645,7 @@ TEST_F(DBIteratorStressTest, StressTest) { << "\n mutated on the fly: " << num_recently_removed << std::endl; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/db_iter_test.cc b/db/db_iter_test.cc index 1503886443..ddbea8d179 100644 --- a/db/db_iter_test.cc +++ b/db/db_iter_test.cc @@ -22,7 +22,7 @@ #include "util/string_util.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static uint64_t TestGetTickerCount(const Options& options, Tickers ticker_type) { @@ -691,7 +691,7 @@ TEST_F(DBIteratorTest, DBIteratorEmpty) { TEST_F(DBIteratorTest, DBIteratorUseSkipCountSkips) { ReadOptions ro; Options options; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.merge_operator = MergeOperators::CreateFromStringId("stringappend"); TestIterator* internal_iter = new TestIterator(BytewiseComparator()); @@ -746,7 +746,7 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) { } internal_iter->Finish(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); std::unique_ptr db_iter(NewDBIterator( env_, ro, cf_options, mutable_cf_options, BytewiseComparator(), internal_iter, i + 2, options.max_sequential_skip_in_iterations, @@ -2481,7 +2481,7 @@ TEST_F(DBIteratorTest, DBIteratorTestDifferentialSnapshots) { ReadOptions ro; ro.iter_start_seqnum=5; Options options; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); TestIterator* internal_iter = new TestIterator(BytewiseComparator()); for (size_t i = 0; i < 10; ++i) { @@ -2516,7 +2516,7 @@ TEST_F(DBIteratorTest, DBIteratorTestDifferentialSnapshots) { ReadOptions ro; ro.iter_start_seqnum=5; Options options; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); TestIterator* internal_iter = new TestIterator(BytewiseComparator()); for (size_t i = 0; i < 10; ++i) { @@ -2661,10 +2661,10 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace1) { // Test call back inserts a key in the end of the mem table after // MergeIterator::Prev() realized the mem table iterator is at its end // and before an SeekToLast() is called. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "MergeIterator::Prev:BeforePrev", [&](void* /*arg*/) { internal_iter2_->Add("z", kTypeValue, "7", 12u); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); db_iter_->Prev(); ASSERT_TRUE(db_iter_->Valid()); @@ -2683,7 +2683,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace1) { ASSERT_EQ(db_iter_->key().ToString(), "a"); ASSERT_EQ(db_iter_->value().ToString(), "4"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace2) { @@ -2697,12 +2697,12 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace2) { // Test call back inserts entries for update a key in the end of the // mem table after MergeIterator::Prev() realized the mem tableiterator is at // its end and before an SeekToLast() is called. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "MergeIterator::Prev:BeforePrev", [&](void* /*arg*/) { internal_iter2_->Add("z", kTypeValue, "7", 12u); internal_iter2_->Add("z", kTypeValue, "7", 11u); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); db_iter_->Prev(); ASSERT_TRUE(db_iter_->Valid()); @@ -2721,7 +2721,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace2) { ASSERT_EQ(db_iter_->key().ToString(), "a"); ASSERT_EQ(db_iter_->value().ToString(), "4"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace3) { @@ -2735,7 +2735,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace3) { // Test call back inserts entries for update a key in the end of the // mem table after MergeIterator::Prev() realized the mem table iterator is at // its end and before an SeekToLast() is called. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "MergeIterator::Prev:BeforePrev", [&](void* /*arg*/) { internal_iter2_->Add("z", kTypeValue, "7", 16u, true); internal_iter2_->Add("z", kTypeValue, "7", 15u, true); @@ -2744,7 +2744,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace3) { internal_iter2_->Add("z", kTypeValue, "7", 12u, true); internal_iter2_->Add("z", kTypeValue, "7", 11u, true); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); db_iter_->Prev(); ASSERT_TRUE(db_iter_->Valid()); @@ -2763,7 +2763,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace3) { ASSERT_EQ(db_iter_->key().ToString(), "a"); ASSERT_EQ(db_iter_->value().ToString(), "4"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace4) { @@ -2779,7 +2779,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace4) { // Test call back inserts entries for update a key before "z" in // mem table after MergeIterator::Prev() calls mem table iterator's // Seek() and before calling Prev() - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "MergeIterator::Prev:BeforePrev", [&](void* arg) { IteratorWrapper* it = reinterpret_cast(arg); if (it->key().starts_with("z")) { @@ -2791,7 +2791,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace4) { internal_iter2_->Add("x", kTypeValue, "7", 11u, true); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); db_iter_->Prev(); ASSERT_TRUE(db_iter_->Valid()); @@ -2814,7 +2814,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace4) { ASSERT_EQ(db_iter_->key().ToString(), "a"); ASSERT_EQ(db_iter_->value().ToString(), "4"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace5) { @@ -2830,7 +2830,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace5) { // Test call back inserts entries for update a key before "z" in // mem table after MergeIterator::Prev() calls mem table iterator's // Seek() and before calling Prev() - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "MergeIterator::Prev:BeforePrev", [&](void* arg) { IteratorWrapper* it = reinterpret_cast(arg); if (it->key().starts_with("z")) { @@ -2838,7 +2838,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace5) { internal_iter2_->Add("x", kTypeValue, "7", 15u, true); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); db_iter_->Prev(); ASSERT_TRUE(db_iter_->Valid()); @@ -2861,7 +2861,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace5) { ASSERT_EQ(db_iter_->key().ToString(), "a"); ASSERT_EQ(db_iter_->value().ToString(), "4"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace6) { @@ -2877,14 +2877,14 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace6) { // Test call back inserts an entry for update a key before "z" in // mem table after MergeIterator::Prev() calls mem table iterator's // Seek() and before calling Prev() - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "MergeIterator::Prev:BeforePrev", [&](void* arg) { IteratorWrapper* it = reinterpret_cast(arg); if (it->key().starts_with("z")) { internal_iter2_->Add("x", kTypeValue, "7", 16u, true); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); db_iter_->Prev(); ASSERT_TRUE(db_iter_->Valid()); @@ -2907,7 +2907,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace6) { ASSERT_EQ(db_iter_->key().ToString(), "a"); ASSERT_EQ(db_iter_->value().ToString(), "4"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace7) { @@ -2926,7 +2926,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace7) { // Test call back inserts entries for update a key before "z" in // mem table after MergeIterator::Prev() calls mem table iterator's // Seek() and before calling Prev() - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "MergeIterator::Prev:BeforePrev", [&](void* arg) { IteratorWrapper* it = reinterpret_cast(arg); if (it->key().starts_with("z")) { @@ -2938,7 +2938,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace7) { internal_iter2_->Add("x", kTypeValue, "7", 11u, true); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); db_iter_->Prev(); ASSERT_TRUE(db_iter_->Valid()); @@ -2961,7 +2961,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace7) { ASSERT_EQ(db_iter_->key().ToString(), "a"); ASSERT_EQ(db_iter_->value().ToString(), "4"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace8) { @@ -2979,7 +2979,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace8) { // Test call back inserts two keys before "z" in mem table after // MergeIterator::Prev() calls mem table iterator's Seek() and // before calling Prev() - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "MergeIterator::Prev:BeforePrev", [&](void* arg) { IteratorWrapper* it = reinterpret_cast(arg); if (it->key().starts_with("z")) { @@ -2987,7 +2987,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace8) { internal_iter2_->Add("y", kTypeValue, "7", 17u, true); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); db_iter_->Prev(); ASSERT_TRUE(db_iter_->Valid()); @@ -2998,7 +2998,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace8) { ASSERT_EQ(db_iter_->key().ToString(), "d"); ASSERT_EQ(db_iter_->value().ToString(), "7"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } @@ -3167,7 +3167,7 @@ TEST_F(DBIteratorTest, ReverseToForwardWithDisappearingKeys) { EXPECT_LT(internal_iter->steps(), 20); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/db_iterator_test.cc b/db/db_iterator_test.cc index debb48eda3..99ffb5ce40 100644 --- a/db/db_iterator_test.cc +++ b/db/db_iterator_test.cc @@ -18,7 +18,7 @@ #include "rocksdb/perf_context.h" #include "table/block_based/flush_block_policy.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A dumb ReadCallback which saying every key is committed. class DummyReadCallback : public ReadCallback { @@ -109,7 +109,7 @@ TEST_P(DBIteratorTest, NonBlockingIteration) { do { ReadOptions non_blocking_opts, regular_opts; Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); non_blocking_opts.read_tier = kBlockCacheTier; CreateAndReopenWithCF({"pikachu"}, options); // write one kv to the database. @@ -535,7 +535,7 @@ TEST_P(DBIteratorTest, IterReseek) { Options options = CurrentOptions(options_override); options.max_sequential_skip_in_iterations = 3; options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); CreateAndReopenWithCF({"pikachu"}, options); @@ -1026,7 +1026,7 @@ TEST_P(DBIteratorTest, DBIteratorBoundMultiSeek) { Options options = CurrentOptions(); options.env = env_; options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.prefix_extractor = nullptr; DestroyAndReopen(options); ASSERT_OK(Put("a", "0")); @@ -1081,10 +1081,10 @@ TEST_P(DBIteratorTest, DBIteratorBoundOptimizationTest) { for (auto format_version : {2, 3, 4}) { int upper_bound_hits = 0; Options options = CurrentOptions(); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "BlockBasedTableIterator:out_of_bound", [&upper_bound_hits](void*) { upper_bound_hits++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); options.env = env_; options.create_if_missing = true; options.prefix_extractor = nullptr; @@ -1132,7 +1132,7 @@ TEST_P(DBIteratorTest, IndexWithFirstKey) { options.create_if_missing = true; options.prefix_extractor = nullptr; options.merge_operator = MergeOperators::CreateStringAppendOperator(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); Statistics* stats = options.statistics.get(); BlockBasedTableOptions table_options; table_options.index_type = @@ -1223,7 +1223,7 @@ TEST_P(DBIteratorTest, IndexWithFirstKeyGet) { options.create_if_missing = true; options.prefix_extractor = nullptr; options.merge_operator = MergeOperators::CreateStringAppendOperator(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); Statistics* stats = options.statistics.get(); BlockBasedTableOptions table_options; table_options.index_type = @@ -2012,7 +2012,7 @@ TEST_P(DBIteratorTest, IterPrevKeyCrossingBlocksRandomized) { TEST_P(DBIteratorTest, IteratorWithLocalStatistics) { Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); Random rnd(301); @@ -2110,7 +2110,7 @@ TEST_P(DBIteratorTest, ReadAhead) { options.env = env_; options.disable_auto_compactions = true; options.write_buffer_size = 4 << 20; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; table_options.block_size = 1024; table_options.no_block_cache = true; @@ -2188,7 +2188,7 @@ TEST_P(DBIteratorTest, DBIteratorSkipRecentDuplicatesTest) { options.max_sequential_skip_in_iterations = 3; options.prefix_extractor = nullptr; options.write_buffer_size = 1 << 27; // big enough to avoid flush - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); // Insert. @@ -2480,7 +2480,7 @@ TEST_P(DBIteratorTest, UpperBoundWithPrevReseek) { TEST_P(DBIteratorTest, SkipStatistics) { Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); int skip_count = 0; @@ -2989,10 +2989,10 @@ TEST_F(DBIteratorWithReadCallbackTest, ReadCallback) { delete iter; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_log_iter_test.cc b/db/db_log_iter_test.cc index 45642bc7ae..1f9ff0d456 100644 --- a/db/db_log_iter_test.cc +++ b/db/db_log_iter_test.cc @@ -15,7 +15,7 @@ #include "db/db_test_util.h" #include "port/stack_trace.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBTestXactLogIterator : public DBTestBase { public: @@ -98,14 +98,14 @@ TEST_F(DBTestXactLogIterator, TransactionLogIteratorRace) { for (int test = 0; test < LOG_ITERATOR_RACE_TEST_COUNT; ++test) { // Setup sync point dependency to reproduce the race condition of // a log file moved to archived dir, in the middle of GetSortedWalFiles - rocksdb::SyncPoint::GetInstance()->LoadDependency( - { { sync_points[test][0], sync_points[test][1] }, - { sync_points[test][2], sync_points[test][3] }, - }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ + {sync_points[test][0], sync_points[test][1]}, + {sync_points[test][2], sync_points[test][3]}, + }); do { - rocksdb::SyncPoint::GetInstance()->ClearTrace(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); Options options = OptionsForLogIterTest(); DestroyAndReopen(options); Put("key1", DummyString(1024)); @@ -123,7 +123,7 @@ TEST_F(DBTestXactLogIterator, TransactionLogIteratorRace) { ExpectRecords(4, iter); } - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // trigger async flush, and log move. Well, log move will // wait until the GetSortedWalFiles:1 to reproduce the race // condition @@ -185,7 +185,7 @@ TEST_F(DBTestXactLogIterator, TransactionLogIteratorCorruptedLog) { dbfull()->Flush(FlushOptions()); dbfull()->FlushWAL(false); // Corrupt this log to create a gap - rocksdb::VectorLogPtr wal_files; + ROCKSDB_NAMESPACE::VectorLogPtr wal_files; ASSERT_OK(dbfull()->GetSortedWalFiles(wal_files)); const auto logfile_path = dbname_ + "/" + wal_files.front()->PathName(); if (mem_env_) { @@ -277,13 +277,13 @@ TEST_F(DBTestXactLogIterator, TransactionLogIteratorBlobs) { "Delete(0, key2)", handler.seen); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !defined(ROCKSDB_LITE) int main(int argc, char** argv) { #if !defined(ROCKSDB_LITE) - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); #else diff --git a/db/db_memtable_test.cc b/db/db_memtable_test.cc index d9ad649e73..a2f4e327c9 100644 --- a/db/db_memtable_test.cc +++ b/db/db_memtable_test.cc @@ -13,7 +13,7 @@ #include "rocksdb/memtablerep.h" #include "rocksdb/slice_transform.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBMemTableTest : public DBTestBase { public: @@ -232,8 +232,8 @@ TEST_F(DBMemTableTest, ConcurrentMergeWrite) { value.clear(); // Write Merge concurrently - rocksdb::port::Thread write_thread1([&]() { - MemTablePostProcessInfo post_process_info1; + ROCKSDB_NAMESPACE::port::Thread write_thread1([&]() { + MemTablePostProcessInfo post_process_info1; std::string v1; for (int seq = 1; seq < num_ops / 2; seq++) { PutFixed64(&v1, seq); @@ -243,8 +243,8 @@ TEST_F(DBMemTableTest, ConcurrentMergeWrite) { v1.clear(); } }); - rocksdb::port::Thread write_thread2([&]() { - MemTablePostProcessInfo post_process_info2; + ROCKSDB_NAMESPACE::port::Thread write_thread2([&]() { + MemTablePostProcessInfo post_process_info2; std::string v2; for (int seq = num_ops / 2; seq < num_ops; seq++) { PutFixed64(&v2, seq); @@ -331,10 +331,10 @@ TEST_F(DBMemTableTest, ColumnFamilyId) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_merge_operand_test.cc b/db/db_merge_operand_test.cc index e6280ad8c7..a0ab34e01c 100644 --- a/db/db_merge_operand_test.cc +++ b/db/db_merge_operand_test.cc @@ -17,7 +17,7 @@ #include "utilities/merge_operators/sortlist.h" #include "utilities/merge_operators/string_append/stringappend2.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBMergeOperandTest : public DBTestBase { public: @@ -231,10 +231,10 @@ TEST_F(DBMergeOperandTest, GetMergeOperandsBasic) { ASSERT_EQ(values[2], "am"); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_merge_operator_test.cc b/db/db_merge_operator_test.cc index 8358ddb56c..4f762468d6 100644 --- a/db/db_merge_operator_test.cc +++ b/db/db_merge_operator_test.cc @@ -12,7 +12,7 @@ #include "utilities/merge_operators.h" #include "utilities/merge_operators/string_append/stringappend2.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TestReadCallback : public ReadCallback { public: @@ -418,8 +418,8 @@ TEST_P(MergeOperatorPinningTest, TailingIterator) { delete iter; }; - rocksdb::port::Thread writer_thread(writer_func); - rocksdb::port::Thread reader_thread(reader_func); + ROCKSDB_NAMESPACE::port::Thread writer_thread(writer_func); + ROCKSDB_NAMESPACE::port::Thread reader_thread(reader_func); writer_thread.join(); reader_thread.join(); @@ -456,19 +456,19 @@ TEST_F(DBMergeOperatorTest, TailingIteratorMemtableUnrefedBySomeoneElse) { bool pushed_first_operand = false; bool stepped_to_next_operand = false; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBIter::MergeValuesNewToOld:PushedFirstOperand", [&](void*) { EXPECT_FALSE(pushed_first_operand); pushed_first_operand = true; db_->Flush(FlushOptions()); // Switch to SuperVersion B }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBIter::MergeValuesNewToOld:SteppedToNextOperand", [&](void*) { EXPECT_FALSE(stepped_to_next_operand); stepped_to_next_operand = true; someone_else.reset(); // Unpin SuperVersion A }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ReadOptions ro; ro.tailing = true; @@ -657,10 +657,10 @@ TEST_P(PerConfigMergeOperatorPinningTest, Randomized) { VerifyDBFromMap(true_data); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_options_test.cc b/db/db_options_test.cc index 0b4e2240f8..383f66cbf6 100644 --- a/db/db_options_test.cc +++ b/db/db_options_test.cc @@ -23,7 +23,7 @@ #include "test_util/testutil.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBOptionsTest : public DBTestBase { public: @@ -134,19 +134,17 @@ TEST_F(DBOptionsTest, SetBytesPerSync) { int i = 0; const std::string kValue(kValueSize, 'v'); ASSERT_EQ(options.bytes_per_sync, dbfull()->GetDBOptions().bytes_per_sync); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "WritableFileWriter::RangeSync:0", [&](void* /*arg*/) { - counter++; - }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "WritableFileWriter::RangeSync:0", [&](void* /*arg*/) { counter++; }); WriteOptions write_opts; // should sync approximately 40MB/1MB ~= 40 times. for (i = 0; i < 40; i++) { Put(Key(i), kValue, write_opts); } - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(dbfull()->CompactRange(CompactRangeOptions(), nullptr, nullptr)); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); low_bytes_per_sync = counter; ASSERT_GT(low_bytes_per_sync, 35); ASSERT_LT(low_bytes_per_sync, 45); @@ -160,7 +158,7 @@ TEST_F(DBOptionsTest, SetBytesPerSync) { for (i = 0; i < 40; i++) { Put(Key(i), kValue, write_opts); } - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(dbfull()->CompactRange(CompactRangeOptions(), nullptr, nullptr)); ASSERT_GT(counter, 5); ASSERT_LT(counter, 15); @@ -183,11 +181,9 @@ TEST_F(DBOptionsTest, SetWalBytesPerSync) { ASSERT_EQ(512, dbfull()->GetDBOptions().wal_bytes_per_sync); int counter = 0; int low_bytes_per_sync = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "WritableFileWriter::RangeSync:0", [&](void* /*arg*/) { - counter++; - }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "WritableFileWriter::RangeSync:0", [&](void* /*arg*/) { counter++; }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); const std::string kValue(kValueSize, 'v'); int i = 0; for (; i < 10; i++) { @@ -223,7 +219,7 @@ TEST_F(DBOptionsTest, WritableFileMaxBufferSize) { std::atomic match_cnt(0); std::atomic unmatch_cnt(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WritableFileWriter::WritableFileWriter:0", [&](void* arg) { int value = static_cast(reinterpret_cast(arg)); if (value == buffer_size) { @@ -232,7 +228,7 @@ TEST_F(DBOptionsTest, WritableFileMaxBufferSize) { unmatch_cnt++; } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); int i = 0; for (; i < 3; i++) { ASSERT_OK(Put("foo", ToString(i))); @@ -865,10 +861,10 @@ TEST_F(DBOptionsTest, FIFOTtlBackwardCompatible) { #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_properties_test.cc b/db/db_properties_test.cc index 57206f6edb..50dc3efef8 100644 --- a/db/db_properties_test.cc +++ b/db/db_properties_test.cc @@ -22,7 +22,7 @@ #include "util/random.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBPropertiesTest : public DBTestBase { public: @@ -391,16 +391,16 @@ TEST_F(DBPropertiesTest, ReadLatencyHistogramByLevel) { options.max_bytes_for_level_base = 4500 << 10; options.target_file_size_base = 98 << 10; options.max_write_buffer_number = 2; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.max_open_files = 11; // Make sure no proloading of table readers // RocksDB sanitize max open files to at least 20. Modify it back. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SanitizeOptions::AfterChangeMaxOpenFiles", [&](void* arg) { int* max_open_files = static_cast(arg); *max_open_files = 11; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); BlockBasedTableOptions table_options; table_options.no_block_cache = true; @@ -448,7 +448,7 @@ TEST_F(DBPropertiesTest, ReadLatencyHistogramByLevel) { // Reopen and issue iterating. See thee latency tracked ReopenWithColumnFamilies({"default", "pikachu"}, options); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_TRUE(dbfull()->GetProperty("rocksdb.cf-file-histogram", &prop)); ASSERT_EQ(std::string::npos, prop.find("** Level 0 read latency histogram")); ASSERT_EQ(std::string::npos, prop.find("** Level 1 read latency histogram")); @@ -1702,10 +1702,10 @@ TEST_F(DBPropertiesTest, BlockCacheProperties) { } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_range_del_test.cc b/db/db_range_del_test.cc index 93a16a9cf2..15225875d6 100644 --- a/db/db_range_del_test.cc +++ b/db/db_range_del_test.cc @@ -9,7 +9,7 @@ #include "test_util/testutil.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBRangeDelTest : public DBTestBase { public: @@ -925,7 +925,8 @@ TEST_F(DBRangeDelTest, MemtableBloomFilter) { Options options = CurrentOptions(); options.memtable_prefix_bloom_size_ratio = static_cast(kMemtablePrefixFilterSize) / kMemtableSize; - options.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform(kPrefixLen)); + options.prefix_extractor.reset( + ROCKSDB_NAMESPACE::NewFixedPrefixTransform(kPrefixLen)); options.write_buffer_size = kMemtableSize; Reopen(options); @@ -1078,7 +1079,7 @@ TEST_F(DBRangeDelTest, RangeTombstoneEndKeyAsSstableUpperBound) { // endpoint (key000002#6,1) to disappear. ASSERT_EQ(value, Get(Key(2))); auto begin_str = Key(3); - const rocksdb::Slice begin = begin_str; + const ROCKSDB_NAMESPACE::Slice begin = begin_str; dbfull()->TEST_CompactRange(1, &begin, nullptr); ASSERT_EQ(1, NumTableFilesAtLevel(1)); ASSERT_EQ(2, NumTableFilesAtLevel(2)); @@ -1097,7 +1098,7 @@ TEST_F(DBRangeDelTest, RangeTombstoneEndKeyAsSstableUpperBound) { // [key000001#5,1, key000002#72057594037927935,15] // [key000002#6,1, key000004#72057594037927935,15] auto begin_str = Key(0); - const rocksdb::Slice begin = begin_str; + const ROCKSDB_NAMESPACE::Slice begin = begin_str; dbfull()->TEST_CompactRange(1, &begin, &begin); ASSERT_EQ(0, NumTableFilesAtLevel(1)); ASSERT_EQ(3, NumTableFilesAtLevel(2)); @@ -1650,10 +1651,10 @@ TEST_F(DBRangeDelTest, OverlappedKeys) { #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_sst_test.cc b/db/db_sst_test.cc index 589a5915b9..e0ecfb6410 100644 --- a/db/db_sst_test.cc +++ b/db/db_sst_test.cc @@ -13,7 +13,7 @@ #include "port/stack_trace.h" #include "rocksdb/sst_file_manager.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBSSTTest : public DBTestBase { public: @@ -283,13 +283,14 @@ TEST_F(DBSSTTest, DBWithSstFileManager) { int files_added = 0; int files_deleted = 0; int files_moved = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SstFileManagerImpl::OnAddFile", [&](void* /*arg*/) { files_added++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "SstFileManagerImpl::OnDeleteFile", [&](void* /*arg*/) { files_deleted++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "SstFileManagerImpl::OnDeleteFile", + [&](void* /*arg*/) { files_deleted++; }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SstFileManagerImpl::OnMoveFile", [&](void* /*arg*/) { files_moved++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.sst_file_manager = sst_file_manager; @@ -337,21 +338,21 @@ TEST_F(DBSSTTest, DBWithSstFileManager) { ASSERT_EQ(sfm->GetTrackedFiles(), files_in_db); ASSERT_EQ(sfm->GetTotalSize(), total_files_size); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBSSTTest, RateLimitedDelete) { Destroy(last_options_); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DBSSTTest::RateLimitedDelete:1", "DeleteScheduler::BackgroundEmptyTrash"}, }); std::vector penalties; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::BackgroundEmptyTrash:Wait", [&](void* arg) { penalties.push_back(*(static_cast(arg))); }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "InstrumentedCondVar::TimedWaitInternal", [&](void* arg) { // Turn timed wait into a simulated sleep uint64_t* abs_time_us = static_cast(arg); @@ -372,7 +373,7 @@ TEST_F(DBSSTTest, RateLimitedDelete) { *abs_time_us = static_cast(real_cur_time); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); env_->no_slowdown_ = true; env_->time_elapse_only_sleep_ = true; @@ -437,14 +438,14 @@ TEST_F(DBSSTTest, RateLimitedDelete) { ASSERT_GT(time_spent_deleting, expected_penlty * 0.9); ASSERT_LT(time_spent_deleting, expected_penlty * 1.1); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBSSTTest, RateLimitedWALDelete) { Destroy(last_options_); std::vector penalties; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::BackgroundEmptyTrash:Wait", [&](void* arg) { penalties.push_back(*(static_cast(arg))); }); @@ -465,7 +466,7 @@ TEST_F(DBSSTTest, RateLimitedWALDelete) { sfm->delete_scheduler()->SetMaxTrashDBRatio(3.1); ASSERT_OK(TryReopen(options)); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Create 4 files in L0 for (char v = 'a'; v <= 'd'; v++) { @@ -489,7 +490,7 @@ TEST_F(DBSSTTest, RateLimitedWALDelete) { sfm->WaitForEmptyTrash(); ASSERT_EQ(penalties.size(), 8); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } class DBWALTestWithParam @@ -627,14 +628,13 @@ TEST_F(DBSSTTest, OpenDBWithExistingTrash) { // files in the second path were not. TEST_F(DBSSTTest, DeleteSchedulerMultipleDBPaths) { std::atomic bg_delete_file(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", [&](void* /*arg*/) { bg_delete_file++; }); // The deletion scheduler sometimes skips marking file as trash according to // a heuristic. In that case the deletion will go through the below SyncPoint. - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DeleteScheduler::DeleteFile", - [&](void* /*arg*/) { bg_delete_file++; }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "DeleteScheduler::DeleteFile", [&](void* /*arg*/) { bg_delete_file++; }); Options options = CurrentOptions(); options.disable_auto_compactions = true; @@ -652,7 +652,7 @@ TEST_F(DBSSTTest, DeleteSchedulerMultipleDBPaths) { auto sfm = static_cast(options.sst_file_manager.get()); DestroyAndReopen(options); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); WriteOptions wo; wo.disableWAL = true; @@ -700,15 +700,15 @@ TEST_F(DBSSTTest, DeleteSchedulerMultipleDBPaths) { sfm->WaitForEmptyTrash(); ASSERT_EQ(bg_delete_file, 10); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBSSTTest, DestroyDBWithRateLimitedDelete) { int bg_delete_file = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", [&](void* /*arg*/) { bg_delete_file++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Status s; Options options = CurrentOptions(); @@ -793,15 +793,15 @@ TEST_F(DBSSTTest, CancellingCompactionsWorks) { DestroyAndReopen(options); int completed_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction():CancelledCompaction", [&](void* /*arg*/) { sfm->SetMaxAllowedSpaceUsage(0); ASSERT_EQ(sfm->GetCompactionsReservedSize(), 0); }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { completed_compactions++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); @@ -828,7 +828,7 @@ TEST_F(DBSSTTest, CancellingCompactionsWorks) { ASSERT_EQ(sfm->GetCompactionsReservedSize(), 0); // Make sure the stat is bumped ASSERT_GT(dbfull()->immutable_db_options().statistics.get()->getTickerCount(COMPACTION_CANCELLED), 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBSSTTest, CancellingManualCompactionsWorks) { @@ -876,7 +876,7 @@ TEST_F(DBSSTTest, CancellingManualCompactionsWorks) { // Now make sure CompactFiles also gets cancelled auto l0_files = collector->GetFlushedFiles(); - dbfull()->CompactFiles(rocksdb::CompactionOptions(), l0_files, 0); + dbfull()->CompactFiles(ROCKSDB_NAMESPACE::CompactionOptions(), l0_files, 0); // Wait for manual compaction to get scheduled and finish dbfull()->TEST_WaitForCompact(true); @@ -890,17 +890,17 @@ TEST_F(DBSSTTest, CancellingManualCompactionsWorks) { // returns to normal sfm->SetMaxAllowedSpaceUsage(0); int completed_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactFilesImpl:End", [&](void* /*arg*/) { completed_compactions++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - dbfull()->CompactFiles(rocksdb::CompactionOptions(), l0_files, 0); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + dbfull()->CompactFiles(ROCKSDB_NAMESPACE::CompactionOptions(), l0_files, 0); dbfull()->TEST_WaitForCompact(true); ASSERT_EQ(sfm->GetCompactionsReservedSize(), 0); ASSERT_GT(completed_compactions, 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBSSTTest, DBWithMaxSpaceAllowedRandomized) { @@ -914,7 +914,7 @@ TEST_F(DBSSTTest, DBWithMaxSpaceAllowedRandomized) { std::atomic reached_max_space_on_flush(0); std::atomic reached_max_space_on_compaction(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::FlushMemTableToOutputFile:MaxAllowedSpaceReached", [&](void* arg) { Status* bg_error = static_cast(arg); @@ -924,13 +924,13 @@ TEST_F(DBSSTTest, DBWithMaxSpaceAllowedRandomized) { *bg_error = Status::OK(); }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction():CancelledCompaction", [&](void* arg) { bool* enough_room = static_cast(arg); *enough_room = true; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::FinishCompactionOutputFile:MaxAllowedSpaceReached", [&](void* /*arg*/) { bg_error_set = true; @@ -939,8 +939,8 @@ TEST_F(DBSSTTest, DBWithMaxSpaceAllowedRandomized) { for (auto limit_mb : max_space_limits_mbs) { bg_error_set = false; - rocksdb::SyncPoint::GetInstance()->ClearTrace(); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); std::shared_ptr sst_file_manager(NewSstFileManager(env_)); auto sfm = static_cast(sst_file_manager.get()); @@ -964,7 +964,7 @@ TEST_F(DBSSTTest, DBWithMaxSpaceAllowedRandomized) { uint64_t total_sst_files_size = 0; GetAllSSTFiles(&total_sst_files_size); ASSERT_GE(total_sst_files_size, limit_mb * 1024 * 1024); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } ASSERT_GT(reached_max_space_on_flush, 0); @@ -1218,10 +1218,10 @@ TEST_F(DBSSTTest, GetTotalSstFilesSizeVersionsFilesShared) { #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_statistics_test.cc b/db/db_statistics_test.cc index 31396a7bf4..8fbbb96d5e 100644 --- a/db/db_statistics_test.cc +++ b/db/db_statistics_test.cc @@ -10,7 +10,7 @@ #include "port/stack_trace.h" #include "rocksdb/statistics.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBStatisticsTest : public DBTestBase { public: @@ -45,7 +45,7 @@ TEST_F(DBStatisticsTest, CompressionStatsTest) { Options options = CurrentOptions(); options.compression = type; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.statistics->set_stats_level(StatsLevel::kExceptTimeForMutex); DestroyAndReopen(options); @@ -91,7 +91,7 @@ TEST_F(DBStatisticsTest, CompressionStatsTest) { TEST_F(DBStatisticsTest, MutexWaitStatsDisabledByDefault) { Options options = CurrentOptions(); options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); CreateAndReopenWithCF({"pikachu"}, options); const uint64_t kMutexWaitDelay = 100; ThreadStatusUtil::TEST_SetStateDelay(ThreadStatus::STATE_MUTEX_WAIT, @@ -104,7 +104,7 @@ TEST_F(DBStatisticsTest, MutexWaitStatsDisabledByDefault) { TEST_F(DBStatisticsTest, MutexWaitStats) { Options options = CurrentOptions(); options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.statistics->set_stats_level(StatsLevel::kAll); CreateAndReopenWithCF({"pikachu"}, options); const uint64_t kMutexWaitDelay = 100; @@ -118,7 +118,7 @@ TEST_F(DBStatisticsTest, MutexWaitStats) { TEST_F(DBStatisticsTest, ResetStats) { Options options = CurrentOptions(); options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); for (int i = 0; i < 2; ++i) { // pick arbitrary ticker and histogram. On first iteration they're zero @@ -140,10 +140,10 @@ TEST_F(DBStatisticsTest, ResetStats) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_table_properties_test.cc b/db/db_table_properties_test.cc index 164042bc27..e3499df70a 100644 --- a/db/db_table_properties_test.cc +++ b/db/db_table_properties_test.cc @@ -19,7 +19,7 @@ #ifndef ROCKSDB_LITE -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A helper function that ensures the table properties returned in // `GetPropertiesOfAllTablesTest` is correct. @@ -325,12 +325,12 @@ TEST_F(DBTablePropertiesTest, DeletionTriggeredCompactionMarking) { } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_tailing_iter_test.cc b/db/db_tailing_iter_test.cc index 62e60758fd..39988638be 100644 --- a/db/db_tailing_iter_test.cc +++ b/db/db_tailing_iter_test.cc @@ -16,7 +16,7 @@ #include "db/forward_iterator.h" #include "port/stack_trace.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBTestTailingIterator : public DBTestBase { public: @@ -98,8 +98,8 @@ TEST_F(DBTestTailingIterator, TailingIteratorSeekToNext) { ASSERT_TRUE(itern->Valid()); ASSERT_EQ(itern->key().compare(key), 0); } - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); for (int i = 2 * num_records; i > 0; --i) { char buf1[32]; char buf2[32]; @@ -143,25 +143,25 @@ TEST_F(DBTestTailingIterator, TailingIteratorTrimSeekToNext) { bool file_iters_deleted = false; bool file_iters_renewed_null = false; bool file_iters_renewed_copy = false; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "ForwardIterator::SeekInternal:Return", [&](void* arg) { ForwardIterator* fiter = reinterpret_cast(arg); ASSERT_TRUE(!file_iters_deleted || fiter->TEST_CheckDeletedIters(&deleted_iters, &num_iters)); }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "ForwardIterator::Next:Return", [&](void* arg) { ForwardIterator* fiter = reinterpret_cast(arg); ASSERT_TRUE(!file_iters_deleted || fiter->TEST_CheckDeletedIters(&deleted_iters, &num_iters)); }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "ForwardIterator::RenewIterators:Null", [&](void* /*arg*/) { file_iters_renewed_null = true; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "ForwardIterator::RenewIterators:Copy", [&](void* /*arg*/) { file_iters_renewed_copy = true; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); const int num_records = 1000; for (int i = 1; i < num_records; ++i) { char buf1[32]; @@ -413,14 +413,14 @@ TEST_F(DBTestTailingIterator, TailingIteratorUpperBound) { // This keeps track of the number of times NeedToSeekImmutable() was true. int immutable_seeks = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "ForwardIterator::SeekInternal:Immutable", [&](void* /*arg*/) { ++immutable_seeks; }); // Seek to 13. This should not require any immutable seeks. - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); it->Seek("13"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_FALSE(it->Valid()); ASSERT_EQ(0, immutable_seeks); @@ -530,13 +530,13 @@ TEST_F(DBTestTailingIterator, SeekToFirstWithUpperBoundBug) { ASSERT_EQ(iter->key().ToString(), "aa"); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !defined(ROCKSDB_LITE) int main(int argc, char** argv) { #if !defined(ROCKSDB_LITE) - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); #else diff --git a/db/db_test.cc b/db/db_test.cc index b3234c7662..60b4d60f41 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -68,7 +68,7 @@ #include "util/string_util.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBTest : public DBTestBase { public: @@ -232,14 +232,14 @@ TEST_F(DBTest, SkipDelay) { // the test flaky auto token = dbfull()->TEST_write_controler().GetDelayToken(1); std::atomic sleep_count(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::DelayWrite:Sleep", [&](void* /*arg*/) { sleep_count.fetch_add(1); }); std::atomic wait_count(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::DelayWrite:Wait", [&](void* /*arg*/) { wait_count.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); WriteOptions wo; wo.sync = sync; @@ -290,9 +290,8 @@ TEST_F(DBTest, MixedSlowdownOptions) { // the test flaky auto token = dbfull()->TEST_write_controler().GetDelayToken(1); std::atomic sleep_count(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::DelayWrite:BeginWriteStallDone", - [&](void* /*arg*/) { + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "DBImpl::DelayWrite:BeginWriteStallDone", [&](void* /*arg*/) { sleep_count.fetch_add(1); if (threads.empty()) { for (int i = 0; i < 2; ++i) { @@ -303,7 +302,7 @@ TEST_F(DBTest, MixedSlowdownOptions) { } } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); WriteOptions wo; wo.sync = false; @@ -345,9 +344,8 @@ TEST_F(DBTest, MixedSlowdownOptionsInQueue) { // the test flaky auto token = dbfull()->TEST_write_controler().GetDelayToken(1); std::atomic sleep_count(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::DelayWrite:Sleep", - [&](void* /*arg*/) { + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "DBImpl::DelayWrite:Sleep", [&](void* /*arg*/) { sleep_count.fetch_add(1); if (threads.empty()) { for (int i = 0; i < 2; ++i) { @@ -359,10 +357,10 @@ TEST_F(DBTest, MixedSlowdownOptionsInQueue) { } }); std::atomic wait_count(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::DelayWrite:Wait", [&](void* /*arg*/) { wait_count.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); WriteOptions wo; wo.sync = false; @@ -414,9 +412,8 @@ TEST_F(DBTest, MixedSlowdownOptionsStop) { // the test flaky auto token = dbfull()->TEST_write_controler().GetStopToken(); std::atomic wait_count(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::DelayWrite:Wait", - [&](void* /*arg*/) { + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "DBImpl::DelayWrite:Wait", [&](void* /*arg*/) { wait_count.fetch_add(1); if (threads.empty()) { for (int i = 0; i < 2; ++i) { @@ -432,7 +429,7 @@ TEST_F(DBTest, MixedSlowdownOptionsStop) { token.reset(); threads.emplace_back(wakeup_writer); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); WriteOptions wo; wo.sync = false; @@ -2592,15 +2589,15 @@ TEST_F(DBTest, GroupCommitTest) { do { Options options = CurrentOptions(); options.env = env_; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); Reopen(options); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"WriteThread::JoinBatchGroup:BeganWaiting", "DBImpl::WriteImpl:BeforeLeaderEnters"}, - {"WriteThread::AwaitState:BlockingWaiting", + {"WriteThread::AwaitState:BlockingWaiting", "WriteThread::EnterAsBatchGroupLeader:End"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Start threads GCThread thread[kGCNumThreads]; @@ -2919,13 +2916,13 @@ class ModelDB : public DB { DBOptions GetDBOptions() const override { return options_; } using DB::Flush; - Status Flush(const rocksdb::FlushOptions& /*options*/, + Status Flush(const ROCKSDB_NAMESPACE::FlushOptions& /*options*/, ColumnFamilyHandle* /*column_family*/) override { Status ret; return ret; } Status Flush( - const rocksdb::FlushOptions& /*options*/, + const ROCKSDB_NAMESPACE::FlushOptions& /*options*/, const std::vector& /*column_families*/) override { return Status::OK(); } @@ -2958,8 +2955,8 @@ class ModelDB : public DB { Status DeleteFile(std::string /*name*/) override { return Status::OK(); } Status GetUpdatesSince( - rocksdb::SequenceNumber, - std::unique_ptr*, + ROCKSDB_NAMESPACE::SequenceNumber, + std::unique_ptr*, const TransactionLogIterator::ReadOptions& /*read_options*/ = TransactionLogIterator::ReadOptions()) override { return Status::NotSupported("Not supported in Model DB"); @@ -3219,12 +3216,12 @@ TEST_F(DBTest, BlockBasedTablePrefixIndexTotalOrderSeek) { options.prefix_extractor.reset(NewFixedPrefixTransform(1)); // RocksDB sanitize max open files to at least 20. Modify it back. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SanitizeOptions::AfterChangeMaxOpenFiles", [&](void* arg) { int* max_open_files = static_cast(arg); *max_open_files = 11; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Reopen(options); ASSERT_OK(Put("k1", "v1")); @@ -3257,7 +3254,7 @@ TEST_F(DBTest, BlockBasedTablePrefixIndexTotalOrderSeek) { ASSERT_TRUE(iter->Valid()); ASSERT_EQ("k1", iter->key().ToString()); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBTest, ChecksumTest) { @@ -3681,7 +3678,7 @@ TEST_F(DBTest, DISABLED_RateLimitingTest) { options.compression = kNoCompression; options.create_if_missing = true; options.env = env_; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.IncreaseParallelism(4); DestroyAndReopen(options); @@ -4007,10 +4004,10 @@ TEST_F(DBTest, DynamicMemtableOptions) { int count = 0; Random rnd(301); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::DelayWrite:Wait", [&](void* /*arg*/) { sleeping_task_low.WakeUp(); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); while (!sleeping_task_low.WokenUp() && count < 256) { ASSERT_OK(Put(Key(count), RandomString(&rnd, 1024), WriteOptions())); @@ -4068,7 +4065,7 @@ TEST_F(DBTest, DynamicMemtableOptions) { #endif sleeping_task_low.WaitUntilDone(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } #endif // ROCKSDB_LITE @@ -4177,11 +4174,11 @@ TEST_F(DBTest, ThreadStatusFlush) { options.enable_thread_tracking = true; options = CurrentOptions(options); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"FlushJob::FlushJob()", "DBTest::ThreadStatusFlush:1"}, {"DBTest::ThreadStatusFlush:2", "FlushJob::WriteLevel0Table"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); CreateAndReopenWithCF({"pikachu"}, options); VerifyOperationCount(env_, ThreadStatus::OP_FLUSH, 0); @@ -4206,7 +4203,7 @@ TEST_F(DBTest, ThreadStatusFlush) { // This second sync point is to ensure the flush job will not // be completed until we already perform VerifyOperationCount(). TEST_SYNC_POINT("DBTest::ThreadStatusFlush:2"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_P(DBTestWithParam, ThreadStatusSingleCompaction) { @@ -4229,15 +4226,15 @@ TEST_P(DBTestWithParam, ThreadStatusSingleCompaction) { options.level0_file_num_compaction_trigger = kNumL0Files; options.max_subcompactions = max_subcompactions_; - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DBTest::ThreadStatusSingleCompaction:0", "DBImpl::BGWorkCompaction"}, {"CompactionJob::Run():Start", "DBTest::ThreadStatusSingleCompaction:1"}, {"DBTest::ThreadStatusSingleCompaction:2", "CompactionJob::Run():End"}, }); for (int tests = 0; tests < 2; ++tests) { DestroyAndReopen(options); - rocksdb::SyncPoint::GetInstance()->ClearTrace(); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); // The Put Phase. @@ -4276,7 +4273,7 @@ TEST_P(DBTestWithParam, ThreadStatusSingleCompaction) { // repeat the test with disabling thread tracking. options.enable_thread_tracking = false; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } @@ -4373,7 +4370,7 @@ TEST_P(DBTestWithParam, PreShutdownMultipleCompaction) { std::vector thread_list; // Delay both flush and compaction - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"FlushJob::FlushJob()", "CompactionJob::Run():Start"}, {"CompactionJob::Run():Start", "DBTest::PreShutdownMultipleCompaction:Preshutdown"}, @@ -4384,7 +4381,7 @@ TEST_P(DBTestWithParam, PreShutdownMultipleCompaction) { {"CompactionJob::Run():End", "DBTest::PreShutdownMultipleCompaction:VerifyPreshutdown"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Make rocksdb busy int key = 0; @@ -4462,7 +4459,7 @@ TEST_P(DBTestWithParam, PreShutdownCompactionMiddle) { std::vector thread_list; // Delay both flush and compaction - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBTest::PreShutdownCompactionMiddle:Preshutdown", "CompactionJob::Run():Inprogress"}, {"CompactionJob::Run():Start", @@ -4471,7 +4468,7 @@ TEST_P(DBTestWithParam, PreShutdownCompactionMiddle) { {"CompactionJob::Run():End", "DBTest::PreShutdownCompactionMiddle:VerifyPreshutdown"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Make rocksdb busy int key = 0; @@ -4648,7 +4645,7 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel2) { std::atomic num_zlib(0); std::atomic num_lz4(0); std::atomic num_no(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); if (compaction->output_level() == 4) { @@ -4656,13 +4653,13 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel2) { num_lz4.fetch_add(1); } }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "FlushJob::WriteLevel0Table:output_compression", [&](void* arg) { auto* compression = reinterpret_cast(arg); ASSERT_TRUE(*compression == kNoCompression); num_no.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); for (int i = 0; i < 100; i++) { std::string value = RandomString(&rnd, 200); @@ -4676,8 +4673,8 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel2) { Flush(); dbfull()->TEST_WaitForFlushMemTable(); dbfull()->TEST_WaitForCompact(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); ASSERT_EQ(NumTableFilesAtLevel(1), 0); ASSERT_EQ(NumTableFilesAtLevel(2), 0); @@ -4690,7 +4687,7 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel2) { // After base level turn L4->L3, L3 becomes LZ4 and L4 becomes Zlib num_lz4.store(0); num_no.store(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); if (compaction->output_level() == 4 && compaction->start_level() == 3) { @@ -4701,13 +4698,13 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel2) { num_lz4.fetch_add(1); } }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "FlushJob::WriteLevel0Table:output_compression", [&](void* arg) { auto* compression = reinterpret_cast(arg); ASSERT_TRUE(*compression == kNoCompression); num_no.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); for (int i = 101; i < 500; i++) { std::string value = RandomString(&rnd, 200); @@ -4718,8 +4715,8 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel2) { } } - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_EQ(NumTableFilesAtLevel(1), 0); ASSERT_EQ(NumTableFilesAtLevel(2), 0); ASSERT_GT(NumTableFilesAtLevel(3), 0); @@ -5135,7 +5132,7 @@ TEST_F(DBTest, DynamicMiscOptions) { options.create_if_missing = true; options.max_sequential_skip_in_iterations = 16; options.compression = kNoCompression; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); auto assert_reseek_count = [this, &options](int key_start, int num_reseek) { @@ -5227,7 +5224,7 @@ TEST_F(DBTest, L0L1L2AndUpHitCounter) { options.max_write_buffer_number = 2; options.max_background_compactions = 8; options.max_background_flushes = 8; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); CreateAndReopenWithCF({"mypikachu"}, options); int numkeys = 20000; @@ -5330,7 +5327,7 @@ TEST_F(DBTest, CloseSpeedup) { env_->DeleteDir(dbname_); DestroyAndReopen(options); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); env_->SetBackgroundThreads(1, Env::LOW); env_->SetBackgroundThreads(1, Env::HIGH); Random rnd(301); @@ -5385,7 +5382,7 @@ TEST_F(DBTest, MergeTestTime) { this->env_->time_elapse_only_sleep_ = true; this->env_->no_slowdown_ = true; Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.merge_operator.reset(new DelayedMergeOperator(this)); DestroyAndReopen(options); @@ -5426,7 +5423,7 @@ TEST_P(DBTestWithParam, MergeCompactionTimeTest) { SetPerfLevel(kEnableTime); Options options = CurrentOptions(); options.compaction_filter_factory = std::make_shared(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.merge_operator.reset(new DelayedMergeOperator(this)); options.compaction_style = kCompactionStyleUniversal; options.max_subcompactions = max_subcompactions_; @@ -5448,7 +5445,7 @@ TEST_P(DBTestWithParam, FilterCompactionTimeTest) { std::make_shared(this); options.disable_auto_compactions = true; options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.statistics->set_stats_level(kExceptTimeForMutex); options.max_subcompactions = max_subcompactions_; DestroyAndReopen(options); @@ -5712,16 +5709,16 @@ TEST_F(DBTest, AutomaticConflictsWithManualCompaction) { // schedule automatic compactions after the manual one starts, but before it // finishes to ensure conflict. - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::BackgroundCompaction:Start", "DBTest::AutomaticConflictsWithManualCompaction:PrePuts"}, {"DBTest::AutomaticConflictsWithManualCompaction:PostPuts", "DBImpl::BackgroundCompaction:NonTrivial:AfterRun"}}); std::atomic callback_count(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::MaybeScheduleFlushOrCompaction:Conflict", [&](void* /*arg*/) { callback_count.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); for (int i = 0; i < 2; ++i) { @@ -5751,7 +5748,7 @@ TEST_F(DBTest, AutomaticConflictsWithManualCompaction) { for (int i = 0; i < 2; ++i) { ASSERT_NE("NOT_FOUND", Get(Key(i))); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); manual_compaction_thread.join(); dbfull()->TEST_WaitForCompact(); } @@ -5775,7 +5772,7 @@ TEST_F(DBTest, CompactFilesShouldTriggerAutoCompaction) { ASSERT_OK(Flush()); } - rocksdb::ColumnFamilyMetaData cf_meta_data; + ROCKSDB_NAMESPACE::ColumnFamilyMetaData cf_meta_data; db_->GetColumnFamilyMetaData(db_->DefaultColumnFamily(), &cf_meta_data); std::vector input_files; @@ -5879,19 +5876,19 @@ TEST_F(DBTest, FlushesInParallelWithCompactRange) { } if (iter == 1) { - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::RunManualCompaction()::1", "DBTest::FlushesInParallelWithCompactRange:1"}, {"DBTest::FlushesInParallelWithCompactRange:2", "DBImpl::RunManualCompaction()::2"}}); } else { - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"CompactionJob::Run():Start", "DBTest::FlushesInParallelWithCompactRange:1"}, {"DBTest::FlushesInParallelWithCompactRange:2", "CompactionJob::Run():End"}}); } - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); std::vector threads; threads.emplace_back([&]() { Compact("a", "z"); }); @@ -5910,7 +5907,7 @@ TEST_F(DBTest, FlushesInParallelWithCompactRange) { for (auto& t : threads) { t.join(); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } @@ -5976,7 +5973,7 @@ TEST_F(DBTest, DelayedWriteRate) { static_cast(estimated_sleep_time * 2)); env_->no_slowdown_ = false; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); sleeping_task_low.WakeUp(); sleeping_task_low.WaitUntilDone(); } @@ -6005,12 +6002,12 @@ TEST_F(DBTest, HardLimit) { CreateAndReopenWithCF({"pikachu"}, options); std::atomic callback_count(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack("DBImpl::DelayWrite:Wait", - [&](void* /*arg*/) { - callback_count.fetch_add(1); - sleeping_task_low.WakeUp(); - }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "DBImpl::DelayWrite:Wait", [&](void* /*arg*/) { + callback_count.fetch_add(1); + sleeping_task_low.WakeUp(); + }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); int key_idx = 0; @@ -6027,7 +6024,7 @@ TEST_F(DBTest, HardLimit) { } ASSERT_GE(callback_count.load(), 1); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); sleeping_task_low.WaitUntilDone(); } @@ -6099,7 +6096,7 @@ TEST_F(DBTest, SoftLimit) { "DBImpl::BackgroundCallFlush:ContextCleanedUp"); }; - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Reopen(options); @@ -6155,7 +6152,7 @@ TEST_F(DBTest, SoftLimit) { ASSERT_TRUE(listener->CheckCondition(WriteStallCondition::kNormal)); // Only allow one compactin going through. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "BackgroundCallCompaction:0", [&](void* /*arg*/) { // Schedule a sleeping task. sleeping_task_low.Reset(); @@ -6229,7 +6226,7 @@ TEST_F(DBTest, SoftLimit) { ASSERT_TRUE(listener->CheckCondition(WriteStallCondition::kDelayed)); sleeping_task_low.WaitUntilSleeping(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); sleeping_task_low.WakeUp(); sleeping_task_low.WaitUntilDone(); } @@ -6307,7 +6304,7 @@ TEST_F(DBTest, CreateColumnFamilyShouldFailOnIncompatibleOptions) { #ifndef ROCKSDB_LITE TEST_F(DBTest, RowCache) { Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.row_cache = NewLRUCache(8192); DestroyAndReopen(options); @@ -6326,7 +6323,7 @@ TEST_F(DBTest, RowCache) { TEST_F(DBTest, PinnableSliceAndRowCache) { Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.row_cache = NewLRUCache(8192); DestroyAndReopen(options); @@ -6356,12 +6353,12 @@ TEST_F(DBTest, PinnableSliceAndRowCache) { #endif // ROCKSDB_LITE TEST_F(DBTest, DeletingOldWalAfterDrop) { - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"Test:AllowFlushes", "DBImpl::BGWorkFlush"}, {"DBImpl::BGWorkFlush:done", "Test:WaitForFlush"}}); - rocksdb::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); Options options = CurrentOptions(); options.max_total_wal_size = 8192; options.compression = kNoCompression; @@ -6371,7 +6368,7 @@ TEST_F(DBTest, DeletingOldWalAfterDrop) { options.level0_stop_writes_trigger = (1 << 30); options.disable_auto_compactions = true; DestroyAndReopen(options); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); CreateColumnFamilies({"cf1", "cf2"}, options); ASSERT_OK(Put(0, "key1", DummyString(8192))); @@ -6509,7 +6506,7 @@ TEST_F(DBTest, CreationTimeOfOldestFile) { env_->GetCurrentTime(&time_2); const uint64_t uint_time_2 = static_cast(time_2); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "PropertyBlockBuilder::AddTableProperty:Start", [&](void* arg) { TableProperties* props = reinterpret_cast(arg); if (set_file_creation_time_to_zero) { @@ -6530,12 +6527,12 @@ TEST_F(DBTest, CreationTimeOfOldestFile) { } }); // Set file creation time in manifest all to 0. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "FileMetaData::FileMetaData", [&](void* arg) { FileMetaData* meta = static_cast(arg); meta->file_creation_time = 0; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); for (int i = 0; i < kNumLevelFiles; ++i) { @@ -6585,12 +6582,12 @@ TEST_F(DBTest, CreationTimeOfOldestFile) { Status s3 = dbfull()->GetCreationTimeOfOldestFile(&ctime); ASSERT_EQ(s3, Status::NotSupported()); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } #endif -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS extern "C" { @@ -6601,7 +6598,7 @@ void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {} #endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/db/db_test2.cc b/db/db_test2.cc index f59b341de0..f4e8e960a4 100644 --- a/db/db_test2.cc +++ b/db/db_test2.cc @@ -18,7 +18,7 @@ #include "rocksdb/wal_filter.h" #include "test_util/fault_injection_test_env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBTest2 : public DBTestBase { public: @@ -40,7 +40,7 @@ TEST_P(PrefixFullBloomWithReverseComparator, Options options = last_options_; options.comparator = ReverseBytewiseComparator(); options.prefix_extractor.reset(NewCappedPrefixTransform(3)); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions bbto; if (if_cache_filter_) { bbto.no_block_cache = false; @@ -132,7 +132,7 @@ TEST_F(DBTest2, IteratorPropertyVersionNumber) { TEST_F(DBTest2, CacheIndexAndFilterWithDBRestart) { Options options = CurrentOptions(); options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; table_options.cache_index_and_filter_blocks = true; table_options.filter_policy.reset(NewBloomFilterPolicy(20)); @@ -151,7 +151,7 @@ TEST_F(DBTest2, CacheIndexAndFilterWithDBRestart) { TEST_F(DBTest2, MaxSuccessiveMergesChangeWithDBRecovery) { Options options = CurrentOptions(); options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.max_successive_merges = 3; options.merge_operator = MergeOperators::CreatePutOperator(); options.disable_auto_compactions = true; @@ -185,19 +185,19 @@ TEST_P(DBTestSharedWriteBufferAcrossCFs, SharedWriteBufferAcrossCFs) { // Avoid undeterministic value by malloc_usable_size(); // Force arena block size to 1 - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "Arena::Arena:0", [&](void* arg) { size_t* block_size = static_cast(arg); *block_size = 1; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "Arena::AllocateNewBlock:0", [&](void* arg) { std::pair* pair = static_cast*>(arg); *std::get<0>(*pair) = *std::get<1>(*pair); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // The total soft write buffer size is about 105000 std::shared_ptr cache = NewLRUCache(4 * 1024 * 1024, 2); @@ -346,7 +346,7 @@ TEST_P(DBTestSharedWriteBufferAcrossCFs, SharedWriteBufferAcrossCFs) { last_options_.write_buffer_manager.reset(); ASSERT_LT(cache->GetUsage(), 256 * 1024); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } INSTANTIATE_TEST_CASE_P(DBTestSharedWriteBufferAcrossCFs, @@ -361,19 +361,19 @@ TEST_F(DBTest2, SharedWriteBufferLimitAcrossDB) { options.arena_block_size = 4096; // Avoid undeterministic value by malloc_usable_size(); // Force arena block size to 1 - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "Arena::Arena:0", [&](void* arg) { size_t* block_size = static_cast(arg); *block_size = 1; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "Arena::AllocateNewBlock:0", [&](void* arg) { std::pair* pair = static_cast*>(arg); *std::get<0>(*pair) = *std::get<1>(*pair); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); options.write_buffer_size = 500000; // this is never hit // Use a write buffer total size so that the soft limit is about @@ -453,7 +453,7 @@ TEST_F(DBTest2, SharedWriteBufferLimitAcrossDB) { delete db2; ASSERT_OK(DestroyDB(dbname2, options)); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBTest2, TestWriteBufferNoLimitWithCache) { @@ -1114,7 +1114,7 @@ TEST_F(DBTest2, PresetCompressionDict) { assert(false); } - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.table_factory.reset(NewBlockBasedTableFactory(table_options)); CreateAndReopenWithCF({"pikachu"}, options); Random rnd(301); @@ -1185,7 +1185,7 @@ TEST_F(DBTest2, PresetCompressionDictLocality) { options.compression = kZSTD; options.compression_opts.max_dict_bytes = 1 << 14; // 16KB options.compression_opts.zstd_max_train_bytes = 1 << 18; // 256KB - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.target_file_size_base = kNumEntriesPerFile * kNumBytesPerEntry; BlockBasedTableOptions table_options; table_options.cache_index_and_filter_blocks = true; @@ -1205,12 +1205,12 @@ TEST_F(DBTest2, PresetCompressionDictLocality) { // Store all the dictionaries generated during a full compaction. std::vector compression_dicts; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "BlockBasedTableBuilder::WriteCompressionDictBlock:RawDict", [&](void* arg) { compression_dicts.emplace_back(static_cast(arg)->ToString()); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); CompactRangeOptions compact_range_opts; compact_range_opts.bottommost_level_compaction = BottommostLevelCompaction::kForceOptimized; @@ -1351,14 +1351,14 @@ class CompactionStallTestListener : public EventListener { }; TEST_F(DBTest2, CompactionStall) { - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::BGWorkCompaction", "DBTest2::CompactionStall:0"}, {"DBImpl::BGWorkCompaction", "DBTest2::CompactionStall:1"}, {"DBTest2::CompactionStall:2", "DBImpl::NotifyOnCompactionBegin::UnlockMutex"}, {"DBTest2::CompactionStall:3", "DBImpl::NotifyOnCompactionCompleted::UnlockMutex"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.level0_file_num_compaction_trigger = 4; @@ -1385,7 +1385,7 @@ TEST_F(DBTest2, CompactionStall) { // Clear "DBImpl::BGWorkCompaction" SYNC_POINT since we want to hold it again // at DBTest2::CompactionStall::1 - rocksdb::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); // Another 6 L0 files to trigger compaction again for (int i = 0; i < 6; i++) { @@ -1411,7 +1411,7 @@ TEST_F(DBTest2, CompactionStall) { 10 - options.level0_file_num_compaction_trigger); ASSERT_EQ(listener->compacting_files_cnt_.load(), listener->compacted_files_cnt_.load()); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } #endif // ROCKSDB_LITE @@ -1480,7 +1480,7 @@ class PinL0IndexAndFilterBlocksTest options->max_open_files = -1; } options->create_if_missing = true; - options->statistics = rocksdb::CreateDBStatistics(); + options->statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; table_options.cache_index_and_filter_blocks = true; table_options.pin_l0_filter_and_index_blocks_in_cache = true; @@ -1520,7 +1520,7 @@ TEST_P(PinL0IndexAndFilterBlocksTest, options.max_open_files = -1; } options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions table_options; table_options.cache_index_and_filter_blocks = true; table_options.pin_l0_filter_and_index_blocks_in_cache = true; @@ -1606,20 +1606,20 @@ TEST_P(PinL0IndexAndFilterBlocksTest, DisablePrefetchingNonL0IndexAndFilter) { // so that preloading SST files won't happen. options.max_open_files = 13; // RocksDB sanitize max open files to at least 20. Modify it back. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SanitizeOptions::AfterChangeMaxOpenFiles", [&](void* arg) { int* max_open_files = static_cast(arg); *max_open_files = 13; }); } - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Reopen database. If max_open_files is set as -1, table readers will be // preloaded. This will trigger a BlockBasedTable::Open() and prefetch // L0 index and filter. Level 1's prefetching is disabled in DB::Open() TryReopenWithColumnFamilies({"default", "pikachu"}, options); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); if (!disallow_preload_) { // After reopen, cache miss are increased by one because we read (and only @@ -1759,8 +1759,8 @@ static void UniqueIdCallback(void* arg) { *result = 0; } - rocksdb::SyncPoint::GetInstance()->ClearTrace(); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "GetUniqueIdFromFile:FS_IOC_GETVERSION", UniqueIdCallback); } @@ -1768,8 +1768,8 @@ class MockPersistentCache : public PersistentCache { public: explicit MockPersistentCache(const bool is_compressed, const size_t max_size) : is_compressed_(is_compressed), max_size_(max_size) { - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "GetUniqueIdFromFile:FS_IOC_GETVERSION", UniqueIdCallback); } @@ -1841,10 +1841,10 @@ TEST_F(DBTest2, TestPerfContextGetCpuTime) { uint64_t kDummyAddonTime = uint64_t{1000000000000}; // Add time to NowNanos() reading. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "TableCache::FindTable:0", [&](void* /*arg*/) { env_->addon_time_.fetch_add(kDummyAddonTime); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); SetPerfLevel(PerfLevel::kEnableTimeAndCPUTimeExceptForMutex); ASSERT_EQ("bar", Get("foo")); @@ -1853,7 +1853,7 @@ TEST_F(DBTest2, TestPerfContextGetCpuTime) { ASSERT_GT(get_perf_context()->find_table_nanos, kDummyAddonTime); SetPerfLevel(PerfLevel::kDisable); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBTest2, TestPerfContextIterCpuTime) { @@ -1903,10 +1903,10 @@ TEST_F(DBTest2, TestPerfContextIterCpuTime) { uint64_t kDummyAddonTime = uint64_t{1000000000000}; // Add time to NowNanos() reading. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "TableCache::FindTable:0", [&](void* /*arg*/) { env_->addon_time_.fetch_add(kDummyAddonTime); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); SetPerfLevel(PerfLevel::kEnableTimeAndCPUTimeExceptForMutex); iter = db_->NewIterator(ReadOptions()); @@ -1937,7 +1937,7 @@ TEST_F(DBTest2, TestPerfContextIterCpuTime) { ASSERT_GT(get_perf_context()->find_table_nanos, kDummyAddonTime); SetPerfLevel(PerfLevel::kDisable); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); delete iter; } #endif // OS_LINUX @@ -1951,7 +1951,7 @@ TEST_F(DBTest2, PersistentCache) { Options options; options.write_buffer_size = 64 * 1024; // small write buffer - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options = CurrentOptions(options); auto bsizes = {/*no block cache*/ 0, /*1M*/ 1 * 1024 * 1024}; @@ -2019,7 +2019,7 @@ void CountSyncPoint() { TEST_F(DBTest2, SyncPointMarker) { std::atomic sync_point_called(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBTest2::MarkedPoint", [&](void* /*arg*/) { sync_point_called.fetch_add(1); }); @@ -2031,11 +2031,11 @@ TEST_F(DBTest2, SyncPointMarker) { // | MarkedPoint | | // | Thread1First | | // | | MarkedPoint | - rocksdb::SyncPoint::GetInstance()->LoadDependencyAndMarkers( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependencyAndMarkers( {{"DBTest2::SyncPointMarker:Thread1First", "DBTest2::MarkedPoint"}}, {{"DBTest2::SyncPointMarker:Marker", "DBTest2::MarkedPoint"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); std::function func1 = [&]() { CountSyncPoint(); @@ -2054,7 +2054,7 @@ TEST_F(DBTest2, SyncPointMarker) { // Callback is only executed once ASSERT_EQ(sync_point_called.load(), 1); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } #endif @@ -2079,7 +2079,7 @@ TEST_F(DBTest2, ReadAmpBitmap) { bbto.block_cache = NewLRUCache(1024 * 1024 * 1024); bbto.read_amp_bytes_per_bit = bytes_per_bit[k]; options.table_factory.reset(NewBlockBasedTableFactory(bbto)); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); const size_t kNumEntries = 10000; @@ -2176,7 +2176,7 @@ TEST_F(DBTest2, ReadAmpBitmapLiveInCacheAfterDBClose) { uint32_t bytes_per_bit[2] = {1, 16}; for (size_t k = 0; k < 2; k++) { std::shared_ptr lru_cache = NewLRUCache(1024 * 1024 * 1024); - std::shared_ptr stats = rocksdb::CreateDBStatistics(); + std::shared_ptr stats = ROCKSDB_NAMESPACE::CreateDBStatistics(); Options options = CurrentOptions(); BlockBasedTableOptions bbto; @@ -2223,7 +2223,8 @@ TEST_F(DBTest2, ReadAmpBitmapLiveInCacheAfterDBClose) { options.statistics->getTickerCount(READ_AMP_TOTAL_READ_BYTES); Close(); - std::shared_ptr new_statistics = rocksdb::CreateDBStatistics(); + std::shared_ptr new_statistics = + ROCKSDB_NAMESPACE::CreateDBStatistics(); // Destroy old statistics obj that the blocks in lru_cache are pointing to options.statistics.reset(); // Use the statistics object that we just created @@ -2307,7 +2308,7 @@ TEST_F(DBTest2, AutomaticCompactionOverlapManualCompaction) { // While the compaction is running, we will create 2 new files that // can fit in L2, these 2 files will be moved to L2 and overlap with // the running compaction and break the LSM consistency. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::Run():Start", [&](void* /*arg*/) { ASSERT_OK( dbfull()->SetOptions({{"level0_file_num_compaction_trigger", "2"}, @@ -2320,7 +2321,7 @@ TEST_F(DBTest2, AutomaticCompactionOverlapManualCompaction) { ASSERT_OK(Put(Key(9), "a")); ASSERT_OK(Flush()); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Run a manual compaction that will compact the 2 files in L2 // into 1 file in L2 @@ -2328,7 +2329,7 @@ TEST_F(DBTest2, AutomaticCompactionOverlapManualCompaction) { cro.bottommost_level_compaction = BottommostLevelCompaction::kForceOptimized; ASSERT_OK(db_->CompactRange(cro, nullptr, nullptr)); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); // Test that the stats GetMapProperty API reporting 1 file in L2 { @@ -2367,13 +2368,13 @@ TEST_F(DBTest2, ManualCompactionOverlapManualCompaction) { cro.exclusive_manual_compaction = false; ASSERT_OK(db_->CompactRange(cro, &k1s, &k2s)); }; - rocksdb::port::Thread bg_thread; + ROCKSDB_NAMESPACE::port::Thread bg_thread; // While the compaction is running, we will create 2 new files that // can fit in L1, these 2 files will be moved to L1 and overlap with // the running compaction and break the LSM consistency. std::atomic flag(false); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::Run():Start", [&](void* /*arg*/) { if (flag.exchange(true)) { // We want to make sure to call this callback only once @@ -2393,7 +2394,7 @@ TEST_F(DBTest2, ManualCompactionOverlapManualCompaction) { // so it should wait until the first compaction finish env_->SleepForMicroseconds(1000000); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Run a manual compaction that will compact the 2 files in L1 // into 1 file in L1 @@ -2403,7 +2404,7 @@ TEST_F(DBTest2, ManualCompactionOverlapManualCompaction) { ASSERT_OK(db_->CompactRange(cro, nullptr, nullptr)); bg_thread.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBTest2, PausingManualCompaction1) { @@ -2426,14 +2427,14 @@ TEST_F(DBTest2, PausingManualCompaction1) { ASSERT_OK(Flush()); int manual_compactions_paused = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::Run():PausingManualCompaction:1", [&](void* arg) { auto paused = reinterpret_cast*>(arg); ASSERT_FALSE(paused->load(std::memory_order_acquire)); paused->store(true, std::memory_order_release); manual_compactions_paused += 1; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); std::vector files_before_compact, files_after_compact; // Remember file name before compaction is triggered @@ -2462,7 +2463,8 @@ TEST_F(DBTest2, PausingManualCompaction1) { manual_compactions_paused = 0; // Now make sure CompactFiles also not run - dbfull()->CompactFiles(rocksdb::CompactionOptions(), files_before_compact, 0); + dbfull()->CompactFiles(ROCKSDB_NAMESPACE::CompactionOptions(), + files_before_compact, 0); // Wait for manual compaction to get scheduled and finish dbfull()->TEST_WaitForCompact(true); @@ -2477,7 +2479,7 @@ TEST_F(DBTest2, PausingManualCompaction1) { // CompactFiles returns at entry point ASSERT_EQ(manual_compactions_paused, 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } // PausingManualCompaction does not affect auto compaction @@ -2532,10 +2534,10 @@ TEST_F(DBTest2, PausingManualCompaction3) { ASSERT_EQ("2,3,4,5,6,7,8", FilesPerLevel()); #endif // !ROCKSDB_LITE int run_manual_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::Run():PausingManualCompaction:1", [&](void* /*arg*/) { run_manual_compactions++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); dbfull()->DisableManualCompaction(); dbfull()->CompactRange(compact_options, nullptr, nullptr); @@ -2546,7 +2548,7 @@ TEST_F(DBTest2, PausingManualCompaction3) { ASSERT_EQ("2,3,4,5,6,7,8", FilesPerLevel()); #endif // !ROCKSDB_LITE - rocksdb::SyncPoint::GetInstance()->ClearCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearCallBack( "CompactionJob::Run():PausingManualCompaction:1"); dbfull()->EnableManualCompaction(); dbfull()->CompactRange(compact_options, nullptr, nullptr); @@ -2555,7 +2557,7 @@ TEST_F(DBTest2, PausingManualCompaction3) { ASSERT_EQ("0,0,0,0,0,0,2", FilesPerLevel()); #endif // !ROCKSDB_LITE - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBTest2, PausingManualCompaction4) { @@ -2586,14 +2588,14 @@ TEST_F(DBTest2, PausingManualCompaction4) { ASSERT_EQ("2,3,4,5,6,7,8", FilesPerLevel()); #endif // !ROCKSDB_LITE int run_manual_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::Run():PausingManualCompaction:2", [&](void* arg) { auto paused = reinterpret_cast*>(arg); ASSERT_FALSE(paused->load(std::memory_order_acquire)); paused->store(true, std::memory_order_release); run_manual_compactions++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); dbfull()->EnableManualCompaction(); dbfull()->CompactRange(compact_options, nullptr, nullptr); @@ -2603,7 +2605,7 @@ TEST_F(DBTest2, PausingManualCompaction4) { ASSERT_EQ("2,3,4,5,6,7,8", FilesPerLevel()); #endif // !ROCKSDB_LITE - rocksdb::SyncPoint::GetInstance()->ClearCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearCallBack( "CompactionJob::Run():PausingManualCompaction:2"); dbfull()->EnableManualCompaction(); dbfull()->CompactRange(compact_options, nullptr, nullptr); @@ -2612,7 +2614,7 @@ TEST_F(DBTest2, PausingManualCompaction4) { ASSERT_EQ("0,0,0,0,0,0,2", FilesPerLevel()); #endif // !ROCKSDB_LITE - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBTest2, OptimizeForPointLookup) { @@ -2667,13 +2669,13 @@ TEST_F(DBTest2, OptimizeForSmallDB) { TEST_F(DBTest2, GetRaceFlush1) { ASSERT_OK(Put("foo", "v1")); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::GetImpl:1", "DBTest2::GetRaceFlush:1"}, {"DBTest2::GetRaceFlush:2", "DBImpl::GetImpl:2"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread t1([&] { + ROCKSDB_NAMESPACE::port::Thread t1([&] { TEST_SYNC_POINT("DBTest2::GetRaceFlush:1"); ASSERT_OK(Put("foo", "v2")); Flush(); @@ -2684,17 +2686,17 @@ TEST_F(DBTest2, GetRaceFlush1) { // "v1" or "v2". ASSERT_NE("NOT_FOUND", Get("foo")); t1.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBTest2, GetRaceFlush2) { ASSERT_OK(Put("foo", "v1")); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::GetImpl:3", "DBTest2::GetRaceFlush:1"}, {"DBTest2::GetRaceFlush:2", "DBImpl::GetImpl:4"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); port::Thread t1([&] { TEST_SYNC_POINT("DBTest2::GetRaceFlush:1"); @@ -2707,7 +2709,7 @@ TEST_F(DBTest2, GetRaceFlush2) { // "v1" or "v2". ASSERT_NE("NOT_FOUND", Get("foo")); t1.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBTest2, DirectIO) { @@ -2807,17 +2809,17 @@ TEST_F(DBTest2, LowPriWrite) { std::atomic rate_limit_count(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "GenericRateLimiter::Request:1", [&](void* arg) { rate_limit_count.fetch_add(1); int64_t* rate_bytes_per_sec = static_cast(arg); ASSERT_EQ(1024 * 1024, *rate_bytes_per_sec); }); // Block compaction - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DBTest.LowPriWrite:0", "DBImpl::BGWorkCompaction"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); WriteOptions wo; for (int i = 0; i < 6; i++) { wo.low_pri = false; @@ -2835,7 +2837,7 @@ TEST_F(DBTest2, LowPriWrite) { ASSERT_EQ(1, rate_limit_count.load()); TEST_SYNC_POINT("DBTest.LowPriWrite:0"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); dbfull()->TEST_WaitForCompact(); wo.low_pri = true; @@ -3050,16 +3052,16 @@ TEST_F(DBTest2, LiveFilesOmitObsoleteFiles) { // Instead, if we sleep for a second between Find and Purge, and ensure the // read attempt happens after purge, then the sequence of events will almost // certainly happen on the old code. - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DBImpl::BackgroundCallFlush:FilesFound", "DBTest2::LiveFilesOmitObsoleteFiles:FlushTriggered"}, {"DBImpl::PurgeObsoleteFiles:End", "DBTest2::LiveFilesOmitObsoleteFiles:LiveFilesCaptured"}, }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::PurgeObsoleteFiles:Begin", [&](void* /*arg*/) { env_->SleepForMicroseconds(1000000); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Put("key", "val"); FlushOptions flush_opts; @@ -3076,7 +3078,7 @@ TEST_F(DBTest2, LiveFilesOmitObsoleteFiles) { } db_->EnableFileDeletions(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBTest2, TestNumPread) { @@ -3598,7 +3600,7 @@ TEST_F(DBTest2, PinnableSliceAndMmapReads) { TEST_F(DBTest2, DISABLED_IteratorPinnedMemory) { Options options = CurrentOptions(); options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions bbto; bbto.no_block_cache = false; bbto.cache_index_and_filter_blocks = false; @@ -3665,7 +3667,7 @@ TEST_F(DBTest2, DISABLED_IteratorPinnedMemory) { std::atomic finished(false); std::atomic block_newed(0); std::atomic block_destroyed(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "Block::Block:0", [&](void* /*arg*/) { if (finished) { return; @@ -3675,7 +3677,7 @@ TEST_F(DBTest2, DISABLED_IteratorPinnedMemory) { EXPECT_LE(block_newed.load(), block_destroyed.load() + 1); block_newed.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "Block::~Block", [&](void* /*arg*/) { if (finished) { return; @@ -3685,10 +3687,10 @@ TEST_F(DBTest2, DISABLED_IteratorPinnedMemory) { EXPECT_LE(block_newed.load(), block_destroyed.load() + 2); block_destroyed.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::Run:BeforeVerify", [&](void* /*arg*/) { finished = true; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr)); @@ -3696,21 +3698,21 @@ TEST_F(DBTest2, DISABLED_IteratorPinnedMemory) { ASSERT_EQ(8, block_newed.load()); ASSERT_EQ(8, block_destroyed.load()); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBTest2, TestBBTTailPrefetch) { std::atomic called(false); size_t expected_lower_bound = 512 * 1024; size_t expected_higher_bound = 512 * 1024; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "BlockBasedTable::Open::TailPrefetchLen", [&](void* arg) { size_t* prefetch_size = static_cast(arg); EXPECT_LE(expected_lower_bound, *prefetch_size); EXPECT_GE(expected_higher_bound, *prefetch_size); called = true; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Put("1", "1"); Put("9", "1"); @@ -3733,11 +3735,11 @@ TEST_F(DBTest2, TestBBTTailPrefetch) { ASSERT_TRUE(called.load()); called = false; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); std::atomic first_call(true); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "BlockBasedTable::Open::TailPrefetchLen", [&](void* arg) { size_t* prefetch_size = static_cast(arg); if (first_call) { @@ -3748,7 +3750,7 @@ TEST_F(DBTest2, TestBBTTailPrefetch) { } called = true; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.max_file_opening_threads = 1; // one thread @@ -3777,19 +3779,19 @@ TEST_F(DBTest2, TestBBTTailPrefetch) { ASSERT_TRUE(called.load()); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } TEST_F(DBTest2, TestGetColumnFamilyHandleUnlocked) { // Setup sync point dependency to reproduce the race condition of // DBImpl::GetColumnFamilyHandleUnlocked - rocksdb::SyncPoint::GetInstance()->LoadDependency( - { {"TestGetColumnFamilyHandleUnlocked::GetColumnFamilyHandleUnlocked1", - "TestGetColumnFamilyHandleUnlocked::PreGetColumnFamilyHandleUnlocked2"}, - {"TestGetColumnFamilyHandleUnlocked::GetColumnFamilyHandleUnlocked2", - "TestGetColumnFamilyHandleUnlocked::ReadColumnFamilyHandle1"}, - }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ + {"TestGetColumnFamilyHandleUnlocked::GetColumnFamilyHandleUnlocked1", + "TestGetColumnFamilyHandleUnlocked::PreGetColumnFamilyHandleUnlocked2"}, + {"TestGetColumnFamilyHandleUnlocked::GetColumnFamilyHandleUnlocked2", + "TestGetColumnFamilyHandleUnlocked::ReadColumnFamilyHandle1"}, + }); SyncPoint::GetInstance()->EnableProcessing(); CreateColumnFamilies({"test1", "test2"}, Options()); @@ -3815,15 +3817,15 @@ TEST_F(DBTest2, TestGetColumnFamilyHandleUnlocked) { user_thread1.join(); user_thread2.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } #ifndef ROCKSDB_LITE TEST_F(DBTest2, TestCompactFiles) { // Setup sync point dependency to reproduce the race condition of // DBImpl::GetColumnFamilyHandleUnlocked - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"TestCompactFiles::IngestExternalFile1", "TestCompactFiles::IngestExternalFile2"}, }); @@ -3836,7 +3838,8 @@ TEST_F(DBTest2, TestCompactFiles) { auto* handle = db_->DefaultColumnFamily(); ASSERT_EQ(db_->NumberLevels(handle), 2); - rocksdb::SstFileWriter sst_file_writer{rocksdb::EnvOptions(), options}; + ROCKSDB_NAMESPACE::SstFileWriter sst_file_writer{ + ROCKSDB_NAMESPACE::EnvOptions(), options}; std::string external_file1 = dbname_ + "/test_compact_files1.sst_t"; std::string external_file2 = dbname_ + "/test_compact_files2.sst_t"; std::string external_file3 = dbname_ + "/test_compact_files3.sst_t"; @@ -3875,8 +3878,8 @@ TEST_F(DBTest2, TestCompactFiles) { user_thread1.join(); user_thread2.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } #endif // ROCKSDB_LITE @@ -3945,8 +3948,9 @@ class DummyOldStats : public Statistics { void measureTime(uint32_t /*histogram_type*/, uint64_t /*count*/) override { num_mt++; } - void histogramData(uint32_t /*histogram_type*/, - rocksdb::HistogramData* const /*data*/) const override {} + void histogramData( + uint32_t /*histogram_type*/, + ROCKSDB_NAMESPACE::HistogramData* const /*data*/) const override {} std::string getHistogramString(uint32_t /*type*/) const override { return ""; } @@ -4066,7 +4070,7 @@ TEST_F(DBTest2, PrefixBloomFilteredOut) { #ifndef ROCKSDB_LITE TEST_F(DBTest2, RowCacheSnapshot) { Options options = CurrentOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.row_cache = NewLRUCache(8 * 8192); DestroyAndReopen(options); @@ -4159,14 +4163,14 @@ TEST_F(DBTest2, CrashInRecoveryMultipleCF) { // Reopen and freeze the file system after the first manifest write. FaultInjectionTestEnv fit_env(options.env); options.env = &fit_env; - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( test_sync_point, [&](void* /*arg*/) { fit_env.SetFilesystemActive(false); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_NOK(TryReopenWithColumnFamilies( {kDefaultColumnFamilyName, "pikachu"}, options)); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); fit_env.SetFilesystemActive(true); // If we continue using failure ingestion Env, it will conplain something @@ -4213,7 +4217,8 @@ TEST_F(DBTest2, SeekFileRangeDeleteTail) { TEST_F(DBTest2, BackgroundPurgeTest) { Options options = CurrentOptions(); - options.write_buffer_manager = std::make_shared(1 << 20); + options.write_buffer_manager = + std::make_shared(1 << 20); options.avoid_unnecessary_blocking_io = true; DestroyAndReopen(options); size_t base_value = options.write_buffer_manager->memory_usage(); @@ -4672,7 +4677,7 @@ TEST_F(DBTest2, AutoPrefixMode1) { } } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS extern "C" { @@ -4683,7 +4688,7 @@ void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {} #endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/db/db_test_util.cc b/db/db_test_util.cc index 4594ab9af5..c73abde41c 100644 --- a/db/db_test_util.cc +++ b/db/db_test_util.cc @@ -12,7 +12,7 @@ #include "rocksdb/env_encryption.h" #include "rocksdb/utilities/object_registry.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Special Env used to delay background operations @@ -90,9 +90,9 @@ DBTestBase::DBTestBase(const std::string path) } DBTestBase::~DBTestBase() { - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->LoadDependency({}); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({}); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); Close(); Options options; options.db_paths.emplace_back(dbname_, 0); @@ -340,9 +340,10 @@ Options DBTestBase::GetOptions( bool set_block_based_table_factory = true; #if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \ !defined(OS_AIX) - rocksdb::SyncPoint::GetInstance()->ClearCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearCallBack( "NewRandomAccessFile:O_DIRECT"); - rocksdb::SyncPoint::GetInstance()->ClearCallBack("NewWritableFile:O_DIRECT"); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearCallBack( + "NewWritableFile:O_DIRECT"); #endif bool can_allow_mmap = IsMemoryMappedAccessSupported(); @@ -400,18 +401,18 @@ Options DBTestBase::GetOptions( options.compaction_readahead_size = 2 * 1024 * 1024; #if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \ !defined(OS_AIX) && !defined(OS_OPENBSD) - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "NewWritableFile:O_DIRECT", [&](void* arg) { int* val = static_cast(arg); *val &= ~O_DIRECT; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "NewRandomAccessFile:O_DIRECT", [&](void* arg) { int* val = static_cast(arg); *val &= ~O_DIRECT; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - #endif + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); +#endif break; } #endif // ROCKSDB_LITE @@ -1560,4 +1561,4 @@ uint64_t DBTestBase::GetNumberOfSstFilesForColumnFamily( } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_test_util.h b/db/db_test_util.h index 4b36783cc3..eeabea9bdc 100644 --- a/db/db_test_util.h +++ b/db/db_test_util.h @@ -52,7 +52,7 @@ #include "util/string_util.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace anon { class AtomicCounter { @@ -997,4 +997,4 @@ class DBTestBase : public testing::Test { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/db_universal_compaction_test.cc b/db/db_universal_compaction_test.cc index e7cf9c0860..61531ae169 100644 --- a/db/db_universal_compaction_test.cc +++ b/db/db_universal_compaction_test.cc @@ -13,7 +13,7 @@ #include "rocksdb/utilities/table_properties_collectors.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static std::string CompressibleString(Random* rnd, int len) { std::string r; @@ -178,7 +178,7 @@ TEST_P(DBTestUniversalCompaction, OptimizeFiltersForHits) { bbto.whole_key_filtering = true; options.table_factory.reset(NewBlockBasedTableFactory(bbto)); options.optimize_filters_for_hits = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.memtable_factory.reset(new SpecialSkipListFactory(3)); DestroyAndReopen(options); @@ -249,7 +249,7 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrigger) { DestroyAndReopen(options); CreateAndReopenWithCF({"pikachu"}, options); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBTestWritableFile.GetPreallocationStatus", [&](void* arg) { ASSERT_TRUE(arg != nullptr); size_t preallocation_size = *(static_cast(arg)); @@ -257,7 +257,7 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrigger) { ASSERT_LE(preallocation_size, options.target_file_size_base * 1.1); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); int key_idx = 0; @@ -335,7 +335,7 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrigger) { // All files at level 0 will be compacted into a single one. ASSERT_EQ(NumSortedRuns(1), 1); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_P(DBTestUniversalCompaction, UniversalCompactionSizeAmplification) { @@ -395,7 +395,7 @@ TEST_P(DBTestUniversalCompaction, DynamicUniversalCompactionSizeAmplification) { int total_picked_compactions = 0; int total_size_amp_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "UniversalCompactionBuilder::PickCompaction:Return", [&](void* arg) { if (arg) { total_picked_compactions++; @@ -406,7 +406,7 @@ TEST_P(DBTestUniversalCompaction, DynamicUniversalCompactionSizeAmplification) { } } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); MutableCFOptions mutable_cf_options; CreateAndReopenWithCF({"pikachu"}, options); @@ -476,7 +476,7 @@ TEST_P(DBTestUniversalCompaction, DynamicUniversalCompactionReadAmplification) { int total_picked_compactions = 0; int total_size_ratio_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "UniversalCompactionBuilder::PickCompaction:Return", [&](void* arg) { if (arg) { total_picked_compactions++; @@ -486,7 +486,7 @@ TEST_P(DBTestUniversalCompaction, DynamicUniversalCompactionReadAmplification) { } } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); MutableCFOptions mutable_cf_options; CreateAndReopenWithCF({"pikachu"}, options); @@ -704,17 +704,17 @@ TEST_P(DBTestUniversalCompactionMultiLevels, UniversalCompactionMultiLevels) { TEST_P(DBTestUniversalCompactionMultiLevels, UniversalCompactionTrivialMove) { int32_t trivial_move = 0; int32_t non_trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* arg) { non_trivial_move++; ASSERT_TRUE(arg != nullptr); int output_level = *(static_cast(arg)); ASSERT_EQ(output_level, 0); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.compaction_style = kCompactionStyleUniversal; @@ -745,7 +745,7 @@ TEST_P(DBTestUniversalCompactionMultiLevels, UniversalCompactionTrivialMove) { ASSERT_GT(trivial_move, 0); ASSERT_GT(non_trivial_move, 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } INSTANTIATE_TEST_CASE_P(MultiLevels, DBTestUniversalCompactionMultiLevels, @@ -776,24 +776,24 @@ TEST_P(DBTestUniversalCompactionParallel, UniversalCompactionParallel) { // Delay every compaction so multiple compactions will happen. std::atomic num_compactions_running(0); std::atomic has_parallel(false); - rocksdb::SyncPoint::GetInstance()->SetCallBack("CompactionJob::Run():Start", - [&](void* /*arg*/) { - if (num_compactions_running.fetch_add(1) > 0) { - has_parallel.store(true); - return; - } - for (int nwait = 0; nwait < 20000; nwait++) { - if (has_parallel.load() || num_compactions_running.load() > 1) { - has_parallel.store(true); - break; - } - env_->SleepForMicroseconds(1000); - } - }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "CompactionJob::Run():Start", [&](void* /*arg*/) { + if (num_compactions_running.fetch_add(1) > 0) { + has_parallel.store(true); + return; + } + for (int nwait = 0; nwait < 20000; nwait++) { + if (has_parallel.load() || num_compactions_running.load() > 1) { + has_parallel.store(true); + break; + } + env_->SleepForMicroseconds(1000); + } + }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::Run():End", [&](void* /*arg*/) { num_compactions_running.fetch_add(-1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); options = CurrentOptions(options); ReopenWithColumnFamilies({"default", "pikachu"}, options); @@ -805,7 +805,7 @@ TEST_P(DBTestUniversalCompactionParallel, UniversalCompactionParallel) { } dbfull()->TEST_WaitForCompact(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_EQ(num_compactions_running.load(), 0); ASSERT_TRUE(has_parallel.load()); @@ -834,7 +834,7 @@ TEST_P(DBTestUniversalCompactionParallel, PickByFileNumberBug) { UINT_MAX; DestroyAndReopen(options); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBTestUniversalCompactionParallel::PickByFileNumberBug:0", "BackgroundCallCompaction:0"}, {"UniversalCompactionBuilder::PickCompaction:Return", @@ -843,14 +843,14 @@ TEST_P(DBTestUniversalCompactionParallel, PickByFileNumberBug) { "CompactionJob::Run():Start"}}); int total_picked_compactions = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "UniversalCompactionBuilder::PickCompaction:Return", [&](void* arg) { if (arg) { total_picked_compactions++; } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Write 7 files to trigger compaction int key_idx = 1; @@ -865,7 +865,7 @@ TEST_P(DBTestUniversalCompactionParallel, PickByFileNumberBug) { // Wait for the 1st background compaction process to start TEST_SYNC_POINT("DBTestUniversalCompactionParallel::PickByFileNumberBug:0"); TEST_SYNC_POINT("DBTestUniversalCompactionParallel::PickByFileNumberBug:1"); - rocksdb::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); // Write 3 files while 1st compaction is held // These 3 files have different sizes to avoid compacting based on size_ratio @@ -889,13 +889,13 @@ TEST_P(DBTestUniversalCompactionParallel, PickByFileNumberBug) { EXPECT_EQ(TotalTableFiles(), 4); // Stop SyncPoint and destroy the DB and reopen it again - rocksdb::SyncPoint::GetInstance()->ClearTrace(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); key_idx = 1; total_picked_compactions = 0; DestroyAndReopen(options); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Write 7 files to trigger compaction for (int i = 1; i <= 70; i++) { @@ -909,7 +909,7 @@ TEST_P(DBTestUniversalCompactionParallel, PickByFileNumberBug) { // Wait for the 1st background compaction process to start TEST_SYNC_POINT("DBTestUniversalCompactionParallel::PickByFileNumberBug:0"); TEST_SYNC_POINT("DBTestUniversalCompactionParallel::PickByFileNumberBug:1"); - rocksdb::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); // Write 8 files while 1st compaction is held // These 8 files have different sizes to avoid compacting based on size_ratio @@ -1161,17 +1161,17 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionCompressRatio2) { TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest1) { int32_t trivial_move = 0; int32_t non_trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* arg) { non_trivial_move++; ASSERT_TRUE(arg != nullptr); int output_level = *(static_cast(arg)); ASSERT_EQ(output_level, 0); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.compaction_style = kCompactionStyleUniversal; @@ -1202,22 +1202,22 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest1) { ASSERT_GT(trivial_move, 0); ASSERT_GT(non_trivial_move, 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } // Test that checks trivial move in universal compaction TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest2) { int32_t trivial_move = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", [&](void* /*arg*/) { trivial_move++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* arg) { ASSERT_TRUE(arg != nullptr); int output_level = *(static_cast(arg)); ASSERT_EQ(output_level, 0); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); options.compaction_style = kCompactionStyleUniversal; @@ -1247,7 +1247,7 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest2) { ASSERT_GT(trivial_move, 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } #endif // ROCKSDB_VALGRIND_RUN @@ -1708,7 +1708,7 @@ TEST_P(DBTestUniversalCompaction, ConcurrentBottomPriLowPriCompactions) { options.compaction_options_universal.max_size_amplification_percent = 110; DestroyAndReopen(options); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {// wait for the full compaction to be picked before adding files intended // for the second one. {"DBImpl::BackgroundCompaction:ForwardToBottomPriPool", @@ -1741,7 +1741,7 @@ TEST_P(DBTestUniversalCompaction, ConcurrentBottomPriLowPriCompactions) { ASSERT_EQ(NumSortedRuns(), 2); ASSERT_GT(NumTableFilesAtLevel(0), 0); ASSERT_GT(NumTableFilesAtLevel(num_levels_ - 1), 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); Env::Default()->SetBackgroundThreads(0, Env::Priority::BOTTOM); } @@ -1762,11 +1762,10 @@ TEST_P(DBTestUniversalCompaction, RecalculateScoreAfterPicking) { Reopen(options); std::atomic num_compactions_attempted(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:Start", [&](void* /*arg*/) { - ++num_compactions_attempted; - }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "DBImpl::BackgroundCompaction:Start", + [&](void* /*arg*/) { ++num_compactions_attempted; }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); for (int num = 0; num < kNumFilesTrigger; num++) { @@ -1815,12 +1814,12 @@ TEST_P(DBTestUniversalCompaction, FinalSortedRunCompactFilesConflict) { std::string first_sst_filename = cf_meta.levels[num_levels_ - 1].files[0].name; - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"CompactFilesImpl:0", "DBTestUniversalCompaction:FinalSortedRunCompactFilesConflict:0"}, {"DBImpl::BackgroundCompaction():AfterPickCompaction", "CompactFilesImpl:1"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); port::Thread compact_files_thread([&]() { ASSERT_OK(dbfull()->CompactFiles(CompactionOptions(), default_cfh, @@ -2189,7 +2188,7 @@ TEST_F(DBTestUniversalCompaction2, PeriodicCompaction) { int periodic_compactions = 0; int start_level = -1; int output_level = -1; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "UniversalCompactionPicker::PickPeriodicCompaction:Return", [&](void* arg) { Compaction* compaction = reinterpret_cast(arg); @@ -2200,7 +2199,7 @@ TEST_F(DBTestUniversalCompaction2, PeriodicCompaction) { output_level = compaction->output_level(); periodic_compactions++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Case 1: Oldest flushed file excceeds periodic compaction threshold. ASSERT_OK(Put("foo", "bar")); @@ -2238,13 +2237,13 @@ TEST_F(DBTestUniversalCompaction2, PeriodicCompaction) { ASSERT_EQ(4, output_level); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !defined(ROCKSDB_LITE) int main(int argc, char** argv) { #if !defined(ROCKSDB_LITE) - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); #else diff --git a/db/db_wal_test.cc b/db/db_wal_test.cc index 50c6f42586..ef81de803f 100644 --- a/db/db_wal_test.cc +++ b/db/db_wal_test.cc @@ -15,7 +15,7 @@ #include "test_util/fault_injection_test_env.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBWALTest : public DBTestBase { public: DBWALTest() : DBTestBase("/db_wal_test") {} @@ -191,15 +191,15 @@ TEST_F(DBWALTest, SyncWALNotBlockWrite) { ASSERT_OK(Put("foo1", "bar1")); ASSERT_OK(Put("foo5", "bar5")); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"WritableFileWriter::SyncWithoutFlush:1", "DBWALTest::SyncWALNotBlockWrite:1"}, {"DBWALTest::SyncWALNotBlockWrite:2", "WritableFileWriter::SyncWithoutFlush:2"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread thread([&]() { ASSERT_OK(db_->SyncWAL()); }); + ROCKSDB_NAMESPACE::port::Thread thread([&]() { ASSERT_OK(db_->SyncWAL()); }); TEST_SYNC_POINT("DBWALTest::SyncWALNotBlockWrite:1"); ASSERT_OK(Put("foo2", "bar2")); @@ -218,20 +218,21 @@ TEST_F(DBWALTest, SyncWALNotBlockWrite) { ASSERT_EQ(Get("foo3"), "bar3"); ASSERT_EQ(Get("foo4"), "bar4"); ASSERT_EQ(Get("foo5"), "bar5"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBWALTest, SyncWALNotWaitWrite) { ASSERT_OK(Put("foo1", "bar1")); ASSERT_OK(Put("foo3", "bar3")); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"SpecialEnv::WalFile::Append:1", "DBWALTest::SyncWALNotWaitWrite:1"}, {"DBWALTest::SyncWALNotWaitWrite:2", "SpecialEnv::WalFile::Append:2"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread thread([&]() { ASSERT_OK(Put("foo2", "bar2")); }); + ROCKSDB_NAMESPACE::port::Thread thread( + [&]() { ASSERT_OK(Put("foo2", "bar2")); }); // Moving this to SyncWAL before the actual fsync // TEST_SYNC_POINT("DBWALTest::SyncWALNotWaitWrite:1"); ASSERT_OK(db_->SyncWAL()); @@ -242,7 +243,7 @@ TEST_F(DBWALTest, SyncWALNotWaitWrite) { ASSERT_EQ(Get("foo1"), "bar1"); ASSERT_EQ(Get("foo2"), "bar2"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DBWALTest, Recover) { @@ -293,7 +294,7 @@ TEST_F(DBWALTest, RecoverWithTableHandle) { // happen. options.max_open_files = kSmallMaxOpenFiles; // RocksDB sanitize max open files to at least 20. Modify it back. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SanitizeOptions::AfterChangeMaxOpenFiles", [&](void* arg) { int* max_open_files = static_cast(arg); *max_open_files = kSmallMaxOpenFiles; @@ -305,10 +306,10 @@ TEST_F(DBWALTest, RecoverWithTableHandle) { } else { options.max_open_files = -1; } - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ReopenWithColumnFamilies({"default", "pikachu"}, options); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); std::vector> files; dbfull()->TEST_GetFilesMetaData(handles_[1], &files); @@ -443,38 +444,38 @@ TEST_F(DBWALTest, PreallocateBlock) { DestroyAndReopen(options); std::atomic called(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBTestWalFile.GetPreallocationStatus", [&](void* arg) { ASSERT_TRUE(arg != nullptr); size_t preallocation_size = *(static_cast(arg)); ASSERT_EQ(expected_preallocation_size, preallocation_size); called.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Put("", ""); Flush(); Put("", ""); Close(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_EQ(2, called.load()); options.max_total_wal_size = 1000 * 1000; expected_preallocation_size = static_cast(options.max_total_wal_size); Reopen(options); called.store(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBTestWalFile.GetPreallocationStatus", [&](void* arg) { ASSERT_TRUE(arg != nullptr); size_t preallocation_size = *(static_cast(arg)); ASSERT_EQ(expected_preallocation_size, preallocation_size); called.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Put("", ""); Flush(); Put("", ""); Close(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_EQ(2, called.load()); options.db_write_buffer_size = 800 * 1000; @@ -482,19 +483,19 @@ TEST_F(DBWALTest, PreallocateBlock) { static_cast(options.db_write_buffer_size); Reopen(options); called.store(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBTestWalFile.GetPreallocationStatus", [&](void* arg) { ASSERT_TRUE(arg != nullptr); size_t preallocation_size = *(static_cast(arg)); ASSERT_EQ(expected_preallocation_size, preallocation_size); called.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Put("", ""); Flush(); Put("", ""); Close(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_EQ(2, called.load()); expected_preallocation_size = 700 * 1000; @@ -503,19 +504,19 @@ TEST_F(DBWALTest, PreallocateBlock) { options.write_buffer_manager = write_buffer_manager; Reopen(options); called.store(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBTestWalFile.GetPreallocationStatus", [&](void* arg) { ASSERT_TRUE(arg != nullptr); size_t preallocation_size = *(static_cast(arg)); ASSERT_EQ(expected_preallocation_size, preallocation_size); called.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Put("", ""); Flush(); Put("", ""); Close(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_EQ(2, called.load()); } #endif // !(defined NDEBUG) || !defined(OS_WIN) @@ -577,19 +578,19 @@ TEST_F(DBWALTest, FullPurgePreservesLogPendingReuse) { // The second flush can recycle the first log. Sync points enforce the // full purge happens after choosing the log to recycle and before it is // renamed. - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DBImpl::CreateWAL:BeforeReuseWritableFile1", "DBWALTest::FullPurgePreservesLogPendingReuse:PreFullPurge"}, {"DBWALTest::FullPurgePreservesLogPendingReuse:PostFullPurge", "DBImpl::CreateWAL:BeforeReuseWritableFile2"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread thread([&]() { - TEST_SYNC_POINT( - "DBWALTest::FullPurgePreservesLogPendingReuse:PreFullPurge"); - ASSERT_OK(db_->EnableFileDeletions(true)); - TEST_SYNC_POINT( - "DBWALTest::FullPurgePreservesLogPendingReuse:PostFullPurge"); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::port::Thread thread([&]() { + TEST_SYNC_POINT( + "DBWALTest::FullPurgePreservesLogPendingReuse:PreFullPurge"); + ASSERT_OK(db_->EnableFileDeletions(true)); + TEST_SYNC_POINT( + "DBWALTest::FullPurgePreservesLogPendingReuse:PostFullPurge"); }); ASSERT_OK(Put("foo", "bar")); ASSERT_OK(Flush()); @@ -1576,10 +1577,10 @@ TEST_F(DBWALTest, WalTermTest) { ASSERT_EQ("bar", Get(1, "foo")); ASSERT_EQ("NOT_FOUND", Get(1, "foo2")); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_write_test.cc b/db/db_write_test.cc index 74a8c89fa9..cc1aaac082 100644 --- a/db/db_write_test.cc +++ b/db/db_write_test.cc @@ -17,7 +17,7 @@ #include "test_util/sync_point.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Test variations of WriteImpl. class DBWriteTest : public DBTestBase, public testing::WithParamInterface { @@ -79,18 +79,18 @@ TEST_P(DBWriteTest, WriteThreadHangOnWriteStall) { Flush(); Put("foo" + std::to_string(thread_num.fetch_add(1)), "bar"); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "WriteThread::JoinBatchGroup:Start", unblock_main_thread_func); - rocksdb::SyncPoint::GetInstance()->LoadDependency( - {{"DBWriteTest::WriteThreadHangOnWriteStall:1", - "DBImpl::BackgroundCallFlush:start"}, - {"DBWriteTest::WriteThreadHangOnWriteStall:2", - "DBImpl::WriteImpl:BeforeLeaderEnters"}, - // Make compaction start wait for the write stall to be detected and - // implemented by a write group leader - {"DBWriteTest::WriteThreadHangOnWriteStall:3", - "BackgroundCallCompaction:0"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "WriteThread::JoinBatchGroup:Start", unblock_main_thread_func); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( + {{"DBWriteTest::WriteThreadHangOnWriteStall:1", + "DBImpl::BackgroundCallFlush:start"}, + {"DBWriteTest::WriteThreadHangOnWriteStall:2", + "DBImpl::WriteImpl:BeforeLeaderEnters"}, + // Make compaction start wait for the write stall to be detected and + // implemented by a write group leader + {"DBWriteTest::WriteThreadHangOnWriteStall:3", + "BackgroundCallCompaction:0"}}); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Schedule creation of 4th L0 file without waiting. This will seal the // memtable and then wait for a sync point before writing the file. We need @@ -279,7 +279,7 @@ TEST_P(DBWriteTest, LockWalInEffect) { TEST_P(DBWriteTest, ConcurrentlyDisabledWAL) { Options options = GetOptions(); - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.statistics->set_stats_level(StatsLevel::kAll); Reopen(options); std::string wal_key_prefix = "WAL_KEY_"; @@ -292,14 +292,16 @@ TEST_P(DBWriteTest, ConcurrentlyDisabledWAL) { for (int t = 0; t < 10; t++) { threads[t] = std::thread([t, wal_key_prefix, wal_value, no_wal_key_prefix, no_wal_value, this] { for(int i = 0; i < 10; i++) { - rocksdb::WriteOptions write_option_disable; - write_option_disable.disableWAL = true; - rocksdb::WriteOptions write_option_default; - std::string no_wal_key = no_wal_key_prefix + std::to_string(t) + "_" + std::to_string(i); - this->Put(no_wal_key, no_wal_value, write_option_disable); - std::string wal_key = wal_key_prefix + std::to_string(i) + "_" + std::to_string(i); - this->Put(wal_key, wal_value, write_option_default); - dbfull()->SyncWAL(); + ROCKSDB_NAMESPACE::WriteOptions write_option_disable; + write_option_disable.disableWAL = true; + ROCKSDB_NAMESPACE::WriteOptions write_option_default; + std::string no_wal_key = no_wal_key_prefix + std::to_string(t) + + "_" + std::to_string(i); + this->Put(no_wal_key, no_wal_value, write_option_disable); + std::string wal_key = + wal_key_prefix + std::to_string(i) + "_" + std::to_string(i); + this->Put(wal_key, wal_value, write_option_default); + dbfull()->SyncWAL(); } return 0; }); @@ -307,7 +309,8 @@ TEST_P(DBWriteTest, ConcurrentlyDisabledWAL) { for (auto& t: threads) { t.join(); } - uint64_t bytes_num = options.statistics->getTickerCount(rocksdb::Tickers::WAL_FILE_BYTES); + uint64_t bytes_num = options.statistics->getTickerCount( + ROCKSDB_NAMESPACE::Tickers::WAL_FILE_BYTES); // written WAL size should less than 100KB (even included HEADER & FOOTER overhead) ASSERT_LE(bytes_num, 1024 * 100); } @@ -317,10 +320,10 @@ INSTANTIATE_TEST_CASE_P(DBWriteTestInstance, DBWriteTest, DBTestBase::kConcurrentWALWrites, DBTestBase::kPipelinedWrite)); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/dbformat.cc b/db/dbformat.cc index a20e2a02d3..e10af2b857 100644 --- a/db/dbformat.cc +++ b/db/dbformat.cc @@ -15,7 +15,7 @@ #include "util/coding.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // kValueTypeForSeek defines the ValueType that should be passed when // constructing a ParsedInternalKey object for seeking to a particular @@ -194,4 +194,4 @@ void IterKey::EnlargeBuffer(size_t key_size) { buf_ = new char[key_size]; buf_size_ = key_size; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/dbformat.h b/db/dbformat.h index 090d8c133f..de98be8dfa 100644 --- a/db/dbformat.h +++ b/db/dbformat.h @@ -26,7 +26,7 @@ #include "util/coding.h" #include "util/user_comparator_wrapper.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // The file declares data structures and functions that deal with internal // keys. @@ -668,4 +668,4 @@ struct ParsedInternalKeyComparator { const InternalKeyComparator* cmp; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/dbformat_test.cc b/db/dbformat_test.cc index 9ec1bc3434..a2c67795af 100644 --- a/db/dbformat_test.cc +++ b/db/dbformat_test.cc @@ -11,7 +11,7 @@ #include "logging/logging.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static std::string IKey(const std::string& user_key, uint64_t seq, @@ -199,7 +199,7 @@ TEST_F(FormatTest, RangeTombstoneSerializeEndKey) { ASSERT_LT(cmp.Compare(t.SerializeEndKey(), k), 0); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/deletefile_test.cc b/db/deletefile_test.cc index db6f945a7d..f202388c05 100644 --- a/db/deletefile_test.cc +++ b/db/deletefile_test.cc @@ -27,7 +27,7 @@ #include "test_util/testutil.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DeleteFileTest : public DBTestBase { public: @@ -388,13 +388,13 @@ TEST_F(DeleteFileTest, BackgroundPurgeTestMultipleJobs) { // 5 sst files after 2 compactions with 2 live iterators CheckFileTypeCounts(dbname_, 0, 5, 1); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); // ~DBImpl should wait until all BGWorkPurge are finished - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::~DBImpl:WaitJob", "DBImpl::BGWorkPurge"}, {"DeleteFileTest::GuardFinish", "DeleteFileTest::BackgroundPurgeTestMultipleJobs:DBClose"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); delete itr1; env_->Schedule(&DeleteFileTest::DoSleep, this, Env::Priority::HIGH); @@ -542,7 +542,7 @@ TEST_F(DeleteFileTest, DeleteNonDefaultColumnFamily) { } } -} //namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS extern "C" { @@ -553,7 +553,7 @@ void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {} #endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/db/error_handler.cc b/db/error_handler.cc index 317f007237..3ba4d9fd94 100644 --- a/db/error_handler.cc +++ b/db/error_handler.cc @@ -8,7 +8,7 @@ #include "db/event_helpers.h" #include "file/sst_file_manager_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Maps to help decide the severity of an error based on the // BackgroundErrorReason, Code, SubCode and whether db_options.paranoid_checks @@ -341,4 +341,4 @@ Status ErrorHandler::RecoverFromBGError(bool is_manual) { return bg_error_; #endif } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/db/error_handler.h b/db/error_handler.h index c2af809fc6..7276f6510c 100644 --- a/db/error_handler.h +++ b/db/error_handler.h @@ -9,7 +9,7 @@ #include "rocksdb/listener.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBImpl; @@ -72,4 +72,4 @@ class ErrorHandler { void RecoverFromNoSpace(); }; -} +} // namespace ROCKSDB_NAMESPACE diff --git a/db/error_handler_test.cc b/db/error_handler_test.cc index cbbd33efcd..b9d78490cb 100644 --- a/db/error_handler_test.cc +++ b/db/error_handler_test.cc @@ -17,7 +17,7 @@ #include "test_util/sync_point.h" #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBErrorHandlingTest : public DBTestBase { public: @@ -165,7 +165,7 @@ TEST_F(DBErrorHandlingTest, FLushWriteError) { }); SyncPoint::GetInstance()->EnableProcessing(); s = Flush(); - ASSERT_EQ(s.severity(), rocksdb::Status::Severity::kHardError); + ASSERT_EQ(s.severity(), ROCKSDB_NAMESPACE::Status::Severity::kHardError); SyncPoint::GetInstance()->DisableProcessing(); fault_env->SetFilesystemActive(true); s = dbfull()->Resume(); @@ -201,7 +201,7 @@ TEST_F(DBErrorHandlingTest, ManifestWriteError) { }); SyncPoint::GetInstance()->EnableProcessing(); s = Flush(); - ASSERT_EQ(s.severity(), rocksdb::Status::Severity::kHardError); + ASSERT_EQ(s.severity(), ROCKSDB_NAMESPACE::Status::Severity::kHardError); SyncPoint::GetInstance()->ClearAllCallBacks(); SyncPoint::GetInstance()->DisableProcessing(); fault_env->SetFilesystemActive(true); @@ -242,12 +242,12 @@ TEST_F(DBErrorHandlingTest, DoubleManifestWriteError) { }); SyncPoint::GetInstance()->EnableProcessing(); s = Flush(); - ASSERT_EQ(s.severity(), rocksdb::Status::Severity::kHardError); + ASSERT_EQ(s.severity(), ROCKSDB_NAMESPACE::Status::Severity::kHardError); fault_env->SetFilesystemActive(true); // This Resume() will attempt to create a new manifest file and fail again s = dbfull()->Resume(); - ASSERT_EQ(s.severity(), rocksdb::Status::Severity::kHardError); + ASSERT_EQ(s.severity(), ROCKSDB_NAMESPACE::Status::Severity::kHardError); fault_env->SetFilesystemActive(true); SyncPoint::GetInstance()->ClearAllCallBacks(); SyncPoint::GetInstance()->DisableProcessing(); @@ -286,32 +286,29 @@ TEST_F(DBErrorHandlingTest, CompactionManifestWriteError) { s = Flush(); ASSERT_EQ(s, Status::OK()); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( // Wait for flush of 2nd L0 file before starting compaction {{"DBImpl::FlushMemTable:FlushMemTableFinished", "BackgroundCallCompaction:0"}, - // Wait for compaction to detect manifest write error - {"BackgroundCallCompaction:1", - "CompactionManifestWriteError:0"}, - // Make compaction thread wait for error to be cleared + // Wait for compaction to detect manifest write error + {"BackgroundCallCompaction:1", "CompactionManifestWriteError:0"}, + // Make compaction thread wait for error to be cleared {"CompactionManifestWriteError:1", "DBImpl::BackgroundCallCompaction:FoundObsoleteFiles"}, - // Wait for DB instance to clear bg_error before calling - // TEST_WaitForCompact - {"SstFileManagerImpl::ErrorCleared", - "CompactionManifestWriteError:2"}}); + // Wait for DB instance to clear bg_error before calling + // TEST_WaitForCompact + {"SstFileManagerImpl::ErrorCleared", "CompactionManifestWriteError:2"}}); // trigger manifest write failure in compaction thread - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "BackgroundCallCompaction:0", [&](void *) { - fail_manifest.store(true); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "BackgroundCallCompaction:0", [&](void*) { fail_manifest.store(true); }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "VersionSet::LogAndApply:WriteManifest", [&](void*) { + if (fail_manifest.load()) { + fault_env->SetFilesystemActive(false, + Status::NoSpace("Out of space")); + } }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "VersionSet::LogAndApply:WriteManifest", [&](void *) { - if (fail_manifest.load()) { - fault_env->SetFilesystemActive(false, Status::NoSpace("Out of space")); - } - }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Put(Key(1), "val"); // This Flush will trigger a compaction, which will fail when appending to @@ -322,12 +319,12 @@ TEST_F(DBErrorHandlingTest, CompactionManifestWriteError) { TEST_SYNC_POINT("CompactionManifestWriteError:0"); // Clear all errors so when the compaction is retried, it will succeed fault_env->SetFilesystemActive(true); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); TEST_SYNC_POINT("CompactionManifestWriteError:1"); TEST_SYNC_POINT("CompactionManifestWriteError:2"); s = dbfull()->TEST_WaitForCompact(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_EQ(s, Status::OK()); new_manifest = GetManifestNameFromLiveFiles(); @@ -360,21 +357,21 @@ TEST_F(DBErrorHandlingTest, CompactionWriteError) { Status(Status::NoSpace(), Status::Severity::kHardError) ); listener->EnableAutoRecovery(false); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::FlushMemTable:FlushMemTableFinished", "BackgroundCallCompaction:0"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "BackgroundCallCompaction:0", [&](void *) { - fault_env->SetFilesystemActive(false, Status::NoSpace("Out of space")); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "BackgroundCallCompaction:0", [&](void*) { + fault_env->SetFilesystemActive(false, Status::NoSpace("Out of space")); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Put(Key(1), "val"); s = Flush(); ASSERT_EQ(s, Status::OK()); s = dbfull()->TEST_WaitForCompact(); - ASSERT_EQ(s.severity(), rocksdb::Status::Severity::kHardError); + ASSERT_EQ(s.severity(), ROCKSDB_NAMESPACE::Status::Severity::kHardError); fault_env->SetFilesystemActive(true); s = dbfull()->Resume(); @@ -397,21 +394,22 @@ TEST_F(DBErrorHandlingTest, CorruptionError) { s = Flush(); ASSERT_EQ(s, Status::OK()); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::FlushMemTable:FlushMemTableFinished", "BackgroundCallCompaction:0"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "BackgroundCallCompaction:0", [&](void *) { - fault_env->SetFilesystemActive(false, Status::Corruption("Corruption")); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "BackgroundCallCompaction:0", [&](void*) { + fault_env->SetFilesystemActive(false, Status::Corruption("Corruption")); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Put(Key(1), "val"); s = Flush(); ASSERT_EQ(s, Status::OK()); s = dbfull()->TEST_WaitForCompact(); - ASSERT_EQ(s.severity(), rocksdb::Status::Severity::kUnrecoverableError); + ASSERT_EQ(s.severity(), + ROCKSDB_NAMESPACE::Status::Severity::kUnrecoverableError); fault_env->SetFilesystemActive(true); s = dbfull()->Resume(); @@ -438,7 +436,7 @@ TEST_F(DBErrorHandlingTest, AutoRecoverFlushError) { }); SyncPoint::GetInstance()->EnableProcessing(); s = Flush(); - ASSERT_EQ(s.severity(), rocksdb::Status::Severity::kHardError); + ASSERT_EQ(s.severity(), ROCKSDB_NAMESPACE::Status::Severity::kHardError); SyncPoint::GetInstance()->DisableProcessing(); fault_env->SetFilesystemActive(true); ASSERT_EQ(listener->WaitForRecovery(5000000), true); @@ -471,7 +469,7 @@ TEST_F(DBErrorHandlingTest, FailRecoverFlushError) { }); SyncPoint::GetInstance()->EnableProcessing(); s = Flush(); - ASSERT_EQ(s.severity(), rocksdb::Status::Severity::kHardError); + ASSERT_EQ(s.severity(), ROCKSDB_NAMESPACE::Status::Severity::kHardError); // We should be able to shutdown the database while auto recovery is going // on in the background Close(); @@ -854,10 +852,10 @@ TEST_F(DBErrorHandlingTest, MultiDBVariousErrors) { delete def_env; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/event_helpers.cc b/db/event_helpers.cc index f5345c7550..57aa711fc8 100644 --- a/db/event_helpers.cc +++ b/db/event_helpers.cc @@ -5,7 +5,7 @@ #include "db/event_helpers.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { template @@ -220,4 +220,4 @@ void EventHelpers::NotifyOnErrorRecoveryCompleted( #endif // ROCKSDB_LITE } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/event_helpers.h b/db/event_helpers.h index 820eb09be4..87cc1cb8c1 100644 --- a/db/event_helpers.h +++ b/db/event_helpers.h @@ -14,7 +14,7 @@ #include "rocksdb/listener.h" #include "rocksdb/table_properties.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class EventHelpers { public: @@ -52,4 +52,4 @@ class EventHelpers { const FileDescriptor& fd, const TableFileCreationInfo& info); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/experimental.cc b/db/experimental.cc index 0c3c3335d9..d12882c8f5 100644 --- a/db/experimental.cc +++ b/db/experimental.cc @@ -7,7 +7,7 @@ #include "db/db_impl/db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace experimental { #ifndef ROCKSDB_LITE @@ -47,4 +47,4 @@ Status SuggestCompactRange(DB* db, const Slice* begin, const Slice* end) { } } // namespace experimental -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/external_sst_file_basic_test.cc b/db/external_sst_file_basic_test.cc index 43a003a85c..b184df20e6 100644 --- a/db/external_sst_file_basic_test.cc +++ b/db/external_sst_file_basic_test.cc @@ -12,7 +12,7 @@ #include "test_util/fault_injection_test_env.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE class ExternalSSTFileBasicTest @@ -657,12 +657,12 @@ TEST_F(ExternalSSTFileBasicTest, FadviseTrigger) { const int kNumKeys = 10000; size_t total_fadvised_bytes = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SstFileWriter::Rep::InvalidatePageCache", [&](void* arg) { size_t fadvise_size = *(reinterpret_cast(arg)); total_fadvised_bytes += fadvise_size; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); std::unique_ptr sst_file_writer; @@ -689,7 +689,7 @@ TEST_F(ExternalSSTFileBasicTest, FadviseTrigger) { ASSERT_EQ(total_fadvised_bytes, sst_file_writer->FileSize()); ASSERT_GT(total_fadvised_bytes, 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(ExternalSSTFileBasicTest, SyncFailure) { @@ -1119,10 +1119,10 @@ INSTANTIATE_TEST_CASE_P(ExternalSSTFileBasicTest, ExternalSSTFileBasicTest, #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/external_sst_file_ingestion_job.cc b/db/external_sst_file_ingestion_job.cc index f703b9d9cf..4cec5d3767 100644 --- a/db/external_sst_file_ingestion_job.cc +++ b/db/external_sst_file_ingestion_job.cc @@ -24,7 +24,7 @@ #include "test_util/sync_point.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status ExternalSstFileIngestionJob::Prepare( const std::vector& external_files_paths, @@ -726,6 +726,6 @@ Status ExternalSstFileIngestionJob::SyncIngestedFile(TWritableFile* file) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/db/external_sst_file_ingestion_job.h b/db/external_sst_file_ingestion_job.h index f6733218de..7ddb6f3e86 100644 --- a/db/external_sst_file_ingestion_job.h +++ b/db/external_sst_file_ingestion_job.h @@ -19,7 +19,7 @@ #include "rocksdb/sst_file_writer.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Directories; @@ -177,4 +177,4 @@ class ExternalSstFileIngestionJob { bool files_overlap_{false}; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/external_sst_file_test.cc b/db/external_sst_file_test.cc index c949f22583..0b91910a16 100644 --- a/db/external_sst_file_test.cc +++ b/db/external_sst_file_test.cc @@ -14,7 +14,7 @@ #include "test_util/fault_injection_test_env.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A test environment that can be configured to fail the Link operation. class ExternalSSTTestEnv : public EnvWrapper { @@ -889,7 +889,7 @@ TEST_F(ExternalSSTFileTest, PurgeObsoleteFilesBug) { options.disable_auto_compactions = true; DestroyAndReopen(options); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "ExternalSstFileIngestionJob::Prepare:FileAdded", [&](void* /* arg */) { ASSERT_OK(Put("aaa", "bbb")); ASSERT_OK(Flush()); @@ -897,7 +897,7 @@ TEST_F(ExternalSSTFileTest, PurgeObsoleteFilesBug) { ASSERT_OK(Flush()); db_->CompactRange(CompactRangeOptions(), nullptr, nullptr); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); s = DeprecatedAddFile({sst_file_path}); ASSERT_OK(s); @@ -908,7 +908,7 @@ TEST_F(ExternalSSTFileTest, PurgeObsoleteFilesBug) { ASSERT_EQ(Get(k), v); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(ExternalSSTFileTest, SkipSnapshot) { @@ -1099,25 +1099,25 @@ TEST_F(ExternalSSTFileTest, MultiThreaded) { TEST_F(ExternalSSTFileTest, OverlappingRanges) { Random rnd(301); SequenceNumber assigned_seqno = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "ExternalSstFileIngestionJob::Run", [&assigned_seqno](void* arg) { - ASSERT_TRUE(arg != nullptr); - assigned_seqno = *(static_cast(arg)); - }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "ExternalSstFileIngestionJob::Run", [&assigned_seqno](void* arg) { + ASSERT_TRUE(arg != nullptr); + assigned_seqno = *(static_cast(arg)); + }); bool need_flush = false; - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::IngestExternalFile:NeedFlush", [&need_flush](void* arg) { - ASSERT_TRUE(arg != nullptr); - need_flush = *(static_cast(arg)); - }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "DBImpl::IngestExternalFile:NeedFlush", [&need_flush](void* arg) { + ASSERT_TRUE(arg != nullptr); + need_flush = *(static_cast(arg)); + }); bool overlap_with_db = false; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "ExternalSstFileIngestionJob::AssignLevelAndSeqnoForIngestedFile", [&overlap_with_db](void* arg) { ASSERT_TRUE(arg != nullptr); overlap_with_db = *(static_cast(arg)); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); do { Options options = CurrentOptions(); DestroyAndReopen(options); @@ -1246,14 +1246,14 @@ TEST_P(ExternalSSTFileTest, PickedLevel) { false, false, &true_data)); EXPECT_EQ(FilesPerLevel(), "0,0,1,1"); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"ExternalSSTFileTest::PickedLevel:0", "BackgroundCallCompaction:0"}, {"DBImpl::BackgroundCompaction:Start", "ExternalSSTFileTest::PickedLevel:1"}, {"ExternalSSTFileTest::PickedLevel:2", "DBImpl::BackgroundCompaction:NonTrivial:AfterRun"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Flush 4 files containing the same keys for (int i = 0; i < 4; i++) { @@ -1290,7 +1290,7 @@ TEST_P(ExternalSSTFileTest, PickedLevel) { size_t kcnt = 0; VerifyDBFromMap(true_data, &kcnt, false); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(ExternalSSTFileTest, PickedLevelBug) { @@ -1319,7 +1319,7 @@ TEST_F(ExternalSSTFileTest, PickedLevelBug) { // We have 2 overlapping files in L0 EXPECT_EQ(FilesPerLevel(), "2"); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::AddFile:MutexLock", "ExternalSSTFileTest::PickedLevelBug:0"}, {"ExternalSSTFileTest::PickedLevelBug:1", "DBImpl::AddFile:MutexUnlock"}, {"ExternalSSTFileTest::PickedLevelBug:2", @@ -1328,20 +1328,20 @@ TEST_F(ExternalSSTFileTest, PickedLevelBug) { "DBImpl::RunManualCompaction:1"}}); std::atomic bg_compact_started(false); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:Start", [&](void* /*arg*/) { bg_compact_started.store(true); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // While writing the MANIFEST start a thread that will ask for compaction - rocksdb::port::Thread bg_compact([&]() { + ROCKSDB_NAMESPACE::port::Thread bg_compact([&]() { ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr)); }); TEST_SYNC_POINT("ExternalSSTFileTest::PickedLevelBug:2"); // Start a thread that will ingest a new file - rocksdb::port::Thread bg_addfile([&]() { + ROCKSDB_NAMESPACE::port::Thread bg_addfile([&]() { file_keys = {1, 2, 3}; ASSERT_OK(GenerateAndAddExternalFile(options, file_keys, 1)); }); @@ -1376,7 +1376,7 @@ TEST_F(ExternalSSTFileTest, PickedLevelBug) { delete iter; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(ExternalSSTFileTest, IngestNonExistingFile) { @@ -1479,7 +1479,7 @@ TEST_F(ExternalSSTFileTest, PickedLevelDynamic) { DestroyAndReopen(options); std::map true_data; - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"ExternalSSTFileTest::PickedLevelDynamic:0", "BackgroundCallCompaction:0"}, {"DBImpl::BackgroundCompaction:Start", @@ -1487,7 +1487,7 @@ TEST_F(ExternalSSTFileTest, PickedLevelDynamic) { {"ExternalSSTFileTest::PickedLevelDynamic:2", "DBImpl::BackgroundCompaction:NonTrivial:AfterRun"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Flush 4 files containing the same keys for (int i = 0; i < 4; i++) { @@ -1571,7 +1571,7 @@ TEST_F(ExternalSSTFileTest, PickedLevelDynamic) { VerifyDBFromMap(true_data, &kcnt, false); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(ExternalSSTFileTest, AddExternalSstFileWithCustomCompartor) { @@ -1645,7 +1645,7 @@ TEST_F(ExternalSSTFileTest, AddFileTrivialMoveBug) { ASSERT_OK(GenerateAndAddExternalFile(options, {20, 24}, 5)); // L3 ASSERT_OK(GenerateAndAddExternalFile(options, {22, 23}, 6)); // L2 - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::Run():Start", [&](void* /*arg*/) { // fit in L3 but will overlap with compaction so will be added // to L2 but a compaction will trivially move it to L3 @@ -1657,7 +1657,7 @@ TEST_F(ExternalSSTFileTest, AddFileTrivialMoveBug) { ASSERT_OK(GenerateAndAddExternalFile(options, {15, 16}, 7)); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); CompactRangeOptions cro; cro.exclusive_manual_compaction = false; @@ -1665,7 +1665,7 @@ TEST_F(ExternalSSTFileTest, AddFileTrivialMoveBug) { dbfull()->TEST_WaitForCompact(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(ExternalSSTFileTest, CompactAddedFiles) { @@ -1948,16 +1948,16 @@ TEST_F(ExternalSSTFileTest, CompactionDeadlock) { // atomic conter of currently running bg threads std::atomic running_threads(0); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DBImpl::DelayWrite:Wait", "ExternalSSTFileTest::DeadLock:0"}, {"ExternalSSTFileTest::DeadLock:1", "DBImpl::AddFile:Start"}, {"DBImpl::AddFile:MutexLock", "ExternalSSTFileTest::DeadLock:2"}, {"ExternalSSTFileTest::DeadLock:3", "BackgroundCallCompaction:0"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // Start ingesting and extrnal file in the background - rocksdb::port::Thread bg_ingest_file([&]() { + ROCKSDB_NAMESPACE::port::Thread bg_ingest_file([&]() { running_threads += 1; ASSERT_OK(GenerateAndAddExternalFile(options, {5, 6})); running_threads -= 1; @@ -1977,7 +1977,7 @@ TEST_F(ExternalSSTFileTest, CompactionDeadlock) { // This thread will try to insert into the memtable but since we have 4 L0 // files this thread will be blocked and hold the writer thread - rocksdb::port::Thread bg_block_put([&]() { + ROCKSDB_NAMESPACE::port::Thread bg_block_put([&]() { running_threads += 1; ASSERT_OK(Put(Key(10), "memtable")); running_threads -= 1; @@ -2115,10 +2115,10 @@ TEST_P(ExternSSTFileLinkFailFallbackTest, LinkFailFallBackExternalSst) { ASSERT_OK(env_->GetFileSize(file_path, &file_size)); bool copyfile = false; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "ExternalSstFileIngestionJob::Prepare:CopyFile", [&](void* /* arg */) { copyfile = true; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); const Status s = db_->IngestExternalFile({file_path}, ifo); @@ -2156,7 +2156,7 @@ TEST_P(ExternSSTFileLinkFailFallbackTest, LinkFailFallBackExternalSst) { ASSERT_EQ(0, bytes_copied); } } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } class TestIngestExternalFileListener : public EventListener { @@ -2324,7 +2324,7 @@ TEST_F(ExternalSSTFileTest, SkipBloomFilter) { // Create external SST file and include bloom filters - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); { std::string file_path = sst_files_dir_ + "sst_with_bloom.sst"; @@ -2342,7 +2342,7 @@ TEST_F(ExternalSSTFileTest, SkipBloomFilter) { } // Create external SST file but skip bloom filters - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); DestroyAndReopen(options); { std::string file_path = sst_files_dir_ + "sst_with_no_bloom.sst"; @@ -2375,10 +2375,10 @@ TEST_F(ExternalSSTFileTest, IngestFileWrittenWithCompressionDictionary) { DestroyAndReopen(options); std::atomic num_compression_dicts(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "BlockBasedTableBuilder::WriteCompressionDictBlock:RawDict", [&](void* /* arg */) { ++num_compression_dicts; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); std::vector> random_data; @@ -2811,10 +2811,10 @@ INSTANTIATE_TEST_CASE_P(ExternSSTFileLinkFailFallbackTest, std::make_tuple(true, true), std::make_tuple(false, false))); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/fault_injection_test.cc b/db/fault_injection_test.cc index 1d18569f2f..f4ca3458a9 100644 --- a/db/fault_injection_test.cc +++ b/db/fault_injection_test.cc @@ -28,7 +28,7 @@ #include "test_util/testutil.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const int kValueSize = 1000; static const int kMaxNumValues = 2000; @@ -84,8 +84,8 @@ class FaultInjectionTest db_(nullptr) {} ~FaultInjectionTest() override { - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } bool ChangeOptions() { @@ -436,14 +436,14 @@ TEST_P(FaultInjectionTest, UninstalledCompaction) { OpenDB(); if (!sequential_order_) { - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"FaultInjectionTest::FaultTest:0", "DBImpl::BGWorkCompaction"}, {"CompactionJob::Run():End", "FaultInjectionTest::FaultTest:1"}, {"FaultInjectionTest::FaultTest:2", "DBImpl::BackgroundCompaction:NonTrivial:AfterRun"}, }); } - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); int kNumKeys = 1000; Build(WriteOptions(), 0, kNumKeys); @@ -456,22 +456,22 @@ TEST_P(FaultInjectionTest, UninstalledCompaction) { env_->SetFilesystemActive(false); TEST_SYNC_POINT("FaultInjectionTest::FaultTest:2"); CloseDB(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ResetDBState(kResetDropUnsyncedData); std::atomic opened(false); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::Open:Opened", [&](void* /*arg*/) { opened.store(true); }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BGWorkCompaction", [&](void* /*arg*/) { ASSERT_TRUE(opened.load()); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(OpenDB()); ASSERT_OK(Verify(0, kNumKeys, FaultInjectionTest::kValExpectFound)); WaitCompactionFinish(); ASSERT_OK(Verify(0, kNumKeys, FaultInjectionTest::kValExpectFound)); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } TEST_P(FaultInjectionTest, ManualLogSyncTest) { @@ -547,7 +547,7 @@ INSTANTIATE_TEST_CASE_P( std::make_tuple(false, kSyncWal, kEnd), std::make_tuple(true, kSyncWal, kEnd))); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/file_indexer.cc b/db/file_indexer.cc index fd0180992e..523cb3c160 100644 --- a/db/file_indexer.cc +++ b/db/file_indexer.cc @@ -13,7 +13,7 @@ #include "db/version_edit.h" #include "rocksdb/comparator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { FileIndexer::FileIndexer(const Comparator* ucmp) : num_levels_(0), ucmp_(ucmp), level_rb_(nullptr) {} @@ -213,4 +213,4 @@ void FileIndexer::CalculateRB( } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/file_indexer.h b/db/file_indexer.h index 2091f80292..ad7553f2c4 100644 --- a/db/file_indexer.h +++ b/db/file_indexer.h @@ -16,7 +16,7 @@ #include "port/port.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Comparator; struct FileMetaData; @@ -60,7 +60,7 @@ class FileIndexer { enum { // MSVC version 1800 still does not have constexpr for ::max() - kLevelMaxIndex = rocksdb::port::kMaxInt32 + kLevelMaxIndex = ROCKSDB_NAMESPACE::port::kMaxInt32 }; private: @@ -139,4 +139,4 @@ class FileIndexer { int32_t* level_rb_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/file_indexer_test.cc b/db/file_indexer_test.cc index 6942aa682d..99ce939936 100644 --- a/db/file_indexer_test.cc +++ b/db/file_indexer_test.cc @@ -16,7 +16,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class IntComparator : public Comparator { public: @@ -341,10 +341,10 @@ TEST_F(FileIndexerTest, mixed) { ClearFiles(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/filename_test.cc b/db/filename_test.cc index bc52e0eae6..9a04542f62 100644 --- a/db/filename_test.cc +++ b/db/filename_test.cc @@ -14,7 +14,7 @@ #include "port/port.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class FileNameTest : public testing::Test {}; @@ -172,7 +172,7 @@ TEST_F(FileNameTest, Construction) { ASSERT_EQ(kMetaDatabase, type); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/flush_job.cc b/db/flush_job.cc index 40dd825850..416715a332 100644 --- a/db/flush_job.cc +++ b/db/flush_job.cc @@ -49,7 +49,7 @@ #include "util/mutexlock.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const char* GetFlushReasonString (FlushReason flush_reason) { switch (flush_reason) { @@ -459,4 +459,4 @@ std::unique_ptr FlushJob::GetFlushJobInfo() const { } #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/flush_job.h b/db/flush_job.h index 52161d261b..1f4435f4c5 100644 --- a/db/flush_job.h +++ b/db/flush_job.h @@ -43,7 +43,7 @@ #include "util/stop_watch.h" #include "util/thread_local.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBImpl; class MemTable; @@ -155,4 +155,4 @@ class FlushJob { Env::Priority thread_pri_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/flush_job_test.cc b/db/flush_job_test.cc index 6c53d21350..b77a4a2a9f 100644 --- a/db/flush_job_test.cc +++ b/db/flush_job_test.cc @@ -21,7 +21,7 @@ #include "test_util/testutil.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // TODO(icanadi) Mock out everything else: // 1. VersionSet @@ -42,7 +42,7 @@ class FlushJobTest : public testing::Test { EXPECT_OK(env_->CreateDirIfMissing(dbname_)); db_options_.db_paths.emplace_back(dbname_, std::numeric_limits::max()); - db_options_.statistics = rocksdb::CreateDBStatistics(); + db_options_.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); // TODO(icanadi) Remove this once we mock out VersionSet NewDB(); std::vector column_families; @@ -490,7 +490,7 @@ TEST_F(FlushJobTest, Snapshots) { job_context.Clean(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/flush_scheduler.cc b/db/flush_scheduler.cc index e40366408d..6f4d3e1a5e 100644 --- a/db/flush_scheduler.cc +++ b/db/flush_scheduler.cc @@ -9,7 +9,7 @@ #include "db/column_family.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void FlushScheduler::ScheduleWork(ColumnFamilyData* cfd) { #ifndef NDEBUG @@ -83,4 +83,4 @@ void FlushScheduler::Clear() { assert(head_.load(std::memory_order_relaxed) == nullptr); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/flush_scheduler.h b/db/flush_scheduler.h index 5ca85e88bc..cbe17994fd 100644 --- a/db/flush_scheduler.h +++ b/db/flush_scheduler.h @@ -11,7 +11,7 @@ #include #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ColumnFamilyData; @@ -51,4 +51,4 @@ class FlushScheduler { #endif // NDEBUG }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/forward_iterator.cc b/db/forward_iterator.cc index ae039db03c..f2b8825490 100644 --- a/db/forward_iterator.cc +++ b/db/forward_iterator.cc @@ -24,7 +24,7 @@ #include "test_util/sync_point.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Usage: // ForwardLevelIterator iter; @@ -970,6 +970,6 @@ void ForwardIterator::DeleteIterator(InternalIterator* iter, bool is_arena) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/forward_iterator.h b/db/forward_iterator.h index fb73f458ed..8c671c75fc 100644 --- a/db/forward_iterator.h +++ b/db/forward_iterator.h @@ -17,7 +17,7 @@ #include "rocksdb/options.h" #include "table/internal_iterator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBImpl; class Env; @@ -156,5 +156,5 @@ class ForwardIterator : public InternalIterator { Arena arena_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/forward_iterator_bench.cc b/db/forward_iterator_bench.cc index 174a258a68..6f1223537a 100644 --- a/db/forward_iterator_bench.cc +++ b/db/forward_iterator_bench.cc @@ -79,16 +79,17 @@ struct ShardState { Reader* reader; char pad2[128] __attribute__((__unused__)); std::atomic last_read{0}; - std::unique_ptr it; - std::unique_ptr it_cacheonly; + std::unique_ptr it; + std::unique_ptr it_cacheonly; Key upper_bound; - rocksdb::Slice upper_bound_slice; + ROCKSDB_NAMESPACE::Slice upper_bound_slice; char pad3[128] __attribute__((__unused__)); }; struct Reader { public: - explicit Reader(std::vector* shard_states, rocksdb::DB* db) + explicit Reader(std::vector* shard_states, + ROCKSDB_NAMESPACE::DB* db) : shard_states_(shard_states), db_(db) { sem_init(&sem_, 0, 0); thread_ = port::Thread(&Reader::run, this); @@ -117,11 +118,11 @@ struct Reader { ShardState& state = (*shard_states_)[shard]; if (!state.it) { // Initialize iterators - rocksdb::ReadOptions options; + ROCKSDB_NAMESPACE::ReadOptions options; options.tailing = true; if (FLAGS_iterate_upper_bound) { state.upper_bound = Key(shard, std::numeric_limits::max()); - state.upper_bound_slice = rocksdb::Slice( + state.upper_bound_slice = ROCKSDB_NAMESPACE::Slice( (const char*)&state.upper_bound, sizeof(state.upper_bound)); options.iterate_upper_bound = &state.upper_bound_slice; } @@ -129,13 +130,14 @@ struct Reader { state.it.reset(db_->NewIterator(options)); if (FLAGS_cache_only_first) { - options.read_tier = rocksdb::ReadTier::kBlockCacheTier; + options.read_tier = ROCKSDB_NAMESPACE::ReadTier::kBlockCacheTier; state.it_cacheonly.reset(db_->NewIterator(options)); } } const uint64_t upto = state.last_written.load(); - for (rocksdb::Iterator* it : {state.it_cacheonly.get(), state.it.get()}) { + for (ROCKSDB_NAMESPACE::Iterator* it : + {state.it_cacheonly.get(), state.it.get()}) { if (it == nullptr) { continue; } @@ -146,7 +148,7 @@ struct Reader { for (uint64_t seq = state.last_read.load() + 1; seq <= upto; ++seq) { if (need_seek) { Key from(shard, state.last_read.load() + 1); - it->Seek(rocksdb::Slice((const char*)&from, sizeof(from))); + it->Seek(ROCKSDB_NAMESPACE::Slice((const char*)&from, sizeof(from))); need_seek = false; } else { it->Next(); @@ -189,8 +191,8 @@ struct Reader { private: char pad1[128] __attribute__((__unused__)); std::vector* shard_states_; - rocksdb::DB* db_; - rocksdb::port::Thread thread_; + ROCKSDB_NAMESPACE::DB* db_; + ROCKSDB_NAMESPACE::port::Thread thread_; sem_t sem_; std::mutex queue_mutex_; std::bitset shards_pending_set_; @@ -200,7 +202,8 @@ struct Reader { }; struct Writer { - explicit Writer(std::vector* shard_states, rocksdb::DB* db) + explicit Writer(std::vector* shard_states, + ROCKSDB_NAMESPACE::DB* db) : shard_states_(shard_states), db_(db) {} void start() { thread_ = port::Thread(&Writer::run, this); } @@ -240,10 +243,10 @@ struct Writer { uint64_t seqno = state.last_written.load() + 1; Key key(shard, seqno); // fprintf(stderr, "Writing (%ld, %ld)\n", shard, seqno); - rocksdb::Status status = - db_->Put(rocksdb::WriteOptions(), - rocksdb::Slice((const char*)&key, sizeof(key)), - rocksdb::Slice(value)); + ROCKSDB_NAMESPACE::Status status = + db_->Put(ROCKSDB_NAMESPACE::WriteOptions(), + ROCKSDB_NAMESPACE::Slice((const char*)&key, sizeof(key)), + ROCKSDB_NAMESPACE::Slice(value)); assert(status.ok()); state.last_written.store(seqno); state.reader->onWrite(shard); @@ -259,13 +262,13 @@ struct Writer { private: char pad1[128] __attribute__((__unused__)); std::vector* shard_states_; - rocksdb::DB* db_; - rocksdb::port::Thread thread_; + ROCKSDB_NAMESPACE::DB* db_; + ROCKSDB_NAMESPACE::port::Thread thread_; char pad2[128] __attribute__((__unused__)); }; struct StatsThread { - explicit StatsThread(rocksdb::DB* db) + explicit StatsThread(ROCKSDB_NAMESPACE::DB* db) : db_(db), thread_(&StatsThread::run, this) {} void run() { @@ -307,10 +310,10 @@ struct StatsThread { } private: - rocksdb::DB* db_; + ROCKSDB_NAMESPACE::DB* db_; std::mutex cvm_; std::condition_variable cv_; - rocksdb::port::Thread thread_; + ROCKSDB_NAMESPACE::port::Thread thread_; std::atomic done_{false}; }; @@ -318,29 +321,32 @@ int main(int argc, char** argv) { GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); std::mt19937 rng{std::random_device()()}; - rocksdb::Status status; - std::string path = rocksdb::test::PerThreadDBPath("forward_iterator_test"); + ROCKSDB_NAMESPACE::Status status; + std::string path = + ROCKSDB_NAMESPACE::test::PerThreadDBPath("forward_iterator_test"); fprintf(stderr, "db path is %s\n", path.c_str()); - rocksdb::Options options; + ROCKSDB_NAMESPACE::Options options; options.create_if_missing = true; - options.compression = rocksdb::CompressionType::kNoCompression; - options.compaction_style = rocksdb::CompactionStyle::kCompactionStyleNone; + options.compression = ROCKSDB_NAMESPACE::CompressionType::kNoCompression; + options.compaction_style = + ROCKSDB_NAMESPACE::CompactionStyle::kCompactionStyleNone; options.level0_slowdown_writes_trigger = 99999; options.level0_stop_writes_trigger = 99999; options.use_direct_io_for_flush_and_compaction = true; options.write_buffer_size = FLAGS_memtable_size; - rocksdb::BlockBasedTableOptions table_options; - table_options.block_cache = rocksdb::NewLRUCache(FLAGS_block_cache_size); + ROCKSDB_NAMESPACE::BlockBasedTableOptions table_options; + table_options.block_cache = + ROCKSDB_NAMESPACE::NewLRUCache(FLAGS_block_cache_size); table_options.block_size = FLAGS_block_size; options.table_factory.reset( - rocksdb::NewBlockBasedTableFactory(table_options)); + ROCKSDB_NAMESPACE::NewBlockBasedTableFactory(table_options)); - status = rocksdb::DestroyDB(path, options); + status = ROCKSDB_NAMESPACE::DestroyDB(path, options); assert(status.ok()); - rocksdb::DB* db_raw; - status = rocksdb::DB::Open(options, path, &db_raw); + ROCKSDB_NAMESPACE::DB* db_raw; + status = ROCKSDB_NAMESPACE::DB::Open(options, path, &db_raw); assert(status.ok()); - std::unique_ptr db(db_raw); + std::unique_ptr db(db_raw); std::vector shard_states(FLAGS_shards + 1); std::deque readers; diff --git a/db/import_column_family_job.cc b/db/import_column_family_job.cc index eb73ef6441..15af1cf809 100644 --- a/db/import_column_family_job.cc +++ b/db/import_column_family_job.cc @@ -16,7 +16,7 @@ #include "table/table_builder.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status ImportColumnFamilyJob::Prepare(uint64_t next_file_number, SuperVersion* sv) { @@ -271,6 +271,6 @@ Status ImportColumnFamilyJob::GetIngestedFileInfo( return status; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/db/import_column_family_job.h b/db/import_column_family_job.h index 1bdb4fb2bb..160fd1247a 100644 --- a/db/import_column_family_job.h +++ b/db/import_column_family_job.h @@ -14,7 +14,7 @@ #include "rocksdb/sst_file_writer.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Imports a set of sst files as is into a new column family. Logic is similar // to ExternalSstFileIngestionJob. @@ -69,4 +69,4 @@ class ImportColumnFamilyJob { std::vector metadata_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/import_column_family_test.cc b/db/import_column_family_test.cc index 1138b16bae..a25560b7c3 100644 --- a/db/import_column_family_test.cc +++ b/db/import_column_family_test.cc @@ -7,7 +7,7 @@ #include "rocksdb/sst_file_writer.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ImportColumnFamilyTest : public DBTestBase { public: @@ -546,10 +546,10 @@ TEST_F(ImportColumnFamilyTest, ImportColumnFamilyNegativeTest) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/internal_stats.cc b/db/internal_stats.cc index 28e9aae4e5..f729ee7c74 100644 --- a/db/internal_stats.cc +++ b/db/internal_stats.cc @@ -22,7 +22,7 @@ #include "table/block_based/block_based_table_factory.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE @@ -1421,4 +1421,4 @@ const DBPropertyInfo* GetPropertyInfo(const Slice& /*property*/) { #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/internal_stats.h b/db/internal_stats.h index aa4eda537b..ce83be2447 100644 --- a/db/internal_stats.h +++ b/db/internal_stats.h @@ -17,7 +17,7 @@ class ColumnFamilyData; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBImpl; class MemTableList; @@ -694,4 +694,4 @@ class InternalStats { }; #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/job_context.h b/db/job_context.h index 3978fad33c..31ff26c3af 100644 --- a/db/job_context.h +++ b/db/job_context.h @@ -15,7 +15,7 @@ #include "db/log_writer.h" #include "db/column_family.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MemTable; struct SuperVersion; @@ -216,4 +216,4 @@ struct JobContext { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/listener_test.cc b/db/listener_test.cc index 0e8bae4078..eb1a08a354 100644 --- a/db/listener_test.cc +++ b/db/listener_test.cc @@ -37,7 +37,7 @@ #ifndef ROCKSDB_LITE -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class EventListenerTest : public DBTestBase { public: @@ -54,24 +54,27 @@ class EventListenerTest : public DBTestBase { const size_t k110KB = 110 << 10; }; -struct TestPropertiesCollector : public rocksdb::TablePropertiesCollector { - rocksdb::Status AddUserKey(const rocksdb::Slice& /*key*/, - const rocksdb::Slice& /*value*/, - rocksdb::EntryType /*type*/, - rocksdb::SequenceNumber /*seq*/, - uint64_t /*file_size*/) override { +struct TestPropertiesCollector + : public ROCKSDB_NAMESPACE::TablePropertiesCollector { + ROCKSDB_NAMESPACE::Status AddUserKey( + const ROCKSDB_NAMESPACE::Slice& /*key*/, + const ROCKSDB_NAMESPACE::Slice& /*value*/, + ROCKSDB_NAMESPACE::EntryType /*type*/, + ROCKSDB_NAMESPACE::SequenceNumber /*seq*/, + uint64_t /*file_size*/) override { return Status::OK(); } - rocksdb::Status Finish( - rocksdb::UserCollectedProperties* properties) override { + ROCKSDB_NAMESPACE::Status Finish( + ROCKSDB_NAMESPACE::UserCollectedProperties* properties) override { properties->insert({"0", "1"}); return Status::OK(); } const char* Name() const override { return "TestTablePropertiesCollector"; } - rocksdb::UserCollectedProperties GetReadableProperties() const override { - rocksdb::UserCollectedProperties ret; + ROCKSDB_NAMESPACE::UserCollectedProperties GetReadableProperties() + const override { + ROCKSDB_NAMESPACE::UserCollectedProperties ret; ret["2"] = "3"; return ret; } @@ -912,10 +915,10 @@ TEST_F(EventListenerTest, BackgroundErrorListenerFailedFlushTest) { // the usual TEST_WaitForFlushMemTable() doesn't work for failed flushes, so // forge a custom one for the failed flush case. - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"DBImpl::BGWorkFlush:done", "EventListenerTest:BackgroundErrorListenerFailedFlushTest:1"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); env_->drop_writes_.store(true, std::memory_order_release); env_->no_slowdown_ = true; @@ -1029,7 +1032,7 @@ TEST_F(EventListenerTest, OnFileOperationTest) { ASSERT_GT(listener->file_reads_.load(), 0); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/log_format.h b/db/log_format.h index 5aeb5aa5fd..c22e2b6bce 100644 --- a/db/log_format.h +++ b/db/log_format.h @@ -11,7 +11,10 @@ // See ../doc/log_format.txt for more detail. #pragma once -namespace rocksdb { + +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { namespace log { enum RecordType { @@ -42,4 +45,4 @@ static const int kHeaderSize = 4 + 2 + 1; static const int kRecyclableHeaderSize = 4 + 2 + 1 + 4; } // namespace log -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/log_reader.cc b/db/log_reader.cc index 3a71cbc429..c60a814b99 100644 --- a/db/log_reader.cc +++ b/db/log_reader.cc @@ -17,7 +17,7 @@ #include "util/crc32c.h" #include "util/util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace log { Reader::Reporter::~Reporter() { @@ -621,4 +621,4 @@ bool FragmentBufferedReader::TryReadFragment( } } // namespace log -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/log_reader.h b/db/log_reader.h index 299eca26e4..293ae957c4 100644 --- a/db/log_reader.h +++ b/db/log_reader.h @@ -17,7 +17,7 @@ #include "rocksdb/slice.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Logger; namespace log { @@ -186,4 +186,4 @@ class FragmentBufferedReader : public Reader { }; } // namespace log -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/log_test.cc b/db/log_test.cc index b76e221184..849b89d8ae 100644 --- a/db/log_test.cc +++ b/db/log_test.cc @@ -19,7 +19,7 @@ #include "util/crc32c.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace log { // Construct a string of the specified length made out of the supplied @@ -920,7 +920,7 @@ TEST_P(RetriableLogTest, NonBlockingReadFullRecord) { INSTANTIATE_TEST_CASE_P(bool, RetriableLogTest, ::testing::Values(0, 2)); } // namespace log -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/log_writer.cc b/db/log_writer.cc index 53efc6c15b..0222ee2a72 100644 --- a/db/log_writer.cc +++ b/db/log_writer.cc @@ -15,7 +15,7 @@ #include "util/coding.h" #include "util/crc32c.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace log { Writer::Writer(std::unique_ptr&& dest, uint64_t log_number, @@ -159,4 +159,4 @@ Status Writer::EmitPhysicalRecord(RecordType t, const char* ptr, size_t n) { } } // namespace log -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/log_writer.h b/db/log_writer.h index e5ed71a764..a7f952eddb 100644 --- a/db/log_writer.h +++ b/db/log_writer.h @@ -16,7 +16,7 @@ #include "rocksdb/slice.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WritableFileWriter; @@ -111,4 +111,4 @@ class Writer { }; } // namespace log -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/logs_with_prep_tracker.cc b/db/logs_with_prep_tracker.cc index 1082dc102a..ff98155c45 100644 --- a/db/logs_with_prep_tracker.cc +++ b/db/logs_with_prep_tracker.cc @@ -7,7 +7,7 @@ #include "port/likely.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void LogsWithPrepTracker::MarkLogAsHavingPrepSectionFlushed(uint64_t log) { assert(log != 0); std::lock_guard lock(prepared_section_completed_mutex_); @@ -64,4 +64,4 @@ uint64_t LogsWithPrepTracker::FindMinLogContainingOutstandingPrep() { // no such log found return 0; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/logs_with_prep_tracker.h b/db/logs_with_prep_tracker.h index 639d8f8069..86c88012ad 100644 --- a/db/logs_with_prep_tracker.h +++ b/db/logs_with_prep_tracker.h @@ -12,7 +12,9 @@ #include #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { // This class is used to track the log files with outstanding prepare entries. class LogsWithPrepTracker { @@ -58,4 +60,4 @@ class LogsWithPrepTracker { std::mutex prepared_section_completed_mutex_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/lookup_key.h b/db/lookup_key.h index 1b0f6f5629..51e5daed1f 100644 --- a/db/lookup_key.h +++ b/db/lookup_key.h @@ -14,7 +14,7 @@ #include "rocksdb/slice.h" #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A helper class useful for DBImpl::Get() class LookupKey { @@ -63,4 +63,4 @@ inline LookupKey::~LookupKey() { if (start_ != space_) delete[] start_; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/malloc_stats.cc b/db/malloc_stats.cc index 1dfe0d55b4..12824e5163 100644 --- a/db/malloc_stats.cc +++ b/db/malloc_stats.cc @@ -15,8 +15,7 @@ #include "port/jemalloc_helper.h" - -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_JEMALLOC @@ -51,5 +50,5 @@ void DumpMallocStats(std::string* stats) { #else void DumpMallocStats(std::string*) {} #endif // ROCKSDB_JEMALLOC -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/db/malloc_stats.h b/db/malloc_stats.h index a2f324ff18..18aff3ad0f 100644 --- a/db/malloc_stats.h +++ b/db/malloc_stats.h @@ -13,7 +13,9 @@ #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { void DumpMallocStats(std::string*); diff --git a/db/manual_compaction_test.cc b/db/manual_compaction_test.cc index 1a69a89dea..22cd919b51 100644 --- a/db/manual_compaction_test.cc +++ b/db/manual_compaction_test.cc @@ -15,7 +15,7 @@ #include "rocksdb/write_batch.h" #include "test_util/testharness.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; namespace { @@ -40,8 +40,8 @@ class ManualCompactionTest : public testing::Test { public: ManualCompactionTest() { // Get rid of any state from an old run. - dbname_ = rocksdb::test::PerThreadDBPath("rocksdb_cbug_test"); - DestroyDB(dbname_, rocksdb::Options()); + dbname_ = ROCKSDB_NAMESPACE::test::PerThreadDBPath("rocksdb_cbug_test"); + DestroyDB(dbname_, ROCKSDB_NAMESPACE::Options()); } std::string dbname_; @@ -71,7 +71,7 @@ TEST_F(ManualCompactionTest, CompactTouchesAllKeys) { options.compaction_style = kCompactionStyleUniversal; } options.create_if_missing = true; - options.compression = rocksdb::kNoCompression; + options.compression = ROCKSDB_NAMESPACE::kNoCompression; options.compaction_filter = new DestroyAllCompactionFilter(); ASSERT_OK(DB::Open(options, dbname_, &db)); @@ -100,45 +100,46 @@ TEST_F(ManualCompactionTest, Test) { // Open database. Disable compression since it affects the creation // of layers and the code below is trying to test against a very // specific scenario. - rocksdb::DB* db; - rocksdb::Options db_options; + ROCKSDB_NAMESPACE::DB* db; + ROCKSDB_NAMESPACE::Options db_options; db_options.write_buffer_size = 1024; db_options.create_if_missing = true; - db_options.compression = rocksdb::kNoCompression; - ASSERT_OK(rocksdb::DB::Open(db_options, dbname_, &db)); + db_options.compression = ROCKSDB_NAMESPACE::kNoCompression; + ASSERT_OK(ROCKSDB_NAMESPACE::DB::Open(db_options, dbname_, &db)); // create first key range - rocksdb::WriteBatch batch; + ROCKSDB_NAMESPACE::WriteBatch batch; for (int i = 0; i < kNumKeys; i++) { batch.Put(Key1(i), "value for range 1 key"); } - ASSERT_OK(db->Write(rocksdb::WriteOptions(), &batch)); + ASSERT_OK(db->Write(ROCKSDB_NAMESPACE::WriteOptions(), &batch)); // create second key range batch.Clear(); for (int i = 0; i < kNumKeys; i++) { batch.Put(Key2(i), "value for range 2 key"); } - ASSERT_OK(db->Write(rocksdb::WriteOptions(), &batch)); + ASSERT_OK(db->Write(ROCKSDB_NAMESPACE::WriteOptions(), &batch)); // delete second key range batch.Clear(); for (int i = 0; i < kNumKeys; i++) { batch.Delete(Key2(i)); } - ASSERT_OK(db->Write(rocksdb::WriteOptions(), &batch)); + ASSERT_OK(db->Write(ROCKSDB_NAMESPACE::WriteOptions(), &batch)); // compact database std::string start_key = Key1(0); std::string end_key = Key1(kNumKeys - 1); - rocksdb::Slice least(start_key.data(), start_key.size()); - rocksdb::Slice greatest(end_key.data(), end_key.size()); + ROCKSDB_NAMESPACE::Slice least(start_key.data(), start_key.size()); + ROCKSDB_NAMESPACE::Slice greatest(end_key.data(), end_key.size()); // commenting out the line below causes the example to work correctly db->CompactRange(CompactRangeOptions(), &least, &greatest); // count the keys - rocksdb::Iterator* iter = db->NewIterator(rocksdb::ReadOptions()); + ROCKSDB_NAMESPACE::Iterator* iter = + db->NewIterator(ROCKSDB_NAMESPACE::ReadOptions()); int num_keys = 0; for (iter->SeekToFirst(); iter->Valid(); iter->Next()) { num_keys++; @@ -148,7 +149,7 @@ TEST_F(ManualCompactionTest, Test) { // close database delete db; - DestroyDB(dbname_, rocksdb::Options()); + DestroyDB(dbname_, ROCKSDB_NAMESPACE::Options()); } } // anonymous namespace diff --git a/db/memtable.cc b/db/memtable.cc index c19656ccd2..45483ea096 100644 --- a/db/memtable.cc +++ b/db/memtable.cc @@ -38,7 +38,7 @@ #include "util/mutexlock.h" #include "util/util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { ImmutableMemTableOptions::ImmutableMemTableOptions( const ImmutableCFOptions& ioptions, @@ -127,10 +127,10 @@ MemTable::~MemTable() { } size_t MemTable::ApproximateMemoryUsage() { - autovector usages = {arena_.ApproximateMemoryUsage(), - table_->ApproximateMemoryUsage(), - range_del_table_->ApproximateMemoryUsage(), - rocksdb::ApproximateMemoryUsage(insert_hints_)}; + autovector usages = { + arena_.ApproximateMemoryUsage(), table_->ApproximateMemoryUsage(), + range_del_table_->ApproximateMemoryUsage(), + ROCKSDB_NAMESPACE::ApproximateMemoryUsage(insert_hints_)}; size_t total_usage = 0; for (size_t usage : usages) { // If usage + total_usage >= kMaxSizet, return kMaxSizet. @@ -668,7 +668,7 @@ static bool SaveValue(void* arg, const char* entry) { ROCKS_LOG_ERROR(s->logger, "Encounter unexpected blob index."); *(s->status) = Status::NotSupported( "Encounter unsupported blob value. Please open DB with " - "rocksdb::blob_db::BlobDB instead."); + "ROCKSDB_NAMESPACE::blob_db::BlobDB instead."); } else if (*(s->merge_in_progress)) { *(s->status) = Status::NotSupported("Blob DB does not support merge operator."); @@ -1119,4 +1119,4 @@ uint64_t MemTable::GetMinLogContainingPrepSection() { return min_prep_log_referenced_.load(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/memtable.h b/db/memtable.h index 961707008a..f4e4b98a92 100644 --- a/db/memtable.h +++ b/db/memtable.h @@ -30,7 +30,7 @@ #include "util/dynamic_bloom.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct FlushJobInfo; class Mutex; @@ -539,4 +539,4 @@ class MemTable { extern const char* EncodeKey(std::string* scratch, const Slice& target); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/memtable_list.cc b/db/memtable_list.cc index 3281c96d04..a8b358fa6b 100644 --- a/db/memtable_list.cc +++ b/db/memtable_list.cc @@ -22,7 +22,7 @@ #include "test_util/sync_point.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class InternalKeyComparator; class Mutex; @@ -768,4 +768,4 @@ void MemTableList::RemoveOldMemTables(uint64_t log_number, ResetTrimHistoryNeeded(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/memtable_list.h b/db/memtable_list.h index cbf42ac080..a6acf6a324 100644 --- a/db/memtable_list.h +++ b/db/memtable_list.h @@ -25,7 +25,7 @@ #include "rocksdb/types.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ColumnFamilyData; class InternalKeyComparator; @@ -419,4 +419,4 @@ extern Status InstallMemtableAtomicFlushResults( InstrumentedMutex* mu, const autovector& file_meta, autovector* to_delete, Directory* db_directory, LogBuffer* log_buffer); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/memtable_list_test.cc b/db/memtable_list_test.cc index 7df20674ad..a92bc6c795 100644 --- a/db/memtable_list_test.cc +++ b/db/memtable_list_test.cc @@ -17,7 +17,7 @@ #include "test_util/testutil.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MemTableListTest : public testing::Test { public: @@ -914,7 +914,7 @@ TEST_F(MemTableListTest, AtomicFlusTest) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/merge_context.h b/db/merge_context.h index 884682eecc..e1869a341b 100644 --- a/db/merge_context.h +++ b/db/merge_context.h @@ -10,7 +10,7 @@ #include #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const std::vector empty_operand_list; @@ -131,4 +131,4 @@ class MergeContext { bool operands_reversed_ = true; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/merge_helper.cc b/db/merge_helper.cc index b5ae924ffc..96fe792519 100644 --- a/db/merge_helper.cc +++ b/db/merge_helper.cc @@ -17,7 +17,7 @@ #include "table/format.h" #include "table/internal_iterator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { MergeHelper::MergeHelper(Env* env, const Comparator* user_comparator, const MergeOperator* user_merge_operator, @@ -414,4 +414,4 @@ CompactionFilter::Decision MergeHelper::FilterMerge(const Slice& user_key, return ret; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/merge_helper.h b/db/merge_helper.h index 670cba5983..c0534f08ba 100644 --- a/db/merge_helper.h +++ b/db/merge_helper.h @@ -18,7 +18,7 @@ #include "rocksdb/slice.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Comparator; class Iterator; @@ -191,4 +191,4 @@ class MergeOutputIterator { std::vector::const_reverse_iterator it_values_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/merge_helper_test.cc b/db/merge_helper_test.cc index 3386f9bd06..117916c8ff 100644 --- a/db/merge_helper_test.cc +++ b/db/merge_helper_test.cc @@ -14,7 +14,7 @@ #include "util/coding.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MergeHelperTest : public testing::Test { public: @@ -282,7 +282,7 @@ TEST_F(MergeHelperTest, DontFilterMergeOperandsBeforeSnapshotTest) { ASSERT_FALSE(merge_output_iter.Valid()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/merge_operator.cc b/db/merge_operator.cc index 1981e65ba4..75dea432ca 100644 --- a/db/merge_operator.cc +++ b/db/merge_operator.cc @@ -9,7 +9,7 @@ #include "rocksdb/merge_operator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { bool MergeOperator::FullMergeV2(const MergeOperationInput& merge_in, MergeOperationOutput* merge_out) const { @@ -83,4 +83,4 @@ bool AssociativeMergeOperator::PartialMerge( return Merge(key, &left_operand, right_operand, new_value, logger); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/merge_test.cc b/db/merge_test.cc index 2965045d9d..3f85f64641 100644 --- a/db/merge_test.cc +++ b/db/merge_test.cc @@ -20,7 +20,7 @@ #include "test_util/testharness.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { bool use_compression; @@ -346,7 +346,7 @@ void testPartialMerge(Counters* counters, DB* db, size_t max_merge, // Test case 2: partial merge should not be called when a put is found. resetNumPartialMergeCalls(); tmp_sum = 0; - db->Put(rocksdb::WriteOptions(), "c", "10"); + db->Put(ROCKSDB_NAMESPACE::WriteOptions(), "c", "10"); for (size_t i = 1; i <= count; i++) { counters->assert_add("c", i); tmp_sum += i; @@ -490,15 +490,15 @@ TEST_F(MergeTest, MergeDbTtlTest) { } #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::use_compression = false; + ROCKSDB_NAMESPACE::use_compression = false; if (argc > 1) { - rocksdb::use_compression = true; + ROCKSDB_NAMESPACE::use_compression = true; } - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/obsolete_files_test.cc b/db/obsolete_files_test.cc index 096a50c1ae..bf018a0e39 100644 --- a/db/obsolete_files_test.cc +++ b/db/obsolete_files_test.cc @@ -32,7 +32,7 @@ using std::cout; using std::endl; using std::flush; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ObsoleteFilesTest : public DBTestBase { public: @@ -193,7 +193,7 @@ TEST_F(ObsoleteFilesTest, DeleteObsoleteOptionsFile) { ASSERT_EQ(2, opts_file_count); } -} //namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS extern "C" { @@ -204,7 +204,7 @@ void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {} #endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/db/options_file_test.cc b/db/options_file_test.cc index b86ecefa97..00427de8ab 100644 --- a/db/options_file_test.cc +++ b/db/options_file_test.cc @@ -12,7 +12,7 @@ #include "rocksdb/table.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class OptionsFileTest : public testing::Test { public: OptionsFileTest() : dbname_(test::PerThreadDBPath("options_file_test")) {} @@ -98,7 +98,7 @@ TEST_F(OptionsFileTest, OptionsFileName) { ASSERT_EQ(type, kTempFile); ASSERT_EQ(number, kTempOptionsFileNum); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { #if !(defined NDEBUG) || !defined(OS_WIN) diff --git a/db/perf_context_test.cc b/db/perf_context_test.cc index 94eabff7ff..86f2db7b6a 100644 --- a/db/perf_context_test.cc +++ b/db/perf_context_test.cc @@ -31,9 +31,10 @@ int FLAGS_min_write_buffer_number_to_merge = 7; bool FLAGS_verbose = false; // Path to the database on file system -const std::string kDbName = rocksdb::test::PerThreadDBPath("perf_context_test"); +const std::string kDbName = + ROCKSDB_NAMESPACE::test::PerThreadDBPath("perf_context_test"); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::shared_ptr OpenDb(bool read_only = false) { DB* db; @@ -47,7 +48,8 @@ std::shared_ptr OpenDb(bool read_only = false) { if (FLAGS_use_set_based_memetable) { #ifndef ROCKSDB_LITE - options.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform(0)); + options.prefix_extractor.reset( + ROCKSDB_NAMESPACE::NewFixedPrefixTransform(0)); options.memtable_factory.reset(NewHashSkipListRepFactory()); #endif // ROCKSDB_LITE } @@ -585,7 +587,7 @@ TEST_F(PerfContextTest, DBMutexLockCounter) { for (int c = 0; c < 2; ++c) { InstrumentedMutex mutex(nullptr, Env::Default(), stats_code[c]); mutex.Lock(); - rocksdb::port::Thread child_thread([&] { + ROCKSDB_NAMESPACE::port::Thread child_thread([&] { SetPerfLevel(perf_level_test); get_perf_context()->Reset(); ASSERT_EQ(get_perf_context()->db_mutex_lock_nanos, 0); @@ -938,7 +940,7 @@ TEST_F(PerfContextTest, CPUTimer) { ASSERT_EQ(count, get_perf_context()->iter_seek_cpu_nanos); } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/pinned_iterators_manager.h b/db/pinned_iterators_manager.h index 7874eef6d7..5e8ad51dd0 100644 --- a/db/pinned_iterators_manager.h +++ b/db/pinned_iterators_manager.h @@ -11,7 +11,7 @@ #include "table/internal_iterator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // PinnedIteratorsManager will be notified whenever we need to pin an Iterator // and it will be responsible for deleting pinned Iterators when they are @@ -84,4 +84,4 @@ class PinnedIteratorsManager : public Cleanable { std::vector> pinned_ptrs_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/plain_table_db_test.cc b/db/plain_table_db_test.cc index f5dcf02008..d80cc4f67b 100644 --- a/db/plain_table_db_test.cc +++ b/db/plain_table_db_test.cc @@ -39,7 +39,7 @@ using std::unique_ptr; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class PlainTableKeyDecoderTest : public testing::Test {}; TEST_F(PlainTableKeyDecoderTest, ReadNonMmap) { @@ -653,9 +653,9 @@ TEST_P(PlainTableDBTest, Immortal) { dbfull()->TEST_FlushMemTable(); int copied = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "GetContext::SaveValue::PinSelf", [&](void* /*arg*/) { copied++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_EQ("b", Get("0000000000000bar")); ASSERT_EQ("v1", Get("1000000000000foo")); ASSERT_EQ(2, copied); @@ -672,7 +672,7 @@ TEST_P(PlainTableDBTest, Immortal) { } else { ASSERT_EQ(2, copied); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } @@ -1357,7 +1357,7 @@ TEST_P(PlainTableDBTest, AdaptiveTable) { INSTANTIATE_TEST_CASE_P(PlainTableDBTest, PlainTableDBTest, ::testing::Bool()); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/pre_release_callback.h b/db/pre_release_callback.h index e4167904ff..b74be95375 100644 --- a/db/pre_release_callback.h +++ b/db/pre_release_callback.h @@ -7,7 +7,7 @@ #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DB; @@ -35,4 +35,4 @@ class PreReleaseCallback { uint64_t log_number, size_t index, size_t total) = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/prefix_test.cc b/db/prefix_test.cc index 19f02f1099..c61ec2a1ea 100644 --- a/db/prefix_test.cc +++ b/db/prefix_test.cc @@ -53,9 +53,10 @@ DEFINE_int32(value_size, 40, ""); DEFINE_bool(enable_print, false, "Print options generated to console."); // Path to the database on file system -const std::string kDbName = rocksdb::test::PerThreadDBPath("prefix_test"); +const std::string kDbName = + ROCKSDB_NAMESPACE::test::PerThreadDBPath("prefix_test"); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct TestKey { uint64_t prefix; @@ -871,7 +872,7 @@ TEST_F(PrefixTest, PrefixSeekModePrev3) { } } -} // end namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/range_del_aggregator.cc b/db/range_del_aggregator.cc index c8d33ffb38..1f6a7b139e 100644 --- a/db/range_del_aggregator.cc +++ b/db/range_del_aggregator.cc @@ -20,7 +20,7 @@ #include "util/kv_map.h" #include "util/vector_iterator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { TruncatedRangeDelIterator::TruncatedRangeDelIterator( std::unique_ptr iter, @@ -481,4 +481,4 @@ CompactionRangeDelAggregator::NewIterator(const Slice* lower_bound, kMaxSequenceNumber /* upper_bound */)); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/range_del_aggregator.h b/db/range_del_aggregator.h index c68d75d7fe..b47cf31d35 100644 --- a/db/range_del_aggregator.h +++ b/db/range_del_aggregator.h @@ -27,7 +27,7 @@ #include "util/heap.h" #include "util/kv_map.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TruncatedRangeDelIterator { public: @@ -438,4 +438,4 @@ class CompactionRangeDelAggregator : public RangeDelAggregator { const std::vector* snapshots_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/range_del_aggregator_bench.cc b/db/range_del_aggregator_bench.cc index 97ba6ca4f8..3f3135f2e8 100644 --- a/db/range_del_aggregator_bench.cc +++ b/db/range_del_aggregator_bench.cc @@ -84,11 +84,12 @@ std::ostream& operator<<(std::ostream& os, const Stats& s) { return os; } -auto icmp = rocksdb::InternalKeyComparator(rocksdb::BytewiseComparator()); +auto icmp = ROCKSDB_NAMESPACE::InternalKeyComparator( + ROCKSDB_NAMESPACE::BytewiseComparator()); } // anonymous namespace -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -165,30 +166,31 @@ static std::string Key(int64_t val) { } // anonymous namespace -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ParseCommandLineFlags(&argc, &argv, true); Stats stats; - rocksdb::Random64 rnd(FLAGS_seed); + ROCKSDB_NAMESPACE::Random64 rnd(FLAGS_seed); std::default_random_engine random_gen(FLAGS_seed); std::normal_distribution normal_dist(FLAGS_tombstone_width_mean, FLAGS_tombstone_width_stddev); - std::vector > + std::vector > all_persistent_range_tombstones(FLAGS_add_tombstones_per_run); for (int i = 0; i < FLAGS_add_tombstones_per_run; i++) { all_persistent_range_tombstones[i] = - std::vector( + std::vector( FLAGS_num_range_tombstones); } - auto mode = rocksdb::RangeDelPositioningMode::kForwardTraversal; + auto mode = ROCKSDB_NAMESPACE::RangeDelPositioningMode::kForwardTraversal; for (int i = 0; i < FLAGS_num_runs; i++) { - rocksdb::ReadRangeDelAggregator range_del_agg( - &icmp, rocksdb::kMaxSequenceNumber /* upper_bound */); + ROCKSDB_NAMESPACE::ReadRangeDelAggregator range_del_agg( + &icmp, ROCKSDB_NAMESPACE::kMaxSequenceNumber /* upper_bound */); - std::vector > + std::vector< + std::unique_ptr > fragmented_range_tombstone_lists(FLAGS_add_tombstones_per_run); for (auto& persistent_range_tombstones : all_persistent_range_tombstones) { @@ -199,41 +201,43 @@ int main(int argc, char** argv) { uint64_t start = rnd.Uniform(FLAGS_tombstone_start_upper_bound); uint64_t end = static_cast( std::round(start + std::max(1.0, normal_dist(random_gen)))); - persistent_range_tombstones[j] = rocksdb::PersistentRangeTombstone( - rocksdb::Key(start), rocksdb::Key(end), j); + persistent_range_tombstones[j] = + ROCKSDB_NAMESPACE::PersistentRangeTombstone( + ROCKSDB_NAMESPACE::Key(start), ROCKSDB_NAMESPACE::Key(end), j); } auto range_del_iter = - rocksdb::MakeRangeDelIterator(persistent_range_tombstones); + ROCKSDB_NAMESPACE::MakeRangeDelIterator(persistent_range_tombstones); fragmented_range_tombstone_lists.emplace_back( - new rocksdb::FragmentedRangeTombstoneList( - rocksdb::MakeRangeDelIterator(persistent_range_tombstones), + new ROCKSDB_NAMESPACE::FragmentedRangeTombstoneList( + ROCKSDB_NAMESPACE::MakeRangeDelIterator( + persistent_range_tombstones), icmp)); - std::unique_ptr + std::unique_ptr fragmented_range_del_iter( - new rocksdb::FragmentedRangeTombstoneIterator( + new ROCKSDB_NAMESPACE::FragmentedRangeTombstoneIterator( fragmented_range_tombstone_lists.back().get(), icmp, - rocksdb::kMaxSequenceNumber)); + ROCKSDB_NAMESPACE::kMaxSequenceNumber)); - rocksdb::StopWatchNano stop_watch_add_tombstones(rocksdb::Env::Default(), - true /* auto_start */); + ROCKSDB_NAMESPACE::StopWatchNano stop_watch_add_tombstones( + ROCKSDB_NAMESPACE::Env::Default(), true /* auto_start */); range_del_agg.AddTombstones(std::move(fragmented_range_del_iter)); stats.time_add_tombstones += stop_watch_add_tombstones.ElapsedNanos(); } - rocksdb::ParsedInternalKey parsed_key; + ROCKSDB_NAMESPACE::ParsedInternalKey parsed_key; parsed_key.sequence = FLAGS_num_range_tombstones / 2; - parsed_key.type = rocksdb::kTypeValue; + parsed_key.type = ROCKSDB_NAMESPACE::kTypeValue; uint64_t first_key = rnd.Uniform(FLAGS_should_delete_upper_bound - FLAGS_should_deletes_per_run + 1); for (int j = 0; j < FLAGS_should_deletes_per_run; j++) { - std::string key_string = rocksdb::Key(first_key + j); + std::string key_string = ROCKSDB_NAMESPACE::Key(first_key + j); parsed_key.user_key = key_string; - rocksdb::StopWatchNano stop_watch_should_delete(rocksdb::Env::Default(), - true /* auto_start */); + ROCKSDB_NAMESPACE::StopWatchNano stop_watch_should_delete( + ROCKSDB_NAMESPACE::Env::Default(), true /* auto_start */); range_del_agg.ShouldDelete(parsed_key, mode); uint64_t call_time = stop_watch_should_delete.ElapsedNanos(); diff --git a/db/range_del_aggregator_test.cc b/db/range_del_aggregator_test.cc index 7ce666326a..0b8b5079cc 100644 --- a/db/range_del_aggregator_test.cc +++ b/db/range_del_aggregator_test.cc @@ -14,7 +14,7 @@ #include "db/range_tombstone_fragmenter.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class RangeDelAggregatorTest : public testing::Test {}; @@ -701,7 +701,7 @@ TEST_F(RangeDelAggregatorTest, {"f", "g", 8}}); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/range_tombstone_fragmenter.cc b/db/range_tombstone_fragmenter.cc index fe64623fee..58426248c3 100644 --- a/db/range_tombstone_fragmenter.cc +++ b/db/range_tombstone_fragmenter.cc @@ -16,7 +16,7 @@ #include "util/kv_map.h" #include "util/vector_iterator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { FragmentedRangeTombstoneList::FragmentedRangeTombstoneList( std::unique_ptr unfragmented_tombstones, @@ -436,4 +436,4 @@ FragmentedRangeTombstoneIterator::SplitBySnapshot( return splits; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/range_tombstone_fragmenter.h b/db/range_tombstone_fragmenter.h index 23a28396fd..63ec24e64f 100644 --- a/db/range_tombstone_fragmenter.h +++ b/db/range_tombstone_fragmenter.h @@ -16,7 +16,7 @@ #include "rocksdb/status.h" #include "table/internal_iterator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct FragmentedRangeTombstoneList { public: @@ -253,4 +253,4 @@ class FragmentedRangeTombstoneIterator : public InternalIterator { mutable InternalKey current_start_key_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/range_tombstone_fragmenter_test.cc b/db/range_tombstone_fragmenter_test.cc index 11f3574967..56234b1dd4 100644 --- a/db/range_tombstone_fragmenter_test.cc +++ b/db/range_tombstone_fragmenter_test.cc @@ -9,7 +9,7 @@ #include "rocksdb/comparator.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class RangeTombstoneFragmenterTest : public testing::Test {}; @@ -544,7 +544,7 @@ TEST_F(RangeTombstoneFragmenterTest, SeekOutOfBounds) { {{"", {}, true /* out of range */}, {"z", {"l", "n", 4}}}); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/read_callback.h b/db/read_callback.h index d8801e6517..fbef1dd0de 100644 --- a/db/read_callback.h +++ b/db/read_callback.h @@ -7,7 +7,7 @@ #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ReadCallback { public: @@ -50,4 +50,4 @@ class ReadCallback { const SequenceNumber min_uncommitted_ = kMinUnCommittedSeq; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/repair.cc b/db/repair.cc index 7091dd83fb..383ffe3a4b 100644 --- a/db/repair.cc +++ b/db/repair.cc @@ -83,7 +83,7 @@ #include "table/scoped_arena_iterator.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -686,6 +686,6 @@ Status RepairDB(const std::string& dbname, const Options& options) { return repairer.Run(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/repair_test.cc b/db/repair_test.cc index d9e0556c6c..ba2bae3d0f 100644 --- a/db/repair_test.cc +++ b/db/repair_test.cc @@ -17,7 +17,7 @@ #include "rocksdb/transaction_log.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE class RepairTest : public DBTestBase { @@ -351,7 +351,7 @@ TEST_F(RepairTest, DbNameContainsTrailingSlash) { ASSERT_EQ(Get("key"), "val"); } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/snapshot_checker.h b/db/snapshot_checker.h index 4d29b83c4f..1d2c2c316b 100644 --- a/db/snapshot_checker.h +++ b/db/snapshot_checker.h @@ -6,7 +6,7 @@ #pragma once #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { enum class SnapshotCheckerResult : int { kInSnapshot = 0, @@ -58,4 +58,4 @@ class WritePreparedSnapshotChecker : public SnapshotChecker { #endif // !ROCKSDB_LITE }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/snapshot_impl.cc b/db/snapshot_impl.cc index 032ef398aa..b9228c797c 100644 --- a/db/snapshot_impl.cc +++ b/db/snapshot_impl.cc @@ -7,7 +7,7 @@ #include "rocksdb/db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { ManagedSnapshot::ManagedSnapshot(DB* db) : db_(db), snapshot_(db->GetSnapshot()) {} @@ -23,4 +23,4 @@ ManagedSnapshot::~ManagedSnapshot() { const Snapshot* ManagedSnapshot::snapshot() { return snapshot_;} -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/snapshot_impl.h b/db/snapshot_impl.h index f6ee47628a..785f814f81 100644 --- a/db/snapshot_impl.h +++ b/db/snapshot_impl.h @@ -12,7 +12,7 @@ #include "rocksdb/db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SnapshotList; @@ -164,4 +164,4 @@ class SnapshotList { uint64_t count_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/table_cache.cc b/db/table_cache.cc index 5dc895d842..411959a33e 100644 --- a/db/table_cache.cc +++ b/db/table_cache.cc @@ -29,7 +29,7 @@ #include "util/coding.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -665,4 +665,4 @@ uint64_t TableCache::ApproximateSize( return result; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/table_cache.h b/db/table_cache.h index 8319901b24..b9de824ee4 100644 --- a/db/table_cache.h +++ b/db/table_cache.h @@ -25,7 +25,7 @@ #include "table/table_reader.h" #include "trace_replay/block_cache_tracer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Env; class Arena; @@ -223,4 +223,4 @@ class TableCache { BlockCacheTracer* const block_cache_tracer_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/table_properties_collector.cc b/db/table_properties_collector.cc index 4dbcd4cc41..d98ff5e9b4 100644 --- a/db/table_properties_collector.cc +++ b/db/table_properties_collector.cc @@ -9,7 +9,7 @@ #include "util/coding.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -71,4 +71,4 @@ uint64_t GetMergeOperands(const UserCollectedProperties& props, props, TablePropertiesNames::kMergeOperands, property_present); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/table_properties_collector.h b/db/table_properties_collector.h index e4d6217157..130eb64d48 100644 --- a/db/table_properties_collector.h +++ b/db/table_properties_collector.h @@ -12,7 +12,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Base class for internal table properties collector. class IntTblPropCollector { @@ -104,4 +104,4 @@ class UserKeyTablePropertiesCollectorFactory std::shared_ptr user_collector_factory_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/table_properties_collector_test.cc b/db/table_properties_collector_test.cc index 9c8129570c..5c202de817 100644 --- a/db/table_properties_collector_test.cc +++ b/db/table_properties_collector_test.cc @@ -25,7 +25,7 @@ #include "test_util/testutil.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TablePropertiesTest : public testing::Test, public testing::WithParamInterface { @@ -507,7 +507,7 @@ INSTANTIATE_TEST_CASE_P(InternalKeyPropertiesCollector, TablePropertiesTest, INSTANTIATE_TEST_CASE_P(CustomizedTablePropertiesCollector, TablePropertiesTest, ::testing::Bool()); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/transaction_log_impl.cc b/db/transaction_log_impl.cc index 6c8f6dac81..56bc161a37 100644 --- a/db/transaction_log_impl.cc +++ b/db/transaction_log_impl.cc @@ -10,7 +10,7 @@ #include "db/write_batch_internal.h" #include "file/sequence_file_reader.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { TransactionLogIteratorImpl::TransactionLogIteratorImpl( const std::string& dir, const ImmutableDBOptions* options, @@ -311,5 +311,5 @@ Status TransactionLogIteratorImpl::OpenLogReader(const LogFile* log_file) { read_options_.verify_checksums_, log_file->LogNumber())); return Status::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/transaction_log_impl.h b/db/transaction_log_impl.h index 7d6993d1d0..eb53daf2b1 100644 --- a/db/transaction_log_impl.h +++ b/db/transaction_log_impl.h @@ -17,7 +17,7 @@ #include "rocksdb/transaction_log.h" #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class LogFileImpl : public LogFile { public: @@ -123,5 +123,5 @@ class TransactionLogIteratorImpl : public TransactionLogIterator { void UpdateCurrentWriteBatch(const Slice& record); Status OpenLogReader(const LogFile* file); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/db/trim_history_scheduler.cc b/db/trim_history_scheduler.cc index 7451ba47d7..d7ca0899f1 100644 --- a/db/trim_history_scheduler.cc +++ b/db/trim_history_scheduler.cc @@ -9,7 +9,7 @@ #include "db/column_family.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void TrimHistoryScheduler::ScheduleWork(ColumnFamilyData* cfd) { std::lock_guard lock(checking_mutex_); @@ -51,4 +51,4 @@ void TrimHistoryScheduler::Clear() { assert(Empty()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/trim_history_scheduler.h b/db/trim_history_scheduler.h index e9013b9647..b17f6170fc 100644 --- a/db/trim_history_scheduler.h +++ b/db/trim_history_scheduler.h @@ -10,7 +10,7 @@ #include #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ColumnFamilyData; @@ -41,4 +41,4 @@ class TrimHistoryScheduler { std::mutex checking_mutex_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/version_builder.cc b/db/version_builder.cc index f2d3acb50d..4694218a1d 100644 --- a/db/version_builder.cc +++ b/db/version_builder.cc @@ -29,7 +29,7 @@ #include "table/table_reader.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { bool NewestFirstBySeqNo(FileMetaData* a, FileMetaData* b) { if (a->fd.largest_seqno != b->fd.largest_seqno) { @@ -542,4 +542,4 @@ void VersionBuilder::MaybeAddFile(VersionStorageInfo* vstorage, int level, rep_->MaybeAddFile(vstorage, level, f); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/version_builder.h b/db/version_builder.h index ba38a2f2a0..87415ed559 100644 --- a/db/version_builder.h +++ b/db/version_builder.h @@ -11,7 +11,7 @@ #include "rocksdb/file_system.h" #include "rocksdb/slice_transform.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TableCache; class VersionStorageInfo; @@ -45,4 +45,4 @@ class VersionBuilder { }; extern bool NewestFirstBySeqNo(FileMetaData* a, FileMetaData* b); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/version_builder_test.cc b/db/version_builder_test.cc index 718e53ccc4..2dda03f310 100644 --- a/db/version_builder_test.cc +++ b/db/version_builder_test.cc @@ -11,7 +11,7 @@ #include "test_util/testutil.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class VersionBuilderTest : public testing::Test { public: @@ -341,7 +341,7 @@ TEST_F(VersionBuilderTest, EstimatedActiveKeys) { (kEntriesPerFile - 2 * kDeletionsPerFile) * kNumFiles); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/version_edit.cc b/db/version_edit.cc index 7c39fb262b..5d17144210 100644 --- a/db/version_edit.cc +++ b/db/version_edit.cc @@ -17,7 +17,7 @@ #include "util/coding.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // The unknown file checksum. const std::string kUnknownFileChecksum(""); // The unknown sst file checksum function name. @@ -799,4 +799,4 @@ std::string VersionEdit::DebugJSON(int edit_num, bool hex_key) const { return jw.Get(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/version_edit.h b/db/version_edit.h index 3aabb9b46e..6d1893f2a3 100644 --- a/db/version_edit.h +++ b/db/version_edit.h @@ -19,7 +19,7 @@ #include "table/table_reader.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class VersionSet; @@ -435,4 +435,4 @@ class VersionEdit { uint32_t remaining_entries_ = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/version_edit_test.cc b/db/version_edit_test.cc index 886935fabd..8bc884df9d 100644 --- a/db/version_edit_test.cc +++ b/db/version_edit_test.cc @@ -12,7 +12,7 @@ #include "test_util/testharness.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static void TestEncodeDecode(const VersionEdit& edit) { std::string encoded, encoded2; @@ -127,7 +127,7 @@ TEST_F(VersionEditTest, ForwardCompatibleNewFile4) { // Call back function to add extra customized builds. bool first = true; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "VersionEdit::EncodeTo:NewFile4:CustomizeFields", [&](void* arg) { std::string* str = reinterpret_cast(arg); PutVarint32(str, 33); @@ -140,9 +140,9 @@ TEST_F(VersionEditTest, ForwardCompatibleNewFile4) { PutLengthPrefixedSlice(str, str2); } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); edit.EncodeTo(&encoded); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); VersionEdit parsed; Status s = parsed.DecodeFrom(encoded); @@ -173,15 +173,15 @@ TEST_F(VersionEditTest, NewFile4NotSupportedField) { std::string encoded; // Call back function to add extra customized builds. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "VersionEdit::EncodeTo:NewFile4:CustomizeFields", [&](void* arg) { std::string* str = reinterpret_cast(arg); const std::string str1 = "s"; PutLengthPrefixedSlice(str, str1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); edit.EncodeTo(&encoded); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); VersionEdit parsed; Status s = parsed.DecodeFrom(encoded); @@ -278,7 +278,7 @@ TEST_F(VersionEditTest, DbId) { TestEncodeDecode(edit); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/version_set.cc b/db/version_set.cc index 515e61fb0a..b413ba50ff 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -54,7 +54,7 @@ #include "util/string_util.h" #include "util/user_comparator_wrapper.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -1859,7 +1859,7 @@ void Version::Get(const ReadOptions& read_options, const LookupKey& k, ROCKS_LOG_ERROR(info_log_, "Encounter unexpected blob index."); *status = Status::NotSupported( "Encounter unexpected blob index. Please open DB with " - "rocksdb::blob_db::BlobDB instead."); + "ROCKSDB_NAMESPACE::blob_db::BlobDB instead."); return; } f = fp.GetNextFile(); @@ -2030,7 +2030,7 @@ void Version::MultiGet(const ReadOptions& read_options, MultiGetRange* range, ROCKS_LOG_ERROR(info_log_, "Encounter unexpected blob index."); *status = Status::NotSupported( "Encounter unexpected blob index. Please open DB with " - "rocksdb::blob_db::BlobDB instead."); + "ROCKSDB_NAMESPACE::blob_db::BlobDB instead."); file_range.MarkKeyDone(iter); continue; } @@ -6001,4 +6001,4 @@ Status ReactiveVersionSet::MaybeSwitchManifest( return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/version_set.h b/db/version_set.h index 667fe56cbd..2ab09a5f80 100644 --- a/db/version_set.h +++ b/db/version_set.h @@ -49,7 +49,7 @@ #include "table/multiget_context.h" #include "trace_replay/block_cache_tracer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace log { class Writer; @@ -279,7 +279,7 @@ class VersionStorageInfo { return files_[level]; } - const rocksdb::LevelFilesBrief& LevelFilesBrief(int level) const { + const ROCKSDB_NAMESPACE::LevelFilesBrief& LevelFilesBrief(int level) const { assert(level < static_cast(level_files_brief_.size())); return level_files_brief_[level]; } @@ -443,7 +443,7 @@ class VersionStorageInfo { std::vector level_max_bytes_; // A short brief metadata of files per level - autovector level_files_brief_; + autovector level_files_brief_; FileIndexer file_indexer_; Arena arena_; // Used to allocate space for file_levels_ @@ -1248,4 +1248,4 @@ class ReactiveVersionSet : public VersionSet { ReactiveVersionSet& operator=(const ReactiveVersionSet&); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/version_set_test.cc b/db/version_set_test.cc index 3baf07e0ad..03e0e26d27 100644 --- a/db/version_set_test.cc +++ b/db/version_set_test.cc @@ -16,7 +16,7 @@ #include "test_util/testutil.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class GenerateLevelFilesBriefTest : public testing::Test { public: @@ -1279,7 +1279,7 @@ INSTANTIATE_TEST_CASE_P( testing::Values(VersionSetTestBase::kColumnFamilyName1, VersionSetTestBase::kColumnFamilyName2, VersionSetTestBase::kColumnFamilyName3)); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/wal_manager.cc b/db/wal_manager.cc index bb74ad03df..5b699274c4 100644 --- a/db/wal_manager.cc +++ b/db/wal_manager.cc @@ -32,7 +32,7 @@ #include "util/mutexlock.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE @@ -507,4 +507,4 @@ Status WalManager::ReadFirstLine(const std::string& fname, } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/wal_manager.h b/db/wal_manager.h index 6c387bf3ac..783bfe99ca 100644 --- a/db/wal_manager.h +++ b/db/wal_manager.h @@ -26,7 +26,7 @@ #include "rocksdb/transaction_log.h" #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE @@ -111,4 +111,4 @@ class WalManager { }; #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/wal_manager_test.cc b/db/wal_manager_test.cc index 4763a6ba22..26bad368e8 100644 --- a/db/wal_manager_test.cc +++ b/db/wal_manager_test.cc @@ -24,7 +24,7 @@ #include "test_util/testutil.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // TODO(icanadi) mock out VersionSet // TODO(icanadi) move other WalManager-specific tests from db_test here @@ -320,7 +320,7 @@ TEST_F(WalManagerTest, TransactionLogIteratorNewFileWhileScanning) { ASSERT_TRUE(iter->status().ok()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/write_batch.cc b/db/write_batch.cc index 43dbd995b7..d578db59ba 100644 --- a/db/write_batch.cc +++ b/db/write_batch.cc @@ -61,7 +61,7 @@ #include "util/string_util.h" #include "util/util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // anon namespace for file-local types namespace { @@ -2089,4 +2089,4 @@ size_t WriteBatchInternal::AppendedByteSize(size_t leftByteSize, } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/write_batch_base.cc b/db/write_batch_base.cc index 5522c1ff77..e4c0e74bd6 100644 --- a/db/write_batch_base.cc +++ b/db/write_batch_base.cc @@ -10,7 +10,7 @@ #include "rocksdb/slice.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Simple implementation of SlicePart variants of Put(). Child classes // can override these method with more performant solutions if they choose. @@ -91,4 +91,4 @@ Status WriteBatchBase::Merge(const SliceParts& key, const SliceParts& value) { return Merge(key_slice, value_slice); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/write_batch_internal.h b/db/write_batch_internal.h index 3810c67227..30c4899651 100644 --- a/db/write_batch_internal.h +++ b/db/write_batch_internal.h @@ -18,7 +18,7 @@ #include "rocksdb/write_batch.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MemTable; class FlushScheduler; @@ -247,4 +247,4 @@ class LocalSavePoint { #endif }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/write_batch_test.cc b/db/write_batch_test.cc index a4c21cf62b..84f9a45ec6 100644 --- a/db/write_batch_test.cc +++ b/db/write_batch_test.cc @@ -21,7 +21,7 @@ #include "test_util/testharness.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static std::string PrintContents(WriteBatch* b) { InternalKeyComparator cmp(BytewiseComparator()); @@ -880,7 +880,7 @@ TEST_F(WriteBatchTest, MemoryLimitTest) { ASSERT_TRUE(s.IsMemoryLimit()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/write_callback.h b/db/write_callback.h index 6517a7c3aa..106d020417 100644 --- a/db/write_callback.h +++ b/db/write_callback.h @@ -7,7 +7,7 @@ #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DB; @@ -24,4 +24,4 @@ class WriteCallback { virtual bool AllowWriteBatching() = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/write_callback_test.cc b/db/write_callback_test.cc index 1ab97b0458..df7d673aa7 100644 --- a/db/write_callback_test.cc +++ b/db/write_callback_test.cc @@ -22,7 +22,7 @@ using std::string; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WriteCallbackTest : public testing::Test { public: @@ -185,7 +185,7 @@ TEST_F(WriteCallbackTest, WriteWithCallbackTest) { std::atomic seq(db_impl->GetLatestSequenceNumber()); ASSERT_EQ(db_impl->GetLatestSequenceNumber(), 0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WriteThread::JoinBatchGroup:Start", [&](void*) { uint64_t cur_threads_joining = threads_joining.fetch_add(1); // Wait for the last joined writer to link to the queue. @@ -197,7 +197,7 @@ TEST_F(WriteCallbackTest, WriteWithCallbackTest) { }); // Verification once writers call JoinBatchGroup. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WriteThread::JoinBatchGroup:Wait", [&](void* arg) { uint64_t cur_threads_linked = threads_linked.fetch_add(1); bool is_leader = false; @@ -236,7 +236,7 @@ TEST_F(WriteCallbackTest, WriteWithCallbackTest) { } }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WriteThread::JoinBatchGroup:DoneWaiting", [&](void* arg) { // check my state auto* writer = reinterpret_cast(arg); @@ -330,7 +330,7 @@ TEST_F(WriteCallbackTest, WriteWithCallbackTest) { } }; - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // do all the writes std::vector threads; @@ -341,7 +341,7 @@ TEST_F(WriteCallbackTest, WriteWithCallbackTest) { t.join(); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); // check for keys string value; @@ -433,7 +433,7 @@ TEST_F(WriteCallbackTest, WriteCallBackTest) { DestroyDB(dbname, options); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/write_controller.cc b/db/write_controller.cc index 558aa72192..5480aabd14 100644 --- a/db/write_controller.cc +++ b/db/write_controller.cc @@ -10,7 +10,7 @@ #include #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::unique_ptr WriteController::GetStopToken() { ++total_stopped_; @@ -125,4 +125,4 @@ CompactionPressureToken::~CompactionPressureToken() { assert(controller_->total_compaction_pressure_ >= 0); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/write_controller.h b/db/write_controller.h index 7c301ce7d2..785ae68965 100644 --- a/db/write_controller.h +++ b/db/write_controller.h @@ -11,7 +11,7 @@ #include #include "rocksdb/rate_limiter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Env; class WriteControllerToken; @@ -141,4 +141,4 @@ class CompactionPressureToken : public WriteControllerToken { virtual ~CompactionPressureToken(); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/write_controller_test.cc b/db/write_controller_test.cc index 919c2c1180..72d116798e 100644 --- a/db/write_controller_test.cc +++ b/db/write_controller_test.cc @@ -10,7 +10,7 @@ #include "rocksdb/env.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WriteControllerTest : public testing::Test {}; @@ -127,7 +127,7 @@ TEST_F(WriteControllerTest, SanityTest) { ASSERT_FALSE(controller.IsStopped()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/db/write_thread.cc b/db/write_thread.cc index 98478e20d4..5f50bba63a 100644 --- a/db/write_thread.cc +++ b/db/write_thread.cc @@ -12,7 +12,7 @@ #include "test_util/sync_point.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { WriteThread::WriteThread(const ImmutableDBOptions& db_options) : max_yield_usec_(db_options.enable_write_thread_adaptive_yield @@ -774,4 +774,4 @@ void WriteThread::WaitForMemTableWriters() { newest_memtable_writer_.store(nullptr); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db/write_thread.h b/db/write_thread.h index e1db970663..8781997143 100644 --- a/db/write_thread.h +++ b/db/write_thread.h @@ -24,7 +24,7 @@ #include "rocksdb/write_batch.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WriteThread { public: @@ -428,4 +428,4 @@ class WriteThread { void CompleteFollower(Writer* w, WriteGroup& write_group); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db_stress_tool/batched_ops_stress.cc b/db_stress_tool/batched_ops_stress.cc index 9adaf2fe2d..ea1fab5696 100644 --- a/db_stress_tool/batched_ops_stress.cc +++ b/db_stress_tool/batched_ops_stress.cc @@ -10,7 +10,7 @@ #ifdef GFLAGS #include "db_stress_tool/db_stress_common.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class BatchedOpsStressTest : public StressTest { public: BatchedOpsStressTest() {} @@ -337,5 +337,5 @@ class BatchedOpsStressTest : public StressTest { StressTest* CreateBatchedOpsStressTest() { return new BatchedOpsStressTest(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/cf_consistency_stress.cc b/db_stress_tool/cf_consistency_stress.cc index d00d6a52b4..ac9c014f79 100644 --- a/db_stress_tool/cf_consistency_stress.cc +++ b/db_stress_tool/cf_consistency_stress.cc @@ -10,7 +10,7 @@ #ifdef GFLAGS #include "db_stress_tool/db_stress_common.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CfConsistencyStressTest : public StressTest { public: CfConsistencyStressTest() : batch_id_(0) {} @@ -579,5 +579,5 @@ StressTest* CreateCfConsistencyStressTest() { return new CfConsistencyStressTest(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress.cc b/db_stress_tool/db_stress.cc index adc159ae6b..e03e967878 100644 --- a/db_stress_tool/db_stress.cc +++ b/db_stress_tool/db_stress.cc @@ -17,5 +17,7 @@ int main() { #else #include -int main(int argc, char** argv) { return rocksdb::db_stress_tool(argc, argv); } +int main(int argc, char** argv) { + return ROCKSDB_NAMESPACE::db_stress_tool(argc, argv); +} #endif // GFLAGS diff --git a/db_stress_tool/db_stress_common.cc b/db_stress_tool/db_stress_common.cc index 8834c533a3..953cfe505f 100644 --- a/db_stress_tool/db_stress_common.cc +++ b/db_stress_tool/db_stress_common.cc @@ -12,16 +12,18 @@ #include "db_stress_tool/db_stress_common.h" #include -rocksdb::DbStressEnvWrapper* db_stress_env = nullptr; -enum rocksdb::CompressionType compression_type_e = rocksdb::kSnappyCompression; -enum rocksdb::CompressionType bottommost_compression_type_e = - rocksdb::kSnappyCompression; -enum rocksdb::ChecksumType checksum_type_e = rocksdb::kCRC32c; +ROCKSDB_NAMESPACE::DbStressEnvWrapper* db_stress_env = nullptr; +enum ROCKSDB_NAMESPACE::CompressionType compression_type_e = + ROCKSDB_NAMESPACE::kSnappyCompression; +enum ROCKSDB_NAMESPACE::CompressionType bottommost_compression_type_e = + ROCKSDB_NAMESPACE::kSnappyCompression; +enum ROCKSDB_NAMESPACE::ChecksumType checksum_type_e = + ROCKSDB_NAMESPACE::kCRC32c; enum RepFactory FLAGS_rep_factory = kSkipList; std::vector sum_probs(100001); int64_t zipf_sum_size = 100000; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Zipfian distribution is generated based on a pre-calculated array. // It should be used before start the stress test. @@ -103,7 +105,7 @@ void PoolSizeChangeThread(void* v) { new_thread_pool_size = 1; } db_stress_env->SetBackgroundThreads(new_thread_pool_size, - rocksdb::Env::Priority::LOW); + ROCKSDB_NAMESPACE::Env::Priority::LOW); // Sleep up to 3 seconds db_stress_env->SleepForMicroseconds( thread->rand.Next() % FLAGS_compaction_thread_pool_adjust_interval * @@ -219,5 +221,5 @@ size_t GenerateValue(uint32_t rand, char* v, size_t max_sz) { v[value_sz] = '\0'; return value_sz; // the size of the value set. } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress_common.h b/db_stress_tool/db_stress_common.h index 47b5cd9f7e..4008055026 100644 --- a/db_stress_tool/db_stress_common.h +++ b/db_stress_tool/db_stress_common.h @@ -232,11 +232,11 @@ const int kRandomValueMaxFactor = 3; const int kValueMaxLen = 100; // wrapped posix or hdfs environment -extern rocksdb::DbStressEnvWrapper* db_stress_env; +extern ROCKSDB_NAMESPACE::DbStressEnvWrapper* db_stress_env; -extern enum rocksdb::CompressionType compression_type_e; -extern enum rocksdb::CompressionType bottommost_compression_type_e; -extern enum rocksdb::ChecksumType checksum_type_e; +extern enum ROCKSDB_NAMESPACE::CompressionType compression_type_e; +extern enum ROCKSDB_NAMESPACE::CompressionType bottommost_compression_type_e; +extern enum ROCKSDB_NAMESPACE::ChecksumType checksum_type_e; enum RepFactory { kSkipList, kHashSkipList, kVectorRep }; @@ -256,61 +256,63 @@ inline enum RepFactory StringToRepFactory(const char* ctype) { extern enum RepFactory FLAGS_rep_factory; -namespace rocksdb { -inline enum rocksdb::CompressionType StringToCompressionType( +namespace ROCKSDB_NAMESPACE { +inline enum ROCKSDB_NAMESPACE::CompressionType StringToCompressionType( const char* ctype) { assert(ctype); - rocksdb::CompressionType ret_compression_type; + ROCKSDB_NAMESPACE::CompressionType ret_compression_type; if (!strcasecmp(ctype, "disable")) { - ret_compression_type = rocksdb::kDisableCompressionOption; + ret_compression_type = ROCKSDB_NAMESPACE::kDisableCompressionOption; } else if (!strcasecmp(ctype, "none")) { - ret_compression_type = rocksdb::kNoCompression; + ret_compression_type = ROCKSDB_NAMESPACE::kNoCompression; } else if (!strcasecmp(ctype, "snappy")) { - ret_compression_type = rocksdb::kSnappyCompression; + ret_compression_type = ROCKSDB_NAMESPACE::kSnappyCompression; } else if (!strcasecmp(ctype, "zlib")) { - ret_compression_type = rocksdb::kZlibCompression; + ret_compression_type = ROCKSDB_NAMESPACE::kZlibCompression; } else if (!strcasecmp(ctype, "bzip2")) { - ret_compression_type = rocksdb::kBZip2Compression; + ret_compression_type = ROCKSDB_NAMESPACE::kBZip2Compression; } else if (!strcasecmp(ctype, "lz4")) { - ret_compression_type = rocksdb::kLZ4Compression; + ret_compression_type = ROCKSDB_NAMESPACE::kLZ4Compression; } else if (!strcasecmp(ctype, "lz4hc")) { - ret_compression_type = rocksdb::kLZ4HCCompression; + ret_compression_type = ROCKSDB_NAMESPACE::kLZ4HCCompression; } else if (!strcasecmp(ctype, "xpress")) { - ret_compression_type = rocksdb::kXpressCompression; + ret_compression_type = ROCKSDB_NAMESPACE::kXpressCompression; } else if (!strcasecmp(ctype, "zstd")) { - ret_compression_type = rocksdb::kZSTD; + ret_compression_type = ROCKSDB_NAMESPACE::kZSTD; } else { fprintf(stderr, "Cannot parse compression type '%s'\n", ctype); - ret_compression_type = rocksdb::kSnappyCompression; // default value + ret_compression_type = + ROCKSDB_NAMESPACE::kSnappyCompression; // default value } - if (ret_compression_type != rocksdb::kDisableCompressionOption && + if (ret_compression_type != ROCKSDB_NAMESPACE::kDisableCompressionOption && !CompressionTypeSupported(ret_compression_type)) { // Use no compression will be more portable but considering this is // only a stress test and snappy is widely available. Use snappy here. - ret_compression_type = rocksdb::kSnappyCompression; + ret_compression_type = ROCKSDB_NAMESPACE::kSnappyCompression; } return ret_compression_type; } -inline enum rocksdb::ChecksumType StringToChecksumType(const char* ctype) { +inline enum ROCKSDB_NAMESPACE::ChecksumType StringToChecksumType( + const char* ctype) { assert(ctype); - auto iter = rocksdb::checksum_type_string_map.find(ctype); - if (iter != rocksdb::checksum_type_string_map.end()) { + auto iter = ROCKSDB_NAMESPACE::checksum_type_string_map.find(ctype); + if (iter != ROCKSDB_NAMESPACE::checksum_type_string_map.end()) { return iter->second; } fprintf(stderr, "Cannot parse checksum type '%s'\n", ctype); - return rocksdb::kCRC32c; + return ROCKSDB_NAMESPACE::kCRC32c; } -inline std::string ChecksumTypeToString(rocksdb::ChecksumType ctype) { +inline std::string ChecksumTypeToString(ROCKSDB_NAMESPACE::ChecksumType ctype) { auto iter = std::find_if( - rocksdb::checksum_type_string_map.begin(), - rocksdb::checksum_type_string_map.end(), - [&](const std::pair& + ROCKSDB_NAMESPACE::checksum_type_string_map.begin(), + ROCKSDB_NAMESPACE::checksum_type_string_map.end(), + [&](const std::pair& name_and_enum_val) { return name_and_enum_val.second == ctype; }); - assert(iter != rocksdb::checksum_type_string_map.end()); + assert(iter != ROCKSDB_NAMESPACE::checksum_type_string_map.end()); return iter->first; } @@ -334,7 +336,7 @@ inline std::vector SplitString(std::string src) { // truncation of constant value on static_cast #pragma warning(disable : 4309) #endif -inline bool GetNextPrefix(const rocksdb::Slice& src, std::string* v) { +inline bool GetNextPrefix(const ROCKSDB_NAMESPACE::Slice& src, std::string* v) { std::string ret = src.ToString(); for (int i = static_cast(ret.size()) - 1; i >= 0; i--) { if (ret[i] != static_cast(255)) { @@ -505,5 +507,5 @@ extern StressTest* CreateBatchedOpsStressTest(); extern StressTest* CreateNonBatchedOpsStressTest(); extern void InitializeHotKeyGenerator(double alpha); extern int64_t GetOneHotKeyID(double rand_seed, int64_t max_key); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress_driver.cc b/db_stress_tool/db_stress_driver.cc index 801cd33db0..59e019c607 100644 --- a/db_stress_tool/db_stress_driver.cc +++ b/db_stress_tool/db_stress_driver.cc @@ -11,7 +11,7 @@ #ifdef GFLAGS #include "db_stress_tool/db_stress_common.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void ThreadBody(void* v) { ThreadState* thread = reinterpret_cast(v); SharedState* shared = thread->shared; @@ -159,5 +159,5 @@ bool RunStressTest(StressTest* stress) { } return true; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress_driver.h b/db_stress_tool/db_stress_driver.h index b2e0590c27..ff701fcb29 100644 --- a/db_stress_tool/db_stress_driver.h +++ b/db_stress_tool/db_stress_driver.h @@ -10,8 +10,8 @@ #ifdef GFLAGS #pragma once #include "db_stress_tool/db_stress_test_base.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern void ThreadBody(void* /*thread_state*/); extern bool RunStressTest(StressTest*); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress_env_wrapper.h b/db_stress_tool/db_stress_env_wrapper.h index 83e1f73914..4111506973 100644 --- a/db_stress_tool/db_stress_env_wrapper.h +++ b/db_stress_tool/db_stress_env_wrapper.h @@ -11,7 +11,7 @@ #pragma once #include "db_stress_tool/db_stress_common.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DbStressEnvWrapper : public EnvWrapper { public: explicit DbStressEnvWrapper(Env* t) : EnvWrapper(t) {} @@ -32,5 +32,5 @@ class DbStressEnvWrapper : public EnvWrapper { // If true, all manifest files will not be delted in DeleteFile(). bool if_preserve_all_manifests = true; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress_gflags.cc b/db_stress_tool/db_stress_gflags.cc index 1c7390c3fb..c12a9a291f 100644 --- a/db_stress_tool/db_stress_gflags.cc +++ b/db_stress_tool/db_stress_gflags.cc @@ -113,20 +113,22 @@ DEFINE_bool(verbose, false, "Verbose"); DEFINE_bool(progress_reports, true, "If true, db_stress will report number of finished operations"); -DEFINE_uint64(db_write_buffer_size, rocksdb::Options().db_write_buffer_size, +DEFINE_uint64(db_write_buffer_size, + ROCKSDB_NAMESPACE::Options().db_write_buffer_size, "Number of bytes to buffer in all memtables before compacting"); -DEFINE_int32(write_buffer_size, - static_cast(rocksdb::Options().write_buffer_size), - "Number of bytes to buffer in memtable before compacting"); +DEFINE_int32( + write_buffer_size, + static_cast(ROCKSDB_NAMESPACE::Options().write_buffer_size), + "Number of bytes to buffer in memtable before compacting"); DEFINE_int32(max_write_buffer_number, - rocksdb::Options().max_write_buffer_number, + ROCKSDB_NAMESPACE::Options().max_write_buffer_number, "The number of in-memory memtables. " "Each memtable is of size FLAGS_write_buffer_size."); DEFINE_int32(min_write_buffer_number_to_merge, - rocksdb::Options().min_write_buffer_number_to_merge, + ROCKSDB_NAMESPACE::Options().min_write_buffer_number_to_merge, "The minimum number of write buffers that will be merged together " "before writing to storage. This is cheap because it is an " "in-memory merge. If this feature is not enabled, then all these " @@ -137,7 +139,7 @@ DEFINE_int32(min_write_buffer_number_to_merge, " each of these individual write buffers."); DEFINE_int32(max_write_buffer_number_to_maintain, - rocksdb::Options().max_write_buffer_number_to_maintain, + ROCKSDB_NAMESPACE::Options().max_write_buffer_number_to_maintain, "The total maximum number of write buffers to maintain in memory " "including copies of buffers that have already been flushed. " "Unlike max_write_buffer_number, this parameter does not affect " @@ -151,7 +153,7 @@ DEFINE_int32(max_write_buffer_number_to_maintain, "'max_write_buffer_number' will be used."); DEFINE_int64(max_write_buffer_size_to_maintain, - rocksdb::Options().max_write_buffer_size_to_maintain, + ROCKSDB_NAMESPACE::Options().max_write_buffer_size_to_maintain, "The total maximum size of write buffers to maintain in memory " "including copies of buffers that have already been flushed. " "Unlike max_write_buffer_number, this parameter does not affect " @@ -165,15 +167,15 @@ DEFINE_int64(max_write_buffer_size_to_maintain, "'max_write_buffer_number' will be used."); DEFINE_double(memtable_prefix_bloom_size_ratio, - rocksdb::Options().memtable_prefix_bloom_size_ratio, + ROCKSDB_NAMESPACE::Options().memtable_prefix_bloom_size_ratio, "creates prefix blooms for memtables, each with size " "`write_buffer_size * memtable_prefix_bloom_size_ratio`."); DEFINE_bool(memtable_whole_key_filtering, - rocksdb::Options().memtable_whole_key_filtering, + ROCKSDB_NAMESPACE::Options().memtable_whole_key_filtering, "Enable whole key filtering in memtables."); -DEFINE_int32(open_files, rocksdb::Options().max_open_files, +DEFINE_int32(open_files, ROCKSDB_NAMESPACE::Options().max_open_files, "Maximum number of files to keep open at the same time " "(use default if == 0)"); @@ -181,36 +183,39 @@ DEFINE_int64(compressed_cache_size, -1, "Number of bytes to use as a cache of compressed data." " Negative means use default settings."); -DEFINE_int32(compaction_style, rocksdb::Options().compaction_style, ""); +DEFINE_int32(compaction_style, ROCKSDB_NAMESPACE::Options().compaction_style, + ""); DEFINE_int32(level0_file_num_compaction_trigger, - rocksdb::Options().level0_file_num_compaction_trigger, + ROCKSDB_NAMESPACE::Options().level0_file_num_compaction_trigger, "Level0 compaction start trigger"); DEFINE_int32(level0_slowdown_writes_trigger, - rocksdb::Options().level0_slowdown_writes_trigger, + ROCKSDB_NAMESPACE::Options().level0_slowdown_writes_trigger, "Number of files in level-0 that will slow down writes"); DEFINE_int32(level0_stop_writes_trigger, - rocksdb::Options().level0_stop_writes_trigger, + ROCKSDB_NAMESPACE::Options().level0_stop_writes_trigger, "Number of files in level-0 that will trigger put stop."); DEFINE_int32(block_size, - static_cast(rocksdb::BlockBasedTableOptions().block_size), + static_cast( + ROCKSDB_NAMESPACE::BlockBasedTableOptions().block_size), "Number of bytes in a block."); -DEFINE_int32( - format_version, - static_cast(rocksdb::BlockBasedTableOptions().format_version), - "Format version of SST files."); +DEFINE_int32(format_version, + static_cast( + ROCKSDB_NAMESPACE::BlockBasedTableOptions().format_version), + "Format version of SST files."); -DEFINE_int32(index_block_restart_interval, - rocksdb::BlockBasedTableOptions().index_block_restart_interval, - "Number of keys between restart points " - "for delta encoding of keys in index block."); +DEFINE_int32( + index_block_restart_interval, + ROCKSDB_NAMESPACE::BlockBasedTableOptions().index_block_restart_interval, + "Number of keys between restart points " + "for delta encoding of keys in index block."); DEFINE_int32(max_background_compactions, - rocksdb::Options().max_background_compactions, + ROCKSDB_NAMESPACE::Options().max_background_compactions, "The maximum number of concurrent background compactions " "that can occur in parallel."); @@ -226,7 +231,8 @@ DEFINE_int32(compaction_thread_pool_variations, 2, "Range of background thread pool size variations when adjusted " "periodically."); -DEFINE_int32(max_background_flushes, rocksdb::Options().max_background_flushes, +DEFINE_int32(max_background_flushes, + ROCKSDB_NAMESPACE::Options().max_background_flushes, "The maximum number of concurrent background flushes " "that can occur in parallel."); @@ -291,25 +297,27 @@ DEFINE_bool(enable_write_thread_adaptive_yield, true, DEFINE_bool(use_blob_db, false, "Use BlobDB."); DEFINE_uint64(blob_db_min_blob_size, - rocksdb::blob_db::BlobDBOptions().min_blob_size, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().min_blob_size, "Smallest blob to store in a file. Blobs smaller than this " "will be inlined with the key in the LSM tree."); DEFINE_uint64(blob_db_bytes_per_sync, - rocksdb::blob_db::BlobDBOptions().bytes_per_sync, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().bytes_per_sync, "Sync blob files once per every N bytes written."); DEFINE_uint64(blob_db_file_size, - rocksdb::blob_db::BlobDBOptions().blob_file_size, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().blob_file_size, "Target size of each blob file."); -DEFINE_bool(blob_db_enable_gc, - rocksdb::blob_db::BlobDBOptions().enable_garbage_collection, - "Enable BlobDB garbage collection."); +DEFINE_bool( + blob_db_enable_gc, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().enable_garbage_collection, + "Enable BlobDB garbage collection."); -DEFINE_double(blob_db_gc_cutoff, - rocksdb::blob_db::BlobDBOptions().garbage_collection_cutoff, - "Cutoff ratio for BlobDB garbage collection."); +DEFINE_double( + blob_db_gc_cutoff, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().garbage_collection_cutoff, + "Cutoff ratio for BlobDB garbage collection."); #endif // !ROCKSDB_LITE static const bool FLAGS_subcompactions_dummy __attribute__((__unused__)) = @@ -341,7 +349,8 @@ DEFINE_bool(partition_filters, false, DEFINE_int32( index_type, - static_cast(rocksdb::BlockBasedTableOptions::kBinarySearch), + static_cast( + ROCKSDB_NAMESPACE::BlockBasedTableOptions::kBinarySearch), "Type of block-based table index (see `enum IndexType` in table.h)"); DEFINE_string(db, "", "Use the db with the following name."); @@ -362,17 +371,17 @@ DEFINE_string( DEFINE_bool(verify_checksum, false, "Verify checksum for every block read from storage"); -DEFINE_bool(mmap_read, rocksdb::Options().allow_mmap_reads, +DEFINE_bool(mmap_read, ROCKSDB_NAMESPACE::Options().allow_mmap_reads, "Allow reads to occur via mmap-ing files"); -DEFINE_bool(mmap_write, rocksdb::Options().allow_mmap_writes, +DEFINE_bool(mmap_write, ROCKSDB_NAMESPACE::Options().allow_mmap_writes, "Allow writes to occur via mmap-ing files"); -DEFINE_bool(use_direct_reads, rocksdb::Options().use_direct_reads, +DEFINE_bool(use_direct_reads, ROCKSDB_NAMESPACE::Options().use_direct_reads, "Use O_DIRECT for reading data"); DEFINE_bool(use_direct_io_for_flush_and_compaction, - rocksdb::Options().use_direct_io_for_flush_and_compaction, + ROCKSDB_NAMESPACE::Options().use_direct_io_for_flush_and_compaction, "Use O_DIRECT for writing data"); DEFINE_bool(statistics, false, "Create database statistics"); @@ -395,17 +404,19 @@ extern std::vector rocksdb_kill_prefix_blacklist; DEFINE_bool(disable_wal, false, "If true, do not write WAL for write."); -DEFINE_uint64(recycle_log_file_num, rocksdb::Options().recycle_log_file_num, +DEFINE_uint64(recycle_log_file_num, + ROCKSDB_NAMESPACE::Options().recycle_log_file_num, "Number of old WAL files to keep around for later recycling"); -DEFINE_int64(target_file_size_base, rocksdb::Options().target_file_size_base, +DEFINE_int64(target_file_size_base, + ROCKSDB_NAMESPACE::Options().target_file_size_base, "Target level-1 file size for compaction"); DEFINE_int32(target_file_size_multiplier, 1, "A multiplier to compute target level-N file size (N >= 2)"); DEFINE_uint64(max_bytes_for_level_base, - rocksdb::Options().max_bytes_for_level_base, + ROCKSDB_NAMESPACE::Options().max_bytes_for_level_base, "Max bytes for level-1"); DEFINE_double(max_bytes_for_level_multiplier, 2, @@ -608,19 +619,20 @@ DEFINE_int32(sync_wal_one_in, 0, "on average. 0 indicates that calls to SyncWAL() are disabled."); DEFINE_bool(avoid_unnecessary_blocking_io, - rocksdb::Options().avoid_unnecessary_blocking_io, + ROCKSDB_NAMESPACE::Options().avoid_unnecessary_blocking_io, "If true, some expensive cleaning up operations will be moved from " "user reads to high-pri background threads."); -DEFINE_bool(write_dbid_to_manifest, rocksdb::Options().write_dbid_to_manifest, +DEFINE_bool(write_dbid_to_manifest, + ROCKSDB_NAMESPACE::Options().write_dbid_to_manifest, "Write DB_ID to manifest"); DEFINE_uint64(max_write_batch_group_size_bytes, - rocksdb::Options().max_write_batch_group_size_bytes, + ROCKSDB_NAMESPACE::Options().max_write_batch_group_size_bytes, "Max write batch group size"); DEFINE_bool(level_compaction_dynamic_level_bytes, - rocksdb::Options().level_compaction_dynamic_level_bytes, + ROCKSDB_NAMESPACE::Options().level_compaction_dynamic_level_bytes, "Use dynamic level"); DEFINE_int32(verify_checksum_one_in, 0, diff --git a/db_stress_tool/db_stress_listener.h b/db_stress_tool/db_stress_listener.h index e0917fa235..bda4ec131e 100644 --- a/db_stress_tool/db_stress_listener.h +++ b/db_stress_tool/db_stress_listener.h @@ -11,7 +11,7 @@ DECLARE_int32(compact_files_one_in); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DbStressListener : public EventListener { public: DbStressListener(const std::string& db_name, @@ -218,5 +218,5 @@ class DbStressListener : public EventListener { std::vector column_families_; std::atomic num_pending_file_creations_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress_shared_state.cc b/db_stress_tool/db_stress_shared_state.cc index c6ff73ce2d..d25a47b1b2 100644 --- a/db_stress_tool/db_stress_shared_state.cc +++ b/db_stress_tool/db_stress_shared_state.cc @@ -11,8 +11,8 @@ #ifdef GFLAGS #include "db_stress_tool/db_stress_shared_state.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const uint32_t SharedState::UNKNOWN_SENTINEL = 0xfffffffe; const uint32_t SharedState::DELETION_SENTINEL = 0xffffffff; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress_shared_state.h b/db_stress_tool/db_stress_shared_state.h index 08c5d5254e..b68670b580 100644 --- a/db_stress_tool/db_stress_shared_state.h +++ b/db_stress_tool/db_stress_shared_state.h @@ -25,7 +25,7 @@ DECLARE_bool(test_batches_snapshots); DECLARE_int32(compaction_thread_pool_adjust_interval); DECLARE_int32(continuous_verification_interval); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class StressTest; // State shared by all concurrent executions of the same benchmark. @@ -386,5 +386,5 @@ struct ThreadState { ThreadState(uint32_t index, SharedState* _shared) : tid(index), rand(1000 + index + _shared->GetSeed()), shared(_shared) {} }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress_stat.h b/db_stress_tool/db_stress_stat.h index 0ec96ff4f4..a38c873349 100644 --- a/db_stress_tool/db_stress_stat.h +++ b/db_stress_tool/db_stress_stat.h @@ -20,10 +20,10 @@ DECLARE_bool(histogram); DECLARE_bool(progress_reports); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Database statistics -static std::shared_ptr dbstats; -static std::shared_ptr dbstats_secondaries; +static std::shared_ptr dbstats; +static std::shared_ptr dbstats_secondaries; class Stats { private: @@ -210,4 +210,4 @@ class Stats { fflush(stdout); } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index f335d52024..66b8537930 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -13,7 +13,7 @@ #include "db_stress_tool/db_stress_driver.h" #include "rocksdb/convenience.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { StressTest::StressTest() : cache_(NewCache(FLAGS_cache_size)), compressed_cache_(NewLRUCache(FLAGS_compressed_cache_size)), @@ -1376,7 +1376,7 @@ Status StressTest::TestCheckpoint(ThreadState* thread, void StressTest::TestCompactFiles(ThreadState* thread, ColumnFamilyHandle* column_family) { - rocksdb::ColumnFamilyMetaData cf_meta_data; + ROCKSDB_NAMESPACE::ColumnFamilyMetaData cf_meta_data; db_->GetColumnFamilyMetaData(column_family, &cf_meta_data); // Randomly compact up to three consecutive files from a level @@ -1751,7 +1751,7 @@ void StressTest::Open() { options_.max_background_compactions = FLAGS_max_background_compactions; options_.max_background_flushes = FLAGS_max_background_flushes; options_.compaction_style = - static_cast(FLAGS_compaction_style); + static_cast(FLAGS_compaction_style); if (FLAGS_prefix_size >= 0) { options_.prefix_extractor.reset( NewFixedPrefixTransform(FLAGS_prefix_size)); @@ -2129,5 +2129,5 @@ void StressTest::Reopen(ThreadState* thread) { num_times_reopened_); Open(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress_test_base.h b/db_stress_tool/db_stress_test_base.h index 0f0dbbc821..5d88ceb428 100644 --- a/db_stress_tool/db_stress_test_base.h +++ b/db_stress_tool/db_stress_test_base.h @@ -12,7 +12,7 @@ #include "db_stress_tool/db_stress_common.h" #include "db_stress_tool/db_stress_shared_state.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Transaction; class TransactionDB; @@ -227,5 +227,5 @@ class StressTest { std::vector cmp_cfhs_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/db_stress_tool.cc b/db_stress_tool/db_stress_tool.cc index 3ed1cf8388..ddb4c340d2 100644 --- a/db_stress_tool/db_stress_tool.cc +++ b/db_stress_tool/db_stress_tool.cc @@ -24,10 +24,10 @@ #include "db_stress_tool/db_stress_common.h" #include "db_stress_tool/db_stress_driver.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { -static std::shared_ptr env_guard; -static std::shared_ptr env_wrapper_guard; +static std::shared_ptr env_guard; +static std::shared_ptr env_wrapper_guard; } // namespace KeyGenContext key_gen_ctx; @@ -42,9 +42,9 @@ int db_stress_tool(int argc, char** argv) { SanitizeDoubleParam(&FLAGS_max_bytes_for_level_multiplier); if (FLAGS_statistics) { - dbstats = rocksdb::CreateDBStatistics(); + dbstats = ROCKSDB_NAMESPACE::CreateDBStatistics(); if (FLAGS_test_secondary) { - dbstats_secondaries = rocksdb::CreateDBStatistics(); + dbstats_secondaries = ROCKSDB_NAMESPACE::CreateDBStatistics(); } } compression_type_e = StringToCompressionType(FLAGS_compression_type.c_str()); @@ -59,7 +59,7 @@ int db_stress_tool(int argc, char** argv) { fprintf(stderr, "Cannot specify both --hdfs and --env_uri.\n"); exit(1); } - raw_env = new rocksdb::HdfsEnv(FLAGS_hdfs); + raw_env = new ROCKSDB_NAMESPACE::HdfsEnv(FLAGS_hdfs); } else if (!FLAGS_env_uri.empty()) { Status s = Env::LoadEnv(FLAGS_env_uri, &raw_env, &env_guard); if (raw_env == nullptr) { @@ -77,9 +77,9 @@ int db_stress_tool(int argc, char** argv) { // The number of background threads should be at least as much the // max number of concurrent compactions. db_stress_env->SetBackgroundThreads(FLAGS_max_background_compactions, - rocksdb::Env::Priority::LOW); + ROCKSDB_NAMESPACE::Env::Priority::LOW); db_stress_env->SetBackgroundThreads(FLAGS_num_bottom_pri_threads, - rocksdb::Env::Priority::BOTTOM); + ROCKSDB_NAMESPACE::Env::Priority::BOTTOM); if (FLAGS_prefixpercent > 0 && FLAGS_prefix_size < 0) { fprintf(stderr, "Error: prefixpercent is non-zero while prefix_size is " @@ -179,7 +179,7 @@ int db_stress_tool(int argc, char** argv) { std::string default_secondaries_path; db_stress_env->GetTestDirectory(&default_secondaries_path); default_secondaries_path += "/dbstress_secondaries"; - rocksdb::Status s = + ROCKSDB_NAMESPACE::Status s = db_stress_env->CreateDirIfMissing(default_secondaries_path); if (!s.ok()) { fprintf(stderr, "Failed to create directory %s: %s\n", @@ -231,7 +231,7 @@ int db_stress_tool(int argc, char** argv) { keys_per_level * (levels - 1)); } - std::unique_ptr stress; + std::unique_ptr stress; if (FLAGS_test_cf_consistency) { stress.reset(CreateCfConsistencyStressTest()); } else if (FLAGS_test_batches_snapshots) { @@ -248,5 +248,5 @@ int db_stress_tool(int argc, char** argv) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/db_stress_tool/no_batched_ops_stress.cc b/db_stress_tool/no_batched_ops_stress.cc index aa25c8e45c..2e6734f21c 100644 --- a/db_stress_tool/no_batched_ops_stress.cc +++ b/db_stress_tool/no_batched_ops_stress.cc @@ -10,7 +10,7 @@ #ifdef GFLAGS #include "db_stress_tool/db_stress_common.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class NonBatchedOpsStressTest : public StressTest { public: NonBatchedOpsStressTest() {} @@ -627,5 +627,5 @@ StressTest* CreateNonBatchedOpsStressTest() { return new NonBatchedOpsStressTest(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS diff --git a/env/composite_env_wrapper.h b/env/composite_env_wrapper.h index bbe58a4882..fbc0b93fa0 100644 --- a/env/composite_env_wrapper.h +++ b/env/composite_env_wrapper.h @@ -8,7 +8,7 @@ #include "rocksdb/env.h" #include "rocksdb/file_system.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // The CompositeEnvWrapper class provides an interface that is compatible // with the old monolithic Env API, and an implementation that wraps around @@ -1114,4 +1114,4 @@ inline std::unique_ptr NewLegacyWritableFileWrapper( new LegacyWritableFileWrapper(std::move(file))); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/env/env.cc b/env/env.cc index ea8a653c66..70f4b29f7a 100644 --- a/env/env.cc +++ b/env/env.cc @@ -20,7 +20,7 @@ #include "rocksdb/utilities/object_registry.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Env::~Env() { } @@ -472,4 +472,4 @@ Status NewEnvLogger(const std::string& fname, Env* env, return Status::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/env/env_basic_test.cc b/env/env_basic_test.cc index c955bdb714..d2041f780e 100644 --- a/env/env_basic_test.cc +++ b/env/env_basic_test.cc @@ -13,7 +13,7 @@ #include "rocksdb/env.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Normalizes trivial differences across Envs such that these test cases can // run on all Envs. @@ -347,7 +347,7 @@ TEST_P(EnvMoreTestWithParam, GetChildren) { ASSERT_EQ(0U, children.size()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/env/env_chroot.cc b/env/env_chroot.cc index 8a7fb44999..246437bdd2 100644 --- a/env/env_chroot.cc +++ b/env/env_chroot.cc @@ -18,7 +18,7 @@ #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ChrootEnv : public EnvWrapper { public: @@ -316,6 +316,6 @@ Env* NewChrootEnv(Env* base_env, const std::string& chroot_dir) { return new ChrootEnv(base_env, chroot_dir); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !defined(ROCKSDB_LITE) && !defined(OS_WIN) diff --git a/env/env_chroot.h b/env/env_chroot.h index b2760bc0a3..cb5585b3b7 100644 --- a/env/env_chroot.h +++ b/env/env_chroot.h @@ -11,12 +11,12 @@ #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Returns an Env that translates paths such that the root directory appears to // be chroot_dir. chroot_dir should refer to an existing directory. Env* NewChrootEnv(Env* base_env, const std::string& chroot_dir); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !defined(ROCKSDB_LITE) && !defined(OS_WIN) diff --git a/env/env_encryption.cc b/env/env_encryption.cc index b7095c0f57..5f4f65d75f 100644 --- a/env/env_encryption.cc +++ b/env/env_encryption.cc @@ -17,7 +17,7 @@ #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE @@ -934,4 +934,4 @@ Status CTREncryptionProvider::CreateCipherStreamFromPrefix( #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/env/env_hdfs.cc b/env/env_hdfs.cc index 207f0815bc..cb84dcc648 100644 --- a/env/env_hdfs.cc +++ b/env/env_hdfs.cc @@ -31,7 +31,7 @@ // will reside on the same HDFS cluster. // -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -614,14 +614,14 @@ Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname) { *hdfs_env = new HdfsEnv(fsname); return Status::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_HDFS_FILE_C #else // USE_HDFS // dummy placeholders used when HDFS is not available -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status HdfsEnv::NewSequentialFile(const std::string& /*fname*/, std::unique_ptr* /*result*/, const EnvOptions& /*options*/) { @@ -631,6 +631,6 @@ Status HdfsEnv::NewSequentialFile(const std::string& /*fname*/, Status NewHdfsEnv(Env** /*hdfs_env*/, const std::string& /*fsname*/) { return Status::NotSupported("Not compiled with hdfs support"); } -} + } // namespace ROCKSDB_NAMESPACE #endif diff --git a/env/env_posix.cc b/env/env_posix.cc index 33b895558e..861fbcf627 100644 --- a/env/env_posix.cc +++ b/env/env_posix.cc @@ -80,7 +80,7 @@ #define EXT4_SUPER_MAGIC 0xEF53 #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #if defined(OS_WIN) static const std::string kSharedLibExt = ".dll"; static const char kPathSeparator = ';'; @@ -524,4 +524,4 @@ Env* Env::Default() { return &composite_env; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/env/env_test.cc b/env/env_test.cc index 6e2420705c..96f47e83e2 100644 --- a/env/env_test.cc +++ b/env/env_test.cc @@ -48,7 +48,7 @@ static const size_t kPageSize = sysconf(_SC_PAGESIZE); static const size_t kPageSize = 4 * 1024; #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const int kDelayMicros = 100000; @@ -1172,18 +1172,18 @@ TEST_P(EnvPosixTestWithParam, DISABLED_InvalidateCache) { #else TEST_P(EnvPosixTestWithParam, InvalidateCache) { #endif - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - EnvOptions soptions; - soptions.use_direct_reads = soptions.use_direct_writes = direct_io_; - std::string fname = test::PerThreadDBPath(env_, "testfile"); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + EnvOptions soptions; + soptions.use_direct_reads = soptions.use_direct_writes = direct_io_; + std::string fname = test::PerThreadDBPath(env_, "testfile"); - const size_t kSectorSize = 512; - auto data = NewAligned(kSectorSize, 0); - Slice slice(data.get(), kSectorSize); + const size_t kSectorSize = 512; + auto data = NewAligned(kSectorSize, 0); + Slice slice(data.get(), kSectorSize); - // Create file. - { - std::unique_ptr wfile; + // Create file. + { + std::unique_ptr wfile; #if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && !defined(OS_AIX) if (soptions.use_direct_writes) { soptions.use_direct_writes = false; @@ -1234,7 +1234,7 @@ TEST_P(EnvPosixTestWithParam, InvalidateCache) { } // Delete the file ASSERT_OK(env_->DeleteFile(fname)); - rocksdb::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); } #endif // not TRAVIS #endif // OS_LINUX || OS_WIN @@ -1357,14 +1357,14 @@ TEST_P(EnvPosixTestWithParam, LogBufferMaxSizeTest) { } TEST_P(EnvPosixTestWithParam, Preallocation) { - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); const std::string src = test::PerThreadDBPath(env_, "testfile"); std::unique_ptr srcfile; EnvOptions soptions; soptions.use_direct_reads = soptions.use_direct_writes = direct_io_; #if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && !defined(OS_AIX) && !defined(OS_OPENBSD) && !defined(OS_FREEBSD) if (soptions.use_direct_writes) { - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "NewWritableFile:O_DIRECT", [&](void* arg) { int* val = static_cast(arg); *val &= ~O_DIRECT; @@ -1407,25 +1407,25 @@ TEST_P(EnvPosixTestWithParam, Preallocation) { srcfile->GetPreallocationStatus(&block_size, &last_allocated_block); ASSERT_EQ(last_allocated_block, 7UL); } - rocksdb::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); } // Test that the two ways to get children file attributes (in bulk or // individually) behave consistently. TEST_P(EnvPosixTestWithParam, ConsistentChildrenAttributes) { - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - EnvOptions soptions; - soptions.use_direct_reads = soptions.use_direct_writes = direct_io_; - const int kNumChildren = 10; + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + EnvOptions soptions; + soptions.use_direct_reads = soptions.use_direct_writes = direct_io_; + const int kNumChildren = 10; - std::string data; - for (int i = 0; i < kNumChildren; ++i) { - const std::string path = - test::TmpDir(env_) + "/" + "testfile_" + std::to_string(i); - std::unique_ptr file; + std::string data; + for (int i = 0; i < kNumChildren; ++i) { + const std::string path = + test::TmpDir(env_) + "/" + "testfile_" + std::to_string(i); + std::unique_ptr file; #if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && !defined(OS_AIX) && !defined(OS_OPENBSD) && !defined(OS_FREEBSD) if (soptions.use_direct_writes) { - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "NewWritableFile:O_DIRECT", [&](void* arg) { int* val = static_cast(arg); *val &= ~O_DIRECT; @@ -1454,7 +1454,7 @@ TEST_P(EnvPosixTestWithParam, ConsistentChildrenAttributes) { ASSERT_EQ(size, 4096 * i); ASSERT_EQ(size, file_attrs_iter->size_bytes); } - rocksdb::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); } // Test that all WritableFileWrapper forwards all calls to WritableFile. @@ -1873,7 +1873,7 @@ INSTANTIATE_TEST_CASE_P( ::testing::Values(std::pair(chroot_env.get(), true))); #endif // !defined(ROCKSDB_LITE) && !defined(OS_WIN) -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/env/file_system.cc b/env/file_system.cc index 4b69548725..646e6e3d11 100644 --- a/env/file_system.cc +++ b/env/file_system.cc @@ -8,7 +8,7 @@ #include "options/db_options.h" #include "rocksdb/utilities/object_registry.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { FileSystem::FileSystem() {} @@ -107,4 +107,4 @@ std::shared_ptr FileSystem::Default() { } #endif -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/env/fs_posix.cc b/env/fs_posix.cc index 2b398f131d..0f1a41ac25 100644 --- a/env/fs_posix.cc +++ b/env/fs_posix.cc @@ -73,7 +73,7 @@ #define EXT4_SUPER_MAGIC 0xEF53 #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -520,7 +520,7 @@ class PosixFileSystem : public FileSystem { } IOStatus NewLogger(const std::string& /*fname*/, const IOOptions& /*opts*/, - std::shared_ptr* /*ptr*/, + std::shared_ptr* /*ptr*/, IODebugContext* /*dbg*/) override { return IOStatus::NotSupported(); } @@ -910,4 +910,4 @@ std::shared_ptr FileSystem::Default() { return default_fs_ptr; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/env/io_posix.cc b/env/io_posix.cc index d550ae8c26..0e2d1d766f 100644 --- a/env/io_posix.cc +++ b/env/io_posix.cc @@ -43,7 +43,7 @@ #define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12) #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A wrapper for fadvise, if the platform doesn't support fadvise, // it will simply return 0. @@ -1314,5 +1314,5 @@ IOStatus PosixDirectory::Fsync(const IOOptions& /*opts*/, #endif return IOStatus::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/env/io_posix.h b/env/io_posix.h index 67fdd95d81..535bd99cd3 100644 --- a/env/io_posix.h +++ b/env/io_posix.h @@ -30,7 +30,7 @@ #define POSIX_FADV_DONTNEED 4 /* [MC1] dont need these pages */ #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static std::string IOErrorMsg(const std::string& context, const std::string& file_name) { if (file_name.empty()) { @@ -323,4 +323,4 @@ class PosixDirectory : public FSDirectory { int fd_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/env/mock_env.cc b/env/mock_env.cc index 6d3adc808e..c246c13e1e 100644 --- a/env/mock_env.cc +++ b/env/mock_env.cc @@ -16,7 +16,7 @@ #include "util/random.h" #include "util/rate_limiter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MemFile { public: @@ -771,4 +771,4 @@ Env* NewMemEnv(Env* /*base_env*/) { return nullptr; } #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/env/mock_env.h b/env/mock_env.h index 87b8deaf8c..145cae067f 100644 --- a/env/mock_env.h +++ b/env/mock_env.h @@ -17,7 +17,7 @@ #include "port/port.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MemFile; class MockEnv : public EnvWrapper { @@ -111,4 +111,4 @@ class MockEnv : public EnvWrapper { std::atomic fake_sleep_micros_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/env/mock_env_test.cc b/env/mock_env_test.cc index b21b953b56..7f339540d8 100644 --- a/env/mock_env_test.cc +++ b/env/mock_env_test.cc @@ -12,7 +12,7 @@ #include "rocksdb/env.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MockEnvTest : public testing::Test { public: @@ -77,7 +77,7 @@ TEST_F(MockEnvTest, FakeSleeping) { ASSERT_TRUE(delta == 3 || delta == 4); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/examples/column_families_example.cc b/examples/column_families_example.cc index 589ff8ec29..df936d46a3 100644 --- a/examples/column_families_example.cc +++ b/examples/column_families_example.cc @@ -10,7 +10,7 @@ #include "rocksdb/slice.h" #include "rocksdb/options.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; std::string kDBPath = "/tmp/rocksdb_column_families_example"; diff --git a/examples/compact_files_example.cc b/examples/compact_files_example.cc index c27df8ee79..a0a9fa90aa 100644 --- a/examples/compact_files_example.cc +++ b/examples/compact_files_example.cc @@ -12,7 +12,7 @@ #include "rocksdb/env.h" #include "rocksdb/options.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; std::string kDBPath = "/tmp/rocksdb_compact_files_example"; struct CompactionTask; diff --git a/examples/compaction_filter_example.cc b/examples/compaction_filter_example.cc index 226dfe7905..cee763195e 100644 --- a/examples/compaction_filter_example.cc +++ b/examples/compaction_filter_example.cc @@ -8,7 +8,7 @@ #include #include -class MyMerge : public rocksdb::MergeOperator { +class MyMerge : public ROCKSDB_NAMESPACE::MergeOperator { public: virtual bool FullMergeV2(const MergeOperationInput& merge_in, MergeOperationOutput* merge_out) const override { @@ -17,7 +17,7 @@ class MyMerge : public rocksdb::MergeOperator { merge_out->new_value.assign(merge_in.existing_value->data(), merge_in.existing_value->size()); } - for (const rocksdb::Slice& m : merge_in.operand_list) { + for (const ROCKSDB_NAMESPACE::Slice& m : merge_in.operand_list) { fprintf(stderr, "Merge(%s)\n", m.ToString().c_str()); // the compaction filter filters out bad values assert(m.ToString() != "bad"); @@ -29,19 +29,20 @@ class MyMerge : public rocksdb::MergeOperator { const char* Name() const override { return "MyMerge"; } }; -class MyFilter : public rocksdb::CompactionFilter { +class MyFilter : public ROCKSDB_NAMESPACE::CompactionFilter { public: - bool Filter(int level, const rocksdb::Slice& key, - const rocksdb::Slice& existing_value, std::string* new_value, - bool* value_changed) const override { + bool Filter(int level, const ROCKSDB_NAMESPACE::Slice& key, + const ROCKSDB_NAMESPACE::Slice& existing_value, + std::string* new_value, bool* value_changed) const override { fprintf(stderr, "Filter(%s)\n", key.ToString().c_str()); ++count_; assert(*value_changed == false); return false; } - bool FilterMergeOperand(int level, const rocksdb::Slice& key, - const rocksdb::Slice& existing_value) const override { + bool FilterMergeOperand( + int level, const ROCKSDB_NAMESPACE::Slice& key, + const ROCKSDB_NAMESPACE::Slice& existing_value) const override { fprintf(stderr, "FilterMerge(%s)\n", key.ToString().c_str()); ++merge_count_; return existing_value == "bad"; @@ -54,8 +55,8 @@ class MyFilter : public rocksdb::CompactionFilter { }; int main() { - rocksdb::DB* raw_db; - rocksdb::Status status; + ROCKSDB_NAMESPACE::DB* raw_db; + ROCKSDB_NAMESPACE::Status status; MyFilter filter; @@ -64,22 +65,22 @@ int main() { fprintf(stderr, "Error deleting /tmp/rocksmergetest, code: %d\n", ret); return ret; } - rocksdb::Options options; + ROCKSDB_NAMESPACE::Options options; options.create_if_missing = true; options.merge_operator.reset(new MyMerge); options.compaction_filter = &filter; - status = rocksdb::DB::Open(options, "/tmp/rocksmergetest", &raw_db); + status = ROCKSDB_NAMESPACE::DB::Open(options, "/tmp/rocksmergetest", &raw_db); assert(status.ok()); - std::unique_ptr db(raw_db); + std::unique_ptr db(raw_db); - rocksdb::WriteOptions wopts; + ROCKSDB_NAMESPACE::WriteOptions wopts; db->Merge(wopts, "0", "bad"); // This is filtered out db->Merge(wopts, "1", "data1"); db->Merge(wopts, "1", "bad"); db->Merge(wopts, "1", "data2"); db->Merge(wopts, "1", "bad"); db->Merge(wopts, "3", "data3"); - db->CompactRange(rocksdb::CompactRangeOptions(), nullptr, nullptr); + db->CompactRange(ROCKSDB_NAMESPACE::CompactRangeOptions(), nullptr, nullptr); fprintf(stderr, "filter.count_ = %d\n", filter.count_); assert(filter.count_ == 0); fprintf(stderr, "filter.merge_count_ = %d\n", filter.merge_count_); diff --git a/examples/multi_processes_example.cc b/examples/multi_processes_example.cc index 921041a576..3241e36ea1 100644 --- a/examples/multi_processes_example.cc +++ b/examples/multi_processes_example.cc @@ -36,17 +36,17 @@ #include "rocksdb/options.h" #include "rocksdb/slice.h" -using rocksdb::ColumnFamilyDescriptor; -using rocksdb::ColumnFamilyHandle; -using rocksdb::ColumnFamilyOptions; -using rocksdb::DB; -using rocksdb::FlushOptions; -using rocksdb::Iterator; -using rocksdb::Options; -using rocksdb::ReadOptions; -using rocksdb::Slice; -using rocksdb::Status; -using rocksdb::WriteOptions; +using ROCKSDB_NAMESPACE::ColumnFamilyDescriptor; +using ROCKSDB_NAMESPACE::ColumnFamilyHandle; +using ROCKSDB_NAMESPACE::ColumnFamilyOptions; +using ROCKSDB_NAMESPACE::DB; +using ROCKSDB_NAMESPACE::FlushOptions; +using ROCKSDB_NAMESPACE::Iterator; +using ROCKSDB_NAMESPACE::Options; +using ROCKSDB_NAMESPACE::ReadOptions; +using ROCKSDB_NAMESPACE::Slice; +using ROCKSDB_NAMESPACE::Status; +using ROCKSDB_NAMESPACE::WriteOptions; const std::string kDBPath = "/tmp/rocksdb_multi_processes_example"; const std::string kPrimaryStatusFile = @@ -57,7 +57,7 @@ const size_t kNumKeysPerFlush = 1000; const std::vector& GetColumnFamilyNames() { static std::vector column_family_names = { - rocksdb::kDefaultColumnFamilyName, "pikachu"}; + ROCKSDB_NAMESPACE::kDefaultColumnFamilyName, "pikachu"}; return column_family_names; } @@ -142,7 +142,7 @@ static bool ShouldCloseDB() { return true; } void CreateDB() { long my_pid = static_cast(getpid()); Options options; - Status s = rocksdb::DestroyDB(kDBPath, options); + Status s = ROCKSDB_NAMESPACE::DestroyDB(kDBPath, options); if (!s.ok()) { fprintf(stderr, "[process %ld] Failed to destroy DB: %s\n", my_pid, s.ToString().c_str()); @@ -159,7 +159,7 @@ void CreateDB() { std::vector handles; ColumnFamilyOptions cf_opts(options); for (const auto& cf_name : GetColumnFamilyNames()) { - if (rocksdb::kDefaultColumnFamilyName != cf_name) { + if (ROCKSDB_NAMESPACE::kDefaultColumnFamilyName != cf_name) { ColumnFamilyHandle* handle = nullptr; s = db->CreateColumnFamily(cf_opts, cf_name, &handle); if (!s.ok()) { diff --git a/examples/optimistic_transaction_example.cc b/examples/optimistic_transaction_example.cc index fda50d6ab3..fd6dbad631 100644 --- a/examples/optimistic_transaction_example.cc +++ b/examples/optimistic_transaction_example.cc @@ -11,7 +11,7 @@ #include "rocksdb/utilities/transaction.h" #include "rocksdb/utilities/optimistic_transaction_db.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; std::string kDBPath = "/tmp/rocksdb_transaction_example"; diff --git a/examples/options_file_example.cc b/examples/options_file_example.cc index 5dd0a479c0..e6a1d0e9a0 100644 --- a/examples/options_file_example.cc +++ b/examples/options_file_example.cc @@ -18,7 +18,7 @@ #include "rocksdb/table.h" #include "rocksdb/utilities/options_util.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; std::string kDBPath = "/tmp/rocksdb_options_file_example"; diff --git a/examples/simple_example.cc b/examples/simple_example.cc index a8f80f091e..256c965d77 100644 --- a/examples/simple_example.cc +++ b/examples/simple_example.cc @@ -10,7 +10,7 @@ #include "rocksdb/slice.h" #include "rocksdb/options.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; std::string kDBPath = "/tmp/rocksdb_simple_example"; diff --git a/examples/transaction_example.cc b/examples/transaction_example.cc index 54a4709c52..41b233544b 100644 --- a/examples/transaction_example.cc +++ b/examples/transaction_example.cc @@ -11,7 +11,7 @@ #include "rocksdb/utilities/transaction.h" #include "rocksdb/utilities/transaction_db.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; std::string kDBPath = "/tmp/rocksdb_transaction_example"; diff --git a/file/delete_scheduler.cc b/file/delete_scheduler.cc index 23bc5fcea4..bb318e5959 100644 --- a/file/delete_scheduler.cc +++ b/file/delete_scheduler.cc @@ -17,7 +17,7 @@ #include "test_util/sync_point.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { DeleteScheduler::DeleteScheduler(Env* env, FileSystem* fs, int64_t rate_bytes_per_sec, Logger* info_log, @@ -352,6 +352,6 @@ void DeleteScheduler::WaitForEmptyTrash() { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/file/delete_scheduler.h b/file/delete_scheduler.h index 4e72296c83..60948480af 100644 --- a/file/delete_scheduler.h +++ b/file/delete_scheduler.h @@ -18,7 +18,7 @@ #include "rocksdb/file_system.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Env; class Logger; @@ -136,6 +136,6 @@ class DeleteScheduler { static const uint64_t kMicrosInSecond = 1000 * 1000LL; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/file/delete_scheduler_test.cc b/file/delete_scheduler_test.cc index 39d7af1451..cff645de58 100644 --- a/file/delete_scheduler_test.cc +++ b/file/delete_scheduler_test.cc @@ -19,7 +19,7 @@ #ifndef ROCKSDB_LITE -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DeleteSchedulerTest : public testing::Test { public: @@ -35,9 +35,9 @@ class DeleteSchedulerTest : public testing::Test { } ~DeleteSchedulerTest() override { - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->LoadDependency({}); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({}); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); for (const auto& dummy_files_dir : dummy_files_dirs_) { test::DestroyDir(env_, dummy_files_dir); } @@ -116,17 +116,17 @@ class DeleteSchedulerTest : public testing::Test { // 4- Verify that BackgroundEmptyTrash used to correct penlties for the files // 5- Make sure that all created files were completely deleted TEST_F(DeleteSchedulerTest, BasicRateLimiting) { - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DeleteSchedulerTest::BasicRateLimiting:1", "DeleteScheduler::BackgroundEmptyTrash"}, }); std::vector penalties; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::BackgroundEmptyTrash:Wait", [&](void* arg) { penalties.push_back(*(static_cast(arg))); }); int dir_synced = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile::AfterSyncDir", [&](void* arg) { dir_synced++; std::string* dir = reinterpret_cast(arg); @@ -139,8 +139,8 @@ TEST_F(DeleteSchedulerTest, BasicRateLimiting) { for (size_t t = 0; t < delete_kbs_per_sec.size(); t++) { penalties.clear(); - rocksdb::SyncPoint::GetInstance()->ClearTrace(); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); DestroyAndCreateDir(dummy_files_dirs_[0]); rate_bytes_per_sec_ = delete_kbs_per_sec[t] * 1024; @@ -182,16 +182,16 @@ TEST_F(DeleteSchedulerTest, BasicRateLimiting) { ASSERT_EQ(num_files, dir_synced); ASSERT_EQ(CountTrashFiles(), 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } TEST_F(DeleteSchedulerTest, MultiDirectoryDeletionsScheduled) { - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DeleteSchedulerTest::MultiDbPathDeletionsScheduled:1", "DeleteScheduler::BackgroundEmptyTrash"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 1 << 20; // 1MB NewDeleteScheduler(); @@ -219,7 +219,7 @@ TEST_F(DeleteSchedulerTest, MultiDirectoryDeletionsScheduled) { ASSERT_EQ(0, CountTrashFiles(i)); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } // Same as the BasicRateLimiting test but delete files in multiple threads. @@ -230,13 +230,13 @@ TEST_F(DeleteSchedulerTest, MultiDirectoryDeletionsScheduled) { // 4- Verify that BackgroundEmptyTrash used to correct penlties for the files // 5- Make sure that all created files were completely deleted TEST_F(DeleteSchedulerTest, RateLimitingMultiThreaded) { - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DeleteSchedulerTest::RateLimitingMultiThreaded:1", "DeleteScheduler::BackgroundEmptyTrash"}, }); std::vector penalties; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::BackgroundEmptyTrash:Wait", [&](void* arg) { penalties.push_back(*(static_cast(arg))); }); @@ -247,8 +247,8 @@ TEST_F(DeleteSchedulerTest, RateLimitingMultiThreaded) { std::vector delete_kbs_per_sec = {512, 200, 100, 50, 25}; for (size_t t = 0; t < delete_kbs_per_sec.size(); t++) { penalties.clear(); - rocksdb::SyncPoint::GetInstance()->ClearTrace(); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); DestroyAndCreateDir(dummy_files_dirs_[0]); rate_bytes_per_sec_ = delete_kbs_per_sec[t] * 1024; @@ -301,7 +301,7 @@ TEST_F(DeleteSchedulerTest, RateLimitingMultiThreaded) { ASSERT_EQ(CountNormalFiles(), 0); ASSERT_EQ(CountTrashFiles(), 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } @@ -310,11 +310,11 @@ TEST_F(DeleteSchedulerTest, RateLimitingMultiThreaded) { // move it to trash TEST_F(DeleteSchedulerTest, DisableRateLimiting) { int bg_delete_file = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", [&](void* /*arg*/) { bg_delete_file++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 0; NewDeleteScheduler(); @@ -330,7 +330,7 @@ TEST_F(DeleteSchedulerTest, DisableRateLimiting) { ASSERT_EQ(bg_delete_file, 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } // Testing that moving files to trash with the same name is not a problem @@ -340,11 +340,11 @@ TEST_F(DeleteSchedulerTest, DisableRateLimiting) { // --- Hold DeleteScheduler::BackgroundEmptyTrash --- // 4- Make sure that files are deleted from trash TEST_F(DeleteSchedulerTest, ConflictNames) { - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DeleteSchedulerTest::ConflictNames:1", "DeleteScheduler::BackgroundEmptyTrash"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 1024 * 1024; // 1 Mb/sec NewDeleteScheduler(); @@ -366,7 +366,7 @@ TEST_F(DeleteSchedulerTest, ConflictNames) { auto bg_errors = delete_scheduler_->GetBackgroundErrors(); ASSERT_EQ(bg_errors.size(), 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } // 1- Create 10 dummy files @@ -376,11 +376,11 @@ TEST_F(DeleteSchedulerTest, ConflictNames) { // 4- Make sure that DeleteScheduler failed to delete the 10 files and // reported 10 background errors TEST_F(DeleteSchedulerTest, BackgroundError) { - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DeleteSchedulerTest::BackgroundError:1", "DeleteScheduler::BackgroundEmptyTrash"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 1024 * 1024; // 1 Mb/sec NewDeleteScheduler(); @@ -407,7 +407,7 @@ TEST_F(DeleteSchedulerTest, BackgroundError) { auto bg_errors = delete_scheduler_->GetBackgroundErrors(); ASSERT_EQ(bg_errors.size(), 10); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } // 1- Create 10 dummy files @@ -417,10 +417,10 @@ TEST_F(DeleteSchedulerTest, BackgroundError) { // 5- Repeat previous steps 5 times TEST_F(DeleteSchedulerTest, StartBGEmptyTrashMultipleTimes) { int bg_delete_file = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", [&](void* /*arg*/) { bg_delete_file++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 1024 * 1024; // 1 MB / sec NewDeleteScheduler(); @@ -442,18 +442,18 @@ TEST_F(DeleteSchedulerTest, StartBGEmptyTrashMultipleTimes) { } ASSERT_EQ(bg_delete_file, 50); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); } TEST_F(DeleteSchedulerTest, DeletePartialFile) { int bg_delete_file = 0; int bg_fsync = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", [&](void*) { bg_delete_file++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:Fsync", [&](void*) { bg_fsync++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 1024 * 1024; // 1 MB / sec NewDeleteScheduler(); @@ -473,19 +473,19 @@ TEST_F(DeleteSchedulerTest, DeletePartialFile) { ASSERT_EQ(bg_errors.size(), 0); ASSERT_EQ(7, bg_delete_file); ASSERT_EQ(4, bg_fsync); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); } #ifdef OS_LINUX TEST_F(DeleteSchedulerTest, NoPartialDeleteWithLink) { int bg_delete_file = 0; int bg_fsync = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", [&](void*) { bg_delete_file++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:Fsync", [&](void*) { bg_fsync++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 1024 * 1024; // 1 MB / sec NewDeleteScheduler(); @@ -506,7 +506,7 @@ TEST_F(DeleteSchedulerTest, NoPartialDeleteWithLink) { ASSERT_EQ(bg_errors.size(), 0); ASSERT_EQ(2, bg_delete_file); ASSERT_EQ(0, bg_fsync); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); } #endif @@ -517,10 +517,10 @@ TEST_F(DeleteSchedulerTest, NoPartialDeleteWithLink) { // DeleteScheduler background thread did not delete all files TEST_F(DeleteSchedulerTest, DestructorWithNonEmptyQueue) { int bg_delete_file = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", [&](void* /*arg*/) { bg_delete_file++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 1; // 1 Byte / sec NewDeleteScheduler(); @@ -537,28 +537,27 @@ TEST_F(DeleteSchedulerTest, DestructorWithNonEmptyQueue) { ASSERT_LT(bg_delete_file, 100); ASSERT_GT(CountTrashFiles(), 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DeleteSchedulerTest, DISABLED_DynamicRateLimiting1) { std::vector penalties; int bg_delete_file = 0; int fg_delete_file = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", [&](void* /*arg*/) { bg_delete_file++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DeleteScheduler::DeleteFile", - [&](void* /*arg*/) { fg_delete_file++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "DeleteScheduler::DeleteFile", [&](void* /*arg*/) { fg_delete_file++; }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::BackgroundEmptyTrash:Wait", [&](void* arg) { penalties.push_back(*(static_cast(arg))); }); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"DeleteSchedulerTest::DynamicRateLimiting1:1", "DeleteScheduler::BackgroundEmptyTrash"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 0; // Disable rate limiting initially NewDeleteScheduler(); @@ -572,8 +571,8 @@ TEST_F(DeleteSchedulerTest, DISABLED_DynamicRateLimiting1) { penalties.clear(); bg_delete_file = 0; fg_delete_file = 0; - rocksdb::SyncPoint::GetInstance()->ClearTrace(); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); DestroyAndCreateDir(dummy_files_dirs_[0]); rate_bytes_per_sec_ = delete_kbs_per_sec[t] * 1024; @@ -619,20 +618,20 @@ TEST_F(DeleteSchedulerTest, DISABLED_DynamicRateLimiting1) { } ASSERT_EQ(CountTrashFiles(), 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } TEST_F(DeleteSchedulerTest, ImmediateDeleteOn25PercDBSize) { int bg_delete_file = 0; int fg_delete_file = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", [&](void* /*arg*/) { bg_delete_file++; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteFile", [&](void* /*arg*/) { fg_delete_file++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); int num_files = 100; // 100 files uint64_t file_size = 1024 * 10; // 100 KB as a file size @@ -655,7 +654,7 @@ TEST_F(DeleteSchedulerTest, ImmediateDeleteOn25PercDBSize) { // deleting new files immediately ASSERT_EQ(fg_delete_file, 74); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } TEST_F(DeleteSchedulerTest, IsTrashCheck) { @@ -679,7 +678,7 @@ TEST_F(DeleteSchedulerTest, IsTrashCheck) { ASSERT_FALSE(DeleteScheduler::IsTrashFile("abc.trashx")); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/file/file_prefetch_buffer.cc b/file/file_prefetch_buffer.cc index d741189d99..7b55bd397b 100644 --- a/file/file_prefetch_buffer.cc +++ b/file/file_prefetch_buffer.cc @@ -20,7 +20,7 @@ #include "util/random.h" #include "util/rate_limiter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status FilePrefetchBuffer::Prefetch(RandomAccessFileReader* reader, uint64_t offset, size_t n, bool for_compaction) { @@ -133,4 +133,4 @@ bool FilePrefetchBuffer::TryReadFromCache(uint64_t offset, size_t n, *result = Slice(buffer_.BufferStart() + offset_in_buffer, n); return true; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/file_prefetch_buffer.h b/file/file_prefetch_buffer.h index c3cacf1020..d53f627b55 100644 --- a/file/file_prefetch_buffer.h +++ b/file/file_prefetch_buffer.h @@ -16,7 +16,7 @@ #include "rocksdb/env.h" #include "util/aligned_buffer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // FilePrefetchBuffer is a smart buffer to store and read data from a file. class FilePrefetchBuffer { @@ -94,4 +94,4 @@ class FilePrefetchBuffer { // can be fetched from min_offset_read(). bool track_min_offset_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/file_util.cc b/file/file_util.cc index f34178705f..c231bf7d1d 100644 --- a/file/file_util.cc +++ b/file/file_util.cc @@ -14,7 +14,7 @@ #include "file/writable_file_writer.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Utility function to copy a file up to a specified length Status CopyFile(FileSystem* fs, const std::string& source, @@ -121,4 +121,4 @@ bool IsWalDirSameAsDBPath(const ImmutableDBOptions* db_options) { return same; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/file_util.h b/file/file_util.h index 8547c22794..333749e4dd 100644 --- a/file/file_util.h +++ b/file/file_util.h @@ -13,7 +13,7 @@ #include "rocksdb/status.h" #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // use_fsync maps to options.use_fsync, which determines the way that // the file is synced after copying. extern Status CopyFile(FileSystem* fs, const std::string& source, @@ -30,4 +30,4 @@ extern Status DeleteDBFile(const ImmutableDBOptions* db_options, extern bool IsWalDirSameAsDBPath(const ImmutableDBOptions* db_options); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/filename.cc b/file/filename.cc index 5a3fa29022..d620b7351e 100644 --- a/file/filename.cc +++ b/file/filename.cc @@ -19,7 +19,7 @@ #include "util/stop_watch.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const std::string kRocksDbTFileExt = "sst"; static const std::string kLevelDbTFileExt = "ldb"; @@ -453,4 +453,4 @@ Status GetInfoLogFiles(Env* env, const std::string& db_log_dir, return Status::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/filename.h b/file/filename.h index ad19d38959..909287c25e 100644 --- a/file/filename.h +++ b/file/filename.h @@ -22,7 +22,7 @@ #include "rocksdb/status.h" #include "rocksdb/transaction_log.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Env; class Directory; @@ -182,4 +182,4 @@ extern Status GetInfoLogFiles(Env* env, const std::string& db_log_dir, const std::string& dbname, std::string* parent_dir, std::vector* file_names); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/random_access_file_reader.cc b/file/random_access_file_reader.cc index 6bd3a25d2d..46892360f2 100644 --- a/file/random_access_file_reader.cc +++ b/file/random_access_file_reader.cc @@ -19,7 +19,7 @@ #include "util/random.h" #include "util/rate_limiter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status RandomAccessFileReader::Read(uint64_t offset, size_t n, Slice* result, char* scratch, bool for_compaction) const { Status s; @@ -186,4 +186,4 @@ Status RandomAccessFileReader::MultiRead(FSReadRequest* read_reqs, return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/random_access_file_reader.h b/file/random_access_file_reader.h index 4f0e5307f9..35027bf456 100644 --- a/file/random_access_file_reader.h +++ b/file/random_access_file_reader.h @@ -18,7 +18,7 @@ #include "rocksdb/rate_limiter.h" #include "util/aligned_buffer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Statistics; class HistogramImpl; @@ -117,4 +117,4 @@ class RandomAccessFileReader { bool use_direct_io() const { return file_->use_direct_io(); } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/read_write_util.cc b/file/read_write_util.cc index c092fb1bef..b4854e110f 100644 --- a/file/read_write_util.cc +++ b/file/read_write_util.cc @@ -12,7 +12,7 @@ #include #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { IOStatus NewWritableFile(FileSystem* fs, const std::string& fname, std::unique_ptr* result, @@ -64,4 +64,4 @@ bool IsFileSectorAligned(const size_t off, size_t sector_size) { return off % sector_size == 0; } #endif // NDEBUG -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/read_write_util.h b/file/read_write_util.h index 1f315f0327..22f4076b34 100644 --- a/file/read_write_util.h +++ b/file/read_write_util.h @@ -13,7 +13,7 @@ #include "rocksdb/env.h" #include "rocksdb/file_system.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Returns a WritableFile. // // env : the Env. @@ -31,4 +31,4 @@ bool ReadOneLine(std::istringstream* iss, SequentialFileReader* seq_file_reader, #ifndef NDEBUG bool IsFileSectorAligned(const size_t off, size_t sector_size); #endif // NDEBUG -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/readahead_raf.cc b/file/readahead_raf.cc index dc005b900b..493f9d9e89 100644 --- a/file/readahead_raf.cc +++ b/file/readahead_raf.cc @@ -15,7 +15,7 @@ #include "util/aligned_buffer.h" #include "util/rate_limiter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { class ReadaheadRandomAccessFile : public RandomAccessFile { public: @@ -159,4 +159,4 @@ std::unique_ptr NewReadaheadRandomAccessFile( new ReadaheadRandomAccessFile(std::move(file), readahead_size)); return result; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/readahead_raf.h b/file/readahead_raf.h index f6d64e77ac..cbdcb124fd 100644 --- a/file/readahead_raf.h +++ b/file/readahead_raf.h @@ -11,7 +11,7 @@ #include #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This file provides the following main abstractions: // SequentialFileReader : wrapper over Env::SequentialFile // RandomAccessFileReader : wrapper over Env::RandomAccessFile @@ -24,4 +24,4 @@ namespace rocksdb { // Compaction Table Readers. std::unique_ptr NewReadaheadRandomAccessFile( std::unique_ptr&& file, size_t readahead_size); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/sequence_file_reader.cc b/file/sequence_file_reader.cc index 4f3fa45b8b..81c5e5d1d4 100644 --- a/file/sequence_file_reader.cc +++ b/file/sequence_file_reader.cc @@ -21,7 +21,7 @@ #include "util/random.h" #include "util/rate_limiter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status SequentialFileReader::Read(size_t n, Slice* result, char* scratch) { Status s; if (use_direct_io()) { @@ -234,4 +234,4 @@ SequentialFileReader::NewReadaheadSequentialFile( new ReadaheadSequentialFile(std::move(file), readahead_size)); return result; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/sequence_file_reader.h b/file/sequence_file_reader.h index 5fb3f7b0c6..2f0898b423 100644 --- a/file/sequence_file_reader.h +++ b/file/sequence_file_reader.h @@ -14,7 +14,7 @@ #include "rocksdb/env.h" #include "rocksdb/file_system.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // SequentialFileReader is a wrapper on top of Env::SequentialFile. It handles // Buffered (i.e when page cache is enabled) and Direct (with O_DIRECT / page @@ -64,4 +64,4 @@ class SequentialFileReader { static std::unique_ptr NewReadaheadSequentialFile( std::unique_ptr&& file, size_t readahead_size); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/sst_file_manager_impl.cc b/file/sst_file_manager_impl.cc index c2d3d0e74c..35056429e0 100644 --- a/file/sst_file_manager_impl.cc +++ b/file/sst_file_manager_impl.cc @@ -16,7 +16,7 @@ #include "test_util/sync_point.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE SstFileManagerImpl::SstFileManagerImpl(Env* env, std::shared_ptr fs, @@ -555,4 +555,4 @@ SstFileManager* NewSstFileManager(Env* /*env*/, #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/sst_file_manager_impl.h b/file/sst_file_manager_impl.h index 2a773f088d..323ffc7b2f 100644 --- a/file/sst_file_manager_impl.h +++ b/file/sst_file_manager_impl.h @@ -17,7 +17,7 @@ #include "rocksdb/file_system.h" #include "rocksdb/sst_file_manager.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Env; class Logger; @@ -192,6 +192,6 @@ class SstFileManagerImpl : public SstFileManager { ErrorHandler* cur_instance_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/file/writable_file_writer.cc b/file/writable_file_writer.cc index 742d55e033..d5894c17a7 100644 --- a/file/writable_file_writer.cc +++ b/file/writable_file_writer.cc @@ -20,7 +20,7 @@ #include "util/random.h" #include "util/rate_limiter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status WritableFileWriter::Append(const Slice& data) { const char* src = data.data(); size_t left = data.size(); @@ -426,4 +426,4 @@ Status WritableFileWriter::WriteDirect() { return s; } #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/file/writable_file_writer.h b/file/writable_file_writer.h index 04bd53d46c..123110713e 100644 --- a/file/writable_file_writer.h +++ b/file/writable_file_writer.h @@ -20,7 +20,7 @@ #include "test_util/sync_point.h" #include "util/aligned_buffer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Statistics; // WritableFileWriter is a wrapper on top of Env::WritableFile. It provides @@ -168,4 +168,4 @@ class WritableFileWriter { Status RangeSync(uint64_t offset, uint64_t nbytes); Status SyncInternal(bool use_fsync); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/hdfs/env_hdfs.h b/hdfs/env_hdfs.h index 903e32ef92..6005c36641 100644 --- a/hdfs/env_hdfs.h +++ b/hdfs/env_hdfs.h @@ -16,7 +16,7 @@ #ifdef USE_HDFS #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Thrown during execution when there is an issue with the supplied // arguments. @@ -230,12 +230,11 @@ class HdfsEnv : public Env { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #else // USE_HDFS - -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const Status notsup; @@ -380,6 +379,6 @@ class HdfsEnv : public Env { return 0; } }; -} +} // namespace ROCKSDB_NAMESPACE #endif // USE_HDFS diff --git a/include/rocksdb/advanced_options.h b/include/rocksdb/advanced_options.h index d4e986a110..8e4f93743e 100644 --- a/include/rocksdb/advanced_options.h +++ b/include/rocksdb/advanced_options.h @@ -13,7 +13,7 @@ #include "rocksdb/memtablerep.h" #include "rocksdb/universal_compaction.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Slice; class SliceTransform; @@ -730,4 +730,4 @@ struct AdvancedColumnFamilyOptions { bool purge_redundant_kvs_while_flush = true; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/cache.h b/include/rocksdb/cache.h index dfdc374d0a..77ddf525d0 100644 --- a/include/rocksdb/cache.h +++ b/include/rocksdb/cache.h @@ -30,7 +30,7 @@ #include "rocksdb/statistics.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Cache; @@ -275,4 +275,4 @@ class Cache { std::shared_ptr memory_allocator_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/cleanable.h b/include/rocksdb/cleanable.h index 09a184a456..b6a70ea642 100644 --- a/include/rocksdb/cleanable.h +++ b/include/rocksdb/cleanable.h @@ -8,7 +8,9 @@ #pragma once -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { class Cleanable { public: @@ -66,4 +68,4 @@ class Cleanable { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/compaction_filter.h b/include/rocksdb/compaction_filter.h index 1964091a95..9765078310 100644 --- a/include/rocksdb/compaction_filter.h +++ b/include/rocksdb/compaction_filter.h @@ -13,7 +13,9 @@ #include #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { class Slice; class SliceTransform; @@ -207,4 +209,4 @@ class CompactionFilterFactory { virtual const char* Name() const = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/compaction_job_stats.h b/include/rocksdb/compaction_job_stats.h index 4021fcab20..8949b43e58 100644 --- a/include/rocksdb/compaction_job_stats.h +++ b/include/rocksdb/compaction_job_stats.h @@ -8,7 +8,9 @@ #include #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { struct CompactionJobStats { CompactionJobStats() { Reset(); } void Reset(); @@ -91,4 +93,4 @@ struct CompactionJobStats { // number of single-deletes which meet something other than a put uint64_t num_single_del_mismatch; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/comparator.h b/include/rocksdb/comparator.h index e30a9d0145..76981d1087 100644 --- a/include/rocksdb/comparator.h +++ b/include/rocksdb/comparator.h @@ -10,7 +10,9 @@ #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { class Slice; @@ -117,4 +119,4 @@ extern const Comparator* BytewiseComparator(); // ordering. extern const Comparator* ReverseBytewiseComparator(); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/concurrent_task_limiter.h b/include/rocksdb/concurrent_task_limiter.h index 2e054efdad..4fc6b79406 100644 --- a/include/rocksdb/concurrent_task_limiter.h +++ b/include/rocksdb/concurrent_task_limiter.h @@ -12,7 +12,7 @@ #include "rocksdb/env.h" #include "rocksdb/statistics.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ConcurrentTaskLimiter { public: @@ -43,4 +43,4 @@ class ConcurrentTaskLimiter { extern ConcurrentTaskLimiter* NewConcurrentTaskLimiter(const std::string& name, int32_t limit); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/convenience.h b/include/rocksdb/convenience.h index db26948a43..442303d948 100644 --- a/include/rocksdb/convenience.h +++ b/include/rocksdb/convenience.h @@ -13,7 +13,7 @@ #include "rocksdb/options.h" #include "rocksdb/table.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE // The following set of functions provide a way to construct RocksDB Options @@ -348,4 +348,4 @@ Status VerifySstFileChecksum(const Options& options, #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index e4b4f084fe..3108003f1f 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -37,7 +37,7 @@ #define ROCKSDB_DEPRECATED_FUNC __declspec(deprecated) #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct Options; struct DBOptions; @@ -155,7 +155,7 @@ class DB { // read only, you can specify only a subset of column families in the // database that should be opened. However, you always need to specify default // column family. The default column family name is 'default' and it's stored - // in rocksdb::kDefaultColumnFamilyName + // in ROCKSDB_NAMESPACE::kDefaultColumnFamilyName // // Not supported in ROCKSDB_LITE, in which case the function will // return Status::NotSupported. @@ -221,7 +221,7 @@ class DB { // ListColumnFamilies(). Also, you can open only a subset of column families // for read-only access. // The default column family name is 'default' and it's stored - // in rocksdb::kDefaultColumnFamilyName. + // in ROCKSDB_NAMESPACE::kDefaultColumnFamilyName. // If everything is OK, handles will on return be the same size // as column_families --- handles[i] will be a handle that you // will use to operate on column family column_family[i]. @@ -1522,4 +1522,4 @@ Status RepairDB(const std::string& dbname, const Options& options); #endif -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/db_bench_tool.h b/include/rocksdb/db_bench_tool.h index 047c4256ce..17f4e6bde7 100644 --- a/include/rocksdb/db_bench_tool.h +++ b/include/rocksdb/db_bench_tool.h @@ -4,6 +4,8 @@ // (found in the LICENSE.Apache file in the root directory). #pragma once -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { int db_bench_tool(int argc, char** argv); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/db_dump_tool.h b/include/rocksdb/db_dump_tool.h index aeaa3422df..b7d4766a2f 100644 --- a/include/rocksdb/db_dump_tool.h +++ b/include/rocksdb/db_dump_tool.h @@ -10,7 +10,7 @@ #include "rocksdb/db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct DumpOptions { // Database that will be dumped @@ -24,7 +24,7 @@ struct DumpOptions { class DbDumpTool { public: bool Run(const DumpOptions& dump_options, - rocksdb::Options options = rocksdb::Options()); + ROCKSDB_NAMESPACE::Options options = ROCKSDB_NAMESPACE::Options()); }; struct UndumpOptions { @@ -39,7 +39,7 @@ struct UndumpOptions { class DbUndumpTool { public: bool Run(const UndumpOptions& undump_options, - rocksdb::Options options = rocksdb::Options()); + ROCKSDB_NAMESPACE::Options options = ROCKSDB_NAMESPACE::Options()); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/db_stress_tool.h b/include/rocksdb/db_stress_tool.h index 2ae54980e9..7d3d42c9d6 100644 --- a/include/rocksdb/db_stress_tool.h +++ b/include/rocksdb/db_stress_tool.h @@ -4,6 +4,8 @@ // (found in the LICENSE.Apache file in the root directory). #pragma once -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { int db_stress_tool(int argc, char** argv); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/env.h b/include/rocksdb/env.h index 8c3d74ecc9..056d8a1c02 100644 --- a/include/rocksdb/env.h +++ b/include/rocksdb/env.h @@ -39,7 +39,7 @@ #define ROCKSDB_PRINTF_FORMAT_ATTR(format_param, dots_param) #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DynamicLibrary; class FileLock; @@ -1122,13 +1122,15 @@ extern Status ReadFileToString(Env* env, const std::string& fname, // Useful when wrapping the default implementations. // Typical usage is to inherit your wrapper from *Wrapper, e.g.: // -// class MySequentialFileWrapper : public rocksdb::SequentialFileWrapper { +// class MySequentialFileWrapper : public +// ROCKSDB_NAMESPACE::SequentialFileWrapper { // public: -// MySequentialFileWrapper(rocksdb::SequentialFile* target): -// rocksdb::SequentialFileWrapper(target) {} +// MySequentialFileWrapper(ROCKSDB_NAMESPACE::SequentialFile* target): +// ROCKSDB_NAMESPACE::SequentialFileWrapper(target) {} // Status Read(size_t n, Slice* result, char* scratch) override { // cout << "Doing a read of size " << n << "!" << endl; -// return rocksdb::SequentialFileWrapper::Read(n, result, scratch); +// return ROCKSDB_NAMESPACE::SequentialFileWrapper::Read(n, result, +// scratch); // } // // All other methods are forwarded to target_ automatically. // }; @@ -1584,4 +1586,4 @@ Env* NewTimedEnv(Env* base_env); Status NewEnvLogger(const std::string& fname, Env* env, std::shared_ptr* result); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/env_encryption.h b/include/rocksdb/env_encryption.h index a80da963a3..a4db10fd0d 100644 --- a/include/rocksdb/env_encryption.h +++ b/include/rocksdb/env_encryption.h @@ -11,7 +11,7 @@ #include "env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class EncryptionProvider; @@ -201,6 +201,6 @@ class CTREncryptionProvider : public EncryptionProvider { std::unique_ptr* result); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !defined(ROCKSDB_LITE) diff --git a/include/rocksdb/experimental.h b/include/rocksdb/experimental.h index 0592fe36b1..f26d6371c6 100644 --- a/include/rocksdb/experimental.h +++ b/include/rocksdb/experimental.h @@ -8,7 +8,7 @@ #include "rocksdb/db.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace experimental { // Supported only for Leveled compaction @@ -26,4 +26,4 @@ Status PromoteL0(DB* db, ColumnFamilyHandle* column_family, int target_level = 1); } // namespace experimental -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/file_checksum.h b/include/rocksdb/file_checksum.h index 96e930b6a4..35f54f40b4 100644 --- a/include/rocksdb/file_checksum.h +++ b/include/rocksdb/file_checksum.h @@ -16,7 +16,7 @@ #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // FileChecksumFunc is the function class to generates the checksum value // for each file when the file is written to the file system. @@ -83,4 +83,4 @@ extern FileChecksumList* NewFileChecksumList(); // Create a Crc32c based file checksum function extern FileChecksumFunc* CreateFileChecksumFuncCrc32c(); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/file_system.h b/include/rocksdb/file_system.h index 30e29742e7..c1fd919f3e 100644 --- a/include/rocksdb/file_system.h +++ b/include/rocksdb/file_system.h @@ -30,7 +30,7 @@ #include "rocksdb/options.h" #include "rocksdb/thread_status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class FileLock; class FSDirectory; @@ -944,14 +944,16 @@ class FSDirectory { // Useful when wrapping the default implementations. // Typical usage is to inherit your wrapper from *Wrapper, e.g.: // -// class MySequentialFileWrapper : public rocksdb::FSSequentialFileWrapper { +// class MySequentialFileWrapper : public +// ROCKSDB_NAMESPACE::FSSequentialFileWrapper { // public: -// MySequentialFileWrapper(rocksdb::FSSequentialFile* target): -// rocksdb::FSSequentialFileWrapper(target) {} +// MySequentialFileWrapper(ROCKSDB_NAMESPACE::FSSequentialFile* target): +// ROCKSDB_NAMESPACE::FSSequentialFileWrapper(target) {} // Status Read(size_t n, FileSystem::IOOptions& options, Slice* result, // char* scratch, FileSystem::IODebugContext* dbg) override { // cout << "Doing a read of size " << n << "!" << endl; -// return rocksdb::FSSequentialFileWrapper::Read(n, options, result, +// return ROCKSDB_NAMESPACE::FSSequentialFileWrapper::Read(n, options, +// result, // scratch, dbg); // } // // All other methods are forwarded to target_ automatically. @@ -1353,4 +1355,4 @@ class FSDirectoryWrapper : public FSDirectory { extern Status ReadFileToString(FileSystem* fs, const std::string& fname, std::string* data); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/filter_policy.h b/include/rocksdb/filter_policy.h index fa918c80d6..c7e4e720a6 100644 --- a/include/rocksdb/filter_policy.h +++ b/include/rocksdb/filter_policy.h @@ -27,7 +27,7 @@ #include "rocksdb/advanced_options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Slice; struct BlockBasedTableOptions; @@ -196,4 +196,4 @@ class FilterPolicy { // trailing spaces in keys. extern const FilterPolicy* NewBloomFilterPolicy( double bits_per_key, bool use_block_based_builder = false); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/flush_block_policy.h b/include/rocksdb/flush_block_policy.h index 38807249ce..badc0808a0 100644 --- a/include/rocksdb/flush_block_policy.h +++ b/include/rocksdb/flush_block_policy.h @@ -8,7 +8,7 @@ #include #include "rocksdb/table.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Slice; class BlockBuilder; @@ -58,4 +58,4 @@ class FlushBlockBySizePolicyFactory : public FlushBlockPolicyFactory { const BlockBuilder& data_block_builder); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/io_status.h b/include/rocksdb/io_status.h index 9f2d7e495d..a1de859add 100644 --- a/include/rocksdb/io_status.h +++ b/include/rocksdb/io_status.h @@ -21,7 +21,7 @@ #include #include "status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class IOStatus : public Status { public: @@ -229,4 +229,4 @@ inline bool IOStatus::operator!=(const IOStatus& rhs) const { return !(*this == rhs); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/iostats_context.h b/include/rocksdb/iostats_context.h index 67f2b32177..b31b6d70a4 100644 --- a/include/rocksdb/iostats_context.h +++ b/include/rocksdb/iostats_context.h @@ -12,7 +12,7 @@ // A thread local context for gathering io-stats efficiently and transparently. // Use SetPerfLevel(PerfLevel::kEnableTime) to enable time stats. -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct IOStatsContext { // reset all io-stats counter to zero @@ -53,4 +53,4 @@ struct IOStatsContext { // Get Thread-local IOStatsContext object pointer IOStatsContext* get_iostats_context(); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/iterator.h b/include/rocksdb/iterator.h index 162e262e32..2f8f1e3855 100644 --- a/include/rocksdb/iterator.h +++ b/include/rocksdb/iterator.h @@ -23,7 +23,7 @@ #include "rocksdb/slice.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Iterator : public Cleanable { public: @@ -116,4 +116,4 @@ extern Iterator* NewEmptyIterator(); // Return an empty iterator with the specified status. extern Iterator* NewErrorIterator(const Status& status); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/ldb_tool.h b/include/rocksdb/ldb_tool.h index 636605ff7f..22ea7734f6 100644 --- a/include/rocksdb/ldb_tool.h +++ b/include/rocksdb/ldb_tool.h @@ -9,7 +9,7 @@ #include "rocksdb/db.h" #include "rocksdb/options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // An interface for converting a slice to a readable string class SliceFormatter { @@ -38,6 +38,6 @@ class LDBTool { const std::vector* column_families = nullptr); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/listener.h b/include/rocksdb/listener.h index 57bb1eeb0d..d1c953f0f0 100644 --- a/include/rocksdb/listener.h +++ b/include/rocksdb/listener.h @@ -15,7 +15,7 @@ #include "rocksdb/status.h" #include "rocksdb/table_properties.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { typedef std::unordered_map> TablePropertiesCollection; @@ -488,4 +488,4 @@ struct FlushJobInfo {}; #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/memory_allocator.h b/include/rocksdb/memory_allocator.h index 889c0e9218..60256a9772 100644 --- a/include/rocksdb/memory_allocator.h +++ b/include/rocksdb/memory_allocator.h @@ -9,7 +9,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // MemoryAllocator is an interface that a client can implement to supply custom // memory allocation and deallocation methods. See rocksdb/cache.h for more @@ -74,4 +74,4 @@ extern Status NewJemallocNodumpAllocator( JemallocAllocatorOptions& options, std::shared_ptr* memory_allocator); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/memtablerep.h b/include/rocksdb/memtablerep.h index 7f18a581e9..49723264a5 100644 --- a/include/rocksdb/memtablerep.h +++ b/include/rocksdb/memtablerep.h @@ -41,7 +41,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Arena; class Allocator; @@ -59,7 +59,7 @@ class MemTableRep { // concatenated with values. class KeyComparator { public: - typedef rocksdb::Slice DecodedType; + typedef ROCKSDB_NAMESPACE::Slice DecodedType; virtual DecodedType decode_key(const char* key) const { // The format of key is frozen and can be terated as a part of the API @@ -382,4 +382,4 @@ extern MemTableRepFactory* NewHashLinkListRepFactory( uint32_t threshold_use_skiplist = 256); #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/merge_operator.h b/include/rocksdb/merge_operator.h index 36f47e254e..86f3d72601 100644 --- a/include/rocksdb/merge_operator.h +++ b/include/rocksdb/merge_operator.h @@ -12,7 +12,7 @@ #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Slice; class Logger; @@ -254,4 +254,4 @@ class AssociativeMergeOperator : public MergeOperator { Logger* logger) const override; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/metadata.h b/include/rocksdb/metadata.h index a8cf955954..f1a9ee60e7 100644 --- a/include/rocksdb/metadata.h +++ b/include/rocksdb/metadata.h @@ -13,7 +13,7 @@ #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct ColumnFamilyMetaData; struct LevelMetaData; struct SstFileMetaData; @@ -148,4 +148,4 @@ struct ExportImportFilesMetaData { std::string db_comparator_name; // Used to safety check at import. std::vector files; // Vector of file metadata. }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index d992270b6b..f5d44fb743 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -29,7 +29,7 @@ #undef max #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Cache; class CompactionFilter; @@ -1584,4 +1584,4 @@ struct SizeApproximationOptions { double files_size_error_margin = -1.0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/perf_context.h b/include/rocksdb/perf_context.h index a1d803c2c2..123a21bc96 100644 --- a/include/rocksdb/perf_context.h +++ b/include/rocksdb/perf_context.h @@ -11,7 +11,7 @@ #include "rocksdb/perf_level.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A thread local context for gathering performance counter efficiently // and transparently. @@ -229,4 +229,4 @@ struct PerfContext { // if defined(NPERF_CONTEXT), then the pointer is not thread-local PerfContext* get_perf_context(); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/perf_level.h b/include/rocksdb/perf_level.h index de0a214d6a..e6a7689046 100644 --- a/include/rocksdb/perf_level.h +++ b/include/rocksdb/perf_level.h @@ -8,7 +8,9 @@ #include #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { // How much perf stats to collect. Affects perf_context and iostats_context. enum PerfLevel : unsigned char { @@ -30,4 +32,4 @@ void SetPerfLevel(PerfLevel level); // get current perf stats level for current thread PerfLevel GetPerfLevel(); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/persistent_cache.h b/include/rocksdb/persistent_cache.h index 05c36852a5..9651812c8d 100644 --- a/include/rocksdb/persistent_cache.h +++ b/include/rocksdb/persistent_cache.h @@ -16,7 +16,7 @@ #include "rocksdb/statistics.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // PersistentCache // @@ -64,4 +64,4 @@ Status NewPersistentCache(Env* const env, const std::string& path, const std::shared_ptr& log, const bool optimized_for_nvm, std::shared_ptr* cache); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/rate_limiter.h b/include/rocksdb/rate_limiter.h index 57b1169b63..0ee89f5c80 100644 --- a/include/rocksdb/rate_limiter.h +++ b/include/rocksdb/rate_limiter.h @@ -12,7 +12,7 @@ #include "rocksdb/env.h" #include "rocksdb/statistics.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class RateLimiter { public: @@ -136,4 +136,4 @@ extern RateLimiter* NewGenericRateLimiter( RateLimiter::Mode mode = RateLimiter::Mode::kWritesOnly, bool auto_tuned = false); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/rocksdb_namespace.h b/include/rocksdb/rocksdb_namespace.h new file mode 100644 index 0000000000..e9f8620d06 --- /dev/null +++ b/include/rocksdb/rocksdb_namespace.h @@ -0,0 +1,10 @@ +// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. +// This source code is licensed under both the GPLv2 (found in the +// COPYING file in the root directory) and Apache 2.0 License +// (found in the LICENSE.Apache file in the root directory). + +#pragma once + +#ifndef ROCKSDB_NAMESPACE +#define ROCKSDB_NAMESPACE rocksdb +#endif diff --git a/include/rocksdb/slice.h b/include/rocksdb/slice.h index 03581b1498..c17b32c5c7 100644 --- a/include/rocksdb/slice.h +++ b/include/rocksdb/slice.h @@ -30,7 +30,7 @@ #include "rocksdb/cleanable.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Slice { public: @@ -266,4 +266,4 @@ inline size_t Slice::difference_offset(const Slice& b) const { return off; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/slice_transform.h b/include/rocksdb/slice_transform.h index 39e3d5fa13..54f61f9d2a 100644 --- a/include/rocksdb/slice_transform.h +++ b/include/rocksdb/slice_transform.h @@ -16,7 +16,9 @@ #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { class Slice; @@ -98,4 +100,4 @@ extern const SliceTransform* NewCappedPrefixTransform(size_t cap_len); extern const SliceTransform* NewNoopTransform(); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/snapshot.h b/include/rocksdb/snapshot.h index a96eb763e3..6a7212d607 100644 --- a/include/rocksdb/snapshot.h +++ b/include/rocksdb/snapshot.h @@ -7,7 +7,7 @@ #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DB; @@ -45,4 +45,4 @@ class ManagedSnapshot { const Snapshot* snapshot_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/sst_dump_tool.h b/include/rocksdb/sst_dump_tool.h index c7cc4a0fc4..ecb692e316 100644 --- a/include/rocksdb/sst_dump_tool.h +++ b/include/rocksdb/sst_dump_tool.h @@ -7,13 +7,13 @@ #include "rocksdb/options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SSTDumpTool { public: int Run(int argc, char** argv, Options options = Options()); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/sst_file_manager.h b/include/rocksdb/sst_file_manager.h index 760da19d38..92d0bbbf87 100644 --- a/include/rocksdb/sst_file_manager.h +++ b/include/rocksdb/sst_file_manager.h @@ -13,7 +13,7 @@ #include "rocksdb/file_system.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Env; class Logger; @@ -129,4 +129,4 @@ extern SstFileManager* NewSstFileManager( double max_trash_db_ratio = 0.25, uint64_t bytes_max_delete_chunk = 64 * 1024 * 1024); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/sst_file_reader.h b/include/rocksdb/sst_file_reader.h index 522a8d9a1d..4b86424809 100644 --- a/include/rocksdb/sst_file_reader.h +++ b/include/rocksdb/sst_file_reader.h @@ -12,7 +12,7 @@ #include "rocksdb/slice.h" #include "rocksdb/table_properties.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // SstFileReader is used to read sst files that are generated by DB or // SstFileWriter. @@ -42,6 +42,6 @@ class SstFileReader { std::unique_ptr rep_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/include/rocksdb/sst_file_writer.h b/include/rocksdb/sst_file_writer.h index 273c913e4f..e83383fea0 100644 --- a/include/rocksdb/sst_file_writer.h +++ b/include/rocksdb/sst_file_writer.h @@ -21,7 +21,7 @@ #define ROCKSDB_DEPRECATED_FUNC __declspec(deprecated) #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Comparator; @@ -134,6 +134,6 @@ class SstFileWriter { struct Rep; std::unique_ptr rep_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/include/rocksdb/statistics.h b/include/rocksdb/statistics.h index 1427e4de65..3bda6d7185 100644 --- a/include/rocksdb/statistics.h +++ b/include/rocksdb/statistics.h @@ -15,7 +15,7 @@ #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { /** * Keep adding ticker's here. @@ -475,7 +475,7 @@ enum StatsLevel : uint8_t { // Analyze the performance of a db by providing cumulative stats over time. // Usage: // Options options; -// options.statistics = rocksdb::CreateDBStatistics(); +// options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); // Status s = DB::Open(options, kDBPath, &db); // ... // options.statistics->getTickerCount(NUMBER_BLOCK_COMPRESSED); @@ -545,4 +545,4 @@ class Statistics { // Create a concrete DBStatistics object std::shared_ptr CreateDBStatistics(); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/stats_history.h b/include/rocksdb/stats_history.h index c6634ae68a..4acaad26f6 100644 --- a/include/rocksdb/stats_history.h +++ b/include/rocksdb/stats_history.h @@ -14,7 +14,7 @@ #include "rocksdb/statistics.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBImpl; @@ -66,4 +66,4 @@ class StatsHistoryIterator { virtual Status status() const = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/status.h b/include/rocksdb/status.h index f015348c33..cf62512c32 100644 --- a/include/rocksdb/status.h +++ b/include/rocksdb/status.h @@ -19,7 +19,7 @@ #include #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Status { public: @@ -383,4 +383,4 @@ inline bool Status::operator!=(const Status& rhs) const { return !(*this == rhs); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/table.h b/include/rocksdb/table.h index f4462dffb1..fb5d67114c 100644 --- a/include/rocksdb/table.h +++ b/include/rocksdb/table.h @@ -28,7 +28,7 @@ #include "rocksdb/options.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // -- Block-based Table class FlushBlockPolicyFactory; @@ -604,4 +604,4 @@ extern TableFactory* NewAdaptiveTableFactory( #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/table_properties.h b/include/rocksdb/table_properties.h index a3efe00a25..d0ac023106 100644 --- a/include/rocksdb/table_properties.h +++ b/include/rocksdb/table_properties.h @@ -10,7 +10,7 @@ #include "rocksdb/status.h" #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // -- Table Properties // Other than basic table properties, each table may also have the user @@ -177,8 +177,8 @@ struct TableProperties { uint64_t fixed_key_len = 0; // ID of column family for this SST file, corresponding to the CF identified // by column_family_name. - uint64_t column_family_id = - rocksdb::TablePropertiesCollectorFactory::Context::kUnknownColumnFamily; + uint64_t column_family_id = ROCKSDB_NAMESPACE:: + TablePropertiesCollectorFactory::Context::kUnknownColumnFamily; // Timestamp of the latest key. 0 means unknown. // TODO(sagar0): Should be changed to latest_key_time ... but don't know the // full implications of backward compatibility. Hence retaining for now. @@ -247,4 +247,4 @@ extern uint64_t GetDeletedKeys(const UserCollectedProperties& props); extern uint64_t GetMergeOperands(const UserCollectedProperties& props, bool* property_present); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/thread_status.h b/include/rocksdb/thread_status.h index b81c1c284e..6b2f5c885a 100644 --- a/include/rocksdb/thread_status.h +++ b/include/rocksdb/thread_status.h @@ -25,7 +25,7 @@ #define ROCKSDB_USING_THREAD_STATUS #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // TODO(yhchiang): remove this function once c++14 is available // as std::max will be able to cover this. @@ -37,7 +37,7 @@ struct constexpr_max { // A structure that describes the current status of a thread. // The status of active threads can be fetched using -// rocksdb::GetThreadList(). +// ROCKSDB_NAMESPACE::GetThreadList(). struct ThreadStatus { // The type of a thread. enum ThreadType : int { @@ -185,4 +185,4 @@ struct ThreadStatus { static const std::string& GetStateName(StateType state_type); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/threadpool.h b/include/rocksdb/threadpool.h index 2e2f2b44fe..b39321fe8f 100644 --- a/include/rocksdb/threadpool.h +++ b/include/rocksdb/threadpool.h @@ -10,7 +10,9 @@ #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { /* * ThreadPool is a component that will spawn N background threads that will @@ -53,4 +55,4 @@ class ThreadPool { // with `num_threads` background threads. extern ThreadPool* NewThreadPool(int num_threads); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/trace_reader_writer.h b/include/rocksdb/trace_reader_writer.h index 28919a0fad..d58ed47b2a 100644 --- a/include/rocksdb/trace_reader_writer.h +++ b/include/rocksdb/trace_reader_writer.h @@ -7,7 +7,7 @@ #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Allow custom implementations of TraceWriter and TraceReader. // By default, RocksDB provides a way to capture the traces to a file using the @@ -45,4 +45,4 @@ Status NewFileTraceWriter(Env* env, const EnvOptions& env_options, Status NewFileTraceReader(Env* env, const EnvOptions& env_options, const std::string& trace_filename, std::unique_ptr* trace_reader); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/transaction_log.h b/include/rocksdb/transaction_log.h index 80f373b247..48d0e5c0b8 100644 --- a/include/rocksdb/transaction_log.h +++ b/include/rocksdb/transaction_log.h @@ -11,7 +11,7 @@ #include "rocksdb/types.h" #include "rocksdb/write_batch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class LogFile; typedef std::vector> VectorLogPtr; @@ -118,4 +118,4 @@ class TransactionLogIterator { : verify_checksums_(verify_checksums) {} }; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/types.h b/include/rocksdb/types.h index 2cd4039bd7..4d004b69d0 100644 --- a/include/rocksdb/types.h +++ b/include/rocksdb/types.h @@ -8,7 +8,7 @@ #include #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Define all public custom types here. @@ -51,4 +51,4 @@ struct FullKey { // internal_key is alive. bool ParseFullKey(const Slice& internal_key, FullKey* result); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/universal_compaction.h b/include/rocksdb/universal_compaction.h index e219694b3f..e3aeee6cee 100644 --- a/include/rocksdb/universal_compaction.h +++ b/include/rocksdb/universal_compaction.h @@ -9,7 +9,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // // Algorithm used to make a compaction request stop picking new files @@ -83,4 +83,4 @@ class CompactionOptionsUniversal { allow_trivial_move(false) {} }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/utilities/backupable_db.h b/include/rocksdb/utilities/backupable_db.h index ff1dd1c3fc..f281ed1339 100644 --- a/include/rocksdb/utilities/backupable_db.h +++ b/include/rocksdb/utilities/backupable_db.h @@ -21,7 +21,7 @@ #include "rocksdb/env.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct BackupableDBOptions { // Where to keep the backup files. Has to be different than dbname_ @@ -337,5 +337,5 @@ class BackupEngine { virtual Status GarbageCollect() = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/checkpoint.h b/include/rocksdb/utilities/checkpoint.h index 5f12922c45..c7f93b4cfc 100644 --- a/include/rocksdb/utilities/checkpoint.h +++ b/include/rocksdb/utilities/checkpoint.h @@ -12,7 +12,7 @@ #include #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DB; class ColumnFamilyHandle; @@ -53,5 +53,5 @@ class Checkpoint { virtual ~Checkpoint() {} }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/include/rocksdb/utilities/db_ttl.h b/include/rocksdb/utilities/db_ttl.h index 227796cbe2..dd83cb24b7 100644 --- a/include/rocksdb/utilities/db_ttl.h +++ b/include/rocksdb/utilities/db_ttl.h @@ -12,7 +12,7 @@ #include "rocksdb/db.h" #include "rocksdb/utilities/stackable_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Database with TTL support. // @@ -68,5 +68,5 @@ class DBWithTTL : public StackableDB { explicit DBWithTTL(DB* db) : StackableDB(db) {} }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/debug.h b/include/rocksdb/utilities/debug.h index 3fc414b6ed..a2b6adcb04 100644 --- a/include/rocksdb/utilities/debug.h +++ b/include/rocksdb/utilities/debug.h @@ -10,7 +10,7 @@ #include "rocksdb/db.h" #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Data associated with a particular version of a key. A database may internally // store multiple versions of a same user key due to snapshots, compaction not @@ -44,6 +44,6 @@ Status GetAllKeyVersions(DB* db, ColumnFamilyHandle* cfh, Slice begin_key, Slice end_key, size_t max_num_ikeys, std::vector* key_versions); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/env_librados.h b/include/rocksdb/utilities/env_librados.h index 7be75878d9..361217c621 100644 --- a/include/rocksdb/utilities/env_librados.h +++ b/include/rocksdb/utilities/env_librados.h @@ -13,7 +13,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class LibradosWritableFile; class EnvLibrados : public EnvWrapper { @@ -172,4 +172,4 @@ class EnvLibrados : public EnvWrapper { librados::IoCtx* _GetIoctx(const std::string& prefix); friend class LibradosWritableFile; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/utilities/env_mirror.h b/include/rocksdb/utilities/env_mirror.h index 4b6b66e04f..8e96ac4108 100644 --- a/include/rocksdb/utilities/env_mirror.h +++ b/include/rocksdb/utilities/env_mirror.h @@ -25,7 +25,7 @@ #include #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SequentialFileMirror; class RandomAccessFileMirror; @@ -175,6 +175,6 @@ class EnvMirror : public EnvWrapper { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/info_log_finder.h b/include/rocksdb/utilities/info_log_finder.h index 6df056ffae..824f8a3dfe 100644 --- a/include/rocksdb/utilities/info_log_finder.h +++ b/include/rocksdb/utilities/info_log_finder.h @@ -11,9 +11,9 @@ #include "rocksdb/db.h" #include "rocksdb/options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This function can be used to list the Information logs, // given the db pointer. Status GetInfoLogList(DB* db, std::vector* info_log_list); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/utilities/ldb_cmd.h b/include/rocksdb/utilities/ldb_cmd.h index cf7d25fba2..94548b5385 100644 --- a/include/rocksdb/utilities/ldb_cmd.h +++ b/include/rocksdb/utilities/ldb_cmd.h @@ -24,7 +24,7 @@ #include "rocksdb/utilities/db_ttl.h" #include "rocksdb/utilities/ldb_cmd_execute_result.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class LDBCommand { public: @@ -272,6 +272,6 @@ class LDBCommandRunner { const std::vector* column_families); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/ldb_cmd_execute_result.h b/include/rocksdb/utilities/ldb_cmd_execute_result.h index 85c219542d..c837b47f77 100644 --- a/include/rocksdb/utilities/ldb_cmd_execute_result.h +++ b/include/rocksdb/utilities/ldb_cmd_execute_result.h @@ -9,7 +9,7 @@ #undef FAILED #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class LDBCommandExecuteResult { public: @@ -68,4 +68,4 @@ class LDBCommandExecuteResult { bool operator!=(const LDBCommandExecuteResult&); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/utilities/leveldb_options.h b/include/rocksdb/utilities/leveldb_options.h index fb5a440bbc..e9fef9609b 100644 --- a/include/rocksdb/utilities/leveldb_options.h +++ b/include/rocksdb/utilities/leveldb_options.h @@ -11,7 +11,9 @@ #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { class Cache; class Comparator; @@ -141,4 +143,4 @@ struct LevelDBOptions { // Converts a LevelDBOptions object into a RocksDB Options object. Options ConvertOptions(const LevelDBOptions& leveldb_options); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/utilities/lua/rocks_lua_custom_library.h b/include/rocksdb/utilities/lua/rocks_lua_custom_library.h index 471ae12a6d..f617da02be 100644 --- a/include/rocksdb/utilities/lua/rocks_lua_custom_library.h +++ b/include/rocksdb/utilities/lua/rocks_lua_custom_library.h @@ -13,7 +13,7 @@ extern "C" { #include } -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace lua { // A class that used to define custom C Library that is callable // from Lua script @@ -39,5 +39,5 @@ class RocksLuaCustomLibrary { virtual void CustomSetup(lua_State* /*L*/) const {} }; } // namespace lua -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // LUA diff --git a/include/rocksdb/utilities/lua/rocks_lua_util.h b/include/rocksdb/utilities/lua/rocks_lua_util.h index 36b007cc73..3427b65ef6 100644 --- a/include/rocksdb/utilities/lua/rocks_lua_util.h +++ b/include/rocksdb/utilities/lua/rocks_lua_util.h @@ -17,7 +17,7 @@ extern "C" { #include "rocksdb/utilities/lua/rocks_lua_custom_library.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace lua { class LuaStateWrapper { public: @@ -51,5 +51,5 @@ class LuaStateWrapper { lua_State* lua_state_; }; } // namespace lua -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // LUA diff --git a/include/rocksdb/utilities/memory_util.h b/include/rocksdb/utilities/memory_util.h index c6128909e9..4f1606b519 100644 --- a/include/rocksdb/utilities/memory_util.h +++ b/include/rocksdb/utilities/memory_util.h @@ -15,7 +15,7 @@ #include "rocksdb/cache.h" #include "rocksdb/db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Returns the current memory usage of the specified DB instances. class MemoryUtil { @@ -46,5 +46,5 @@ class MemoryUtil { const std::unordered_set cache_set, std::map* usage_by_type); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/include/rocksdb/utilities/object_registry.h b/include/rocksdb/utilities/object_registry.h index d1516079a6..74a49d400c 100644 --- a/include/rocksdb/utilities/object_registry.h +++ b/include/rocksdb/utilities/object_registry.h @@ -15,7 +15,7 @@ #include #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Logger; // Returns a new T when called with a string. Populates the std::unique_ptr // argument if granting ownership to caller. @@ -201,5 +201,5 @@ class ObjectRegistry { // searching for entries. std::vector> libraries_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/optimistic_transaction_db.h b/include/rocksdb/utilities/optimistic_transaction_db.h index d873683d09..5356df71f3 100644 --- a/include/rocksdb/utilities/optimistic_transaction_db.h +++ b/include/rocksdb/utilities/optimistic_transaction_db.h @@ -13,7 +13,7 @@ #include "rocksdb/db.h" #include "rocksdb/utilities/stackable_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Transaction; @@ -93,6 +93,6 @@ class OptimisticTransactionDB : public StackableDB { explicit OptimisticTransactionDB(DB* db) : StackableDB(db) {} }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/option_change_migration.h b/include/rocksdb/utilities/option_change_migration.h index 81f674c973..cb1d0d1175 100644 --- a/include/rocksdb/utilities/option_change_migration.h +++ b/include/rocksdb/utilities/option_change_migration.h @@ -9,11 +9,11 @@ #include "rocksdb/options.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Try to migrate DB created with old_opts to be use new_opts. // Multiple column families is not supported. // It is best-effort. No guarantee to succeed. // A full compaction may be executed. Status OptionChangeMigration(std::string dbname, const Options& old_opts, const Options& new_opts); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/utilities/options_util.h b/include/rocksdb/utilities/options_util.h index a1d0fde2f5..1a29464a62 100644 --- a/include/rocksdb/utilities/options_util.h +++ b/include/rocksdb/utilities/options_util.h @@ -16,7 +16,7 @@ #include "rocksdb/options.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Constructs the DBOptions and ColumnFamilyDescriptors by loading the // latest RocksDB options file stored in the specified rocksdb database. // @@ -98,5 +98,5 @@ Status CheckOptionsCompatibility( const std::vector& cf_descs, bool ignore_unknown_options = false); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/include/rocksdb/utilities/sim_cache.h b/include/rocksdb/utilities/sim_cache.h index fef9e9910e..ba6f1d7489 100644 --- a/include/rocksdb/utilities/sim_cache.h +++ b/include/rocksdb/utilities/sim_cache.h @@ -14,7 +14,7 @@ #include "rocksdb/statistics.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SimCache; @@ -91,4 +91,4 @@ class SimCache : public Cache { SimCache& operator=(const SimCache&); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/utilities/stackable_db.h b/include/rocksdb/utilities/stackable_db.h index e0b7372552..9888fa22db 100644 --- a/include/rocksdb/utilities/stackable_db.h +++ b/include/rocksdb/utilities/stackable_db.h @@ -14,7 +14,7 @@ #undef DeleteFile #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This class contains APIs to stack rocksdb wrappers.Eg. Stack TTL over base d class StackableDB : public DB { @@ -462,4 +462,4 @@ class StackableDB : public DB { std::shared_ptr shared_db_ptr_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/utilities/table_properties_collectors.h b/include/rocksdb/utilities/table_properties_collectors.h index bb350bcf9c..b7ee88bc30 100644 --- a/include/rocksdb/utilities/table_properties_collectors.h +++ b/include/rocksdb/utilities/table_properties_collectors.h @@ -10,7 +10,7 @@ #include "rocksdb/table_properties.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A factory of a table property collector that marks a SST // file as need-compaction when it observe at least "D" deletion @@ -69,6 +69,6 @@ class CompactOnDeletionCollectorFactory extern std::shared_ptr NewCompactOnDeletionCollectorFactory(size_t sliding_window_size, size_t deletion_trigger); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/include/rocksdb/utilities/transaction.h b/include/rocksdb/utilities/transaction.h index 44ce280195..d6c6722c8e 100644 --- a/include/rocksdb/utilities/transaction.h +++ b/include/rocksdb/utilities/transaction.h @@ -14,7 +14,7 @@ #include "rocksdb/db.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Iterator; class TransactionDB; @@ -535,6 +535,6 @@ class Transaction { friend class TransactionTest_TwoPhaseLogRollingTest2_Test; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/transaction_db.h b/include/rocksdb/utilities/transaction_db.h index d286370fbb..73b7416a0a 100644 --- a/include/rocksdb/utilities/transaction_db.h +++ b/include/rocksdb/utilities/transaction_db.h @@ -19,7 +19,7 @@ // // See transaction.h and examples/transaction_example.cc -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TransactionDBMutexFactory; @@ -304,6 +304,6 @@ class TransactionDB : public StackableDB { void operator=(const TransactionDB&) = delete; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/transaction_db_mutex.h b/include/rocksdb/utilities/transaction_db_mutex.h index df59e7a9e5..96a42adf8c 100644 --- a/include/rocksdb/utilities/transaction_db_mutex.h +++ b/include/rocksdb/utilities/transaction_db_mutex.h @@ -10,7 +10,7 @@ #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // TransactionDBMutex and TransactionDBCondVar APIs allows applications to // implement custom mutexes and condition variables to be used by a @@ -87,6 +87,6 @@ class TransactionDBMutexFactory { virtual ~TransactionDBMutexFactory() {} }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/utility_db.h b/include/rocksdb/utilities/utility_db.h index 0646b8b3cf..cf2e5811cd 100644 --- a/include/rocksdb/utilities/utility_db.h +++ b/include/rocksdb/utilities/utility_db.h @@ -12,7 +12,7 @@ #include "rocksdb/utilities/db_ttl.h" #include "rocksdb/utilities/stackable_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Please don't use this class. It's deprecated class UtilityDB { @@ -30,5 +30,5 @@ class UtilityDB { StackableDB** dbptr, int32_t ttl = 0, bool read_only = false); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/include/rocksdb/utilities/write_batch_with_index.h b/include/rocksdb/utilities/write_batch_with_index.h index b9e3be15f3..424aa15823 100644 --- a/include/rocksdb/utilities/write_batch_with_index.h +++ b/include/rocksdb/utilities/write_batch_with_index.h @@ -23,7 +23,7 @@ #include "rocksdb/write_batch.h" #include "rocksdb/write_batch_base.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ColumnFamilyHandle; class Comparator; @@ -273,6 +273,6 @@ class WriteBatchWithIndex : public WriteBatchBase { std::unique_ptr rep; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/include/rocksdb/wal_filter.h b/include/rocksdb/wal_filter.h index e25746dba4..98eddc2e26 100644 --- a/include/rocksdb/wal_filter.h +++ b/include/rocksdb/wal_filter.h @@ -8,7 +8,9 @@ #include #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { class WriteBatch; @@ -97,4 +99,4 @@ class WalFilter { virtual const char* Name() const = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/write_batch.h b/include/rocksdb/write_batch.h index 0b42b9bd57..51fd4d8ac8 100644 --- a/include/rocksdb/write_batch.h +++ b/include/rocksdb/write_batch.h @@ -32,7 +32,7 @@ #include "rocksdb/status.h" #include "rocksdb/write_batch_base.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Slice; class ColumnFamilyHandle; @@ -374,4 +374,4 @@ class WriteBatch : public WriteBatchBase { // Intentionally copyable }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/write_batch_base.h b/include/rocksdb/write_batch_base.h index a7747a7c84..19ff877e70 100644 --- a/include/rocksdb/write_batch_base.h +++ b/include/rocksdb/write_batch_base.h @@ -10,7 +10,9 @@ #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { class Slice; class Status; @@ -122,4 +124,4 @@ class WriteBatchBase { virtual void SetMaxBytes(size_t max_bytes) = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/include/rocksdb/write_buffer_manager.h b/include/rocksdb/write_buffer_manager.h index a6c204a633..ae1c98cafb 100644 --- a/include/rocksdb/write_buffer_manager.h +++ b/include/rocksdb/write_buffer_manager.h @@ -16,7 +16,7 @@ #include #include "rocksdb/cache.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WriteBufferManager { public: @@ -99,4 +99,4 @@ class WriteBufferManager { void ReserveMemWithCache(size_t mem); void FreeMemWithCache(size_t mem); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/backupablejni.cc b/java/rocksjni/backupablejni.cc index c5ac30377c..3e52305d24 100644 --- a/java/rocksjni/backupablejni.cc +++ b/java/rocksjni/backupablejni.cc @@ -4,8 +4,8 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::BackupEnginge and rocksdb::BackupableDBOptions methods -// from Java side. +// calling c++ ROCKSDB_NAMESPACE::BackupEnginge and +// ROCKSDB_NAMESPACE::BackupableDBOptions methods from Java side. #include #include @@ -32,7 +32,7 @@ jlong Java_org_rocksdb_BackupableDBOptions_newBackupableDBOptions( // exception thrown: OutOfMemoryError return 0; } - auto* bopt = new rocksdb::BackupableDBOptions(cpath); + auto* bopt = new ROCKSDB_NAMESPACE::BackupableDBOptions(cpath); env->ReleaseStringUTFChars(jpath, cpath); return reinterpret_cast(bopt); } @@ -45,7 +45,8 @@ jlong Java_org_rocksdb_BackupableDBOptions_newBackupableDBOptions( jstring Java_org_rocksdb_BackupableDBOptions_backupDir(JNIEnv* env, jobject /*jopt*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); return env->NewStringUTF(bopt->backup_dir.c_str()); } @@ -56,8 +57,10 @@ jstring Java_org_rocksdb_BackupableDBOptions_backupDir(JNIEnv* env, */ void Java_org_rocksdb_BackupableDBOptions_setBackupEnv( JNIEnv* /*env*/, jobject /*jopt*/, jlong jhandle, jlong jrocks_env_handle) { - auto* bopt = reinterpret_cast(jhandle); - auto* rocks_env = reinterpret_cast(jrocks_env_handle); + auto* bopt = + reinterpret_cast(jhandle); + auto* rocks_env = + reinterpret_cast(jrocks_env_handle); bopt->backup_env = rocks_env; } @@ -70,7 +73,8 @@ void Java_org_rocksdb_BackupableDBOptions_setShareTableFiles(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean flag) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); bopt->share_table_files = flag; } @@ -82,7 +86,8 @@ void Java_org_rocksdb_BackupableDBOptions_setShareTableFiles(JNIEnv* /*env*/, jboolean Java_org_rocksdb_BackupableDBOptions_shareTableFiles(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); return bopt->share_table_files; } @@ -95,9 +100,11 @@ void Java_org_rocksdb_BackupableDBOptions_setInfoLog(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong /*jlogger_handle*/) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); auto* sptr_logger = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); bopt->info_log = sptr_logger->get(); } @@ -110,7 +117,8 @@ void Java_org_rocksdb_BackupableDBOptions_setSync(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean flag) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); bopt->sync = flag; } @@ -122,7 +130,8 @@ void Java_org_rocksdb_BackupableDBOptions_setSync(JNIEnv* /*env*/, jboolean Java_org_rocksdb_BackupableDBOptions_sync(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); return bopt->sync; } @@ -135,7 +144,8 @@ void Java_org_rocksdb_BackupableDBOptions_setDestroyOldData(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean flag) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); bopt->destroy_old_data = flag; } @@ -147,7 +157,8 @@ void Java_org_rocksdb_BackupableDBOptions_setDestroyOldData(JNIEnv* /*env*/, jboolean Java_org_rocksdb_BackupableDBOptions_destroyOldData(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); return bopt->destroy_old_data; } @@ -160,7 +171,8 @@ void Java_org_rocksdb_BackupableDBOptions_setBackupLogFiles(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean flag) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); bopt->backup_log_files = flag; } @@ -172,7 +184,8 @@ void Java_org_rocksdb_BackupableDBOptions_setBackupLogFiles(JNIEnv* /*env*/, jboolean Java_org_rocksdb_BackupableDBOptions_backupLogFiles(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); return bopt->backup_log_files; } @@ -184,7 +197,8 @@ jboolean Java_org_rocksdb_BackupableDBOptions_backupLogFiles(JNIEnv* /*env*/, void Java_org_rocksdb_BackupableDBOptions_setBackupRateLimit( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jbackup_rate_limit) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); bopt->backup_rate_limit = jbackup_rate_limit; } @@ -196,7 +210,8 @@ void Java_org_rocksdb_BackupableDBOptions_setBackupRateLimit( jlong Java_org_rocksdb_BackupableDBOptions_backupRateLimit(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); return bopt->backup_rate_limit; } @@ -208,9 +223,10 @@ jlong Java_org_rocksdb_BackupableDBOptions_backupRateLimit(JNIEnv* /*env*/, void Java_org_rocksdb_BackupableDBOptions_setBackupRateLimiter( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jrate_limiter_handle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); auto* sptr_rate_limiter = - reinterpret_cast*>( + reinterpret_cast*>( jrate_limiter_handle); bopt->backup_rate_limiter = *sptr_rate_limiter; } @@ -223,7 +239,8 @@ void Java_org_rocksdb_BackupableDBOptions_setBackupRateLimiter( void Java_org_rocksdb_BackupableDBOptions_setRestoreRateLimit( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jrestore_rate_limit) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); bopt->restore_rate_limit = jrestore_rate_limit; } @@ -235,7 +252,8 @@ void Java_org_rocksdb_BackupableDBOptions_setRestoreRateLimit( jlong Java_org_rocksdb_BackupableDBOptions_restoreRateLimit(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); return bopt->restore_rate_limit; } @@ -247,9 +265,10 @@ jlong Java_org_rocksdb_BackupableDBOptions_restoreRateLimit(JNIEnv* /*env*/, void Java_org_rocksdb_BackupableDBOptions_setRestoreRateLimiter( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jrate_limiter_handle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); auto* sptr_rate_limiter = - reinterpret_cast*>( + reinterpret_cast*>( jrate_limiter_handle); bopt->restore_rate_limiter = *sptr_rate_limiter; } @@ -261,7 +280,8 @@ void Java_org_rocksdb_BackupableDBOptions_setRestoreRateLimiter( */ void Java_org_rocksdb_BackupableDBOptions_setShareFilesWithChecksum( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean flag) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); bopt->share_files_with_checksum = flag; } @@ -272,7 +292,8 @@ void Java_org_rocksdb_BackupableDBOptions_setShareFilesWithChecksum( */ jboolean Java_org_rocksdb_BackupableDBOptions_shareFilesWithChecksum( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); return bopt->share_files_with_checksum; } @@ -284,7 +305,8 @@ jboolean Java_org_rocksdb_BackupableDBOptions_shareFilesWithChecksum( void Java_org_rocksdb_BackupableDBOptions_setMaxBackgroundOperations( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint max_background_operations) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); bopt->max_background_operations = static_cast(max_background_operations); } @@ -295,7 +317,8 @@ void Java_org_rocksdb_BackupableDBOptions_setMaxBackgroundOperations( */ jint Java_org_rocksdb_BackupableDBOptions_maxBackgroundOperations( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); return static_cast(bopt->max_background_operations); } @@ -307,7 +330,8 @@ jint Java_org_rocksdb_BackupableDBOptions_maxBackgroundOperations( void Java_org_rocksdb_BackupableDBOptions_setCallbackTriggerIntervalSize( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jcallback_trigger_interval_size) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); bopt->callback_trigger_interval_size = static_cast(jcallback_trigger_interval_size); } @@ -319,7 +343,8 @@ void Java_org_rocksdb_BackupableDBOptions_setCallbackTriggerIntervalSize( */ jlong Java_org_rocksdb_BackupableDBOptions_callbackTriggerIntervalSize( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); return static_cast(bopt->callback_trigger_interval_size); } @@ -331,7 +356,8 @@ jlong Java_org_rocksdb_BackupableDBOptions_callbackTriggerIntervalSize( void Java_org_rocksdb_BackupableDBOptions_disposeInternal(JNIEnv* /*env*/, jobject /*jopt*/, jlong jhandle) { - auto* bopt = reinterpret_cast(jhandle); + auto* bopt = + reinterpret_cast(jhandle); assert(bopt != nullptr); delete bopt; } diff --git a/java/rocksjni/backupenginejni.cc b/java/rocksjni/backupenginejni.cc index e62b0b4f0f..76889fa80f 100644 --- a/java/rocksjni/backupenginejni.cc +++ b/java/rocksjni/backupenginejni.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling C++ rocksdb::BackupEngine methods from the Java side. +// calling C++ ROCKSDB_NAMESPACE::BackupEngine methods from the Java side. #include #include @@ -21,17 +21,18 @@ jlong Java_org_rocksdb_BackupEngine_open(JNIEnv* env, jclass /*jcls*/, jlong env_handle, jlong backupable_db_options_handle) { - auto* rocks_env = reinterpret_cast(env_handle); - auto* backupable_db_options = reinterpret_cast( - backupable_db_options_handle); - rocksdb::BackupEngine* backup_engine; - auto status = rocksdb::BackupEngine::Open(rocks_env, *backupable_db_options, - &backup_engine); + auto* rocks_env = reinterpret_cast(env_handle); + auto* backupable_db_options = + reinterpret_cast( + backupable_db_options_handle); + ROCKSDB_NAMESPACE::BackupEngine* backup_engine; + auto status = ROCKSDB_NAMESPACE::BackupEngine::Open( + rocks_env, *backupable_db_options, &backup_engine); if (status.ok()) { return reinterpret_cast(backup_engine); } else { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); return 0; } } @@ -44,8 +45,9 @@ jlong Java_org_rocksdb_BackupEngine_open(JNIEnv* env, jclass /*jcls*/, void Java_org_rocksdb_BackupEngine_createNewBackup( JNIEnv* env, jobject /*jbe*/, jlong jbe_handle, jlong db_handle, jboolean jflush_before_backup) { - auto* db = reinterpret_cast(db_handle); - auto* backup_engine = reinterpret_cast(jbe_handle); + auto* db = reinterpret_cast(db_handle); + auto* backup_engine = + reinterpret_cast(jbe_handle); auto status = backup_engine->CreateNewBackup( db, static_cast(jflush_before_backup)); @@ -53,7 +55,7 @@ void Java_org_rocksdb_BackupEngine_createNewBackup( return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } /* @@ -64,14 +66,15 @@ void Java_org_rocksdb_BackupEngine_createNewBackup( void Java_org_rocksdb_BackupEngine_createNewBackupWithMetadata( JNIEnv* env, jobject /*jbe*/, jlong jbe_handle, jlong db_handle, jstring japp_metadata, jboolean jflush_before_backup) { - auto* db = reinterpret_cast(db_handle); - auto* backup_engine = reinterpret_cast(jbe_handle); + auto* db = reinterpret_cast(db_handle); + auto* backup_engine = + reinterpret_cast(jbe_handle); jboolean has_exception = JNI_FALSE; - std::string app_metadata = - rocksdb::JniUtil::copyStdString(env, japp_metadata, &has_exception); + std::string app_metadata = ROCKSDB_NAMESPACE::JniUtil::copyStdString( + env, japp_metadata, &has_exception); if (has_exception == JNI_TRUE) { - rocksdb::RocksDBExceptionJni::ThrowNew( + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, "Could not copy jstring to std::string"); return; } @@ -83,7 +86,7 @@ void Java_org_rocksdb_BackupEngine_createNewBackupWithMetadata( return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } /* @@ -94,10 +97,11 @@ void Java_org_rocksdb_BackupEngine_createNewBackupWithMetadata( jobject Java_org_rocksdb_BackupEngine_getBackupInfo(JNIEnv* env, jobject /*jbe*/, jlong jbe_handle) { - auto* backup_engine = reinterpret_cast(jbe_handle); - std::vector backup_infos; + auto* backup_engine = + reinterpret_cast(jbe_handle); + std::vector backup_infos; backup_engine->GetBackupInfo(&backup_infos); - return rocksdb::BackupInfoListJni::getBackupInfo(env, backup_infos); + return ROCKSDB_NAMESPACE::BackupInfoListJni::getBackupInfo(env, backup_infos); } /* @@ -108,8 +112,9 @@ jobject Java_org_rocksdb_BackupEngine_getBackupInfo(JNIEnv* env, jintArray Java_org_rocksdb_BackupEngine_getCorruptedBackups(JNIEnv* env, jobject /*jbe*/, jlong jbe_handle) { - auto* backup_engine = reinterpret_cast(jbe_handle); - std::vector backup_ids; + auto* backup_engine = + reinterpret_cast(jbe_handle); + std::vector backup_ids; backup_engine->GetCorruptedBackups(&backup_ids); // store backupids in int array std::vector int_backup_ids(backup_ids.begin(), backup_ids.end()); @@ -134,14 +139,15 @@ jintArray Java_org_rocksdb_BackupEngine_getCorruptedBackups(JNIEnv* env, */ void Java_org_rocksdb_BackupEngine_garbageCollect(JNIEnv* env, jobject /*jbe*/, jlong jbe_handle) { - auto* backup_engine = reinterpret_cast(jbe_handle); + auto* backup_engine = + reinterpret_cast(jbe_handle); auto status = backup_engine->GarbageCollect(); if (status.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } /* @@ -152,7 +158,8 @@ void Java_org_rocksdb_BackupEngine_garbageCollect(JNIEnv* env, jobject /*jbe*/, void Java_org_rocksdb_BackupEngine_purgeOldBackups(JNIEnv* env, jobject /*jbe*/, jlong jbe_handle, jint jnum_backups_to_keep) { - auto* backup_engine = reinterpret_cast(jbe_handle); + auto* backup_engine = + reinterpret_cast(jbe_handle); auto status = backup_engine->PurgeOldBackups( static_cast(jnum_backups_to_keep)); @@ -160,7 +167,7 @@ void Java_org_rocksdb_BackupEngine_purgeOldBackups(JNIEnv* env, jobject /*jbe*/, return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } /* @@ -171,15 +178,16 @@ void Java_org_rocksdb_BackupEngine_purgeOldBackups(JNIEnv* env, jobject /*jbe*/, void Java_org_rocksdb_BackupEngine_deleteBackup(JNIEnv* env, jobject /*jbe*/, jlong jbe_handle, jint jbackup_id) { - auto* backup_engine = reinterpret_cast(jbe_handle); - auto status = - backup_engine->DeleteBackup(static_cast(jbackup_id)); + auto* backup_engine = + reinterpret_cast(jbe_handle); + auto status = backup_engine->DeleteBackup( + static_cast(jbackup_id)); if (status.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } /* @@ -190,7 +198,8 @@ void Java_org_rocksdb_BackupEngine_deleteBackup(JNIEnv* env, jobject /*jbe*/, void Java_org_rocksdb_BackupEngine_restoreDbFromBackup( JNIEnv* env, jobject /*jbe*/, jlong jbe_handle, jint jbackup_id, jstring jdb_dir, jstring jwal_dir, jlong jrestore_options_handle) { - auto* backup_engine = reinterpret_cast(jbe_handle); + auto* backup_engine = + reinterpret_cast(jbe_handle); const char* db_dir = env->GetStringUTFChars(jdb_dir, nullptr); if (db_dir == nullptr) { // exception thrown: OutOfMemoryError @@ -202,10 +211,10 @@ void Java_org_rocksdb_BackupEngine_restoreDbFromBackup( env->ReleaseStringUTFChars(jdb_dir, db_dir); return; } - auto* restore_options = - reinterpret_cast(jrestore_options_handle); + auto* restore_options = reinterpret_cast( + jrestore_options_handle); auto status = backup_engine->RestoreDBFromBackup( - static_cast(jbackup_id), db_dir, wal_dir, + static_cast(jbackup_id), db_dir, wal_dir, *restore_options); env->ReleaseStringUTFChars(jwal_dir, wal_dir); @@ -215,7 +224,7 @@ void Java_org_rocksdb_BackupEngine_restoreDbFromBackup( return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } /* @@ -226,7 +235,8 @@ void Java_org_rocksdb_BackupEngine_restoreDbFromBackup( void Java_org_rocksdb_BackupEngine_restoreDbFromLatestBackup( JNIEnv* env, jobject /*jbe*/, jlong jbe_handle, jstring jdb_dir, jstring jwal_dir, jlong jrestore_options_handle) { - auto* backup_engine = reinterpret_cast(jbe_handle); + auto* backup_engine = + reinterpret_cast(jbe_handle); const char* db_dir = env->GetStringUTFChars(jdb_dir, nullptr); if (db_dir == nullptr) { // exception thrown: OutOfMemoryError @@ -238,8 +248,8 @@ void Java_org_rocksdb_BackupEngine_restoreDbFromLatestBackup( env->ReleaseStringUTFChars(jdb_dir, db_dir); return; } - auto* restore_options = - reinterpret_cast(jrestore_options_handle); + auto* restore_options = reinterpret_cast( + jrestore_options_handle); auto status = backup_engine->RestoreDBFromLatestBackup(db_dir, wal_dir, *restore_options); @@ -250,7 +260,7 @@ void Java_org_rocksdb_BackupEngine_restoreDbFromLatestBackup( return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } /* @@ -261,7 +271,7 @@ void Java_org_rocksdb_BackupEngine_restoreDbFromLatestBackup( void Java_org_rocksdb_BackupEngine_disposeInternal(JNIEnv* /*env*/, jobject /*jbe*/, jlong jbe_handle) { - auto* be = reinterpret_cast(jbe_handle); + auto* be = reinterpret_cast(jbe_handle); assert(be != nullptr); delete be; } diff --git a/java/rocksjni/cassandra_compactionfilterjni.cc b/java/rocksjni/cassandra_compactionfilterjni.cc index 799e25e3f4..10d482baf3 100644 --- a/java/rocksjni/cassandra_compactionfilterjni.cc +++ b/java/rocksjni/cassandra_compactionfilterjni.cc @@ -16,8 +16,9 @@ jlong Java_org_rocksdb_CassandraCompactionFilter_createNewCassandraCompactionFilter0( JNIEnv* /*env*/, jclass /*jcls*/, jboolean purge_ttl_on_expiration, jint gc_grace_period_in_seconds) { - auto* compaction_filter = new rocksdb::cassandra::CassandraCompactionFilter( - purge_ttl_on_expiration, gc_grace_period_in_seconds); + auto* compaction_filter = + new ROCKSDB_NAMESPACE::cassandra::CassandraCompactionFilter( + purge_ttl_on_expiration, gc_grace_period_in_seconds); // set the native handle to our native compaction filter return reinterpret_cast(compaction_filter); } diff --git a/java/rocksjni/cassandra_value_operator.cc b/java/rocksjni/cassandra_value_operator.cc index 73b3dcc637..9bd31b9fbc 100644 --- a/java/rocksjni/cassandra_value_operator.cc +++ b/java/rocksjni/cassandra_value_operator.cc @@ -28,8 +28,8 @@ jlong Java_org_rocksdb_CassandraValueMergeOperator_newSharedCassandraValueMergeOperator( JNIEnv* /*env*/, jclass /*jclazz*/, jint gcGracePeriodInSeconds, jint operands_limit) { - auto* op = new std::shared_ptr( - new rocksdb::cassandra::CassandraValueMergeOperator( + auto* op = new std::shared_ptr( + new ROCKSDB_NAMESPACE::cassandra::CassandraValueMergeOperator( gcGracePeriodInSeconds, operands_limit)); return reinterpret_cast(op); } @@ -42,6 +42,7 @@ jlong Java_org_rocksdb_CassandraValueMergeOperator_newSharedCassandraValueMergeO void Java_org_rocksdb_CassandraValueMergeOperator_disposeInternal( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* op = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); delete op; } diff --git a/java/rocksjni/checkpoint.cc b/java/rocksjni/checkpoint.cc index f67f016296..b04846e877 100644 --- a/java/rocksjni/checkpoint.cc +++ b/java/rocksjni/checkpoint.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::Checkpoint methods from Java side. +// calling c++ ROCKSDB_NAMESPACE::Checkpoint methods from Java side. #include #include @@ -23,9 +23,9 @@ jlong Java_org_rocksdb_Checkpoint_newCheckpoint(JNIEnv* /*env*/, jclass /*jclazz*/, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::Checkpoint* checkpoint; - rocksdb::Checkpoint::Create(db, &checkpoint); + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::Checkpoint* checkpoint; + ROCKSDB_NAMESPACE::Checkpoint::Create(db, &checkpoint); return reinterpret_cast(checkpoint); } @@ -37,7 +37,7 @@ jlong Java_org_rocksdb_Checkpoint_newCheckpoint(JNIEnv* /*env*/, void Java_org_rocksdb_Checkpoint_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* checkpoint = reinterpret_cast(jhandle); + auto* checkpoint = reinterpret_cast(jhandle); assert(checkpoint != nullptr); delete checkpoint; } @@ -56,12 +56,13 @@ void Java_org_rocksdb_Checkpoint_createCheckpoint(JNIEnv* env, jobject /*jobj*/, return; } - auto* checkpoint = reinterpret_cast(jcheckpoint_handle); - rocksdb::Status s = checkpoint->CreateCheckpoint(checkpoint_path); + auto* checkpoint = + reinterpret_cast(jcheckpoint_handle); + ROCKSDB_NAMESPACE::Status s = checkpoint->CreateCheckpoint(checkpoint_path); env->ReleaseStringUTFChars(jcheckpoint_path, checkpoint_path); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } diff --git a/java/rocksjni/clock_cache.cc b/java/rocksjni/clock_cache.cc index b1cf0855ed..56ddcfce5b 100644 --- a/java/rocksjni/clock_cache.cc +++ b/java/rocksjni/clock_cache.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::ClockCache. +// ROCKSDB_NAMESPACE::ClockCache. #include @@ -19,8 +19,8 @@ jlong Java_org_rocksdb_ClockCache_newClockCache( JNIEnv* /*env*/, jclass /*jcls*/, jlong jcapacity, jint jnum_shard_bits, jboolean jstrict_capacity_limit) { - auto* sptr_clock_cache = - new std::shared_ptr(rocksdb::NewClockCache( + auto* sptr_clock_cache = new std::shared_ptr( + ROCKSDB_NAMESPACE::NewClockCache( static_cast(jcapacity), static_cast(jnum_shard_bits), static_cast(jstrict_capacity_limit))); return reinterpret_cast(sptr_clock_cache); @@ -35,6 +35,6 @@ void Java_org_rocksdb_ClockCache_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* sptr_clock_cache = - reinterpret_cast*>(jhandle); + reinterpret_cast*>(jhandle); delete sptr_clock_cache; // delete std::shared_ptr } diff --git a/java/rocksjni/columnfamilyhandle.cc b/java/rocksjni/columnfamilyhandle.cc index ed28057386..4140580f02 100644 --- a/java/rocksjni/columnfamilyhandle.cc +++ b/java/rocksjni/columnfamilyhandle.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::ColumnFamilyHandle. +// ROCKSDB_NAMESPACE::ColumnFamilyHandle. #include #include @@ -21,9 +21,9 @@ jbyteArray Java_org_rocksdb_ColumnFamilyHandle_getName(JNIEnv* env, jobject /*jobj*/, jlong jhandle) { - auto* cfh = reinterpret_cast(jhandle); + auto* cfh = reinterpret_cast(jhandle); std::string cf_name = cfh->GetName(); - return rocksdb::JniUtil::copyBytes(env, cf_name); + return ROCKSDB_NAMESPACE::JniUtil::copyBytes(env, cf_name); } /* @@ -34,7 +34,7 @@ jbyteArray Java_org_rocksdb_ColumnFamilyHandle_getName(JNIEnv* env, jint Java_org_rocksdb_ColumnFamilyHandle_getID(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* cfh = reinterpret_cast(jhandle); + auto* cfh = reinterpret_cast(jhandle); const int32_t id = cfh->GetID(); return static_cast(id); } @@ -47,13 +47,13 @@ jint Java_org_rocksdb_ColumnFamilyHandle_getID(JNIEnv* /*env*/, jobject Java_org_rocksdb_ColumnFamilyHandle_getDescriptor(JNIEnv* env, jobject /*jobj*/, jlong jhandle) { - auto* cfh = reinterpret_cast(jhandle); - rocksdb::ColumnFamilyDescriptor desc; - rocksdb::Status s = cfh->GetDescriptor(&desc); + auto* cfh = reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::ColumnFamilyDescriptor desc; + ROCKSDB_NAMESPACE::Status s = cfh->GetDescriptor(&desc); if (s.ok()) { - return rocksdb::ColumnFamilyDescriptorJni::construct(env, &desc); + return ROCKSDB_NAMESPACE::ColumnFamilyDescriptorJni::construct(env, &desc); } else { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } } @@ -66,7 +66,7 @@ jobject Java_org_rocksdb_ColumnFamilyHandle_getDescriptor(JNIEnv* env, void Java_org_rocksdb_ColumnFamilyHandle_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* cfh = reinterpret_cast(jhandle); + auto* cfh = reinterpret_cast(jhandle); assert(cfh != nullptr); delete cfh; } diff --git a/java/rocksjni/compact_range_options.cc b/java/rocksjni/compact_range_options.cc index cc9ac859e8..af5a200e7f 100644 --- a/java/rocksjni/compact_range_options.cc +++ b/java/rocksjni/compact_range_options.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::CompactRangeOptions. +// ROCKSDB_NAMESPACE::CompactRangeOptions. #include @@ -19,7 +19,7 @@ */ jlong Java_org_rocksdb_CompactRangeOptions_newCompactRangeOptions( JNIEnv* /*env*/, jclass /*jclazz*/) { - auto* options = new rocksdb::CompactRangeOptions(); + auto* options = new ROCKSDB_NAMESPACE::CompactRangeOptions(); return reinterpret_cast(options); } @@ -31,7 +31,8 @@ jlong Java_org_rocksdb_CompactRangeOptions_newCompactRangeOptions( */ jboolean Java_org_rocksdb_CompactRangeOptions_exclusiveManualCompaction( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); return static_cast(options->exclusive_manual_compaction); } @@ -43,7 +44,7 @@ jboolean Java_org_rocksdb_CompactRangeOptions_exclusiveManualCompaction( void Java_org_rocksdb_CompactRangeOptions_setExclusiveManualCompaction( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean exclusive_manual_compaction) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); options->exclusive_manual_compaction = static_cast(exclusive_manual_compaction); } @@ -55,9 +56,10 @@ void Java_org_rocksdb_CompactRangeOptions_setExclusiveManualCompaction( */ jint Java_org_rocksdb_CompactRangeOptions_bottommostLevelCompaction( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); - return rocksdb::BottommostLevelCompactionJni::toJavaBottommostLevelCompaction( - options->bottommost_level_compaction); + auto* options = + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::BottommostLevelCompactionJni:: + toJavaBottommostLevelCompaction(options->bottommost_level_compaction); } /* @@ -68,9 +70,11 @@ jint Java_org_rocksdb_CompactRangeOptions_bottommostLevelCompaction( void Java_org_rocksdb_CompactRangeOptions_setBottommostLevelCompaction( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint bottommost_level_compaction) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); options->bottommost_level_compaction = - rocksdb::BottommostLevelCompactionJni::toCppBottommostLevelCompaction(bottommost_level_compaction); + ROCKSDB_NAMESPACE::BottommostLevelCompactionJni:: + toCppBottommostLevelCompaction(bottommost_level_compaction); } /* @@ -80,7 +84,8 @@ void Java_org_rocksdb_CompactRangeOptions_setBottommostLevelCompaction( */ jboolean Java_org_rocksdb_CompactRangeOptions_changeLevel (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); return static_cast(options->change_level); } @@ -91,7 +96,8 @@ jboolean Java_org_rocksdb_CompactRangeOptions_changeLevel */ void Java_org_rocksdb_CompactRangeOptions_setChangeLevel (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean change_level) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); options->change_level = static_cast(change_level); } @@ -102,7 +108,8 @@ void Java_org_rocksdb_CompactRangeOptions_setChangeLevel */ jint Java_org_rocksdb_CompactRangeOptions_targetLevel (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); return static_cast(options->target_level); } @@ -113,7 +120,8 @@ jint Java_org_rocksdb_CompactRangeOptions_targetLevel */ void Java_org_rocksdb_CompactRangeOptions_setTargetLevel (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint target_level) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); options->target_level = static_cast(target_level); } @@ -124,7 +132,8 @@ void Java_org_rocksdb_CompactRangeOptions_setTargetLevel */ jint Java_org_rocksdb_CompactRangeOptions_targetPathId (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); return static_cast(options->target_path_id); } @@ -135,7 +144,8 @@ jint Java_org_rocksdb_CompactRangeOptions_targetPathId */ void Java_org_rocksdb_CompactRangeOptions_setTargetPathId (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint target_path_id) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); options->target_path_id = static_cast(target_path_id); } @@ -146,7 +156,8 @@ void Java_org_rocksdb_CompactRangeOptions_setTargetPathId */ jboolean Java_org_rocksdb_CompactRangeOptions_allowWriteStall (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); return static_cast(options->allow_write_stall); } @@ -157,7 +168,8 @@ jboolean Java_org_rocksdb_CompactRangeOptions_allowWriteStall */ void Java_org_rocksdb_CompactRangeOptions_setAllowWriteStall (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean allow_write_stall) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); options->allow_write_stall = static_cast(allow_write_stall); } @@ -169,7 +181,8 @@ void Java_org_rocksdb_CompactRangeOptions_setAllowWriteStall */ jint Java_org_rocksdb_CompactRangeOptions_maxSubcompactions (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); return static_cast(options->max_subcompactions); } @@ -180,7 +193,8 @@ jint Java_org_rocksdb_CompactRangeOptions_maxSubcompactions */ void Java_org_rocksdb_CompactRangeOptions_setMaxSubcompactions (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint max_subcompactions) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); options->max_subcompactions = static_cast(max_subcompactions); } @@ -191,6 +205,7 @@ void Java_org_rocksdb_CompactRangeOptions_setMaxSubcompactions */ void Java_org_rocksdb_CompactRangeOptions_disposeInternal( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); delete options; } diff --git a/java/rocksjni/compaction_filter.cc b/java/rocksjni/compaction_filter.cc index 263bae05ee..c3a68cdf28 100644 --- a/java/rocksjni/compaction_filter.cc +++ b/java/rocksjni/compaction_filter.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::CompactionFilter. +// ROCKSDB_NAMESPACE::CompactionFilter. #include @@ -21,7 +21,7 @@ void Java_org_rocksdb_AbstractCompactionFilter_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - auto* cf = reinterpret_cast(handle); + auto* cf = reinterpret_cast(handle); assert(cf != nullptr); delete cf; } diff --git a/java/rocksjni/compaction_filter_factory.cc b/java/rocksjni/compaction_filter_factory.cc index 2ef0a77462..3b7c462c45 100644 --- a/java/rocksjni/compaction_filter_factory.cc +++ b/java/rocksjni/compaction_filter_factory.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::CompactionFilterFactory. +// ROCKSDB_NAMESPACE::CompactionFilterFactory. #include #include @@ -19,9 +19,10 @@ */ jlong Java_org_rocksdb_AbstractCompactionFilterFactory_createNewCompactionFilterFactory0( JNIEnv* env, jobject jobj) { - auto* cff = new rocksdb::CompactionFilterFactoryJniCallback(env, jobj); - auto* ptr_sptr_cff = - new std::shared_ptr(cff); + auto* cff = + new ROCKSDB_NAMESPACE::CompactionFilterFactoryJniCallback(env, jobj); + auto* ptr_sptr_cff = new std::shared_ptr< + ROCKSDB_NAMESPACE::CompactionFilterFactoryJniCallback>(cff); return reinterpret_cast(ptr_sptr_cff); } @@ -33,6 +34,7 @@ jlong Java_org_rocksdb_AbstractCompactionFilterFactory_createNewCompactionFilter void Java_org_rocksdb_AbstractCompactionFilterFactory_disposeInternal( JNIEnv*, jobject, jlong jhandle) { auto* ptr_sptr_cff = reinterpret_cast< - std::shared_ptr*>(jhandle); + std::shared_ptr*>( + jhandle); delete ptr_sptr_cff; } diff --git a/java/rocksjni/compaction_filter_factory_jnicallback.cc b/java/rocksjni/compaction_filter_factory_jnicallback.cc index c727a3e02f..cacbf02c1c 100644 --- a/java/rocksjni/compaction_filter_factory_jnicallback.cc +++ b/java/rocksjni/compaction_filter_factory_jnicallback.cc @@ -4,12 +4,12 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::CompactionFilterFactory. +// ROCKSDB_NAMESPACE::CompactionFilterFactory. #include "rocksjni/compaction_filter_factory_jnicallback.h" #include "rocksjni/portal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { CompactionFilterFactoryJniCallback::CompactionFilterFactoryJniCallback( JNIEnv* env, jobject jcompaction_filter_factory) : JniCallback(env, jcompaction_filter_factory) { @@ -73,4 +73,4 @@ std::unique_ptr CompactionFilterFactoryJniCallback::CreateComp return std::unique_ptr(cff); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/compaction_filter_factory_jnicallback.h b/java/rocksjni/compaction_filter_factory_jnicallback.h index 10802edfd1..eb2d5111d6 100644 --- a/java/rocksjni/compaction_filter_factory_jnicallback.h +++ b/java/rocksjni/compaction_filter_factory_jnicallback.h @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::CompactionFilterFactory. +// ROCKSDB_NAMESPACE::CompactionFilterFactory. #ifndef JAVA_ROCKSJNI_COMPACTION_FILTER_FACTORY_JNICALLBACK_H_ #define JAVA_ROCKSJNI_COMPACTION_FILTER_FACTORY_JNICALLBACK_H_ @@ -15,7 +15,7 @@ #include "rocksdb/compaction_filter.h" #include "rocksjni/jnicallback.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CompactionFilterFactoryJniCallback : public JniCallback, public CompactionFilterFactory { public: @@ -30,6 +30,6 @@ class CompactionFilterFactoryJniCallback : public JniCallback, public Compaction jmethodID m_jcreate_compaction_filter_methodid; }; -} //namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_COMPACTION_FILTER_FACTORY_JNICALLBACK_H_ diff --git a/java/rocksjni/compaction_job_info.cc b/java/rocksjni/compaction_job_info.cc index 6af6efcb85..245ff7e618 100644 --- a/java/rocksjni/compaction_job_info.cc +++ b/java/rocksjni/compaction_job_info.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::CompactionJobInfo. +// ROCKSDB_NAMESPACE::CompactionJobInfo. #include @@ -19,7 +19,7 @@ */ jlong Java_org_rocksdb_CompactionJobInfo_newCompactionJobInfo( JNIEnv*, jclass) { - auto* compact_job_info = new rocksdb::CompactionJobInfo(); + auto* compact_job_info = new ROCKSDB_NAMESPACE::CompactionJobInfo(); return reinterpret_cast(compact_job_info); } @@ -31,7 +31,7 @@ jlong Java_org_rocksdb_CompactionJobInfo_newCompactionJobInfo( void Java_org_rocksdb_CompactionJobInfo_disposeInternal( JNIEnv*, jobject, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); delete compact_job_info; } @@ -43,9 +43,8 @@ void Java_org_rocksdb_CompactionJobInfo_disposeInternal( jbyteArray Java_org_rocksdb_CompactionJobInfo_columnFamilyName( JNIEnv* env, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); - return rocksdb::JniUtil::copyBytes( - env, compact_job_info->cf_name); + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::JniUtil::copyBytes(env, compact_job_info->cf_name); } /* @@ -56,9 +55,8 @@ jbyteArray Java_org_rocksdb_CompactionJobInfo_columnFamilyName( jobject Java_org_rocksdb_CompactionJobInfo_status( JNIEnv* env, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); - return rocksdb::StatusJni::construct( - env, compact_job_info->status); + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::StatusJni::construct(env, compact_job_info->status); } /* @@ -69,7 +67,7 @@ jobject Java_org_rocksdb_CompactionJobInfo_status( jlong Java_org_rocksdb_CompactionJobInfo_threadId( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(compact_job_info->thread_id); } @@ -81,7 +79,7 @@ jlong Java_org_rocksdb_CompactionJobInfo_threadId( jint Java_org_rocksdb_CompactionJobInfo_jobId( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(compact_job_info->job_id); } @@ -93,7 +91,7 @@ jint Java_org_rocksdb_CompactionJobInfo_jobId( jint Java_org_rocksdb_CompactionJobInfo_baseInputLevel( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(compact_job_info->base_input_level); } @@ -105,7 +103,7 @@ jint Java_org_rocksdb_CompactionJobInfo_baseInputLevel( jint Java_org_rocksdb_CompactionJobInfo_outputLevel( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(compact_job_info->output_level); } @@ -117,8 +115,8 @@ jint Java_org_rocksdb_CompactionJobInfo_outputLevel( jobjectArray Java_org_rocksdb_CompactionJobInfo_inputFiles( JNIEnv* env, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); - return rocksdb::JniUtil::toJavaStrings( + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::JniUtil::toJavaStrings( env, &compact_job_info->input_files); } @@ -130,8 +128,8 @@ jobjectArray Java_org_rocksdb_CompactionJobInfo_inputFiles( jobjectArray Java_org_rocksdb_CompactionJobInfo_outputFiles( JNIEnv* env, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); - return rocksdb::JniUtil::toJavaStrings( + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::JniUtil::toJavaStrings( env, &compact_job_info->output_files); } @@ -143,37 +141,48 @@ jobjectArray Java_org_rocksdb_CompactionJobInfo_outputFiles( jobject Java_org_rocksdb_CompactionJobInfo_tableProperties( JNIEnv* env, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); auto* map = &compact_job_info->table_properties; - - jobject jhash_map = rocksdb::HashMapJni::construct( + + jobject jhash_map = ROCKSDB_NAMESPACE::HashMapJni::construct( env, static_cast(map->size())); if (jhash_map == nullptr) { // exception occurred return nullptr; } - const rocksdb::HashMapJni::FnMapKV, jobject, jobject> fn_map_kv = - [env](const std::pair>& kv) { - jstring jkey = rocksdb::JniUtil::toJavaString(env, &(kv.first), false); - if (env->ExceptionCheck()) { - // an error occurred - return std::unique_ptr>(nullptr); - } + const ROCKSDB_NAMESPACE::HashMapJni::FnMapKV< + const std::string, + std::shared_ptr, jobject, + jobject> + fn_map_kv = + [env](const std::pair< + const std::string, + std::shared_ptr>& + kv) { + jstring jkey = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &(kv.first), false); + if (env->ExceptionCheck()) { + // an error occurred + return std::unique_ptr>(nullptr); + } - jobject jtable_properties = rocksdb::TablePropertiesJni::fromCppTableProperties( - env, *(kv.second.get())); - if (env->ExceptionCheck()) { - // an error occurred - env->DeleteLocalRef(jkey); - return std::unique_ptr>(nullptr); - } + jobject jtable_properties = + ROCKSDB_NAMESPACE::TablePropertiesJni::fromCppTableProperties( + env, *(kv.second.get())); + if (env->ExceptionCheck()) { + // an error occurred + env->DeleteLocalRef(jkey); + return std::unique_ptr>(nullptr); + } - return std::unique_ptr>( - new std::pair(static_cast(jkey), jtable_properties)); - }; + return std::unique_ptr>( + new std::pair(static_cast(jkey), + jtable_properties)); + }; - if (!rocksdb::HashMapJni::putAll(env, jhash_map, map->begin(), map->end(), fn_map_kv)) { + if (!ROCKSDB_NAMESPACE::HashMapJni::putAll(env, jhash_map, map->begin(), + map->end(), fn_map_kv)) { // exception occurred return nullptr; } @@ -189,8 +198,8 @@ jobject Java_org_rocksdb_CompactionJobInfo_tableProperties( jbyte Java_org_rocksdb_CompactionJobInfo_compactionReason( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); - return rocksdb::CompactionReasonJni::toJavaCompactionReason( + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompactionReasonJni::toJavaCompactionReason( compact_job_info->compaction_reason); } @@ -202,8 +211,8 @@ jbyte Java_org_rocksdb_CompactionJobInfo_compactionReason( jbyte Java_org_rocksdb_CompactionJobInfo_compression( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); - return rocksdb::CompressionTypeJni::toJavaCompressionType( + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( compact_job_info->compression); } @@ -215,8 +224,8 @@ jbyte Java_org_rocksdb_CompactionJobInfo_compression( jlong Java_org_rocksdb_CompactionJobInfo_stats( JNIEnv *, jclass, jlong jhandle) { auto* compact_job_info = - reinterpret_cast(jhandle); - auto* stats = new rocksdb::CompactionJobStats(); + reinterpret_cast(jhandle); + auto* stats = new ROCKSDB_NAMESPACE::CompactionJobStats(); stats->Add(compact_job_info->stats); return reinterpret_cast(stats); } diff --git a/java/rocksjni/compaction_job_stats.cc b/java/rocksjni/compaction_job_stats.cc index 7d13dd12f9..efaec69ee5 100644 --- a/java/rocksjni/compaction_job_stats.cc +++ b/java/rocksjni/compaction_job_stats.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::CompactionJobStats. +// ROCKSDB_NAMESPACE::CompactionJobStats. #include @@ -19,7 +19,7 @@ */ jlong Java_org_rocksdb_CompactionJobStats_newCompactionJobStats( JNIEnv*, jclass) { - auto* compact_job_stats = new rocksdb::CompactionJobStats(); + auto* compact_job_stats = new ROCKSDB_NAMESPACE::CompactionJobStats(); return reinterpret_cast(compact_job_stats); } @@ -31,7 +31,7 @@ jlong Java_org_rocksdb_CompactionJobStats_newCompactionJobStats( void Java_org_rocksdb_CompactionJobStats_disposeInternal( JNIEnv *, jobject, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); delete compact_job_stats; } @@ -43,7 +43,7 @@ void Java_org_rocksdb_CompactionJobStats_disposeInternal( void Java_org_rocksdb_CompactionJobStats_reset( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); compact_job_stats->Reset(); } @@ -55,9 +55,9 @@ void Java_org_rocksdb_CompactionJobStats_reset( void Java_org_rocksdb_CompactionJobStats_add( JNIEnv*, jclass, jlong jhandle, jlong jother_handle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); auto* other_compact_job_stats = - reinterpret_cast(jother_handle); + reinterpret_cast(jother_handle); compact_job_stats->Add(*other_compact_job_stats); } @@ -69,7 +69,7 @@ void Java_org_rocksdb_CompactionJobStats_add( jlong Java_org_rocksdb_CompactionJobStats_elapsedMicros( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(compact_job_stats->elapsed_micros); } @@ -81,7 +81,7 @@ jlong Java_org_rocksdb_CompactionJobStats_elapsedMicros( jlong Java_org_rocksdb_CompactionJobStats_numInputRecords( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(compact_job_stats->num_input_records); } @@ -93,7 +93,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numInputRecords( jlong Java_org_rocksdb_CompactionJobStats_numInputFiles( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(compact_job_stats->num_input_files); } @@ -105,7 +105,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numInputFiles( jlong Java_org_rocksdb_CompactionJobStats_numInputFilesAtOutputLevel( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->num_input_files_at_output_level); } @@ -118,7 +118,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numInputFilesAtOutputLevel( jlong Java_org_rocksdb_CompactionJobStats_numOutputRecords( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->num_output_records); } @@ -131,7 +131,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numOutputRecords( jlong Java_org_rocksdb_CompactionJobStats_numOutputFiles( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->num_output_files); } @@ -144,7 +144,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numOutputFiles( jboolean Java_org_rocksdb_CompactionJobStats_isManualCompaction( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); if (compact_job_stats->is_manual_compaction) { return JNI_TRUE; } else { @@ -160,7 +160,7 @@ jboolean Java_org_rocksdb_CompactionJobStats_isManualCompaction( jlong Java_org_rocksdb_CompactionJobStats_totalInputBytes( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->total_input_bytes); } @@ -173,7 +173,7 @@ jlong Java_org_rocksdb_CompactionJobStats_totalInputBytes( jlong Java_org_rocksdb_CompactionJobStats_totalOutputBytes( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->total_output_bytes); } @@ -186,7 +186,7 @@ jlong Java_org_rocksdb_CompactionJobStats_totalOutputBytes( jlong Java_org_rocksdb_CompactionJobStats_numRecordsReplaced( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->num_records_replaced); } @@ -199,7 +199,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numRecordsReplaced( jlong Java_org_rocksdb_CompactionJobStats_totalInputRawKeyBytes( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->total_input_raw_key_bytes); } @@ -212,7 +212,7 @@ jlong Java_org_rocksdb_CompactionJobStats_totalInputRawKeyBytes( jlong Java_org_rocksdb_CompactionJobStats_totalInputRawValueBytes( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->total_input_raw_value_bytes); } @@ -225,7 +225,7 @@ jlong Java_org_rocksdb_CompactionJobStats_totalInputRawValueBytes( jlong Java_org_rocksdb_CompactionJobStats_numInputDeletionRecords( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->num_input_deletion_records); } @@ -238,7 +238,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numInputDeletionRecords( jlong Java_org_rocksdb_CompactionJobStats_numExpiredDeletionRecords( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->num_expired_deletion_records); } @@ -251,7 +251,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numExpiredDeletionRecords( jlong Java_org_rocksdb_CompactionJobStats_numCorruptKeys( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->num_corrupt_keys); } @@ -264,7 +264,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numCorruptKeys( jlong Java_org_rocksdb_CompactionJobStats_fileWriteNanos( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->file_write_nanos); } @@ -277,7 +277,7 @@ jlong Java_org_rocksdb_CompactionJobStats_fileWriteNanos( jlong Java_org_rocksdb_CompactionJobStats_fileRangeSyncNanos( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->file_range_sync_nanos); } @@ -290,7 +290,7 @@ jlong Java_org_rocksdb_CompactionJobStats_fileRangeSyncNanos( jlong Java_org_rocksdb_CompactionJobStats_fileFsyncNanos( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->file_fsync_nanos); } @@ -303,7 +303,7 @@ jlong Java_org_rocksdb_CompactionJobStats_fileFsyncNanos( jlong Java_org_rocksdb_CompactionJobStats_filePrepareWriteNanos( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->file_prepare_write_nanos); } @@ -316,9 +316,9 @@ jlong Java_org_rocksdb_CompactionJobStats_filePrepareWriteNanos( jbyteArray Java_org_rocksdb_CompactionJobStats_smallestOutputKeyPrefix( JNIEnv* env, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); - return rocksdb::JniUtil::copyBytes(env, - compact_job_stats->smallest_output_key_prefix); + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::JniUtil::copyBytes( + env, compact_job_stats->smallest_output_key_prefix); } /* @@ -329,9 +329,9 @@ jbyteArray Java_org_rocksdb_CompactionJobStats_smallestOutputKeyPrefix( jbyteArray Java_org_rocksdb_CompactionJobStats_largestOutputKeyPrefix( JNIEnv* env, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); - return rocksdb::JniUtil::copyBytes(env, - compact_job_stats->largest_output_key_prefix); + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::JniUtil::copyBytes( + env, compact_job_stats->largest_output_key_prefix); } /* @@ -342,7 +342,7 @@ jbyteArray Java_org_rocksdb_CompactionJobStats_largestOutputKeyPrefix( jlong Java_org_rocksdb_CompactionJobStats_numSingleDelFallthru( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->num_single_del_fallthru); } @@ -355,7 +355,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numSingleDelFallthru( jlong Java_org_rocksdb_CompactionJobStats_numSingleDelMismatch( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_job_stats->num_single_del_mismatch); -} \ No newline at end of file +} diff --git a/java/rocksjni/compaction_options.cc b/java/rocksjni/compaction_options.cc index 6aaabea736..e904d4abc5 100644 --- a/java/rocksjni/compaction_options.cc +++ b/java/rocksjni/compaction_options.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::CompactionOptions. +// ROCKSDB_NAMESPACE::CompactionOptions. #include @@ -20,7 +20,7 @@ */ jlong Java_org_rocksdb_CompactionOptions_newCompactionOptions( JNIEnv*, jclass) { - auto* compact_opts = new rocksdb::CompactionOptions(); + auto* compact_opts = new ROCKSDB_NAMESPACE::CompactionOptions(); return reinterpret_cast(compact_opts); } @@ -32,7 +32,7 @@ jlong Java_org_rocksdb_CompactionOptions_newCompactionOptions( void Java_org_rocksdb_CompactionOptions_disposeInternal( JNIEnv *, jobject, jlong jhandle) { auto* compact_opts = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); delete compact_opts; } @@ -44,8 +44,8 @@ void Java_org_rocksdb_CompactionOptions_disposeInternal( jbyte Java_org_rocksdb_CompactionOptions_compression( JNIEnv*, jclass, jlong jhandle) { auto* compact_opts = - reinterpret_cast(jhandle); - return rocksdb::CompressionTypeJni::toJavaCompressionType( + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( compact_opts->compression); } @@ -57,9 +57,9 @@ jbyte Java_org_rocksdb_CompactionOptions_compression( void Java_org_rocksdb_CompactionOptions_setCompression( JNIEnv*, jclass, jlong jhandle, jbyte jcompression_type_value) { auto* compact_opts = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); compact_opts->compression = - rocksdb::CompressionTypeJni::toCppCompressionType( + ROCKSDB_NAMESPACE::CompressionTypeJni::toCppCompressionType( jcompression_type_value); } @@ -71,7 +71,7 @@ void Java_org_rocksdb_CompactionOptions_setCompression( jlong Java_org_rocksdb_CompactionOptions_outputFileSizeLimit( JNIEnv*, jclass, jlong jhandle) { auto* compact_opts = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_opts->output_file_size_limit); } @@ -84,7 +84,7 @@ jlong Java_org_rocksdb_CompactionOptions_outputFileSizeLimit( void Java_org_rocksdb_CompactionOptions_setOutputFileSizeLimit( JNIEnv*, jclass, jlong jhandle, jlong joutput_file_size_limit) { auto* compact_opts = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); compact_opts->output_file_size_limit = static_cast(joutput_file_size_limit); } @@ -97,7 +97,7 @@ void Java_org_rocksdb_CompactionOptions_setOutputFileSizeLimit( jint Java_org_rocksdb_CompactionOptions_maxSubcompactions( JNIEnv*, jclass, jlong jhandle) { auto* compact_opts = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast( compact_opts->max_subcompactions); } @@ -110,7 +110,7 @@ jint Java_org_rocksdb_CompactionOptions_maxSubcompactions( void Java_org_rocksdb_CompactionOptions_setMaxSubcompactions( JNIEnv*, jclass, jlong jhandle, jint jmax_subcompactions) { auto* compact_opts = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); compact_opts->max_subcompactions = static_cast(jmax_subcompactions); -} \ No newline at end of file +} diff --git a/java/rocksjni/compaction_options_fifo.cc b/java/rocksjni/compaction_options_fifo.cc index b7c445fd6f..08993524b9 100644 --- a/java/rocksjni/compaction_options_fifo.cc +++ b/java/rocksjni/compaction_options_fifo.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::CompactionOptionsFIFO. +// ROCKSDB_NAMESPACE::CompactionOptionsFIFO. #include @@ -18,7 +18,7 @@ */ jlong Java_org_rocksdb_CompactionOptionsFIFO_newCompactionOptionsFIFO( JNIEnv*, jclass) { - const auto* opt = new rocksdb::CompactionOptionsFIFO(); + const auto* opt = new ROCKSDB_NAMESPACE::CompactionOptionsFIFO(); return reinterpret_cast(opt); } @@ -29,7 +29,8 @@ jlong Java_org_rocksdb_CompactionOptionsFIFO_newCompactionOptionsFIFO( */ void Java_org_rocksdb_CompactionOptionsFIFO_setMaxTableFilesSize( JNIEnv*, jobject, jlong jhandle, jlong jmax_table_files_size) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); opt->max_table_files_size = static_cast(jmax_table_files_size); } @@ -40,7 +41,8 @@ void Java_org_rocksdb_CompactionOptionsFIFO_setMaxTableFilesSize( */ jlong Java_org_rocksdb_CompactionOptionsFIFO_maxTableFilesSize( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); return static_cast(opt->max_table_files_size); } @@ -51,7 +53,8 @@ jlong Java_org_rocksdb_CompactionOptionsFIFO_maxTableFilesSize( */ void Java_org_rocksdb_CompactionOptionsFIFO_setAllowCompaction( JNIEnv*, jobject, jlong jhandle, jboolean allow_compaction) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); opt->allow_compaction = static_cast(allow_compaction); } @@ -62,7 +65,8 @@ void Java_org_rocksdb_CompactionOptionsFIFO_setAllowCompaction( */ jboolean Java_org_rocksdb_CompactionOptionsFIFO_allowCompaction( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); return static_cast(opt->allow_compaction); } @@ -73,5 +77,5 @@ jboolean Java_org_rocksdb_CompactionOptionsFIFO_allowCompaction( */ void Java_org_rocksdb_CompactionOptionsFIFO_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - delete reinterpret_cast(jhandle); + delete reinterpret_cast(jhandle); } diff --git a/java/rocksjni/compaction_options_universal.cc b/java/rocksjni/compaction_options_universal.cc index 7ca519885d..899ee6d1a9 100644 --- a/java/rocksjni/compaction_options_universal.cc +++ b/java/rocksjni/compaction_options_universal.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::CompactionOptionsUniversal. +// ROCKSDB_NAMESPACE::CompactionOptionsUniversal. #include @@ -19,7 +19,7 @@ */ jlong Java_org_rocksdb_CompactionOptionsUniversal_newCompactionOptionsUniversal( JNIEnv*, jclass) { - const auto* opt = new rocksdb::CompactionOptionsUniversal(); + const auto* opt = new ROCKSDB_NAMESPACE::CompactionOptionsUniversal(); return reinterpret_cast(opt); } @@ -30,7 +30,8 @@ jlong Java_org_rocksdb_CompactionOptionsUniversal_newCompactionOptionsUniversal( */ void Java_org_rocksdb_CompactionOptionsUniversal_setSizeRatio( JNIEnv*, jobject, jlong jhandle, jint jsize_ratio) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); opt->size_ratio = static_cast(jsize_ratio); } @@ -41,7 +42,8 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setSizeRatio( */ jint Java_org_rocksdb_CompactionOptionsUniversal_sizeRatio( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); return static_cast(opt->size_ratio); } @@ -52,7 +54,8 @@ jint Java_org_rocksdb_CompactionOptionsUniversal_sizeRatio( */ void Java_org_rocksdb_CompactionOptionsUniversal_setMinMergeWidth( JNIEnv*, jobject, jlong jhandle, jint jmin_merge_width) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); opt->min_merge_width = static_cast(jmin_merge_width); } @@ -63,7 +66,8 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setMinMergeWidth( */ jint Java_org_rocksdb_CompactionOptionsUniversal_minMergeWidth( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); return static_cast(opt->min_merge_width); } @@ -74,7 +78,8 @@ jint Java_org_rocksdb_CompactionOptionsUniversal_minMergeWidth( */ void Java_org_rocksdb_CompactionOptionsUniversal_setMaxMergeWidth( JNIEnv*, jobject, jlong jhandle, jint jmax_merge_width) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); opt->max_merge_width = static_cast(jmax_merge_width); } @@ -85,7 +90,8 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setMaxMergeWidth( */ jint Java_org_rocksdb_CompactionOptionsUniversal_maxMergeWidth( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); return static_cast(opt->max_merge_width); } @@ -96,7 +102,8 @@ jint Java_org_rocksdb_CompactionOptionsUniversal_maxMergeWidth( */ void Java_org_rocksdb_CompactionOptionsUniversal_setMaxSizeAmplificationPercent( JNIEnv*, jobject, jlong jhandle, jint jmax_size_amplification_percent) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); opt->max_size_amplification_percent = static_cast(jmax_size_amplification_percent); } @@ -108,7 +115,8 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setMaxSizeAmplificationPercent( */ jint Java_org_rocksdb_CompactionOptionsUniversal_maxSizeAmplificationPercent( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); return static_cast(opt->max_size_amplification_percent); } @@ -120,7 +128,8 @@ jint Java_org_rocksdb_CompactionOptionsUniversal_maxSizeAmplificationPercent( void Java_org_rocksdb_CompactionOptionsUniversal_setCompressionSizePercent( JNIEnv*, jobject, jlong jhandle, jint jcompression_size_percent) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); opt->compression_size_percent = static_cast(jcompression_size_percent); } @@ -132,7 +141,8 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setCompressionSizePercent( */ jint Java_org_rocksdb_CompactionOptionsUniversal_compressionSizePercent( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); return static_cast(opt->compression_size_percent); } @@ -143,9 +153,11 @@ jint Java_org_rocksdb_CompactionOptionsUniversal_compressionSizePercent( */ void Java_org_rocksdb_CompactionOptionsUniversal_setStopStyle( JNIEnv*, jobject, jlong jhandle, jbyte jstop_style_value) { - auto* opt = reinterpret_cast(jhandle); - opt->stop_style = rocksdb::CompactionStopStyleJni::toCppCompactionStopStyle( - jstop_style_value); + auto* opt = + reinterpret_cast(jhandle); + opt->stop_style = + ROCKSDB_NAMESPACE::CompactionStopStyleJni::toCppCompactionStopStyle( + jstop_style_value); } /* @@ -155,8 +167,9 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setStopStyle( */ jbyte Java_org_rocksdb_CompactionOptionsUniversal_stopStyle( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - return rocksdb::CompactionStopStyleJni::toJavaCompactionStopStyle( + auto* opt = + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompactionStopStyleJni::toJavaCompactionStopStyle( opt->stop_style); } @@ -167,7 +180,8 @@ jbyte Java_org_rocksdb_CompactionOptionsUniversal_stopStyle( */ void Java_org_rocksdb_CompactionOptionsUniversal_setAllowTrivialMove( JNIEnv*, jobject, jlong jhandle, jboolean jallow_trivial_move) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); opt->allow_trivial_move = static_cast(jallow_trivial_move); } @@ -178,7 +192,8 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setAllowTrivialMove( */ jboolean Java_org_rocksdb_CompactionOptionsUniversal_allowTrivialMove( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = + reinterpret_cast(jhandle); return opt->allow_trivial_move; } @@ -189,5 +204,6 @@ jboolean Java_org_rocksdb_CompactionOptionsUniversal_allowTrivialMove( */ void Java_org_rocksdb_CompactionOptionsUniversal_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - delete reinterpret_cast(jhandle); + delete reinterpret_cast( + jhandle); } diff --git a/java/rocksjni/comparator.cc b/java/rocksjni/comparator.cc index 5925aea8f7..485d18f0b1 100644 --- a/java/rocksjni/comparator.cc +++ b/java/rocksjni/comparator.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::Comparator. +// ROCKSDB_NAMESPACE::Comparator. #include #include @@ -25,8 +25,10 @@ jlong Java_org_rocksdb_AbstractComparator_createNewComparator( JNIEnv* env, jobject jcomparator, jlong copt_handle) { auto* copt = - reinterpret_cast(copt_handle); - auto* c = new rocksdb::ComparatorJniCallback(env, jcomparator, copt); + reinterpret_cast( + copt_handle); + auto* c = + new ROCKSDB_NAMESPACE::ComparatorJniCallback(env, jcomparator, copt); return reinterpret_cast(c); } @@ -37,7 +39,8 @@ jlong Java_org_rocksdb_AbstractComparator_createNewComparator( */ jboolean Java_org_rocksdb_AbstractComparator_usingDirectBuffers( JNIEnv*, jobject, jlong jhandle) { - auto* c = reinterpret_cast(jhandle); + auto* c = + reinterpret_cast(jhandle); return static_cast(c->m_options->direct_buffer); } @@ -48,6 +51,7 @@ jboolean Java_org_rocksdb_AbstractComparator_usingDirectBuffers( */ void Java_org_rocksdb_NativeComparatorWrapper_disposeInternal( JNIEnv* /*env*/, jobject /*jobj*/, jlong jcomparator_handle) { - auto* comparator = reinterpret_cast(jcomparator_handle); + auto* comparator = + reinterpret_cast(jcomparator_handle); delete comparator; } diff --git a/java/rocksjni/comparatorjnicallback.cc b/java/rocksjni/comparatorjnicallback.cc index e599c67ada..248b15d3a1 100644 --- a/java/rocksjni/comparatorjnicallback.cc +++ b/java/rocksjni/comparatorjnicallback.cc @@ -4,12 +4,12 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::Comparator. +// ROCKSDB_NAMESPACE::Comparator. #include "rocksjni/comparatorjnicallback.h" #include "rocksjni/portal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { ComparatorJniCallback::ComparatorJniCallback( JNIEnv* env, jobject jcomparator, const ComparatorJniCallbackOptions* options) @@ -349,7 +349,8 @@ void ComparatorJniCallback::FindShortestSeparator( DeleteBuffer(env, j_limit_buf); } MaybeUnlockForReuse(mtx_shortest, reuse_jbuf_start || reuse_jbuf_limit); - rocksdb::RocksDBExceptionJni::ThrowNew(env, "Unable to get Direct Buffer Address"); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Unable to get Direct Buffer Address"); env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); return; @@ -470,7 +471,8 @@ void ComparatorJniCallback::FindShortSuccessor( // reused direct buffer void* key_buf = env->GetDirectBufferAddress(j_key_buf); if (key_buf == nullptr) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, "Unable to get Direct Buffer Address"); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Unable to get Direct Buffer Address"); if (!reuse_jbuf_key) { DeleteBuffer(env, j_key_buf); } @@ -593,7 +595,8 @@ jobject ComparatorJniCallback::ReuseBuffer( void* buf = env->GetDirectBufferAddress(jreuse_buffer); if (buf == nullptr) { // either memory region is undefined, given object is not a direct java.nio.Buffer, or JNI access to direct buffers is not supported by this virtual machine. - rocksdb::RocksDBExceptionJni::ThrowNew(env, "Unable to get Direct Buffer Address"); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Unable to get Direct Buffer Address"); return nullptr; } memcpy(buf, src.data(), src.size()); @@ -632,4 +635,4 @@ void ComparatorJniCallback::DeleteBuffer(JNIEnv* env, jobject jbuffer) const { env->DeleteLocalRef(jbuffer); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/comparatorjnicallback.h b/java/rocksjni/comparatorjnicallback.h index a2d7414945..2e27de0088 100644 --- a/java/rocksjni/comparatorjnicallback.h +++ b/java/rocksjni/comparatorjnicallback.h @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::Comparator +// ROCKSDB_NAMESPACE::Comparator #ifndef JAVA_ROCKSJNI_COMPARATORJNICALLBACK_H_ #define JAVA_ROCKSJNI_COMPARATORJNICALLBACK_H_ @@ -18,7 +18,7 @@ #include "port/port.h" #include "util/thread_local.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { enum ReusedSynchronisationType { /** @@ -132,6 +132,6 @@ class ComparatorJniCallback : public JniCallback, public Comparator { ThreadLocalPtr* m_tl_buf_a; ThreadLocalPtr* m_tl_buf_b; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_COMPARATORJNICALLBACK_H_ diff --git a/java/rocksjni/compression_options.cc b/java/rocksjni/compression_options.cc index f0155eb335..4fed5ba5f9 100644 --- a/java/rocksjni/compression_options.cc +++ b/java/rocksjni/compression_options.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::CompressionOptions. +// ROCKSDB_NAMESPACE::CompressionOptions. #include @@ -18,7 +18,7 @@ */ jlong Java_org_rocksdb_CompressionOptions_newCompressionOptions( JNIEnv*, jclass) { - const auto* opt = new rocksdb::CompressionOptions(); + const auto* opt = new ROCKSDB_NAMESPACE::CompressionOptions(); return reinterpret_cast(opt); } @@ -29,7 +29,7 @@ jlong Java_org_rocksdb_CompressionOptions_newCompressionOptions( */ void Java_org_rocksdb_CompressionOptions_setWindowBits( JNIEnv*, jobject, jlong jhandle, jint jwindow_bits) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->window_bits = static_cast(jwindow_bits); } @@ -40,7 +40,7 @@ void Java_org_rocksdb_CompressionOptions_setWindowBits( */ jint Java_org_rocksdb_CompressionOptions_windowBits( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->window_bits); } @@ -51,7 +51,7 @@ jint Java_org_rocksdb_CompressionOptions_windowBits( */ void Java_org_rocksdb_CompressionOptions_setLevel( JNIEnv*, jobject, jlong jhandle, jint jlevel) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->level = static_cast(jlevel); } @@ -62,7 +62,7 @@ void Java_org_rocksdb_CompressionOptions_setLevel( */ jint Java_org_rocksdb_CompressionOptions_level( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->level); } @@ -73,7 +73,7 @@ jint Java_org_rocksdb_CompressionOptions_level( */ void Java_org_rocksdb_CompressionOptions_setStrategy( JNIEnv*, jobject, jlong jhandle, jint jstrategy) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->strategy = static_cast(jstrategy); } @@ -84,7 +84,7 @@ void Java_org_rocksdb_CompressionOptions_setStrategy( */ jint Java_org_rocksdb_CompressionOptions_strategy( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->strategy); } @@ -95,7 +95,7 @@ jint Java_org_rocksdb_CompressionOptions_strategy( */ void Java_org_rocksdb_CompressionOptions_setMaxDictBytes( JNIEnv*, jobject, jlong jhandle, jint jmax_dict_bytes) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->max_dict_bytes = static_cast(jmax_dict_bytes); } @@ -106,7 +106,7 @@ void Java_org_rocksdb_CompressionOptions_setMaxDictBytes( */ jint Java_org_rocksdb_CompressionOptions_maxDictBytes( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_dict_bytes); } @@ -117,7 +117,7 @@ jint Java_org_rocksdb_CompressionOptions_maxDictBytes( */ void Java_org_rocksdb_CompressionOptions_setZstdMaxTrainBytes( JNIEnv*, jobject, jlong jhandle, jint jzstd_max_train_bytes) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->zstd_max_train_bytes = static_cast(jzstd_max_train_bytes); } @@ -128,7 +128,7 @@ void Java_org_rocksdb_CompressionOptions_setZstdMaxTrainBytes( */ jint Java_org_rocksdb_CompressionOptions_zstdMaxTrainBytes( JNIEnv *, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->zstd_max_train_bytes); } @@ -139,7 +139,7 @@ jint Java_org_rocksdb_CompressionOptions_zstdMaxTrainBytes( */ void Java_org_rocksdb_CompressionOptions_setEnabled( JNIEnv*, jobject, jlong jhandle, jboolean jenabled) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->enabled = jenabled == JNI_TRUE; } @@ -150,7 +150,7 @@ void Java_org_rocksdb_CompressionOptions_setEnabled( */ jboolean Java_org_rocksdb_CompressionOptions_enabled( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->enabled); } /* @@ -160,5 +160,5 @@ jboolean Java_org_rocksdb_CompressionOptions_enabled( */ void Java_org_rocksdb_CompressionOptions_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - delete reinterpret_cast(jhandle); + delete reinterpret_cast(jhandle); } diff --git a/java/rocksjni/env.cc b/java/rocksjni/env.cc index ed54bd36a0..f450c560bb 100644 --- a/java/rocksjni/env.cc +++ b/java/rocksjni/env.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::Env methods from Java side. +// calling c++ ROCKSDB_NAMESPACE::Env methods from Java side. #include #include @@ -24,7 +24,7 @@ */ jlong Java_org_rocksdb_Env_getDefaultEnvInternal( JNIEnv*, jclass) { - return reinterpret_cast(rocksdb::Env::Default()); + return reinterpret_cast(ROCKSDB_NAMESPACE::Env::Default()); } /* @@ -34,7 +34,7 @@ jlong Java_org_rocksdb_Env_getDefaultEnvInternal( */ void Java_org_rocksdb_RocksEnv_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto* e = reinterpret_cast(jhandle); + auto* e = reinterpret_cast(jhandle); assert(e != nullptr); delete e; } @@ -46,9 +46,10 @@ void Java_org_rocksdb_RocksEnv_disposeInternal( */ void Java_org_rocksdb_Env_setBackgroundThreads( JNIEnv*, jobject, jlong jhandle, jint jnum, jbyte jpriority_value) { - auto* rocks_env = reinterpret_cast(jhandle); - rocks_env->SetBackgroundThreads(static_cast(jnum), - rocksdb::PriorityJni::toCppPriority(jpriority_value)); + auto* rocks_env = reinterpret_cast(jhandle); + rocks_env->SetBackgroundThreads( + static_cast(jnum), + ROCKSDB_NAMESPACE::PriorityJni::toCppPriority(jpriority_value)); } /* @@ -58,9 +59,9 @@ void Java_org_rocksdb_Env_setBackgroundThreads( */ jint Java_org_rocksdb_Env_getBackgroundThreads( JNIEnv*, jobject, jlong jhandle, jbyte jpriority_value) { - auto* rocks_env = reinterpret_cast(jhandle); + auto* rocks_env = reinterpret_cast(jhandle); const int num = rocks_env->GetBackgroundThreads( - rocksdb::PriorityJni::toCppPriority(jpriority_value)); + ROCKSDB_NAMESPACE::PriorityJni::toCppPriority(jpriority_value)); return static_cast(num); } @@ -71,9 +72,9 @@ jint Java_org_rocksdb_Env_getBackgroundThreads( */ jint Java_org_rocksdb_Env_getThreadPoolQueueLen( JNIEnv*, jobject, jlong jhandle, jbyte jpriority_value) { - auto* rocks_env = reinterpret_cast(jhandle); + auto* rocks_env = reinterpret_cast(jhandle); const int queue_len = rocks_env->GetThreadPoolQueueLen( - rocksdb::PriorityJni::toCppPriority(jpriority_value)); + ROCKSDB_NAMESPACE::PriorityJni::toCppPriority(jpriority_value)); return static_cast(queue_len); } @@ -84,9 +85,10 @@ jint Java_org_rocksdb_Env_getThreadPoolQueueLen( */ void Java_org_rocksdb_Env_incBackgroundThreadsIfNeeded( JNIEnv*, jobject, jlong jhandle, jint jnum, jbyte jpriority_value) { - auto* rocks_env = reinterpret_cast(jhandle); - rocks_env->IncBackgroundThreadsIfNeeded(static_cast(jnum), - rocksdb::PriorityJni::toCppPriority(jpriority_value)); + auto* rocks_env = reinterpret_cast(jhandle); + rocks_env->IncBackgroundThreadsIfNeeded( + static_cast(jnum), + ROCKSDB_NAMESPACE::PriorityJni::toCppPriority(jpriority_value)); } /* @@ -96,9 +98,9 @@ void Java_org_rocksdb_Env_incBackgroundThreadsIfNeeded( */ void Java_org_rocksdb_Env_lowerThreadPoolIOPriority( JNIEnv*, jobject, jlong jhandle, jbyte jpriority_value) { - auto* rocks_env = reinterpret_cast(jhandle); + auto* rocks_env = reinterpret_cast(jhandle); rocks_env->LowerThreadPoolIOPriority( - rocksdb::PriorityJni::toCppPriority(jpriority_value)); + ROCKSDB_NAMESPACE::PriorityJni::toCppPriority(jpriority_value)); } /* @@ -108,9 +110,9 @@ void Java_org_rocksdb_Env_lowerThreadPoolIOPriority( */ void Java_org_rocksdb_Env_lowerThreadPoolCPUPriority( JNIEnv*, jobject, jlong jhandle, jbyte jpriority_value) { - auto* rocks_env = reinterpret_cast(jhandle); + auto* rocks_env = reinterpret_cast(jhandle); rocks_env->LowerThreadPoolCPUPriority( - rocksdb::PriorityJni::toCppPriority(jpriority_value)); + ROCKSDB_NAMESPACE::PriorityJni::toCppPriority(jpriority_value)); } /* @@ -120,26 +122,26 @@ void Java_org_rocksdb_Env_lowerThreadPoolCPUPriority( */ jobjectArray Java_org_rocksdb_Env_getThreadList( JNIEnv* env, jobject, jlong jhandle) { - auto* rocks_env = reinterpret_cast(jhandle); - std::vector thread_status; - rocksdb::Status s = rocks_env->GetThreadList(&thread_status); + auto* rocks_env = reinterpret_cast(jhandle); + std::vector thread_status; + ROCKSDB_NAMESPACE::Status s = rocks_env->GetThreadList(&thread_status); if (!s.ok()) { // error, throw exception - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } // object[] const jsize len = static_cast(thread_status.size()); - jobjectArray jthread_status = - env->NewObjectArray(len, rocksdb::ThreadStatusJni::getJClass(env), nullptr); + jobjectArray jthread_status = env->NewObjectArray( + len, ROCKSDB_NAMESPACE::ThreadStatusJni::getJClass(env), nullptr); if (jthread_status == nullptr) { // an exception occurred return nullptr; } for (jsize i = 0; i < len; ++i) { jobject jts = - rocksdb::ThreadStatusJni::construct(env, &(thread_status[i])); + ROCKSDB_NAMESPACE::ThreadStatusJni::construct(env, &(thread_status[i])); env->SetObjectArrayElement(jthread_status, i, jts); if (env->ExceptionCheck()) { // exception occurred @@ -158,8 +160,8 @@ jobjectArray Java_org_rocksdb_Env_getThreadList( */ jlong Java_org_rocksdb_RocksMemEnv_createMemEnv( JNIEnv*, jclass, jlong jbase_env_handle) { - auto* base_env = reinterpret_cast(jbase_env_handle); - return reinterpret_cast(rocksdb::NewMemEnv(base_env)); + auto* base_env = reinterpret_cast(jbase_env_handle); + return reinterpret_cast(ROCKSDB_NAMESPACE::NewMemEnv(base_env)); } /* @@ -169,7 +171,7 @@ jlong Java_org_rocksdb_RocksMemEnv_createMemEnv( */ void Java_org_rocksdb_RocksMemEnv_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto* e = reinterpret_cast(jhandle); + auto* e = reinterpret_cast(jhandle); assert(e != nullptr); delete e; } @@ -182,16 +184,18 @@ void Java_org_rocksdb_RocksMemEnv_disposeInternal( jlong Java_org_rocksdb_HdfsEnv_createHdfsEnv( JNIEnv* env, jclass, jstring jfsname) { jboolean has_exception = JNI_FALSE; - auto fsname = rocksdb::JniUtil::copyStdString(env, jfsname, &has_exception); + auto fsname = + ROCKSDB_NAMESPACE::JniUtil::copyStdString(env, jfsname, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return 0; } - rocksdb::Env* hdfs_env; - rocksdb::Status s = rocksdb::NewHdfsEnv(&hdfs_env, fsname); + ROCKSDB_NAMESPACE::Env* hdfs_env; + ROCKSDB_NAMESPACE::Status s = + ROCKSDB_NAMESPACE::NewHdfsEnv(&hdfs_env, fsname); if (!s.ok()) { // error occurred - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return 0; } return reinterpret_cast(hdfs_env); @@ -204,7 +208,7 @@ jlong Java_org_rocksdb_HdfsEnv_createHdfsEnv( */ void Java_org_rocksdb_HdfsEnv_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto* e = reinterpret_cast(jhandle); + auto* e = reinterpret_cast(jhandle); assert(e != nullptr); delete e; } @@ -216,8 +220,8 @@ void Java_org_rocksdb_HdfsEnv_disposeInternal( */ jlong Java_org_rocksdb_TimedEnv_createTimedEnv( JNIEnv*, jclass, jlong jbase_env_handle) { - auto* base_env = reinterpret_cast(jbase_env_handle); - return reinterpret_cast(rocksdb::NewTimedEnv(base_env)); + auto* base_env = reinterpret_cast(jbase_env_handle); + return reinterpret_cast(ROCKSDB_NAMESPACE::NewTimedEnv(base_env)); } /* @@ -227,7 +231,7 @@ jlong Java_org_rocksdb_TimedEnv_createTimedEnv( */ void Java_org_rocksdb_TimedEnv_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto* e = reinterpret_cast(jhandle); + auto* e = reinterpret_cast(jhandle); assert(e != nullptr); delete e; } diff --git a/java/rocksjni/env_options.cc b/java/rocksjni/env_options.cc index 9ed330183c..2a9c8aeb07 100644 --- a/java/rocksjni/env_options.cc +++ b/java/rocksjni/env_options.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling C++ rocksdb::EnvOptions methods +// calling C++ ROCKSDB_NAMESPACE::EnvOptions methods // from Java side. #include @@ -12,20 +12,20 @@ #include "include/org_rocksdb_EnvOptions.h" #include "rocksdb/env.h" -#define ENV_OPTIONS_SET_BOOL(_jhandle, _opt) \ - reinterpret_cast(_jhandle)->_opt = \ +#define ENV_OPTIONS_SET_BOOL(_jhandle, _opt) \ + reinterpret_cast(_jhandle)->_opt = \ static_cast(_opt) -#define ENV_OPTIONS_SET_SIZE_T(_jhandle, _opt) \ - reinterpret_cast(_jhandle)->_opt = \ +#define ENV_OPTIONS_SET_SIZE_T(_jhandle, _opt) \ + reinterpret_cast(_jhandle)->_opt = \ static_cast(_opt) -#define ENV_OPTIONS_SET_UINT64_T(_jhandle, _opt) \ - reinterpret_cast(_jhandle)->_opt = \ +#define ENV_OPTIONS_SET_UINT64_T(_jhandle, _opt) \ + reinterpret_cast(_jhandle)->_opt = \ static_cast(_opt) #define ENV_OPTIONS_GET(_jhandle, _opt) \ - reinterpret_cast(_jhandle)->_opt + reinterpret_cast(_jhandle)->_opt /* * Class: org_rocksdb_EnvOptions @@ -34,7 +34,7 @@ */ jlong Java_org_rocksdb_EnvOptions_newEnvOptions__( JNIEnv*, jclass) { - auto *env_opt = new rocksdb::EnvOptions(); + auto *env_opt = new ROCKSDB_NAMESPACE::EnvOptions(); return reinterpret_cast(env_opt); } @@ -45,9 +45,9 @@ jlong Java_org_rocksdb_EnvOptions_newEnvOptions__( */ jlong Java_org_rocksdb_EnvOptions_newEnvOptions__J( JNIEnv*, jclass, jlong jdboptions_handle) { - auto* db_options = - reinterpret_cast(jdboptions_handle); - auto* env_opt = new rocksdb::EnvOptions(*db_options); + auto *db_options = + reinterpret_cast(jdboptions_handle); + auto *env_opt = new ROCKSDB_NAMESPACE::EnvOptions(*db_options); return reinterpret_cast(env_opt); } @@ -58,7 +58,7 @@ jlong Java_org_rocksdb_EnvOptions_newEnvOptions__J( */ void Java_org_rocksdb_EnvOptions_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto *eo = reinterpret_cast(jhandle); + auto *eo = reinterpret_cast(jhandle); assert(eo != nullptr); delete eo; } @@ -291,7 +291,8 @@ jlong Java_org_rocksdb_EnvOptions_writableFileMaxBufferSize( void Java_org_rocksdb_EnvOptions_setRateLimiter( JNIEnv*, jobject, jlong jhandle, jlong rl_handle) { auto *sptr_rate_limiter = - reinterpret_cast *>(rl_handle); - auto *env_opt = reinterpret_cast(jhandle); + reinterpret_cast *>( + rl_handle); + auto *env_opt = reinterpret_cast(jhandle); env_opt->rate_limiter = sptr_rate_limiter->get(); } diff --git a/java/rocksjni/filter.cc b/java/rocksjni/filter.cc index c4c275fb52..4143fc96fa 100644 --- a/java/rocksjni/filter.cc +++ b/java/rocksjni/filter.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::FilterPolicy. +// ROCKSDB_NAMESPACE::FilterPolicy. #include #include @@ -24,8 +24,10 @@ jlong Java_org_rocksdb_BloomFilter_createNewBloomFilter( JNIEnv* /*env*/, jclass /*jcls*/, jdouble bits_per_key, jboolean use_block_base_builder) { - auto* sptr_filter = new std::shared_ptr( - rocksdb::NewBloomFilterPolicy(bits_per_key, use_block_base_builder)); + auto* sptr_filter = + new std::shared_ptr( + ROCKSDB_NAMESPACE::NewBloomFilterPolicy(bits_per_key, + use_block_base_builder)); return reinterpret_cast(sptr_filter); } @@ -37,6 +39,7 @@ jlong Java_org_rocksdb_BloomFilter_createNewBloomFilter( void Java_org_rocksdb_Filter_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* handle = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); delete handle; // delete std::shared_ptr } diff --git a/java/rocksjni/ingest_external_file_options.cc b/java/rocksjni/ingest_external_file_options.cc index e0871ff8ed..ceaa6b1793 100644 --- a/java/rocksjni/ingest_external_file_options.cc +++ b/java/rocksjni/ingest_external_file_options.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::FilterPolicy. +// ROCKSDB_NAMESPACE::FilterPolicy. #include @@ -18,7 +18,7 @@ */ jlong Java_org_rocksdb_IngestExternalFileOptions_newIngestExternalFileOptions__( JNIEnv*, jclass) { - auto* options = new rocksdb::IngestExternalFileOptions(); + auto* options = new ROCKSDB_NAMESPACE::IngestExternalFileOptions(); return reinterpret_cast(options); } @@ -31,7 +31,7 @@ jlong Java_org_rocksdb_IngestExternalFileOptions_newIngestExternalFileOptions__Z JNIEnv*, jclass, jboolean jmove_files, jboolean jsnapshot_consistency, jboolean jallow_global_seqno, jboolean jallow_blocking_flush) { - auto* options = new rocksdb::IngestExternalFileOptions(); + auto* options = new ROCKSDB_NAMESPACE::IngestExternalFileOptions(); options->move_files = static_cast(jmove_files); options->snapshot_consistency = static_cast(jsnapshot_consistency); options->allow_global_seqno = static_cast(jallow_global_seqno); @@ -47,7 +47,7 @@ jlong Java_org_rocksdb_IngestExternalFileOptions_newIngestExternalFileOptions__Z jboolean Java_org_rocksdb_IngestExternalFileOptions_moveFiles( JNIEnv*, jobject, jlong jhandle) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(options->move_files); } @@ -59,7 +59,7 @@ jboolean Java_org_rocksdb_IngestExternalFileOptions_moveFiles( void Java_org_rocksdb_IngestExternalFileOptions_setMoveFiles( JNIEnv*, jobject, jlong jhandle, jboolean jmove_files) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); options->move_files = static_cast(jmove_files); } @@ -71,7 +71,7 @@ void Java_org_rocksdb_IngestExternalFileOptions_setMoveFiles( jboolean Java_org_rocksdb_IngestExternalFileOptions_snapshotConsistency( JNIEnv*, jobject, jlong jhandle) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(options->snapshot_consistency); } @@ -83,7 +83,7 @@ jboolean Java_org_rocksdb_IngestExternalFileOptions_snapshotConsistency( void Java_org_rocksdb_IngestExternalFileOptions_setSnapshotConsistency( JNIEnv*, jobject, jlong jhandle, jboolean jsnapshot_consistency) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); options->snapshot_consistency = static_cast(jsnapshot_consistency); } @@ -95,7 +95,7 @@ void Java_org_rocksdb_IngestExternalFileOptions_setSnapshotConsistency( jboolean Java_org_rocksdb_IngestExternalFileOptions_allowGlobalSeqNo( JNIEnv*, jobject, jlong jhandle) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(options->allow_global_seqno); } @@ -107,7 +107,7 @@ jboolean Java_org_rocksdb_IngestExternalFileOptions_allowGlobalSeqNo( void Java_org_rocksdb_IngestExternalFileOptions_setAllowGlobalSeqNo( JNIEnv*, jobject, jlong jhandle, jboolean jallow_global_seqno) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); options->allow_global_seqno = static_cast(jallow_global_seqno); } @@ -119,7 +119,7 @@ void Java_org_rocksdb_IngestExternalFileOptions_setAllowGlobalSeqNo( jboolean Java_org_rocksdb_IngestExternalFileOptions_allowBlockingFlush( JNIEnv*, jobject, jlong jhandle) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return static_cast(options->allow_blocking_flush); } @@ -131,7 +131,7 @@ jboolean Java_org_rocksdb_IngestExternalFileOptions_allowBlockingFlush( void Java_org_rocksdb_IngestExternalFileOptions_setAllowBlockingFlush( JNIEnv*, jobject, jlong jhandle, jboolean jallow_blocking_flush) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); options->allow_blocking_flush = static_cast(jallow_blocking_flush); } @@ -143,7 +143,7 @@ void Java_org_rocksdb_IngestExternalFileOptions_setAllowBlockingFlush( jboolean Java_org_rocksdb_IngestExternalFileOptions_ingestBehind( JNIEnv*, jobject, jlong jhandle) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return options->ingest_behind == JNI_TRUE; } @@ -155,7 +155,7 @@ jboolean Java_org_rocksdb_IngestExternalFileOptions_ingestBehind( void Java_org_rocksdb_IngestExternalFileOptions_setIngestBehind( JNIEnv*, jobject, jlong jhandle, jboolean jingest_behind) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); options->ingest_behind = jingest_behind == JNI_TRUE; } @@ -167,7 +167,7 @@ void Java_org_rocksdb_IngestExternalFileOptions_setIngestBehind( JNIEXPORT jboolean JNICALL Java_org_rocksdb_IngestExternalFileOptions_writeGlobalSeqno( JNIEnv*, jobject, jlong jhandle) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return options->write_global_seqno == JNI_TRUE; } @@ -179,7 +179,7 @@ JNIEXPORT jboolean JNICALL Java_org_rocksdb_IngestExternalFileOptions_writeGloba JNIEXPORT void JNICALL Java_org_rocksdb_IngestExternalFileOptions_setWriteGlobalSeqno( JNIEnv*, jobject, jlong jhandle, jboolean jwrite_global_seqno) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); options->write_global_seqno = jwrite_global_seqno == JNI_TRUE; } @@ -191,6 +191,6 @@ JNIEXPORT void JNICALL Java_org_rocksdb_IngestExternalFileOptions_setWriteGlobal void Java_org_rocksdb_IngestExternalFileOptions_disposeInternal( JNIEnv*, jobject, jlong jhandle) { auto* options = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); delete options; -} \ No newline at end of file +} diff --git a/java/rocksjni/iterator.cc b/java/rocksjni/iterator.cc index 98883a3522..2935adc58d 100644 --- a/java/rocksjni/iterator.cc +++ b/java/rocksjni/iterator.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::Iterator methods from Java side. +// calling c++ ROCKSDB_NAMESPACE::Iterator methods from Java side. #include #include @@ -23,7 +23,7 @@ void Java_org_rocksdb_RocksIterator_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); + auto* it = reinterpret_cast(handle); assert(it != nullptr); delete it; } @@ -36,7 +36,7 @@ void Java_org_rocksdb_RocksIterator_disposeInternal(JNIEnv* /*env*/, jboolean Java_org_rocksdb_RocksIterator_isValid0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - return reinterpret_cast(handle)->Valid(); + return reinterpret_cast(handle)->Valid(); } /* @@ -47,7 +47,7 @@ jboolean Java_org_rocksdb_RocksIterator_isValid0(JNIEnv* /*env*/, void Java_org_rocksdb_RocksIterator_seekToFirst0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->SeekToFirst(); + reinterpret_cast(handle)->SeekToFirst(); } /* @@ -58,7 +58,7 @@ void Java_org_rocksdb_RocksIterator_seekToFirst0(JNIEnv* /*env*/, void Java_org_rocksdb_RocksIterator_seekToLast0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->SeekToLast(); + reinterpret_cast(handle)->SeekToLast(); } /* @@ -68,7 +68,7 @@ void Java_org_rocksdb_RocksIterator_seekToLast0(JNIEnv* /*env*/, */ void Java_org_rocksdb_RocksIterator_next0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->Next(); + reinterpret_cast(handle)->Next(); } /* @@ -78,7 +78,7 @@ void Java_org_rocksdb_RocksIterator_next0(JNIEnv* /*env*/, jobject /*jobj*/, */ void Java_org_rocksdb_RocksIterator_prev0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->Prev(); + reinterpret_cast(handle)->Prev(); } /* @@ -95,9 +95,10 @@ void Java_org_rocksdb_RocksIterator_seek0(JNIEnv* env, jobject /*jobj*/, return; } - rocksdb::Slice target_slice(reinterpret_cast(target), jtarget_len); + ROCKSDB_NAMESPACE::Slice target_slice(reinterpret_cast(target), + jtarget_len); - auto* it = reinterpret_cast(handle); + auto* it = reinterpret_cast(handle); it->Seek(target_slice); env->ReleaseByteArrayElements(jtarget, target, JNI_ABORT); @@ -112,9 +113,12 @@ void Java_org_rocksdb_RocksIterator_seekDirect0(JNIEnv* env, jobject /*jobj*/, jlong handle, jobject jtarget, jint jtarget_off, jint jtarget_len) { - auto* it = reinterpret_cast(handle); - auto seek = [&it](rocksdb::Slice& target_slice) { it->Seek(target_slice); }; - rocksdb::JniUtil::k_op_direct(seek, env, jtarget, jtarget_off, jtarget_len); + auto* it = reinterpret_cast(handle); + auto seek = [&it](ROCKSDB_NAMESPACE::Slice& target_slice) { + it->Seek(target_slice); + }; + ROCKSDB_NAMESPACE::JniUtil::k_op_direct(seek, env, jtarget, jtarget_off, + jtarget_len); } /* @@ -125,12 +129,12 @@ void Java_org_rocksdb_RocksIterator_seekDirect0(JNIEnv* env, jobject /*jobj*/, void Java_org_rocksdb_RocksIterator_seekForPrevDirect0( JNIEnv* env, jobject /*jobj*/, jlong handle, jobject jtarget, jint jtarget_off, jint jtarget_len) { - auto* it = reinterpret_cast(handle); - auto seekPrev = [&it](rocksdb::Slice& target_slice) { + auto* it = reinterpret_cast(handle); + auto seekPrev = [&it](ROCKSDB_NAMESPACE::Slice& target_slice) { it->SeekForPrev(target_slice); }; - rocksdb::JniUtil::k_op_direct(seekPrev, env, jtarget, jtarget_off, - jtarget_len); + ROCKSDB_NAMESPACE::JniUtil::k_op_direct(seekPrev, env, jtarget, jtarget_off, + jtarget_len); } /* @@ -148,9 +152,10 @@ void Java_org_rocksdb_RocksIterator_seekForPrev0(JNIEnv* env, jobject /*jobj*/, return; } - rocksdb::Slice target_slice(reinterpret_cast(target), jtarget_len); + ROCKSDB_NAMESPACE::Slice target_slice(reinterpret_cast(target), + jtarget_len); - auto* it = reinterpret_cast(handle); + auto* it = reinterpret_cast(handle); it->SeekForPrev(target_slice); env->ReleaseByteArrayElements(jtarget, target, JNI_ABORT); @@ -163,14 +168,14 @@ void Java_org_rocksdb_RocksIterator_seekForPrev0(JNIEnv* env, jobject /*jobj*/, */ void Java_org_rocksdb_RocksIterator_status0(JNIEnv* env, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); - rocksdb::Status s = it->status(); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Status s = it->status(); if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -180,8 +185,8 @@ void Java_org_rocksdb_RocksIterator_status0(JNIEnv* env, jobject /*jobj*/, */ jbyteArray Java_org_rocksdb_RocksIterator_key0(JNIEnv* env, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); - rocksdb::Slice key_slice = it->key(); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Slice key_slice = it->key(); jbyteArray jkey = env->NewByteArray(static_cast(key_slice.size())); if (jkey == nullptr) { @@ -203,10 +208,10 @@ jint Java_org_rocksdb_RocksIterator_keyDirect0(JNIEnv* env, jobject /*jobj*/, jlong handle, jobject jtarget, jint jtarget_off, jint jtarget_len) { - auto* it = reinterpret_cast(handle); - rocksdb::Slice key_slice = it->key(); - return rocksdb::JniUtil::copyToDirect(env, key_slice, jtarget, jtarget_off, - jtarget_len); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Slice key_slice = it->key(); + return ROCKSDB_NAMESPACE::JniUtil::copyToDirect(env, key_slice, jtarget, + jtarget_off, jtarget_len); } /* @@ -216,8 +221,8 @@ jint Java_org_rocksdb_RocksIterator_keyDirect0(JNIEnv* env, jobject /*jobj*/, */ jbyteArray Java_org_rocksdb_RocksIterator_value0(JNIEnv* env, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); - rocksdb::Slice value_slice = it->value(); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Slice value_slice = it->value(); jbyteArray jkeyValue = env->NewByteArray(static_cast(value_slice.size())); @@ -240,8 +245,8 @@ jint Java_org_rocksdb_RocksIterator_valueDirect0(JNIEnv* env, jobject /*jobj*/, jlong handle, jobject jtarget, jint jtarget_off, jint jtarget_len) { - auto* it = reinterpret_cast(handle); - rocksdb::Slice value_slice = it->value(); - return rocksdb::JniUtil::copyToDirect(env, value_slice, jtarget, jtarget_off, - jtarget_len); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Slice value_slice = it->value(); + return ROCKSDB_NAMESPACE::JniUtil::copyToDirect(env, value_slice, jtarget, + jtarget_off, jtarget_len); } diff --git a/java/rocksjni/jnicallback.cc b/java/rocksjni/jnicallback.cc index f72eecd4c2..40fb4514d0 100644 --- a/java/rocksjni/jnicallback.cc +++ b/java/rocksjni/jnicallback.cc @@ -10,7 +10,7 @@ #include "rocksjni/jnicallback.h" #include "rocksjni/portal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { JniCallback::JniCallback(JNIEnv* env, jobject jcallback_obj) { // Note: jcallback_obj may be accessed by multiple threads, // so we ref the jvm not the env @@ -50,4 +50,4 @@ JniCallback::~JniCallback() { releaseJniEnv(attached_thread); } // @lint-ignore TXT4 T25377293 Grandfathered in -} // namespace rocksdb \ No newline at end of file +} // namespace ROCKSDB_NAMESPACE \ No newline at end of file diff --git a/java/rocksjni/jnicallback.h b/java/rocksjni/jnicallback.h index 940ecf064d..54264eade5 100644 --- a/java/rocksjni/jnicallback.h +++ b/java/rocksjni/jnicallback.h @@ -11,19 +11,21 @@ #include -namespace rocksdb { - class JniCallback { - public: - JniCallback(JNIEnv* env, jobject jcallback_obj); - virtual ~JniCallback(); +#include "rocksdb/rocksdb_namespace.h" - protected: - JavaVM* m_jvm; - jobject m_jcallback_obj; - JNIEnv* getJniEnv(jboolean* attached) const; - void releaseJniEnv(jboolean& attached) const; +namespace ROCKSDB_NAMESPACE { +class JniCallback { + public: + JniCallback(JNIEnv* env, jobject jcallback_obj); + virtual ~JniCallback(); + + protected: + JavaVM* m_jvm; + jobject m_jcallback_obj; + JNIEnv* getJniEnv(jboolean* attached) const; + void releaseJniEnv(jboolean& attached) const; }; -} + } // namespace ROCKSDB_NAMESPACE // @lint-ignore TXT4 T25377293 Grandfathered in -#endif // JAVA_ROCKSJNI_JNICALLBACK_H_ \ No newline at end of file +#endif // JAVA_ROCKSJNI_JNICALLBACK_H_ diff --git a/java/rocksjni/loggerjnicallback.cc b/java/rocksjni/loggerjnicallback.cc index a731fdac96..e9a9ce6891 100644 --- a/java/rocksjni/loggerjnicallback.cc +++ b/java/rocksjni/loggerjnicallback.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::Logger. +// ROCKSDB_NAMESPACE::Logger. #include "include/org_rocksdb_Logger.h" @@ -13,7 +13,7 @@ #include "rocksjni/loggerjnicallback.h" #include "rocksjni/portal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { LoggerJniCallback::LoggerJniCallback(JNIEnv* env, jobject jlogger) : JniCallback(env, jlogger) { @@ -107,22 +107,22 @@ void LoggerJniCallback::Logv(const InfoLogLevel log_level, const char* format, // determine InfoLogLevel java enum instance jobject jlog_level; switch (log_level) { - case rocksdb::InfoLogLevel::DEBUG_LEVEL: + case ROCKSDB_NAMESPACE::InfoLogLevel::DEBUG_LEVEL: jlog_level = m_jdebug_level; break; - case rocksdb::InfoLogLevel::INFO_LEVEL: + case ROCKSDB_NAMESPACE::InfoLogLevel::INFO_LEVEL: jlog_level = m_jinfo_level; break; - case rocksdb::InfoLogLevel::WARN_LEVEL: + case ROCKSDB_NAMESPACE::InfoLogLevel::WARN_LEVEL: jlog_level = m_jwarn_level; break; - case rocksdb::InfoLogLevel::ERROR_LEVEL: + case ROCKSDB_NAMESPACE::InfoLogLevel::ERROR_LEVEL: jlog_level = m_jerror_level; break; - case rocksdb::InfoLogLevel::FATAL_LEVEL: + case ROCKSDB_NAMESPACE::InfoLogLevel::FATAL_LEVEL: jlog_level = m_jfatal_level; break; - case rocksdb::InfoLogLevel::HEADER_LEVEL: + case ROCKSDB_NAMESPACE::InfoLogLevel::HEADER_LEVEL: jlog_level = m_jheader_level; break; default: @@ -218,7 +218,7 @@ LoggerJniCallback::~LoggerJniCallback() { releaseJniEnv(attached_thread); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE /* * Class: org_rocksdb_Logger @@ -227,11 +227,11 @@ LoggerJniCallback::~LoggerJniCallback() { */ jlong Java_org_rocksdb_Logger_createNewLoggerOptions(JNIEnv* env, jobject jobj, jlong joptions) { - auto* sptr_logger = new std::shared_ptr( - new rocksdb::LoggerJniCallback(env, jobj)); + auto* sptr_logger = new std::shared_ptr( + new ROCKSDB_NAMESPACE::LoggerJniCallback(env, jobj)); // set log level - auto* options = reinterpret_cast(joptions); + auto* options = reinterpret_cast(joptions); sptr_logger->get()->SetInfoLogLevel(options->info_log_level); return reinterpret_cast(sptr_logger); @@ -245,11 +245,12 @@ jlong Java_org_rocksdb_Logger_createNewLoggerOptions(JNIEnv* env, jobject jobj, jlong Java_org_rocksdb_Logger_createNewLoggerDbOptions(JNIEnv* env, jobject jobj, jlong jdb_options) { - auto* sptr_logger = new std::shared_ptr( - new rocksdb::LoggerJniCallback(env, jobj)); + auto* sptr_logger = new std::shared_ptr( + new ROCKSDB_NAMESPACE::LoggerJniCallback(env, jobj)); // set log level - auto* db_options = reinterpret_cast(jdb_options); + auto* db_options = + reinterpret_cast(jdb_options); sptr_logger->get()->SetInfoLogLevel(db_options->info_log_level); return reinterpret_cast(sptr_logger); @@ -263,9 +264,10 @@ jlong Java_org_rocksdb_Logger_createNewLoggerDbOptions(JNIEnv* env, void Java_org_rocksdb_Logger_setInfoLogLevel(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jbyte jlog_level) { auto* handle = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); handle->get()->SetInfoLogLevel( - static_cast(jlog_level)); + static_cast(jlog_level)); } /* @@ -276,7 +278,8 @@ void Java_org_rocksdb_Logger_setInfoLogLevel(JNIEnv* /*env*/, jobject /*jobj*/, jbyte Java_org_rocksdb_Logger_infoLogLevel(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* handle = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); return static_cast(handle->get()->GetInfoLogLevel()); } @@ -288,6 +291,7 @@ jbyte Java_org_rocksdb_Logger_infoLogLevel(JNIEnv* /*env*/, jobject /*jobj*/, void Java_org_rocksdb_Logger_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* handle = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); delete handle; // delete std::shared_ptr } diff --git a/java/rocksjni/loggerjnicallback.h b/java/rocksjni/loggerjnicallback.h index 80c5a19833..7bcba82eec 100644 --- a/java/rocksjni/loggerjnicallback.h +++ b/java/rocksjni/loggerjnicallback.h @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::Logger +// ROCKSDB_NAMESPACE::Logger #ifndef JAVA_ROCKSJNI_LOGGERJNICALLBACK_H_ #define JAVA_ROCKSJNI_LOGGERJNICALLBACK_H_ @@ -16,34 +16,34 @@ #include "port/port.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { - class LoggerJniCallback : public JniCallback, public Logger { - public: - LoggerJniCallback(JNIEnv* env, jobject jLogger); - ~LoggerJniCallback(); +class LoggerJniCallback : public JniCallback, public Logger { + public: + LoggerJniCallback(JNIEnv* env, jobject jLogger); + ~LoggerJniCallback(); - using Logger::SetInfoLogLevel; - using Logger::GetInfoLogLevel; - // Write an entry to the log file with the specified format. - virtual void Logv(const char* format, va_list ap); - // Write an entry to the log file with the specified log level - // and format. Any log with level under the internal log level - // of *this (see @SetInfoLogLevel and @GetInfoLogLevel) will not be - // printed. - virtual void Logv(const InfoLogLevel log_level, - const char* format, va_list ap); + using Logger::SetInfoLogLevel; + using Logger::GetInfoLogLevel; + // Write an entry to the log file with the specified format. + virtual void Logv(const char* format, va_list ap); + // Write an entry to the log file with the specified log level + // and format. Any log with level under the internal log level + // of *this (see @SetInfoLogLevel and @GetInfoLogLevel) will not be + // printed. + virtual void Logv(const InfoLogLevel log_level, const char* format, + va_list ap); - private: - jmethodID m_jLogMethodId; - jobject m_jdebug_level; - jobject m_jinfo_level; - jobject m_jwarn_level; - jobject m_jerror_level; - jobject m_jfatal_level; - jobject m_jheader_level; - std::unique_ptr format_str(const char* format, va_list ap) const; + private: + jmethodID m_jLogMethodId; + jobject m_jdebug_level; + jobject m_jinfo_level; + jobject m_jwarn_level; + jobject m_jerror_level; + jobject m_jfatal_level; + jobject m_jheader_level; + std::unique_ptr format_str(const char* format, va_list ap) const; }; -} // namespace rocksdb + } // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_LOGGERJNICALLBACK_H_ diff --git a/java/rocksjni/lru_cache.cc b/java/rocksjni/lru_cache.cc index 2424bc8e01..cfdcb525bb 100644 --- a/java/rocksjni/lru_cache.cc +++ b/java/rocksjni/lru_cache.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::LRUCache. +// ROCKSDB_NAMESPACE::LRUCache. #include @@ -21,8 +21,8 @@ jlong Java_org_rocksdb_LRUCache_newLRUCache(JNIEnv* /*env*/, jclass /*jcls*/, jint jnum_shard_bits, jboolean jstrict_capacity_limit, jdouble jhigh_pri_pool_ratio) { - auto* sptr_lru_cache = - new std::shared_ptr(rocksdb::NewLRUCache( + auto* sptr_lru_cache = new std::shared_ptr( + ROCKSDB_NAMESPACE::NewLRUCache( static_cast(jcapacity), static_cast(jnum_shard_bits), static_cast(jstrict_capacity_limit), static_cast(jhigh_pri_pool_ratio))); @@ -38,6 +38,6 @@ void Java_org_rocksdb_LRUCache_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* sptr_lru_cache = - reinterpret_cast*>(jhandle); + reinterpret_cast*>(jhandle); delete sptr_lru_cache; // delete std::shared_ptr } diff --git a/java/rocksjni/memory_util.cc b/java/rocksjni/memory_util.cc index 0438502139..fac288c925 100644 --- a/java/rocksjni/memory_util.cc +++ b/java/rocksjni/memory_util.cc @@ -23,8 +23,7 @@ */ jobject Java_org_rocksdb_MemoryUtil_getApproximateMemoryUsageByType( JNIEnv *env, jclass /*jclazz*/, jlongArray jdb_handles, jlongArray jcache_handles) { - - std::vector dbs; + std::vector dbs; jsize db_handle_count = env->GetArrayLength(jdb_handles); if(db_handle_count > 0) { jlong *ptr_jdb_handles = env->GetLongArrayElements(jdb_handles, nullptr); @@ -33,12 +32,13 @@ jobject Java_org_rocksdb_MemoryUtil_getApproximateMemoryUsageByType( return nullptr; } for (jsize i = 0; i < db_handle_count; i++) { - dbs.push_back(reinterpret_cast(ptr_jdb_handles[i])); + dbs.push_back( + reinterpret_cast(ptr_jdb_handles[i])); } env->ReleaseLongArrayElements(jdb_handles, ptr_jdb_handles, JNI_ABORT); } - std::unordered_set cache_set; + std::unordered_set cache_set; jsize cache_handle_count = env->GetArrayLength(jcache_handles); if(cache_handle_count > 0) { jlong *ptr_jcache_handles = env->GetLongArrayElements(jcache_handles, nullptr); @@ -48,37 +48,43 @@ jobject Java_org_rocksdb_MemoryUtil_getApproximateMemoryUsageByType( } for (jsize i = 0; i < cache_handle_count; i++) { auto *cache_ptr = - reinterpret_cast *>(ptr_jcache_handles[i]); + reinterpret_cast *>( + ptr_jcache_handles[i]); cache_set.insert(cache_ptr->get()); } env->ReleaseLongArrayElements(jcache_handles, ptr_jcache_handles, JNI_ABORT); } - std::map usage_by_type; - if(rocksdb::MemoryUtil::GetApproximateMemoryUsageByType(dbs, cache_set, &usage_by_type) != rocksdb::Status::OK()) { + std::map usage_by_type; + if (ROCKSDB_NAMESPACE::MemoryUtil::GetApproximateMemoryUsageByType( + dbs, cache_set, &usage_by_type) != ROCKSDB_NAMESPACE::Status::OK()) { // Non-OK status return nullptr; } - jobject jusage_by_type = rocksdb::HashMapJni::construct( + jobject jusage_by_type = ROCKSDB_NAMESPACE::HashMapJni::construct( env, static_cast(usage_by_type.size())); if (jusage_by_type == nullptr) { // exception occurred return nullptr; } - const rocksdb::HashMapJni::FnMapKV - fn_map_kv = - [env](const std::pair& pair) { + const ROCKSDB_NAMESPACE::HashMapJni::FnMapKV< + const ROCKSDB_NAMESPACE::MemoryUtil::UsageType, const uint64_t, jobject, + jobject> + fn_map_kv = [env]( + const std::pair &pair) { // Construct key - const jobject jusage_type = - rocksdb::ByteJni::valueOf(env, rocksdb::MemoryUsageTypeJni::toJavaMemoryUsageType(pair.first)); + const jobject jusage_type = ROCKSDB_NAMESPACE::ByteJni::valueOf( + env, ROCKSDB_NAMESPACE::MemoryUsageTypeJni::toJavaMemoryUsageType( + pair.first)); if (jusage_type == nullptr) { // an error occurred return std::unique_ptr>(nullptr); } // Construct value const jobject jusage_value = - rocksdb::LongJni::valueOf(env, pair.second); + ROCKSDB_NAMESPACE::LongJni::valueOf(env, pair.second); if (jusage_value == nullptr) { // an error occurred return std::unique_ptr>(nullptr); @@ -89,8 +95,9 @@ jobject Java_org_rocksdb_MemoryUtil_getApproximateMemoryUsageByType( jusage_value)); }; - if (!rocksdb::HashMapJni::putAll(env, jusage_by_type, usage_by_type.begin(), - usage_by_type.end(), fn_map_kv)) { + if (!ROCKSDB_NAMESPACE::HashMapJni::putAll(env, jusage_by_type, + usage_by_type.begin(), + usage_by_type.end(), fn_map_kv)) { // exception occcurred jusage_by_type = nullptr; } diff --git a/java/rocksjni/memtablejni.cc b/java/rocksjni/memtablejni.cc index ad704c3b16..1188c5e599 100644 --- a/java/rocksjni/memtablejni.cc +++ b/java/rocksjni/memtablejni.cc @@ -20,13 +20,14 @@ jlong Java_org_rocksdb_HashSkipListMemTableConfig_newMemTableFactoryHandle( JNIEnv* env, jobject /*jobj*/, jlong jbucket_count, jint jheight, jint jbranching_factor) { - rocksdb::Status s = rocksdb::JniUtil::check_if_jlong_fits_size_t(jbucket_count); + ROCKSDB_NAMESPACE::Status s = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(jbucket_count); if (s.ok()) { - return reinterpret_cast(rocksdb::NewHashSkipListRepFactory( + return reinterpret_cast(ROCKSDB_NAMESPACE::NewHashSkipListRepFactory( static_cast(jbucket_count), static_cast(jheight), static_cast(jbranching_factor))); } - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); return 0; } @@ -39,19 +40,20 @@ jlong Java_org_rocksdb_HashLinkedListMemTableConfig_newMemTableFactoryHandle( JNIEnv* env, jobject /*jobj*/, jlong jbucket_count, jlong jhuge_page_tlb_size, jint jbucket_entries_logging_threshold, jboolean jif_log_bucket_dist_when_flash, jint jthreshold_use_skiplist) { - rocksdb::Status statusBucketCount = - rocksdb::JniUtil::check_if_jlong_fits_size_t(jbucket_count); - rocksdb::Status statusHugePageTlb = - rocksdb::JniUtil::check_if_jlong_fits_size_t(jhuge_page_tlb_size); + ROCKSDB_NAMESPACE::Status statusBucketCount = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(jbucket_count); + ROCKSDB_NAMESPACE::Status statusHugePageTlb = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + jhuge_page_tlb_size); if (statusBucketCount.ok() && statusHugePageTlb.ok()) { - return reinterpret_cast(rocksdb::NewHashLinkListRepFactory( + return reinterpret_cast(ROCKSDB_NAMESPACE::NewHashLinkListRepFactory( static_cast(jbucket_count), static_cast(jhuge_page_tlb_size), static_cast(jbucket_entries_logging_threshold), static_cast(jif_log_bucket_dist_when_flash), static_cast(jthreshold_use_skiplist))); } - rocksdb::IllegalArgumentExceptionJni::ThrowNew( + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew( env, !statusBucketCount.ok() ? statusBucketCount : statusHugePageTlb); return 0; } @@ -63,12 +65,13 @@ jlong Java_org_rocksdb_HashLinkedListMemTableConfig_newMemTableFactoryHandle( */ jlong Java_org_rocksdb_VectorMemTableConfig_newMemTableFactoryHandle( JNIEnv* env, jobject /*jobj*/, jlong jreserved_size) { - rocksdb::Status s = rocksdb::JniUtil::check_if_jlong_fits_size_t(jreserved_size); + ROCKSDB_NAMESPACE::Status s = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(jreserved_size); if (s.ok()) { - return reinterpret_cast( - new rocksdb::VectorRepFactory(static_cast(jreserved_size))); + return reinterpret_cast(new ROCKSDB_NAMESPACE::VectorRepFactory( + static_cast(jreserved_size))); } - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); return 0; } @@ -79,11 +82,12 @@ jlong Java_org_rocksdb_VectorMemTableConfig_newMemTableFactoryHandle( */ jlong Java_org_rocksdb_SkipListMemTableConfig_newMemTableFactoryHandle0( JNIEnv* env, jobject /*jobj*/, jlong jlookahead) { - rocksdb::Status s = rocksdb::JniUtil::check_if_jlong_fits_size_t(jlookahead); + ROCKSDB_NAMESPACE::Status s = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(jlookahead); if (s.ok()) { - return reinterpret_cast( - new rocksdb::SkipListFactory(static_cast(jlookahead))); + return reinterpret_cast(new ROCKSDB_NAMESPACE::SkipListFactory( + static_cast(jlookahead))); } - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); return 0; } diff --git a/java/rocksjni/merge_operator.cc b/java/rocksjni/merge_operator.cc index 636ab9f45a..edc3e7231b 100644 --- a/java/rocksjni/merge_operator.cc +++ b/java/rocksjni/merge_operator.cc @@ -5,7 +5,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ -// for rocksdb::MergeOperator. +// for ROCKSDB_NAMESPACE::MergeOperator. #include #include @@ -32,8 +32,10 @@ */ jlong Java_org_rocksdb_StringAppendOperator_newSharedStringAppendOperator( JNIEnv* /*env*/, jclass /*jclazz*/, jchar jdelim) { - auto* sptr_string_append_op = new std::shared_ptr( - rocksdb::MergeOperators::CreateStringAppendOperator((char)jdelim)); + auto* sptr_string_append_op = + new std::shared_ptr( + ROCKSDB_NAMESPACE::MergeOperators::CreateStringAppendOperator( + (char)jdelim)); return reinterpret_cast(sptr_string_append_op); } @@ -46,7 +48,8 @@ void Java_org_rocksdb_StringAppendOperator_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* sptr_string_append_op = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); delete sptr_string_append_op; // delete std::shared_ptr } @@ -57,8 +60,9 @@ void Java_org_rocksdb_StringAppendOperator_disposeInternal(JNIEnv* /*env*/, */ jlong Java_org_rocksdb_UInt64AddOperator_newSharedUInt64AddOperator( JNIEnv* /*env*/, jclass /*jclazz*/) { - auto* sptr_uint64_add_op = new std::shared_ptr( - rocksdb::MergeOperators::CreateUInt64AddOperator()); + auto* sptr_uint64_add_op = + new std::shared_ptr( + ROCKSDB_NAMESPACE::MergeOperators::CreateUInt64AddOperator()); return reinterpret_cast(sptr_uint64_add_op); } @@ -71,6 +75,7 @@ void Java_org_rocksdb_UInt64AddOperator_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* sptr_uint64_add_op = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); delete sptr_uint64_add_op; // delete std::shared_ptr } diff --git a/java/rocksjni/native_comparator_wrapper_test.cc b/java/rocksjni/native_comparator_wrapper_test.cc index 829019f917..d2f5c1bda0 100644 --- a/java/rocksjni/native_comparator_wrapper_test.cc +++ b/java/rocksjni/native_comparator_wrapper_test.cc @@ -11,7 +11,7 @@ #include "include/org_rocksdb_NativeComparatorWrapperTest_NativeStringComparatorWrapper.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class NativeComparatorWrapperTestStringComparator : public Comparator { const char* Name() const { @@ -29,7 +29,7 @@ class NativeComparatorWrapperTestStringComparator : public Comparator { void FindShortSuccessor(std::string* /*key*/) const { return; } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE /* * Class: org_rocksdb_NativeComparatorWrapperTest_NativeStringComparatorWrapper @@ -38,6 +38,7 @@ class NativeComparatorWrapperTestStringComparator : public Comparator { */ jlong Java_org_rocksdb_NativeComparatorWrapperTest_00024NativeStringComparatorWrapper_newStringComparator( JNIEnv* /*env*/, jobject /*jobj*/) { - auto* comparator = new rocksdb::NativeComparatorWrapperTestStringComparator(); + auto* comparator = + new ROCKSDB_NAMESPACE::NativeComparatorWrapperTestStringComparator(); return reinterpret_cast(comparator); } diff --git a/java/rocksjni/optimistic_transaction_db.cc b/java/rocksjni/optimistic_transaction_db.cc index 1505ff9895..4f966cdd79 100644 --- a/java/rocksjni/optimistic_transaction_db.cc +++ b/java/rocksjni/optimistic_transaction_db.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ -// for rocksdb::TransactionDB. +// for ROCKSDB_NAMESPACE::TransactionDB. #include @@ -29,16 +29,18 @@ jlong Java_org_rocksdb_OptimisticTransactionDB_open__JLjava_lang_String_2( return 0; } - auto* options = reinterpret_cast(joptions_handle); - rocksdb::OptimisticTransactionDB* otdb = nullptr; - rocksdb::Status s = - rocksdb::OptimisticTransactionDB::Open(*options, db_path, &otdb); + auto* options = + reinterpret_cast(joptions_handle); + ROCKSDB_NAMESPACE::OptimisticTransactionDB* otdb = nullptr; + ROCKSDB_NAMESPACE::Status s = + ROCKSDB_NAMESPACE::OptimisticTransactionDB::Open(*options, db_path, + &otdb); env->ReleaseStringUTFChars(jdb_path, db_path); if (s.ok()) { return reinterpret_cast(otdb); } else { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return 0; } } @@ -58,7 +60,7 @@ Java_org_rocksdb_OptimisticTransactionDB_open__JLjava_lang_String_2_3_3B_3J( return nullptr; } - std::vector column_families; + std::vector column_families; const jsize len_cols = env->GetArrayLength(jcolumn_names); if (len_cols > 0) { if (env->EnsureLocalCapacity(len_cols) != 0) { @@ -104,10 +106,10 @@ Java_org_rocksdb_OptimisticTransactionDB_open__JLjava_lang_String_2_3_3B_3J( const std::string cf_name(reinterpret_cast(jcf_name), jcf_name_len); - const rocksdb::ColumnFamilyOptions* cf_options = - reinterpret_cast(jco[i]); + const ROCKSDB_NAMESPACE::ColumnFamilyOptions* cf_options = + reinterpret_cast(jco[i]); column_families.push_back( - rocksdb::ColumnFamilyDescriptor(cf_name, *cf_options)); + ROCKSDB_NAMESPACE::ColumnFamilyDescriptor(cf_name, *cf_options)); env->ReleaseByteArrayElements(jcn_ba, jcf_name, JNI_ABORT); env->DeleteLocalRef(jcn); @@ -115,11 +117,13 @@ Java_org_rocksdb_OptimisticTransactionDB_open__JLjava_lang_String_2_3_3B_3J( env->ReleaseLongArrayElements(jcolumn_options_handles, jco, JNI_ABORT); } - auto* db_options = reinterpret_cast(jdb_options_handle); - std::vector handles; - rocksdb::OptimisticTransactionDB* otdb = nullptr; - const rocksdb::Status s = rocksdb::OptimisticTransactionDB::Open( - *db_options, db_path, column_families, &handles, &otdb); + auto* db_options = + reinterpret_cast(jdb_options_handle); + std::vector handles; + ROCKSDB_NAMESPACE::OptimisticTransactionDB* otdb = nullptr; + const ROCKSDB_NAMESPACE::Status s = + ROCKSDB_NAMESPACE::OptimisticTransactionDB::Open( + *db_options, db_path, column_families, &handles, &otdb); env->ReleaseStringUTFChars(jdb_path, db_path); @@ -146,7 +150,7 @@ Java_org_rocksdb_OptimisticTransactionDB_open__JLjava_lang_String_2_3_3B_3J( return jresults; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } @@ -158,7 +162,7 @@ Java_org_rocksdb_OptimisticTransactionDB_open__JLjava_lang_String_2_3_3B_3J( void Java_org_rocksdb_OptimisticTransactionDB_disposeInternal( JNIEnv *, jobject, jlong jhandle) { auto* optimistic_txn_db = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); assert(optimistic_txn_db != nullptr); delete optimistic_txn_db; } @@ -171,10 +175,10 @@ void Java_org_rocksdb_OptimisticTransactionDB_disposeInternal( void Java_org_rocksdb_OptimisticTransactionDB_closeDatabase( JNIEnv* env, jclass, jlong jhandle) { auto* optimistic_txn_db = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); assert(optimistic_txn_db != nullptr); - rocksdb::Status s = optimistic_txn_db->Close(); - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::Status s = optimistic_txn_db->Close(); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -185,10 +189,10 @@ void Java_org_rocksdb_OptimisticTransactionDB_closeDatabase( jlong Java_org_rocksdb_OptimisticTransactionDB_beginTransaction__JJ( JNIEnv*, jobject, jlong jhandle, jlong jwrite_options_handle) { auto* optimistic_txn_db = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - rocksdb::Transaction* txn = + reinterpret_cast(jwrite_options_handle); + ROCKSDB_NAMESPACE::Transaction* txn = optimistic_txn_db->BeginTransaction(*write_options); return reinterpret_cast(txn); } @@ -202,13 +206,13 @@ jlong Java_org_rocksdb_OptimisticTransactionDB_beginTransaction__JJJ( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jwrite_options_handle, jlong joptimistic_txn_options_handle) { auto* optimistic_txn_db = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); auto* write_options = - reinterpret_cast(jwrite_options_handle); + reinterpret_cast(jwrite_options_handle); auto* optimistic_txn_options = - reinterpret_cast( + reinterpret_cast( joptimistic_txn_options_handle); - rocksdb::Transaction* txn = optimistic_txn_db->BeginTransaction( + ROCKSDB_NAMESPACE::Transaction* txn = optimistic_txn_db->BeginTransaction( *write_options, *optimistic_txn_options); return reinterpret_cast(txn); } @@ -222,12 +226,13 @@ jlong Java_org_rocksdb_OptimisticTransactionDB_beginTransaction_1withOld__JJJ( JNIEnv*, jobject, jlong jhandle, jlong jwrite_options_handle, jlong jold_txn_handle) { auto* optimistic_txn_db = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - auto* old_txn = reinterpret_cast(jold_txn_handle); - rocksdb::OptimisticTransactionOptions optimistic_txn_options; - rocksdb::Transaction* txn = optimistic_txn_db->BeginTransaction( + reinterpret_cast(jwrite_options_handle); + auto* old_txn = + reinterpret_cast(jold_txn_handle); + ROCKSDB_NAMESPACE::OptimisticTransactionOptions optimistic_txn_options; + ROCKSDB_NAMESPACE::Transaction* txn = optimistic_txn_db->BeginTransaction( *write_options, optimistic_txn_options, old_txn); // RocksJava relies on the assumption that @@ -247,14 +252,15 @@ jlong Java_org_rocksdb_OptimisticTransactionDB_beginTransaction_1withOld__JJJJ( JNIEnv*, jobject, jlong jhandle, jlong jwrite_options_handle, jlong joptimistic_txn_options_handle, jlong jold_txn_handle) { auto* optimistic_txn_db = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); auto* write_options = - reinterpret_cast(jwrite_options_handle); + reinterpret_cast(jwrite_options_handle); auto* optimistic_txn_options = - reinterpret_cast( + reinterpret_cast( joptimistic_txn_options_handle); - auto* old_txn = reinterpret_cast(jold_txn_handle); - rocksdb::Transaction* txn = optimistic_txn_db->BeginTransaction( + auto* old_txn = + reinterpret_cast(jold_txn_handle); + ROCKSDB_NAMESPACE::Transaction* txn = optimistic_txn_db->BeginTransaction( *write_options, *optimistic_txn_options, old_txn); // RocksJava relies on the assumption that @@ -273,6 +279,6 @@ jlong Java_org_rocksdb_OptimisticTransactionDB_beginTransaction_1withOld__JJJJ( jlong Java_org_rocksdb_OptimisticTransactionDB_getBaseDB( JNIEnv*, jobject, jlong jhandle) { auto* optimistic_txn_db = - reinterpret_cast(jhandle); + reinterpret_cast(jhandle); return reinterpret_cast(optimistic_txn_db->GetBaseDB()); } diff --git a/java/rocksjni/optimistic_transaction_options.cc b/java/rocksjni/optimistic_transaction_options.cc index 3eee446673..6bc80fdf04 100644 --- a/java/rocksjni/optimistic_transaction_options.cc +++ b/java/rocksjni/optimistic_transaction_options.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ -// for rocksdb::OptimisticTransactionOptions. +// for ROCKSDB_NAMESPACE::OptimisticTransactionOptions. #include @@ -20,8 +20,8 @@ */ jlong Java_org_rocksdb_OptimisticTransactionOptions_newOptimisticTransactionOptions( JNIEnv* /*env*/, jclass /*jcls*/) { - rocksdb::OptimisticTransactionOptions* opts = - new rocksdb::OptimisticTransactionOptions(); + ROCKSDB_NAMESPACE::OptimisticTransactionOptions* opts = + new ROCKSDB_NAMESPACE::OptimisticTransactionOptions(); return reinterpret_cast(opts); } @@ -33,7 +33,8 @@ jlong Java_org_rocksdb_OptimisticTransactionOptions_newOptimisticTransactionOpti jboolean Java_org_rocksdb_OptimisticTransactionOptions_isSetSnapshot( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* opts = - reinterpret_cast(jhandle); + reinterpret_cast( + jhandle); return opts->set_snapshot; } @@ -45,7 +46,8 @@ jboolean Java_org_rocksdb_OptimisticTransactionOptions_isSetSnapshot( void Java_org_rocksdb_OptimisticTransactionOptions_setSetSnapshot( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean jset_snapshot) { auto* opts = - reinterpret_cast(jhandle); + reinterpret_cast( + jhandle); opts->set_snapshot = jset_snapshot; } @@ -58,8 +60,10 @@ void Java_org_rocksdb_OptimisticTransactionOptions_setComparator( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jcomparator_handle) { auto* opts = - reinterpret_cast(jhandle); - opts->cmp = reinterpret_cast(jcomparator_handle); + reinterpret_cast( + jhandle); + opts->cmp = + reinterpret_cast(jcomparator_handle); } /* @@ -69,5 +73,6 @@ void Java_org_rocksdb_OptimisticTransactionOptions_setComparator( */ void Java_org_rocksdb_OptimisticTransactionOptions_disposeInternal( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - delete reinterpret_cast(jhandle); + delete reinterpret_cast( + jhandle); } diff --git a/java/rocksjni/options.cc b/java/rocksjni/options.cc index 181c5c996a..c13613373d 100644 --- a/java/rocksjni/options.cc +++ b/java/rocksjni/options.cc @@ -3,7 +3,8 @@ // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). // -// This file implements the "bridge" between Java and C++ for rocksdb::Options. +// This file implements the "bridge" between Java and C++ for +// ROCKSDB_NAMESPACE::Options. #include #include @@ -43,7 +44,7 @@ */ jlong Java_org_rocksdb_Options_newOptions__( JNIEnv*, jclass) { - auto* op = new rocksdb::Options(); + auto* op = new ROCKSDB_NAMESPACE::Options(); return reinterpret_cast(op); } @@ -54,10 +55,11 @@ jlong Java_org_rocksdb_Options_newOptions__( */ jlong Java_org_rocksdb_Options_newOptions__JJ( JNIEnv*, jclass, jlong jdboptions, jlong jcfoptions) { - auto* dbOpt = reinterpret_cast(jdboptions); - auto* cfOpt = - reinterpret_cast(jcfoptions); - auto* op = new rocksdb::Options(*dbOpt, *cfOpt); + auto* dbOpt = + reinterpret_cast(jdboptions); + auto* cfOpt = reinterpret_cast( + jcfoptions); + auto* op = new ROCKSDB_NAMESPACE::Options(*dbOpt, *cfOpt); return reinterpret_cast(op); } @@ -68,8 +70,8 @@ jlong Java_org_rocksdb_Options_newOptions__JJ( */ jlong Java_org_rocksdb_Options_copyOptions( JNIEnv*, jclass, jlong jhandle) { - auto new_opt = - new rocksdb::Options(*(reinterpret_cast(jhandle))); + auto new_opt = new ROCKSDB_NAMESPACE::Options( + *(reinterpret_cast(jhandle))); return reinterpret_cast(new_opt); } @@ -80,7 +82,7 @@ jlong Java_org_rocksdb_Options_copyOptions( */ void Java_org_rocksdb_Options_disposeInternal( JNIEnv*, jobject, jlong handle) { - auto* op = reinterpret_cast(handle); + auto* op = reinterpret_cast(handle); assert(op != nullptr); delete op; } @@ -92,7 +94,7 @@ void Java_org_rocksdb_Options_disposeInternal( */ void Java_org_rocksdb_Options_setIncreaseParallelism( JNIEnv*, jobject, jlong jhandle, jint totalThreads) { - reinterpret_cast(jhandle)->IncreaseParallelism( + reinterpret_cast(jhandle)->IncreaseParallelism( static_cast(totalThreads)); } @@ -103,7 +105,8 @@ void Java_org_rocksdb_Options_setIncreaseParallelism( */ void Java_org_rocksdb_Options_setCreateIfMissing( JNIEnv*, jobject, jlong jhandle, jboolean flag) { - reinterpret_cast(jhandle)->create_if_missing = flag; + reinterpret_cast(jhandle)->create_if_missing = + flag; } /* @@ -113,7 +116,8 @@ void Java_org_rocksdb_Options_setCreateIfMissing( */ jboolean Java_org_rocksdb_Options_createIfMissing( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->create_if_missing; + return reinterpret_cast(jhandle) + ->create_if_missing; } /* @@ -123,8 +127,8 @@ jboolean Java_org_rocksdb_Options_createIfMissing( */ void Java_org_rocksdb_Options_setCreateMissingColumnFamilies( JNIEnv*, jobject, jlong jhandle, jboolean flag) { - reinterpret_cast(jhandle)->create_missing_column_families = - flag; + reinterpret_cast(jhandle) + ->create_missing_column_families = flag; } /* @@ -134,7 +138,7 @@ void Java_org_rocksdb_Options_setCreateMissingColumnFamilies( */ jboolean Java_org_rocksdb_Options_createMissingColumnFamilies( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->create_missing_column_families; } @@ -147,12 +151,12 @@ void Java_org_rocksdb_Options_setComparatorHandle__JI( JNIEnv*, jobject, jlong jhandle, jint builtinComparator) { switch (builtinComparator) { case 1: - reinterpret_cast(jhandle)->comparator = - rocksdb::ReverseBytewiseComparator(); + reinterpret_cast(jhandle)->comparator = + ROCKSDB_NAMESPACE::ReverseBytewiseComparator(); break; default: - reinterpret_cast(jhandle)->comparator = - rocksdb::BytewiseComparator(); + reinterpret_cast(jhandle)->comparator = + ROCKSDB_NAMESPACE::BytewiseComparator(); break; } } @@ -165,20 +169,21 @@ void Java_org_rocksdb_Options_setComparatorHandle__JI( void Java_org_rocksdb_Options_setComparatorHandle__JJB( JNIEnv*, jobject, jlong jopt_handle, jlong jcomparator_handle, jbyte jcomparator_type) { - rocksdb::Comparator* comparator = nullptr; + ROCKSDB_NAMESPACE::Comparator* comparator = nullptr; switch (jcomparator_type) { // JAVA_COMPARATOR case 0x0: - comparator = - reinterpret_cast(jcomparator_handle); + comparator = reinterpret_cast( + jcomparator_handle); break; // JAVA_NATIVE_COMPARATOR_WRAPPER case 0x1: - comparator = reinterpret_cast(jcomparator_handle); + comparator = + reinterpret_cast(jcomparator_handle); break; } - auto* opt = reinterpret_cast(jopt_handle); + auto* opt = reinterpret_cast(jopt_handle); opt->comparator = comparator; } @@ -195,9 +200,9 @@ void Java_org_rocksdb_Options_setMergeOperatorName( return; } - auto* options = reinterpret_cast(jhandle); + auto* options = reinterpret_cast(jhandle); options->merge_operator = - rocksdb::MergeOperators::CreateFromStringId(op_name); + ROCKSDB_NAMESPACE::MergeOperators::CreateFromStringId(op_name); env->ReleaseStringUTFChars(jop_name, op_name); } @@ -209,8 +214,8 @@ void Java_org_rocksdb_Options_setMergeOperatorName( */ void Java_org_rocksdb_Options_setMergeOperator( JNIEnv*, jobject, jlong jhandle, jlong mergeOperatorHandle) { - reinterpret_cast(jhandle)->merge_operator = - *(reinterpret_cast*>( + reinterpret_cast(jhandle)->merge_operator = + *(reinterpret_cast*>( mergeOperatorHandle)); } @@ -222,9 +227,10 @@ void Java_org_rocksdb_Options_setMergeOperator( void Java_org_rocksdb_Options_setCompactionFilterHandle( JNIEnv*, jobject, jlong jopt_handle, jlong jcompactionfilter_handle) { - reinterpret_cast(jopt_handle)-> - compaction_filter = reinterpret_cast - (jcompactionfilter_handle); + reinterpret_cast(jopt_handle) + ->compaction_filter = + reinterpret_cast( + jcompactionfilter_handle); } /* @@ -235,11 +241,11 @@ void Java_org_rocksdb_Options_setCompactionFilterHandle( void JNICALL Java_org_rocksdb_Options_setCompactionFilterFactoryHandle( JNIEnv*, jobject, jlong jopt_handle, jlong jcompactionfilterfactory_handle) { - auto* cff_factory = - reinterpret_cast *>( - jcompactionfilterfactory_handle); - reinterpret_cast(jopt_handle)-> - compaction_filter_factory = *cff_factory; + auto* cff_factory = reinterpret_cast< + std::shared_ptr*>( + jcompactionfilterfactory_handle); + reinterpret_cast(jopt_handle) + ->compaction_filter_factory = *cff_factory; } /* @@ -249,13 +255,13 @@ void JNICALL Java_org_rocksdb_Options_setCompactionFilterFactoryHandle( */ void Java_org_rocksdb_Options_setWriteBufferSize( JNIEnv* env, jobject, jlong jhandle, jlong jwrite_buffer_size) { - auto s = - rocksdb::JniUtil::check_if_jlong_fits_size_t(jwrite_buffer_size); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + jwrite_buffer_size); if (s.ok()) { - reinterpret_cast(jhandle)->write_buffer_size = + reinterpret_cast(jhandle)->write_buffer_size = jwrite_buffer_size; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -268,9 +274,10 @@ void Java_org_rocksdb_Options_setWriteBufferManager( JNIEnv*, jobject, jlong joptions_handle, jlong jwrite_buffer_manager_handle) { auto* write_buffer_manager = - reinterpret_cast *>(jwrite_buffer_manager_handle); - reinterpret_cast(joptions_handle)->write_buffer_manager = - *write_buffer_manager; + reinterpret_cast*>( + jwrite_buffer_manager_handle); + reinterpret_cast(joptions_handle) + ->write_buffer_manager = *write_buffer_manager; } /* @@ -280,7 +287,8 @@ void Java_org_rocksdb_Options_setWriteBufferManager( */ jlong Java_org_rocksdb_Options_writeBufferSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->write_buffer_size; + return reinterpret_cast(jhandle) + ->write_buffer_size; } /* @@ -291,8 +299,8 @@ jlong Java_org_rocksdb_Options_writeBufferSize( void Java_org_rocksdb_Options_setMaxWriteBufferNumber( JNIEnv*, jobject, jlong jhandle, jint jmax_write_buffer_number) { - reinterpret_cast(jhandle)->max_write_buffer_number = - jmax_write_buffer_number; + reinterpret_cast(jhandle) + ->max_write_buffer_number = jmax_write_buffer_number; } /* @@ -302,9 +310,10 @@ void Java_org_rocksdb_Options_setMaxWriteBufferNumber( */ void Java_org_rocksdb_Options_setStatistics( JNIEnv*, jobject, jlong jhandle, jlong jstatistics_handle) { - auto* opt = reinterpret_cast(jhandle); - auto* pSptr = reinterpret_cast*>( - jstatistics_handle); + auto* opt = reinterpret_cast(jhandle); + auto* pSptr = + reinterpret_cast*>( + jstatistics_handle); opt->statistics = *pSptr; } @@ -315,13 +324,13 @@ void Java_org_rocksdb_Options_setStatistics( */ jlong Java_org_rocksdb_Options_statistics( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - std::shared_ptr sptr = opt->statistics; + auto* opt = reinterpret_cast(jhandle); + std::shared_ptr sptr = opt->statistics; if (sptr == nullptr) { return 0; } else { - std::shared_ptr* pSptr = - new std::shared_ptr(sptr); + std::shared_ptr* pSptr = + new std::shared_ptr(sptr); return reinterpret_cast(pSptr); } } @@ -333,7 +342,8 @@ jlong Java_org_rocksdb_Options_statistics( */ jint Java_org_rocksdb_Options_maxWriteBufferNumber( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_write_buffer_number; + return reinterpret_cast(jhandle) + ->max_write_buffer_number; } /* @@ -343,7 +353,8 @@ jint Java_org_rocksdb_Options_maxWriteBufferNumber( */ jboolean Java_org_rocksdb_Options_errorIfExists( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->error_if_exists; + return reinterpret_cast(jhandle) + ->error_if_exists; } /* @@ -353,7 +364,7 @@ jboolean Java_org_rocksdb_Options_errorIfExists( */ void Java_org_rocksdb_Options_setErrorIfExists( JNIEnv*, jobject, jlong jhandle, jboolean error_if_exists) { - reinterpret_cast(jhandle)->error_if_exists = + reinterpret_cast(jhandle)->error_if_exists = static_cast(error_if_exists); } @@ -364,7 +375,8 @@ void Java_org_rocksdb_Options_setErrorIfExists( */ jboolean Java_org_rocksdb_Options_paranoidChecks( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->paranoid_checks; + return reinterpret_cast(jhandle) + ->paranoid_checks; } /* @@ -374,7 +386,7 @@ jboolean Java_org_rocksdb_Options_paranoidChecks( */ void Java_org_rocksdb_Options_setParanoidChecks( JNIEnv*, jobject, jlong jhandle, jboolean paranoid_checks) { - reinterpret_cast(jhandle)->paranoid_checks = + reinterpret_cast(jhandle)->paranoid_checks = static_cast(paranoid_checks); } @@ -385,8 +397,8 @@ void Java_org_rocksdb_Options_setParanoidChecks( */ void Java_org_rocksdb_Options_setEnv( JNIEnv*, jobject, jlong jhandle, jlong jenv) { - reinterpret_cast(jhandle)->env = - reinterpret_cast(jenv); + reinterpret_cast(jhandle)->env = + reinterpret_cast(jenv); } /* @@ -396,7 +408,7 @@ void Java_org_rocksdb_Options_setEnv( */ void Java_org_rocksdb_Options_setMaxTotalWalSize( JNIEnv*, jobject, jlong jhandle, jlong jmax_total_wal_size) { - reinterpret_cast(jhandle)->max_total_wal_size = + reinterpret_cast(jhandle)->max_total_wal_size = static_cast(jmax_total_wal_size); } @@ -407,7 +419,8 @@ void Java_org_rocksdb_Options_setMaxTotalWalSize( */ jlong Java_org_rocksdb_Options_maxTotalWalSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_total_wal_size; + return reinterpret_cast(jhandle) + ->max_total_wal_size; } /* @@ -417,7 +430,7 @@ jlong Java_org_rocksdb_Options_maxTotalWalSize( */ jint Java_org_rocksdb_Options_maxOpenFiles( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_open_files; + return reinterpret_cast(jhandle)->max_open_files; } /* @@ -427,7 +440,7 @@ jint Java_org_rocksdb_Options_maxOpenFiles( */ void Java_org_rocksdb_Options_setMaxOpenFiles( JNIEnv*, jobject, jlong jhandle, jint max_open_files) { - reinterpret_cast(jhandle)->max_open_files = + reinterpret_cast(jhandle)->max_open_files = static_cast(max_open_files); } @@ -438,8 +451,8 @@ void Java_org_rocksdb_Options_setMaxOpenFiles( */ void Java_org_rocksdb_Options_setMaxFileOpeningThreads( JNIEnv*, jobject, jlong jhandle, jint jmax_file_opening_threads) { - reinterpret_cast(jhandle)->max_file_opening_threads = - static_cast(jmax_file_opening_threads); + reinterpret_cast(jhandle) + ->max_file_opening_threads = static_cast(jmax_file_opening_threads); } /* @@ -449,7 +462,7 @@ void Java_org_rocksdb_Options_setMaxFileOpeningThreads( */ jint Java_org_rocksdb_Options_maxFileOpeningThreads( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_file_opening_threads); } @@ -460,7 +473,7 @@ jint Java_org_rocksdb_Options_maxFileOpeningThreads( */ jboolean Java_org_rocksdb_Options_useFsync( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->use_fsync; + return reinterpret_cast(jhandle)->use_fsync; } /* @@ -470,7 +483,7 @@ jboolean Java_org_rocksdb_Options_useFsync( */ void Java_org_rocksdb_Options_setUseFsync( JNIEnv*, jobject, jlong jhandle, jboolean use_fsync) { - reinterpret_cast(jhandle)->use_fsync = + reinterpret_cast(jhandle)->use_fsync = static_cast(use_fsync); } @@ -482,7 +495,7 @@ void Java_org_rocksdb_Options_setUseFsync( void Java_org_rocksdb_Options_setDbPaths( JNIEnv* env, jobject, jlong jhandle, jobjectArray jpaths, jlongArray jtarget_sizes) { - std::vector db_paths; + std::vector db_paths; jlong* ptr_jtarget_size = env->GetLongArrayElements(jtarget_sizes, nullptr); if (ptr_jtarget_size == nullptr) { // exception thrown: OutOfMemoryError @@ -499,7 +512,7 @@ void Java_org_rocksdb_Options_setDbPaths( env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT); return; } - std::string path = rocksdb::JniUtil::copyStdString( + std::string path = ROCKSDB_NAMESPACE::JniUtil::copyStdString( env, static_cast(jpath), &has_exception); env->DeleteLocalRef(jpath); @@ -511,12 +524,12 @@ void Java_org_rocksdb_Options_setDbPaths( jlong jtarget_size = ptr_jtarget_size[i]; db_paths.push_back( - rocksdb::DbPath(path, static_cast(jtarget_size))); + ROCKSDB_NAMESPACE::DbPath(path, static_cast(jtarget_size))); } env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT); - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->db_paths = db_paths; } @@ -527,7 +540,7 @@ void Java_org_rocksdb_Options_setDbPaths( */ jlong Java_org_rocksdb_Options_dbPathsLen( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->db_paths.size()); } @@ -545,10 +558,10 @@ void Java_org_rocksdb_Options_dbPaths( return; } - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); const jsize len = env->GetArrayLength(jpaths); for (jsize i = 0; i < len; i++) { - rocksdb::DbPath db_path = opt->db_paths[i]; + ROCKSDB_NAMESPACE::DbPath db_path = opt->db_paths[i]; jstring jpath = env->NewStringUTF(db_path.path.c_str()); if (jpath == nullptr) { @@ -578,7 +591,8 @@ void Java_org_rocksdb_Options_dbPaths( jstring Java_org_rocksdb_Options_dbLogDir( JNIEnv* env, jobject, jlong jhandle) { return env->NewStringUTF( - reinterpret_cast(jhandle)->db_log_dir.c_str()); + reinterpret_cast(jhandle) + ->db_log_dir.c_str()); } /* @@ -593,7 +607,8 @@ void Java_org_rocksdb_Options_setDbLogDir( // exception thrown: OutOfMemoryError return; } - reinterpret_cast(jhandle)->db_log_dir.assign(log_dir); + reinterpret_cast(jhandle)->db_log_dir.assign( + log_dir); env->ReleaseStringUTFChars(jdb_log_dir, log_dir); } @@ -605,7 +620,7 @@ void Java_org_rocksdb_Options_setDbLogDir( jstring Java_org_rocksdb_Options_walDir( JNIEnv* env, jobject, jlong jhandle) { return env->NewStringUTF( - reinterpret_cast(jhandle)->wal_dir.c_str()); + reinterpret_cast(jhandle)->wal_dir.c_str()); } /* @@ -620,7 +635,8 @@ void Java_org_rocksdb_Options_setWalDir( // exception thrown: OutOfMemoryError return; } - reinterpret_cast(jhandle)->wal_dir.assign(wal_dir); + reinterpret_cast(jhandle)->wal_dir.assign( + wal_dir); env->ReleaseStringUTFChars(jwal_dir, wal_dir); } @@ -631,7 +647,7 @@ void Java_org_rocksdb_Options_setWalDir( */ jlong Java_org_rocksdb_Options_deleteObsoleteFilesPeriodMicros( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->delete_obsolete_files_period_micros; } @@ -642,7 +658,7 @@ jlong Java_org_rocksdb_Options_deleteObsoleteFilesPeriodMicros( */ void Java_org_rocksdb_Options_setDeleteObsoleteFilesPeriodMicros( JNIEnv*, jobject, jlong jhandle, jlong micros) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->delete_obsolete_files_period_micros = static_cast(micros); } @@ -653,8 +669,8 @@ void Java_org_rocksdb_Options_setDeleteObsoleteFilesPeriodMicros( */ void Java_org_rocksdb_Options_setBaseBackgroundCompactions( JNIEnv*, jobject, jlong jhandle, jint max) { - reinterpret_cast(jhandle)->base_background_compactions = - static_cast(max); + reinterpret_cast(jhandle) + ->base_background_compactions = static_cast(max); } /* @@ -664,7 +680,7 @@ void Java_org_rocksdb_Options_setBaseBackgroundCompactions( */ jint Java_org_rocksdb_Options_baseBackgroundCompactions( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->base_background_compactions; } @@ -675,7 +691,7 @@ jint Java_org_rocksdb_Options_baseBackgroundCompactions( */ jint Java_org_rocksdb_Options_maxBackgroundCompactions( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_background_compactions; } @@ -686,8 +702,8 @@ jint Java_org_rocksdb_Options_maxBackgroundCompactions( */ void Java_org_rocksdb_Options_setMaxBackgroundCompactions( JNIEnv*, jobject, jlong jhandle, jint max) { - reinterpret_cast(jhandle)->max_background_compactions = - static_cast(max); + reinterpret_cast(jhandle) + ->max_background_compactions = static_cast(max); } /* @@ -697,7 +713,7 @@ void Java_org_rocksdb_Options_setMaxBackgroundCompactions( */ void Java_org_rocksdb_Options_setMaxSubcompactions( JNIEnv*, jobject, jlong jhandle, jint max) { - reinterpret_cast(jhandle)->max_subcompactions = + reinterpret_cast(jhandle)->max_subcompactions = static_cast(max); } @@ -708,7 +724,8 @@ void Java_org_rocksdb_Options_setMaxSubcompactions( */ jint Java_org_rocksdb_Options_maxSubcompactions( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_subcompactions; + return reinterpret_cast(jhandle) + ->max_subcompactions; } /* @@ -718,7 +735,8 @@ jint Java_org_rocksdb_Options_maxSubcompactions( */ jint Java_org_rocksdb_Options_maxBackgroundFlushes( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_background_flushes; + return reinterpret_cast(jhandle) + ->max_background_flushes; } /* @@ -728,8 +746,8 @@ jint Java_org_rocksdb_Options_maxBackgroundFlushes( */ void Java_org_rocksdb_Options_setMaxBackgroundFlushes( JNIEnv*, jobject, jlong jhandle, jint max_background_flushes) { - reinterpret_cast(jhandle)->max_background_flushes = - static_cast(max_background_flushes); + reinterpret_cast(jhandle) + ->max_background_flushes = static_cast(max_background_flushes); } /* @@ -739,7 +757,8 @@ void Java_org_rocksdb_Options_setMaxBackgroundFlushes( */ jint Java_org_rocksdb_Options_maxBackgroundJobs( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_background_jobs; + return reinterpret_cast(jhandle) + ->max_background_jobs; } /* @@ -749,7 +768,7 @@ jint Java_org_rocksdb_Options_maxBackgroundJobs( */ void Java_org_rocksdb_Options_setMaxBackgroundJobs( JNIEnv*, jobject, jlong jhandle, jint max_background_jobs) { - reinterpret_cast(jhandle)->max_background_jobs = + reinterpret_cast(jhandle)->max_background_jobs = static_cast(max_background_jobs); } @@ -760,7 +779,8 @@ void Java_org_rocksdb_Options_setMaxBackgroundJobs( */ jlong Java_org_rocksdb_Options_maxLogFileSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_log_file_size; + return reinterpret_cast(jhandle) + ->max_log_file_size; } /* @@ -770,12 +790,13 @@ jlong Java_org_rocksdb_Options_maxLogFileSize( */ void Java_org_rocksdb_Options_setMaxLogFileSize( JNIEnv* env, jobject, jlong jhandle, jlong max_log_file_size) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(max_log_file_size); + auto s = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(max_log_file_size); if (s.ok()) { - reinterpret_cast(jhandle)->max_log_file_size = + reinterpret_cast(jhandle)->max_log_file_size = max_log_file_size; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -786,7 +807,8 @@ void Java_org_rocksdb_Options_setMaxLogFileSize( */ jlong Java_org_rocksdb_Options_logFileTimeToRoll( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->log_file_time_to_roll; + return reinterpret_cast(jhandle) + ->log_file_time_to_roll; } /* @@ -796,13 +818,13 @@ jlong Java_org_rocksdb_Options_logFileTimeToRoll( */ void Java_org_rocksdb_Options_setLogFileTimeToRoll( JNIEnv* env, jobject, jlong jhandle, jlong log_file_time_to_roll) { - auto s = - rocksdb::JniUtil::check_if_jlong_fits_size_t(log_file_time_to_roll); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + log_file_time_to_roll); if (s.ok()) { - reinterpret_cast(jhandle)->log_file_time_to_roll = - log_file_time_to_roll; + reinterpret_cast(jhandle) + ->log_file_time_to_roll = log_file_time_to_roll; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -813,7 +835,8 @@ void Java_org_rocksdb_Options_setLogFileTimeToRoll( */ jlong Java_org_rocksdb_Options_keepLogFileNum( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->keep_log_file_num; + return reinterpret_cast(jhandle) + ->keep_log_file_num; } /* @@ -823,12 +846,13 @@ jlong Java_org_rocksdb_Options_keepLogFileNum( */ void Java_org_rocksdb_Options_setKeepLogFileNum( JNIEnv* env, jobject, jlong jhandle, jlong keep_log_file_num) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(keep_log_file_num); + auto s = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(keep_log_file_num); if (s.ok()) { - reinterpret_cast(jhandle)->keep_log_file_num = + reinterpret_cast(jhandle)->keep_log_file_num = keep_log_file_num; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -839,7 +863,8 @@ void Java_org_rocksdb_Options_setKeepLogFileNum( */ jlong Java_org_rocksdb_Options_recycleLogFileNum( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->recycle_log_file_num; + return reinterpret_cast(jhandle) + ->recycle_log_file_num; } /* @@ -849,12 +874,13 @@ jlong Java_org_rocksdb_Options_recycleLogFileNum( */ void Java_org_rocksdb_Options_setRecycleLogFileNum( JNIEnv* env, jobject, jlong jhandle, jlong recycle_log_file_num) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(recycle_log_file_num); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + recycle_log_file_num); if (s.ok()) { - reinterpret_cast(jhandle)->recycle_log_file_num = - recycle_log_file_num; + reinterpret_cast(jhandle) + ->recycle_log_file_num = recycle_log_file_num; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -865,7 +891,8 @@ void Java_org_rocksdb_Options_setRecycleLogFileNum( */ jlong Java_org_rocksdb_Options_maxManifestFileSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_manifest_file_size; + return reinterpret_cast(jhandle) + ->max_manifest_file_size; } /* @@ -874,8 +901,8 @@ jlong Java_org_rocksdb_Options_maxManifestFileSize( */ jstring Java_org_rocksdb_Options_memTableFactoryName( JNIEnv* env, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - rocksdb::MemTableRepFactory* tf = opt->memtable_factory.get(); + auto* opt = reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::MemTableRepFactory* tf = opt->memtable_factory.get(); // Should never be nullptr. // Default memtable factory is SkipListFactory @@ -896,8 +923,8 @@ jstring Java_org_rocksdb_Options_memTableFactoryName( */ void Java_org_rocksdb_Options_setMaxManifestFileSize( JNIEnv*, jobject, jlong jhandle, jlong max_manifest_file_size) { - reinterpret_cast(jhandle)->max_manifest_file_size = - static_cast(max_manifest_file_size); + reinterpret_cast(jhandle) + ->max_manifest_file_size = static_cast(max_manifest_file_size); } /* @@ -906,8 +933,10 @@ void Java_org_rocksdb_Options_setMaxManifestFileSize( */ void Java_org_rocksdb_Options_setMemTableFactory( JNIEnv*, jobject, jlong jhandle, jlong jfactory_handle) { - reinterpret_cast(jhandle)->memtable_factory.reset( - reinterpret_cast(jfactory_handle)); + reinterpret_cast(jhandle) + ->memtable_factory.reset( + reinterpret_cast( + jfactory_handle)); } /* @@ -917,10 +946,11 @@ void Java_org_rocksdb_Options_setMemTableFactory( */ void Java_org_rocksdb_Options_setRateLimiter( JNIEnv*, jobject, jlong jhandle, jlong jrate_limiter_handle) { - std::shared_ptr* pRateLimiter = - reinterpret_cast*>( + std::shared_ptr* pRateLimiter = + reinterpret_cast*>( jrate_limiter_handle); - reinterpret_cast(jhandle)->rate_limiter = *pRateLimiter; + reinterpret_cast(jhandle)->rate_limiter = + *pRateLimiter; } /* @@ -931,9 +961,9 @@ void Java_org_rocksdb_Options_setRateLimiter( void Java_org_rocksdb_Options_setSstFileManager( JNIEnv*, jobject, jlong jhandle, jlong jsst_file_manager_handle) { auto* sptr_sst_file_manager = - reinterpret_cast*>( + reinterpret_cast*>( jsst_file_manager_handle); - reinterpret_cast(jhandle)->sst_file_manager = + reinterpret_cast(jhandle)->sst_file_manager = *sptr_sst_file_manager; } @@ -944,10 +974,10 @@ void Java_org_rocksdb_Options_setSstFileManager( */ void Java_org_rocksdb_Options_setLogger( JNIEnv*, jobject, jlong jhandle, jlong jlogger_handle) { - std::shared_ptr* pLogger = - reinterpret_cast*>( + std::shared_ptr* pLogger = + reinterpret_cast*>( jlogger_handle); - reinterpret_cast(jhandle)->info_log = *pLogger; + reinterpret_cast(jhandle)->info_log = *pLogger; } /* @@ -957,8 +987,8 @@ void Java_org_rocksdb_Options_setLogger( */ void Java_org_rocksdb_Options_setInfoLogLevel( JNIEnv*, jobject, jlong jhandle, jbyte jlog_level) { - reinterpret_cast(jhandle)->info_log_level = - static_cast(jlog_level); + reinterpret_cast(jhandle)->info_log_level = + static_cast(jlog_level); } /* @@ -969,7 +999,7 @@ void Java_org_rocksdb_Options_setInfoLogLevel( jbyte Java_org_rocksdb_Options_infoLogLevel( JNIEnv*, jobject, jlong jhandle) { return static_cast( - reinterpret_cast(jhandle)->info_log_level); + reinterpret_cast(jhandle)->info_log_level); } /* @@ -979,7 +1009,8 @@ jbyte Java_org_rocksdb_Options_infoLogLevel( */ jint Java_org_rocksdb_Options_tableCacheNumshardbits( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->table_cache_numshardbits; + return reinterpret_cast(jhandle) + ->table_cache_numshardbits; } /* @@ -989,8 +1020,8 @@ jint Java_org_rocksdb_Options_tableCacheNumshardbits( */ void Java_org_rocksdb_Options_setTableCacheNumshardbits( JNIEnv*, jobject, jlong jhandle, jint table_cache_numshardbits) { - reinterpret_cast(jhandle)->table_cache_numshardbits = - static_cast(table_cache_numshardbits); + reinterpret_cast(jhandle) + ->table_cache_numshardbits = static_cast(table_cache_numshardbits); } /* @@ -999,8 +1030,9 @@ void Java_org_rocksdb_Options_setTableCacheNumshardbits( */ void Java_org_rocksdb_Options_useFixedLengthPrefixExtractor( JNIEnv*, jobject, jlong jhandle, jint jprefix_length) { - reinterpret_cast(jhandle)->prefix_extractor.reset( - rocksdb::NewFixedPrefixTransform(static_cast(jprefix_length))); + reinterpret_cast(jhandle) + ->prefix_extractor.reset(ROCKSDB_NAMESPACE::NewFixedPrefixTransform( + static_cast(jprefix_length))); } /* @@ -1009,8 +1041,9 @@ void Java_org_rocksdb_Options_useFixedLengthPrefixExtractor( */ void Java_org_rocksdb_Options_useCappedPrefixExtractor( JNIEnv*, jobject, jlong jhandle, jint jprefix_length) { - reinterpret_cast(jhandle)->prefix_extractor.reset( - rocksdb::NewCappedPrefixTransform(static_cast(jprefix_length))); + reinterpret_cast(jhandle) + ->prefix_extractor.reset(ROCKSDB_NAMESPACE::NewCappedPrefixTransform( + static_cast(jprefix_length))); } /* @@ -1020,7 +1053,8 @@ void Java_org_rocksdb_Options_useCappedPrefixExtractor( */ jlong Java_org_rocksdb_Options_walTtlSeconds( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->WAL_ttl_seconds; + return reinterpret_cast(jhandle) + ->WAL_ttl_seconds; } /* @@ -1030,7 +1064,7 @@ jlong Java_org_rocksdb_Options_walTtlSeconds( */ void Java_org_rocksdb_Options_setWalTtlSeconds( JNIEnv*, jobject, jlong jhandle, jlong WAL_ttl_seconds) { - reinterpret_cast(jhandle)->WAL_ttl_seconds = + reinterpret_cast(jhandle)->WAL_ttl_seconds = static_cast(WAL_ttl_seconds); } @@ -1041,7 +1075,8 @@ void Java_org_rocksdb_Options_setWalTtlSeconds( */ jlong Java_org_rocksdb_Options_walSizeLimitMB( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->WAL_size_limit_MB; + return reinterpret_cast(jhandle) + ->WAL_size_limit_MB; } /* @@ -1051,7 +1086,7 @@ jlong Java_org_rocksdb_Options_walSizeLimitMB( */ void Java_org_rocksdb_Options_setWalSizeLimitMB( JNIEnv*, jobject, jlong jhandle, jlong WAL_size_limit_MB) { - reinterpret_cast(jhandle)->WAL_size_limit_MB = + reinterpret_cast(jhandle)->WAL_size_limit_MB = static_cast(WAL_size_limit_MB); } @@ -1062,7 +1097,7 @@ void Java_org_rocksdb_Options_setWalSizeLimitMB( */ jlong Java_org_rocksdb_Options_manifestPreallocationSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->manifest_preallocation_size; } @@ -1073,12 +1108,13 @@ jlong Java_org_rocksdb_Options_manifestPreallocationSize( */ void Java_org_rocksdb_Options_setManifestPreallocationSize( JNIEnv* env, jobject, jlong jhandle, jlong preallocation_size) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(preallocation_size); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + preallocation_size); if (s.ok()) { - reinterpret_cast(jhandle)->manifest_preallocation_size = - preallocation_size; + reinterpret_cast(jhandle) + ->manifest_preallocation_size = preallocation_size; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -1088,9 +1124,9 @@ void Java_org_rocksdb_Options_setManifestPreallocationSize( */ void Java_org_rocksdb_Options_setTableFactory( JNIEnv*, jobject, jlong jhandle, jlong jtable_factory_handle) { - auto* options = reinterpret_cast(jhandle); + auto* options = reinterpret_cast(jhandle); auto* table_factory = - reinterpret_cast(jtable_factory_handle); + reinterpret_cast(jtable_factory_handle); options->table_factory.reset(table_factory); } @@ -1101,7 +1137,8 @@ void Java_org_rocksdb_Options_setTableFactory( */ jboolean Java_org_rocksdb_Options_allowMmapReads( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->allow_mmap_reads; + return reinterpret_cast(jhandle) + ->allow_mmap_reads; } /* @@ -1111,7 +1148,7 @@ jboolean Java_org_rocksdb_Options_allowMmapReads( */ void Java_org_rocksdb_Options_setAllowMmapReads( JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_reads) { - reinterpret_cast(jhandle)->allow_mmap_reads = + reinterpret_cast(jhandle)->allow_mmap_reads = static_cast(allow_mmap_reads); } @@ -1122,7 +1159,8 @@ void Java_org_rocksdb_Options_setAllowMmapReads( */ jboolean Java_org_rocksdb_Options_allowMmapWrites( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->allow_mmap_writes; + return reinterpret_cast(jhandle) + ->allow_mmap_writes; } /* @@ -1132,7 +1170,7 @@ jboolean Java_org_rocksdb_Options_allowMmapWrites( */ void Java_org_rocksdb_Options_setAllowMmapWrites( JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_writes) { - reinterpret_cast(jhandle)->allow_mmap_writes = + reinterpret_cast(jhandle)->allow_mmap_writes = static_cast(allow_mmap_writes); } @@ -1143,7 +1181,8 @@ void Java_org_rocksdb_Options_setAllowMmapWrites( */ jboolean Java_org_rocksdb_Options_useDirectReads( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->use_direct_reads; + return reinterpret_cast(jhandle) + ->use_direct_reads; } /* @@ -1153,7 +1192,7 @@ jboolean Java_org_rocksdb_Options_useDirectReads( */ void Java_org_rocksdb_Options_setUseDirectReads( JNIEnv*, jobject, jlong jhandle, jboolean use_direct_reads) { - reinterpret_cast(jhandle)->use_direct_reads = + reinterpret_cast(jhandle)->use_direct_reads = static_cast(use_direct_reads); } @@ -1164,7 +1203,7 @@ void Java_org_rocksdb_Options_setUseDirectReads( */ jboolean Java_org_rocksdb_Options_useDirectIoForFlushAndCompaction( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->use_direct_io_for_flush_and_compaction; } @@ -1176,7 +1215,7 @@ jboolean Java_org_rocksdb_Options_useDirectIoForFlushAndCompaction( void Java_org_rocksdb_Options_setUseDirectIoForFlushAndCompaction( JNIEnv*, jobject, jlong jhandle, jboolean use_direct_io_for_flush_and_compaction) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->use_direct_io_for_flush_and_compaction = static_cast(use_direct_io_for_flush_and_compaction); } @@ -1188,7 +1227,7 @@ void Java_org_rocksdb_Options_setUseDirectIoForFlushAndCompaction( */ void Java_org_rocksdb_Options_setAllowFAllocate( JNIEnv*, jobject, jlong jhandle, jboolean jallow_fallocate) { - reinterpret_cast(jhandle)->allow_fallocate = + reinterpret_cast(jhandle)->allow_fallocate = static_cast(jallow_fallocate); } @@ -1199,7 +1238,7 @@ void Java_org_rocksdb_Options_setAllowFAllocate( */ jboolean Java_org_rocksdb_Options_allowFAllocate( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_fallocate); } @@ -1210,7 +1249,8 @@ jboolean Java_org_rocksdb_Options_allowFAllocate( */ jboolean Java_org_rocksdb_Options_isFdCloseOnExec( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->is_fd_close_on_exec; + return reinterpret_cast(jhandle) + ->is_fd_close_on_exec; } /* @@ -1220,7 +1260,7 @@ jboolean Java_org_rocksdb_Options_isFdCloseOnExec( */ void Java_org_rocksdb_Options_setIsFdCloseOnExec( JNIEnv*, jobject, jlong jhandle, jboolean is_fd_close_on_exec) { - reinterpret_cast(jhandle)->is_fd_close_on_exec = + reinterpret_cast(jhandle)->is_fd_close_on_exec = static_cast(is_fd_close_on_exec); } @@ -1231,7 +1271,8 @@ void Java_org_rocksdb_Options_setIsFdCloseOnExec( */ jint Java_org_rocksdb_Options_statsDumpPeriodSec( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->stats_dump_period_sec; + return reinterpret_cast(jhandle) + ->stats_dump_period_sec; } /* @@ -1242,7 +1283,8 @@ jint Java_org_rocksdb_Options_statsDumpPeriodSec( void Java_org_rocksdb_Options_setStatsDumpPeriodSec( JNIEnv*, jobject, jlong jhandle, jint jstats_dump_period_sec) { - reinterpret_cast(jhandle)->stats_dump_period_sec = + reinterpret_cast(jhandle) + ->stats_dump_period_sec = static_cast(jstats_dump_period_sec); } @@ -1253,7 +1295,8 @@ void Java_org_rocksdb_Options_setStatsDumpPeriodSec( */ jint Java_org_rocksdb_Options_statsPersistPeriodSec( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->stats_persist_period_sec; + return reinterpret_cast(jhandle) + ->stats_persist_period_sec; } /* @@ -1263,7 +1306,8 @@ jint Java_org_rocksdb_Options_statsPersistPeriodSec( */ void Java_org_rocksdb_Options_setStatsPersistPeriodSec( JNIEnv*, jobject, jlong jhandle, jint jstats_persist_period_sec) { - reinterpret_cast(jhandle)->stats_persist_period_sec = + reinterpret_cast(jhandle) + ->stats_persist_period_sec = static_cast(jstats_persist_period_sec); } @@ -1274,7 +1318,8 @@ void Java_org_rocksdb_Options_setStatsPersistPeriodSec( */ jlong Java_org_rocksdb_Options_statsHistoryBufferSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->stats_history_buffer_size; + return reinterpret_cast(jhandle) + ->stats_history_buffer_size; } /* @@ -1284,7 +1329,8 @@ jlong Java_org_rocksdb_Options_statsHistoryBufferSize( */ void Java_org_rocksdb_Options_setStatsHistoryBufferSize( JNIEnv*, jobject, jlong jhandle, jlong jstats_history_buffer_size) { - reinterpret_cast(jhandle)->stats_history_buffer_size = + reinterpret_cast(jhandle) + ->stats_history_buffer_size = static_cast(jstats_history_buffer_size); } @@ -1295,7 +1341,8 @@ void Java_org_rocksdb_Options_setStatsHistoryBufferSize( */ jboolean Java_org_rocksdb_Options_adviseRandomOnOpen( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->advise_random_on_open; + return reinterpret_cast(jhandle) + ->advise_random_on_open; } /* @@ -1306,8 +1353,8 @@ jboolean Java_org_rocksdb_Options_adviseRandomOnOpen( void Java_org_rocksdb_Options_setAdviseRandomOnOpen( JNIEnv*, jobject, jlong jhandle, jboolean advise_random_on_open) { - reinterpret_cast(jhandle)->advise_random_on_open = - static_cast(advise_random_on_open); + reinterpret_cast(jhandle) + ->advise_random_on_open = static_cast(advise_random_on_open); } /* @@ -1318,7 +1365,7 @@ void Java_org_rocksdb_Options_setAdviseRandomOnOpen( void Java_org_rocksdb_Options_setDbWriteBufferSize( JNIEnv*, jobject, jlong jhandle, jlong jdb_write_buffer_size) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->db_write_buffer_size = static_cast(jdb_write_buffer_size); } @@ -1329,7 +1376,7 @@ void Java_org_rocksdb_Options_setDbWriteBufferSize( */ jlong Java_org_rocksdb_Options_dbWriteBufferSize( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->db_write_buffer_size); } @@ -1341,9 +1388,9 @@ jlong Java_org_rocksdb_Options_dbWriteBufferSize( void Java_org_rocksdb_Options_setAccessHintOnCompactionStart( JNIEnv*, jobject, jlong jhandle, jbyte jaccess_hint_value) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->access_hint_on_compaction_start = - rocksdb::AccessHintJni::toCppAccessHint(jaccess_hint_value); + ROCKSDB_NAMESPACE::AccessHintJni::toCppAccessHint(jaccess_hint_value); } /* @@ -1353,8 +1400,8 @@ void Java_org_rocksdb_Options_setAccessHintOnCompactionStart( */ jbyte Java_org_rocksdb_Options_accessHintOnCompactionStart( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - return rocksdb::AccessHintJni::toJavaAccessHint( + auto* opt = reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::AccessHintJni::toJavaAccessHint( opt->access_hint_on_compaction_start); } @@ -1366,7 +1413,7 @@ jbyte Java_org_rocksdb_Options_accessHintOnCompactionStart( void Java_org_rocksdb_Options_setNewTableReaderForCompactionInputs( JNIEnv*, jobject, jlong jhandle, jboolean jnew_table_reader_for_compaction_inputs) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->new_table_reader_for_compaction_inputs = static_cast(jnew_table_reader_for_compaction_inputs); } @@ -1378,7 +1425,7 @@ void Java_org_rocksdb_Options_setNewTableReaderForCompactionInputs( */ jboolean Java_org_rocksdb_Options_newTableReaderForCompactionInputs( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->new_table_reader_for_compaction_inputs); } @@ -1390,7 +1437,7 @@ jboolean Java_org_rocksdb_Options_newTableReaderForCompactionInputs( void Java_org_rocksdb_Options_setCompactionReadaheadSize( JNIEnv*, jobject, jlong jhandle, jlong jcompaction_readahead_size) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->compaction_readahead_size = static_cast(jcompaction_readahead_size); } @@ -1402,7 +1449,7 @@ void Java_org_rocksdb_Options_setCompactionReadaheadSize( */ jlong Java_org_rocksdb_Options_compactionReadaheadSize( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->compaction_readahead_size); } @@ -1413,7 +1460,7 @@ jlong Java_org_rocksdb_Options_compactionReadaheadSize( */ void Java_org_rocksdb_Options_setRandomAccessMaxBufferSize( JNIEnv*, jobject, jlong jhandle, jlong jrandom_access_max_buffer_size) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->random_access_max_buffer_size = static_cast(jrandom_access_max_buffer_size); } @@ -1425,7 +1472,7 @@ void Java_org_rocksdb_Options_setRandomAccessMaxBufferSize( */ jlong Java_org_rocksdb_Options_randomAccessMaxBufferSize( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->random_access_max_buffer_size); } @@ -1437,7 +1484,7 @@ jlong Java_org_rocksdb_Options_randomAccessMaxBufferSize( void Java_org_rocksdb_Options_setWritableFileMaxBufferSize( JNIEnv*, jobject, jlong jhandle, jlong jwritable_file_max_buffer_size) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->writable_file_max_buffer_size = static_cast(jwritable_file_max_buffer_size); } @@ -1449,7 +1496,7 @@ void Java_org_rocksdb_Options_setWritableFileMaxBufferSize( */ jlong Java_org_rocksdb_Options_writableFileMaxBufferSize( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->writable_file_max_buffer_size); } @@ -1460,7 +1507,8 @@ jlong Java_org_rocksdb_Options_writableFileMaxBufferSize( */ jboolean Java_org_rocksdb_Options_useAdaptiveMutex( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->use_adaptive_mutex; + return reinterpret_cast(jhandle) + ->use_adaptive_mutex; } /* @@ -1470,7 +1518,7 @@ jboolean Java_org_rocksdb_Options_useAdaptiveMutex( */ void Java_org_rocksdb_Options_setUseAdaptiveMutex( JNIEnv*, jobject, jlong jhandle, jboolean use_adaptive_mutex) { - reinterpret_cast(jhandle)->use_adaptive_mutex = + reinterpret_cast(jhandle)->use_adaptive_mutex = static_cast(use_adaptive_mutex); } @@ -1481,7 +1529,7 @@ void Java_org_rocksdb_Options_setUseAdaptiveMutex( */ jlong Java_org_rocksdb_Options_bytesPerSync( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->bytes_per_sync; + return reinterpret_cast(jhandle)->bytes_per_sync; } /* @@ -1491,7 +1539,7 @@ jlong Java_org_rocksdb_Options_bytesPerSync( */ void Java_org_rocksdb_Options_setBytesPerSync( JNIEnv*, jobject, jlong jhandle, jlong bytes_per_sync) { - reinterpret_cast(jhandle)->bytes_per_sync = + reinterpret_cast(jhandle)->bytes_per_sync = static_cast(bytes_per_sync); } @@ -1502,7 +1550,7 @@ void Java_org_rocksdb_Options_setBytesPerSync( */ void Java_org_rocksdb_Options_setWalBytesPerSync( JNIEnv*, jobject, jlong jhandle, jlong jwal_bytes_per_sync) { - reinterpret_cast(jhandle)->wal_bytes_per_sync = + reinterpret_cast(jhandle)->wal_bytes_per_sync = static_cast(jwal_bytes_per_sync); } @@ -1513,7 +1561,7 @@ void Java_org_rocksdb_Options_setWalBytesPerSync( */ jlong Java_org_rocksdb_Options_walBytesPerSync( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->wal_bytes_per_sync); } @@ -1524,8 +1572,8 @@ jlong Java_org_rocksdb_Options_walBytesPerSync( */ void Java_org_rocksdb_Options_setStrictBytesPerSync( JNIEnv*, jobject, jlong jhandle, jboolean jstrict_bytes_per_sync) { - reinterpret_cast(jhandle)->strict_bytes_per_sync = - jstrict_bytes_per_sync == JNI_TRUE; + reinterpret_cast(jhandle) + ->strict_bytes_per_sync = jstrict_bytes_per_sync == JNI_TRUE; } /* @@ -1535,7 +1583,7 @@ void Java_org_rocksdb_Options_setStrictBytesPerSync( */ jboolean Java_org_rocksdb_Options_strictBytesPerSync( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->strict_bytes_per_sync); } @@ -1546,7 +1594,7 @@ jboolean Java_org_rocksdb_Options_strictBytesPerSync( */ void Java_org_rocksdb_Options_setEnableThreadTracking( JNIEnv*, jobject, jlong jhandle, jboolean jenable_thread_tracking) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->enable_thread_tracking = static_cast(jenable_thread_tracking); } @@ -1557,7 +1605,7 @@ void Java_org_rocksdb_Options_setEnableThreadTracking( */ jboolean Java_org_rocksdb_Options_enableThreadTracking( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->enable_thread_tracking); } @@ -1568,7 +1616,7 @@ jboolean Java_org_rocksdb_Options_enableThreadTracking( */ void Java_org_rocksdb_Options_setDelayedWriteRate( JNIEnv*, jobject, jlong jhandle, jlong jdelayed_write_rate) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->delayed_write_rate = static_cast(jdelayed_write_rate); } @@ -1579,7 +1627,7 @@ void Java_org_rocksdb_Options_setDelayedWriteRate( */ jlong Java_org_rocksdb_Options_delayedWriteRate( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->delayed_write_rate); } @@ -1590,7 +1638,7 @@ jlong Java_org_rocksdb_Options_delayedWriteRate( */ void Java_org_rocksdb_Options_setEnablePipelinedWrite( JNIEnv*, jobject, jlong jhandle, jboolean jenable_pipelined_write) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->enable_pipelined_write = jenable_pipelined_write == JNI_TRUE; } @@ -1601,7 +1649,7 @@ void Java_org_rocksdb_Options_setEnablePipelinedWrite( */ jboolean Java_org_rocksdb_Options_enablePipelinedWrite( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->enable_pipelined_write); } @@ -1612,8 +1660,8 @@ jboolean Java_org_rocksdb_Options_enablePipelinedWrite( */ void Java_org_rocksdb_Options_setUnorderedWrite( JNIEnv*, jobject, jlong jhandle, jboolean unordered_write) { - reinterpret_cast(jhandle) - ->unordered_write = static_cast(unordered_write); + reinterpret_cast(jhandle)->unordered_write = + static_cast(unordered_write); } /* @@ -1623,7 +1671,8 @@ void Java_org_rocksdb_Options_setUnorderedWrite( */ jboolean Java_org_rocksdb_Options_unorderedWrite( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->unordered_write; + return reinterpret_cast(jhandle) + ->unordered_write; } /* @@ -1633,7 +1682,7 @@ jboolean Java_org_rocksdb_Options_unorderedWrite( */ void Java_org_rocksdb_Options_setAllowConcurrentMemtableWrite( JNIEnv*, jobject, jlong jhandle, jboolean allow) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->allow_concurrent_memtable_write = static_cast(allow); } @@ -1644,7 +1693,7 @@ void Java_org_rocksdb_Options_setAllowConcurrentMemtableWrite( */ jboolean Java_org_rocksdb_Options_allowConcurrentMemtableWrite( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->allow_concurrent_memtable_write; } @@ -1655,7 +1704,7 @@ jboolean Java_org_rocksdb_Options_allowConcurrentMemtableWrite( */ void Java_org_rocksdb_Options_setEnableWriteThreadAdaptiveYield( JNIEnv*, jobject, jlong jhandle, jboolean yield) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->enable_write_thread_adaptive_yield = static_cast(yield); } @@ -1666,7 +1715,7 @@ void Java_org_rocksdb_Options_setEnableWriteThreadAdaptiveYield( */ jboolean Java_org_rocksdb_Options_enableWriteThreadAdaptiveYield( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->enable_write_thread_adaptive_yield; } @@ -1677,8 +1726,8 @@ jboolean Java_org_rocksdb_Options_enableWriteThreadAdaptiveYield( */ void Java_org_rocksdb_Options_setWriteThreadMaxYieldUsec( JNIEnv*, jobject, jlong jhandle, jlong max) { - reinterpret_cast(jhandle)->write_thread_max_yield_usec = - static_cast(max); + reinterpret_cast(jhandle) + ->write_thread_max_yield_usec = static_cast(max); } /* @@ -1688,7 +1737,7 @@ void Java_org_rocksdb_Options_setWriteThreadMaxYieldUsec( */ jlong Java_org_rocksdb_Options_writeThreadMaxYieldUsec( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->write_thread_max_yield_usec; } @@ -1699,8 +1748,8 @@ jlong Java_org_rocksdb_Options_writeThreadMaxYieldUsec( */ void Java_org_rocksdb_Options_setWriteThreadSlowYieldUsec( JNIEnv*, jobject, jlong jhandle, jlong slow) { - reinterpret_cast(jhandle)->write_thread_slow_yield_usec = - static_cast(slow); + reinterpret_cast(jhandle) + ->write_thread_slow_yield_usec = static_cast(slow); } /* @@ -1710,7 +1759,7 @@ void Java_org_rocksdb_Options_setWriteThreadSlowYieldUsec( */ jlong Java_org_rocksdb_Options_writeThreadSlowYieldUsec( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->write_thread_slow_yield_usec; } @@ -1722,7 +1771,7 @@ jlong Java_org_rocksdb_Options_writeThreadSlowYieldUsec( void Java_org_rocksdb_Options_setSkipStatsUpdateOnDbOpen( JNIEnv*, jobject, jlong jhandle, jboolean jskip_stats_update_on_db_open) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->skip_stats_update_on_db_open = static_cast(jskip_stats_update_on_db_open); } @@ -1734,7 +1783,7 @@ void Java_org_rocksdb_Options_setSkipStatsUpdateOnDbOpen( */ jboolean Java_org_rocksdb_Options_skipStatsUpdateOnDbOpen( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->skip_stats_update_on_db_open); } @@ -1746,7 +1795,7 @@ jboolean Java_org_rocksdb_Options_skipStatsUpdateOnDbOpen( void Java_org_rocksdb_Options_setSkipCheckingSstFileSizesOnDbOpen( JNIEnv*, jobject, jlong jhandle, jboolean jskip_checking_sst_file_sizes_on_db_open) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->skip_checking_sst_file_sizes_on_db_open = static_cast(jskip_checking_sst_file_sizes_on_db_open); } @@ -1758,7 +1807,7 @@ void Java_org_rocksdb_Options_setSkipCheckingSstFileSizesOnDbOpen( */ jboolean Java_org_rocksdb_Options_skipCheckingSstFileSizesOnDbOpen( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->skip_checking_sst_file_sizes_on_db_open); } @@ -1770,9 +1819,10 @@ jboolean Java_org_rocksdb_Options_skipCheckingSstFileSizesOnDbOpen( void Java_org_rocksdb_Options_setWalRecoveryMode( JNIEnv*, jobject, jlong jhandle, jbyte jwal_recovery_mode_value) { - auto* opt = reinterpret_cast(jhandle); - opt->wal_recovery_mode = rocksdb::WALRecoveryModeJni::toCppWALRecoveryMode( - jwal_recovery_mode_value); + auto* opt = reinterpret_cast(jhandle); + opt->wal_recovery_mode = + ROCKSDB_NAMESPACE::WALRecoveryModeJni::toCppWALRecoveryMode( + jwal_recovery_mode_value); } /* @@ -1782,8 +1832,8 @@ void Java_org_rocksdb_Options_setWalRecoveryMode( */ jbyte Java_org_rocksdb_Options_walRecoveryMode( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - return rocksdb::WALRecoveryModeJni::toJavaWALRecoveryMode( + auto* opt = reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::WALRecoveryModeJni::toJavaWALRecoveryMode( opt->wal_recovery_mode); } @@ -1794,7 +1844,7 @@ jbyte Java_org_rocksdb_Options_walRecoveryMode( */ void Java_org_rocksdb_Options_setAllow2pc( JNIEnv*, jobject, jlong jhandle, jboolean jallow_2pc) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->allow_2pc = static_cast(jallow_2pc); } @@ -1805,7 +1855,7 @@ void Java_org_rocksdb_Options_setAllow2pc( */ jboolean Java_org_rocksdb_Options_allow2pc( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_2pc); } @@ -1816,9 +1866,10 @@ jboolean Java_org_rocksdb_Options_allow2pc( */ void Java_org_rocksdb_Options_setRowCache( JNIEnv*, jobject, jlong jhandle, jlong jrow_cache_handle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); auto* row_cache = - reinterpret_cast*>(jrow_cache_handle); + reinterpret_cast*>( + jrow_cache_handle); opt->row_cache = *row_cache; } @@ -1830,9 +1881,9 @@ void Java_org_rocksdb_Options_setRowCache( */ void Java_org_rocksdb_Options_setWalFilter( JNIEnv*, jobject, jlong jhandle, jlong jwal_filter_handle) { - auto* opt = reinterpret_cast(jhandle); - auto* wal_filter = - reinterpret_cast(jwal_filter_handle); + auto* opt = reinterpret_cast(jhandle); + auto* wal_filter = reinterpret_cast( + jwal_filter_handle); opt->wal_filter = wal_filter; } @@ -1843,7 +1894,7 @@ void Java_org_rocksdb_Options_setWalFilter( */ void Java_org_rocksdb_Options_setFailIfOptionsFileError( JNIEnv*, jobject, jlong jhandle, jboolean jfail_if_options_file_error) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->fail_if_options_file_error = static_cast(jfail_if_options_file_error); } @@ -1855,7 +1906,7 @@ void Java_org_rocksdb_Options_setFailIfOptionsFileError( */ jboolean Java_org_rocksdb_Options_failIfOptionsFileError( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->fail_if_options_file_error); } @@ -1866,7 +1917,7 @@ jboolean Java_org_rocksdb_Options_failIfOptionsFileError( */ void Java_org_rocksdb_Options_setDumpMallocStats( JNIEnv*, jobject, jlong jhandle, jboolean jdump_malloc_stats) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->dump_malloc_stats = static_cast(jdump_malloc_stats); } @@ -1877,7 +1928,7 @@ void Java_org_rocksdb_Options_setDumpMallocStats( */ jboolean Java_org_rocksdb_Options_dumpMallocStats( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->dump_malloc_stats); } @@ -1888,7 +1939,7 @@ jboolean Java_org_rocksdb_Options_dumpMallocStats( */ void Java_org_rocksdb_Options_setAvoidFlushDuringRecovery( JNIEnv*, jobject, jlong jhandle, jboolean javoid_flush_during_recovery) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->avoid_flush_during_recovery = static_cast(javoid_flush_during_recovery); } @@ -1900,7 +1951,7 @@ void Java_org_rocksdb_Options_setAvoidFlushDuringRecovery( */ jboolean Java_org_rocksdb_Options_avoidFlushDuringRecovery( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->avoid_flush_during_recovery); } @@ -1911,7 +1962,7 @@ jboolean Java_org_rocksdb_Options_avoidFlushDuringRecovery( */ void Java_org_rocksdb_Options_setAvoidFlushDuringShutdown( JNIEnv*, jobject, jlong jhandle, jboolean javoid_flush_during_shutdown) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->avoid_flush_during_shutdown = static_cast(javoid_flush_during_shutdown); } @@ -1923,7 +1974,7 @@ void Java_org_rocksdb_Options_setAvoidFlushDuringShutdown( */ jboolean Java_org_rocksdb_Options_avoidFlushDuringShutdown( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->avoid_flush_during_shutdown); } @@ -1934,7 +1985,7 @@ jboolean Java_org_rocksdb_Options_avoidFlushDuringShutdown( */ void Java_org_rocksdb_Options_setAllowIngestBehind( JNIEnv*, jobject, jlong jhandle, jboolean jallow_ingest_behind) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->allow_ingest_behind = jallow_ingest_behind == JNI_TRUE; } @@ -1945,7 +1996,7 @@ void Java_org_rocksdb_Options_setAllowIngestBehind( */ jboolean Java_org_rocksdb_Options_allowIngestBehind( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_ingest_behind); } @@ -1956,7 +2007,7 @@ jboolean Java_org_rocksdb_Options_allowIngestBehind( */ void Java_org_rocksdb_Options_setPreserveDeletes( JNIEnv*, jobject, jlong jhandle, jboolean jpreserve_deletes) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->preserve_deletes = jpreserve_deletes == JNI_TRUE; } @@ -1967,7 +2018,7 @@ void Java_org_rocksdb_Options_setPreserveDeletes( */ jboolean Java_org_rocksdb_Options_preserveDeletes( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->preserve_deletes); } @@ -1978,7 +2029,7 @@ jboolean Java_org_rocksdb_Options_preserveDeletes( */ void Java_org_rocksdb_Options_setTwoWriteQueues( JNIEnv*, jobject, jlong jhandle, jboolean jtwo_write_queues) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->two_write_queues = jtwo_write_queues == JNI_TRUE; } @@ -1989,7 +2040,7 @@ void Java_org_rocksdb_Options_setTwoWriteQueues( */ jboolean Java_org_rocksdb_Options_twoWriteQueues( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->two_write_queues); } @@ -2000,7 +2051,7 @@ jboolean Java_org_rocksdb_Options_twoWriteQueues( */ void Java_org_rocksdb_Options_setManualWalFlush( JNIEnv*, jobject, jlong jhandle, jboolean jmanual_wal_flush) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->manual_wal_flush = jmanual_wal_flush == JNI_TRUE; } @@ -2011,7 +2062,7 @@ void Java_org_rocksdb_Options_setManualWalFlush( */ jboolean Java_org_rocksdb_Options_manualWalFlush( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->manual_wal_flush); } @@ -2022,7 +2073,7 @@ jboolean Java_org_rocksdb_Options_manualWalFlush( */ void Java_org_rocksdb_Options_setAtomicFlush( JNIEnv*, jobject, jlong jhandle, jboolean jatomic_flush) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->atomic_flush = jatomic_flush == JNI_TRUE; } @@ -2033,7 +2084,7 @@ void Java_org_rocksdb_Options_setAtomicFlush( */ jboolean Java_org_rocksdb_Options_atomicFlush( JNIEnv *, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->atomic_flush); } @@ -2043,8 +2094,8 @@ jboolean Java_org_rocksdb_Options_atomicFlush( */ jstring Java_org_rocksdb_Options_tableFactoryName( JNIEnv* env, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - rocksdb::TableFactory* tf = opt->table_factory.get(); + auto* opt = reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::TableFactory* tf = opt->table_factory.get(); // Should never be nullptr. // Default memtable factory is SkipListFactory @@ -2060,7 +2111,7 @@ jstring Java_org_rocksdb_Options_tableFactoryName( */ jint Java_org_rocksdb_Options_minWriteBufferNumberToMerge( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->min_write_buffer_number_to_merge; } @@ -2071,7 +2122,7 @@ jint Java_org_rocksdb_Options_minWriteBufferNumberToMerge( */ void Java_org_rocksdb_Options_setMinWriteBufferNumberToMerge( JNIEnv*, jobject, jlong jhandle, jint jmin_write_buffer_number_to_merge) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->min_write_buffer_number_to_merge = static_cast(jmin_write_buffer_number_to_merge); } @@ -2082,7 +2133,7 @@ void Java_org_rocksdb_Options_setMinWriteBufferNumberToMerge( */ jint Java_org_rocksdb_Options_maxWriteBufferNumberToMaintain( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_write_buffer_number_to_maintain; } @@ -2094,7 +2145,7 @@ jint Java_org_rocksdb_Options_maxWriteBufferNumberToMaintain( void Java_org_rocksdb_Options_setMaxWriteBufferNumberToMaintain( JNIEnv*, jobject, jlong jhandle, jint jmax_write_buffer_number_to_maintain) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->max_write_buffer_number_to_maintain = static_cast(jmax_write_buffer_number_to_maintain); } @@ -2106,9 +2157,10 @@ void Java_org_rocksdb_Options_setMaxWriteBufferNumberToMaintain( */ void Java_org_rocksdb_Options_setCompressionType( JNIEnv*, jobject, jlong jhandle, jbyte jcompression_type_value) { - auto* opts = reinterpret_cast(jhandle); - opts->compression = rocksdb::CompressionTypeJni::toCppCompressionType( - jcompression_type_value); + auto* opts = reinterpret_cast(jhandle); + opts->compression = + ROCKSDB_NAMESPACE::CompressionTypeJni::toCppCompressionType( + jcompression_type_value); } /* @@ -2118,13 +2170,14 @@ void Java_org_rocksdb_Options_setCompressionType( */ jbyte Java_org_rocksdb_Options_compressionType( JNIEnv*, jobject, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); - return rocksdb::CompressionTypeJni::toJavaCompressionType(opts->compression); + auto* opts = reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( + opts->compression); } /** * Helper method to convert a Java byte array of compression levels - * to a C++ vector of rocksdb::CompressionType + * to a C++ vector of ROCKSDB_NAMESPACE::CompressionType * * @param env A pointer to the Java environment * @param jcompression_levels A reference to a java byte array @@ -2133,23 +2186,25 @@ jbyte Java_org_rocksdb_Options_compressionType( * @return A std::unique_ptr to the vector, or std::unique_ptr(nullptr) if a JNI * exception occurs */ -std::unique_ptr>rocksdb_compression_vector_helper( - JNIEnv* env, jbyteArray jcompression_levels) { +std::unique_ptr> +rocksdb_compression_vector_helper(JNIEnv* env, jbyteArray jcompression_levels) { jsize len = env->GetArrayLength(jcompression_levels); jbyte* jcompression_level = env->GetByteArrayElements(jcompression_levels, nullptr); if (jcompression_level == nullptr) { // exception thrown: OutOfMemoryError - return std::unique_ptr>(); + return std::unique_ptr>(); } - auto* compression_levels = new std::vector(); - std::unique_ptr> + auto* compression_levels = + new std::vector(); + std::unique_ptr> uptr_compression_levels(compression_levels); for (jsize i = 0; i < len; i++) { jbyte jcl = jcompression_level[i]; - compression_levels->push_back(static_cast(jcl)); + compression_levels->push_back( + static_cast(jcl)); } env->ReleaseByteArrayElements(jcompression_levels, jcompression_level, @@ -2159,7 +2214,7 @@ std::unique_ptr>rocksdb_compression_vector } /** - * Helper method to convert a C++ vector of rocksdb::CompressionType + * Helper method to convert a C++ vector of ROCKSDB_NAMESPACE::CompressionType * to a Java byte array of compression levels * * @param env A pointer to the Java environment @@ -2169,7 +2224,8 @@ std::unique_ptr>rocksdb_compression_vector * @return A jbytearray or nullptr if an exception occurs */ jbyteArray rocksdb_compression_list_helper( - JNIEnv* env, std::vector compression_levels) { + JNIEnv* env, + std::vector compression_levels) { const size_t len = compression_levels.size(); jbyte* jbuf = new jbyte[len]; @@ -2211,7 +2267,7 @@ void Java_org_rocksdb_Options_setCompressionPerLevel( // exception occurred return; } - auto* options = reinterpret_cast(jhandle); + auto* options = reinterpret_cast(jhandle); options->compression_per_level = *(uptr_compression_levels.get()); } @@ -2222,7 +2278,7 @@ void Java_org_rocksdb_Options_setCompressionPerLevel( */ jbyteArray Java_org_rocksdb_Options_compressionPerLevel( JNIEnv* env, jobject, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); + auto* options = reinterpret_cast(jhandle); return rocksdb_compression_list_helper(env, options->compression_per_level); } @@ -2233,9 +2289,9 @@ jbyteArray Java_org_rocksdb_Options_compressionPerLevel( */ void Java_org_rocksdb_Options_setBottommostCompressionType( JNIEnv*, jobject, jlong jhandle, jbyte jcompression_type_value) { - auto* options = reinterpret_cast(jhandle); + auto* options = reinterpret_cast(jhandle); options->bottommost_compression = - rocksdb::CompressionTypeJni::toCppCompressionType( + ROCKSDB_NAMESPACE::CompressionTypeJni::toCppCompressionType( jcompression_type_value); } @@ -2246,8 +2302,8 @@ void Java_org_rocksdb_Options_setBottommostCompressionType( */ jbyte Java_org_rocksdb_Options_bottommostCompressionType( JNIEnv*, jobject, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); - return rocksdb::CompressionTypeJni::toJavaCompressionType( + auto* options = reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( options->bottommost_compression); } @@ -2259,9 +2315,9 @@ jbyte Java_org_rocksdb_Options_bottommostCompressionType( void Java_org_rocksdb_Options_setBottommostCompressionOptions( JNIEnv*, jobject, jlong jhandle, jlong jbottommost_compression_options_handle) { - auto* options = reinterpret_cast(jhandle); + auto* options = reinterpret_cast(jhandle); auto* bottommost_compression_options = - reinterpret_cast( + reinterpret_cast( jbottommost_compression_options_handle); options->bottommost_compression_opts = *bottommost_compression_options; } @@ -2273,9 +2329,10 @@ void Java_org_rocksdb_Options_setBottommostCompressionOptions( */ void Java_org_rocksdb_Options_setCompressionOptions( JNIEnv*, jobject, jlong jhandle, jlong jcompression_options_handle) { - auto* options = reinterpret_cast(jhandle); - auto* compression_options = reinterpret_cast( - jcompression_options_handle); + auto* options = reinterpret_cast(jhandle); + auto* compression_options = + reinterpret_cast( + jcompression_options_handle); options->compression_opts = *compression_options; } @@ -2286,9 +2343,9 @@ void Java_org_rocksdb_Options_setCompressionOptions( */ void Java_org_rocksdb_Options_setCompactionStyle( JNIEnv*, jobject, jlong jhandle, jbyte jcompaction_style) { - auto* options = reinterpret_cast(jhandle); + auto* options = reinterpret_cast(jhandle); options->compaction_style = - rocksdb::CompactionStyleJni::toCppCompactionStyle( + ROCKSDB_NAMESPACE::CompactionStyleJni::toCppCompactionStyle( jcompaction_style); } @@ -2299,8 +2356,8 @@ void Java_org_rocksdb_Options_setCompactionStyle( */ jbyte Java_org_rocksdb_Options_compactionStyle( JNIEnv*, jobject, jlong jhandle) { - auto* options = reinterpret_cast(jhandle); - return rocksdb::CompactionStyleJni::toJavaCompactionStyle( + auto* options = reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompactionStyleJni::toJavaCompactionStyle( options->compaction_style); } @@ -2311,7 +2368,7 @@ jbyte Java_org_rocksdb_Options_compactionStyle( */ void Java_org_rocksdb_Options_setMaxTableFilesSizeFIFO( JNIEnv*, jobject, jlong jhandle, jlong jmax_table_files_size) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->compaction_options_fifo.max_table_files_size = static_cast(jmax_table_files_size); } @@ -2323,7 +2380,7 @@ void Java_org_rocksdb_Options_setMaxTableFilesSizeFIFO( */ jlong Java_org_rocksdb_Options_maxTableFilesSizeFIFO( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->compaction_options_fifo.max_table_files_size; } @@ -2334,7 +2391,7 @@ jlong Java_org_rocksdb_Options_maxTableFilesSizeFIFO( */ jint Java_org_rocksdb_Options_numLevels( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->num_levels; + return reinterpret_cast(jhandle)->num_levels; } /* @@ -2344,7 +2401,7 @@ jint Java_org_rocksdb_Options_numLevels( */ void Java_org_rocksdb_Options_setNumLevels( JNIEnv*, jobject, jlong jhandle, jint jnum_levels) { - reinterpret_cast(jhandle)->num_levels = + reinterpret_cast(jhandle)->num_levels = static_cast(jnum_levels); } @@ -2355,7 +2412,7 @@ void Java_org_rocksdb_Options_setNumLevels( */ jint Java_org_rocksdb_Options_levelZeroFileNumCompactionTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger; } @@ -2367,7 +2424,7 @@ jint Java_org_rocksdb_Options_levelZeroFileNumCompactionTrigger( void Java_org_rocksdb_Options_setLevelZeroFileNumCompactionTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_file_num_compaction_trigger) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger = static_cast(jlevel0_file_num_compaction_trigger); } @@ -2379,7 +2436,7 @@ void Java_org_rocksdb_Options_setLevelZeroFileNumCompactionTrigger( */ jint Java_org_rocksdb_Options_levelZeroSlowdownWritesTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_slowdown_writes_trigger; } @@ -2390,7 +2447,8 @@ jint Java_org_rocksdb_Options_levelZeroSlowdownWritesTrigger( */ void Java_org_rocksdb_Options_setLevelZeroSlowdownWritesTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_slowdown_writes_trigger) { - reinterpret_cast(jhandle)->level0_slowdown_writes_trigger = + reinterpret_cast(jhandle) + ->level0_slowdown_writes_trigger = static_cast(jlevel0_slowdown_writes_trigger); } @@ -2401,7 +2459,7 @@ void Java_org_rocksdb_Options_setLevelZeroSlowdownWritesTrigger( */ jint Java_org_rocksdb_Options_levelZeroStopWritesTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_stop_writes_trigger; } @@ -2412,7 +2470,8 @@ jint Java_org_rocksdb_Options_levelZeroStopWritesTrigger( */ void Java_org_rocksdb_Options_setLevelZeroStopWritesTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_stop_writes_trigger) { - reinterpret_cast(jhandle)->level0_stop_writes_trigger = + reinterpret_cast(jhandle) + ->level0_stop_writes_trigger = static_cast(jlevel0_stop_writes_trigger); } @@ -2423,7 +2482,8 @@ void Java_org_rocksdb_Options_setLevelZeroStopWritesTrigger( */ jlong Java_org_rocksdb_Options_targetFileSizeBase( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->target_file_size_base; + return reinterpret_cast(jhandle) + ->target_file_size_base; } /* @@ -2433,8 +2493,8 @@ jlong Java_org_rocksdb_Options_targetFileSizeBase( */ void Java_org_rocksdb_Options_setTargetFileSizeBase( JNIEnv*, jobject, jlong jhandle, jlong jtarget_file_size_base) { - reinterpret_cast(jhandle)->target_file_size_base = - static_cast(jtarget_file_size_base); + reinterpret_cast(jhandle) + ->target_file_size_base = static_cast(jtarget_file_size_base); } /* @@ -2444,7 +2504,7 @@ void Java_org_rocksdb_Options_setTargetFileSizeBase( */ jint Java_org_rocksdb_Options_targetFileSizeMultiplier( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->target_file_size_multiplier; } @@ -2455,7 +2515,8 @@ jint Java_org_rocksdb_Options_targetFileSizeMultiplier( */ void Java_org_rocksdb_Options_setTargetFileSizeMultiplier( JNIEnv*, jobject, jlong jhandle, jint jtarget_file_size_multiplier) { - reinterpret_cast(jhandle)->target_file_size_multiplier = + reinterpret_cast(jhandle) + ->target_file_size_multiplier = static_cast(jtarget_file_size_multiplier); } @@ -2466,7 +2527,8 @@ void Java_org_rocksdb_Options_setTargetFileSizeMultiplier( */ jlong Java_org_rocksdb_Options_maxBytesForLevelBase( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_bytes_for_level_base; + return reinterpret_cast(jhandle) + ->max_bytes_for_level_base; } /* @@ -2476,7 +2538,8 @@ jlong Java_org_rocksdb_Options_maxBytesForLevelBase( */ void Java_org_rocksdb_Options_setMaxBytesForLevelBase( JNIEnv*, jobject, jlong jhandle, jlong jmax_bytes_for_level_base) { - reinterpret_cast(jhandle)->max_bytes_for_level_base = + reinterpret_cast(jhandle) + ->max_bytes_for_level_base = static_cast(jmax_bytes_for_level_base); } @@ -2487,7 +2550,7 @@ void Java_org_rocksdb_Options_setMaxBytesForLevelBase( */ jboolean Java_org_rocksdb_Options_levelCompactionDynamicLevelBytes( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level_compaction_dynamic_level_bytes; } @@ -2498,7 +2561,7 @@ jboolean Java_org_rocksdb_Options_levelCompactionDynamicLevelBytes( */ void Java_org_rocksdb_Options_setLevelCompactionDynamicLevelBytes( JNIEnv*, jobject, jlong jhandle, jboolean jenable_dynamic_level_bytes) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->level_compaction_dynamic_level_bytes = (jenable_dynamic_level_bytes); } @@ -2509,7 +2572,7 @@ void Java_org_rocksdb_Options_setLevelCompactionDynamicLevelBytes( */ jdouble Java_org_rocksdb_Options_maxBytesForLevelMultiplier( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_bytes_for_level_multiplier; } @@ -2520,7 +2583,8 @@ jdouble Java_org_rocksdb_Options_maxBytesForLevelMultiplier( */ void Java_org_rocksdb_Options_setMaxBytesForLevelMultiplier( JNIEnv*, jobject, jlong jhandle, jdouble jmax_bytes_for_level_multiplier) { - reinterpret_cast(jhandle)->max_bytes_for_level_multiplier = + reinterpret_cast(jhandle) + ->max_bytes_for_level_multiplier = static_cast(jmax_bytes_for_level_multiplier); } @@ -2532,7 +2596,8 @@ void Java_org_rocksdb_Options_setMaxBytesForLevelMultiplier( jlong Java_org_rocksdb_Options_maxCompactionBytes( JNIEnv*, jobject, jlong jhandle) { return static_cast( - reinterpret_cast(jhandle)->max_compaction_bytes); + reinterpret_cast(jhandle) + ->max_compaction_bytes); } /* @@ -2542,7 +2607,7 @@ jlong Java_org_rocksdb_Options_maxCompactionBytes( */ void Java_org_rocksdb_Options_setMaxCompactionBytes( JNIEnv*, jobject, jlong jhandle, jlong jmax_compaction_bytes) { - reinterpret_cast(jhandle)->max_compaction_bytes = + reinterpret_cast(jhandle)->max_compaction_bytes = static_cast(jmax_compaction_bytes); } @@ -2553,7 +2618,8 @@ void Java_org_rocksdb_Options_setMaxCompactionBytes( */ jlong Java_org_rocksdb_Options_arenaBlockSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->arena_block_size; + return reinterpret_cast(jhandle) + ->arena_block_size; } /* @@ -2563,12 +2629,13 @@ jlong Java_org_rocksdb_Options_arenaBlockSize( */ void Java_org_rocksdb_Options_setArenaBlockSize( JNIEnv* env, jobject, jlong jhandle, jlong jarena_block_size) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(jarena_block_size); + auto s = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(jarena_block_size); if (s.ok()) { - reinterpret_cast(jhandle)->arena_block_size = + reinterpret_cast(jhandle)->arena_block_size = jarena_block_size; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -2579,7 +2646,8 @@ void Java_org_rocksdb_Options_setArenaBlockSize( */ jboolean Java_org_rocksdb_Options_disableAutoCompactions( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->disable_auto_compactions; + return reinterpret_cast(jhandle) + ->disable_auto_compactions; } /* @@ -2589,8 +2657,8 @@ jboolean Java_org_rocksdb_Options_disableAutoCompactions( */ void Java_org_rocksdb_Options_setDisableAutoCompactions( JNIEnv*, jobject, jlong jhandle, jboolean jdisable_auto_compactions) { - reinterpret_cast(jhandle)->disable_auto_compactions = - static_cast(jdisable_auto_compactions); + reinterpret_cast(jhandle) + ->disable_auto_compactions = static_cast(jdisable_auto_compactions); } /* @@ -2600,7 +2668,7 @@ void Java_org_rocksdb_Options_setDisableAutoCompactions( */ jlong Java_org_rocksdb_Options_maxSequentialSkipInIterations( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_sequential_skip_in_iterations; } @@ -2612,7 +2680,7 @@ jlong Java_org_rocksdb_Options_maxSequentialSkipInIterations( void Java_org_rocksdb_Options_setMaxSequentialSkipInIterations( JNIEnv*, jobject, jlong jhandle, jlong jmax_sequential_skip_in_iterations) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->max_sequential_skip_in_iterations = static_cast(jmax_sequential_skip_in_iterations); } @@ -2624,7 +2692,8 @@ void Java_org_rocksdb_Options_setMaxSequentialSkipInIterations( */ jboolean Java_org_rocksdb_Options_inplaceUpdateSupport( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->inplace_update_support; + return reinterpret_cast(jhandle) + ->inplace_update_support; } /* @@ -2634,8 +2703,8 @@ jboolean Java_org_rocksdb_Options_inplaceUpdateSupport( */ void Java_org_rocksdb_Options_setInplaceUpdateSupport( JNIEnv*, jobject, jlong jhandle, jboolean jinplace_update_support) { - reinterpret_cast(jhandle)->inplace_update_support = - static_cast(jinplace_update_support); + reinterpret_cast(jhandle) + ->inplace_update_support = static_cast(jinplace_update_support); } /* @@ -2645,7 +2714,8 @@ void Java_org_rocksdb_Options_setInplaceUpdateSupport( */ jlong Java_org_rocksdb_Options_inplaceUpdateNumLocks( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->inplace_update_num_locks; + return reinterpret_cast(jhandle) + ->inplace_update_num_locks; } /* @@ -2655,13 +2725,13 @@ jlong Java_org_rocksdb_Options_inplaceUpdateNumLocks( */ void Java_org_rocksdb_Options_setInplaceUpdateNumLocks( JNIEnv* env, jobject, jlong jhandle, jlong jinplace_update_num_locks) { - auto s = - rocksdb::JniUtil::check_if_jlong_fits_size_t(jinplace_update_num_locks); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + jinplace_update_num_locks); if (s.ok()) { - reinterpret_cast(jhandle)->inplace_update_num_locks = - jinplace_update_num_locks; + reinterpret_cast(jhandle) + ->inplace_update_num_locks = jinplace_update_num_locks; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -2672,7 +2742,7 @@ void Java_org_rocksdb_Options_setInplaceUpdateNumLocks( */ jdouble Java_org_rocksdb_Options_memtablePrefixBloomSizeRatio( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->memtable_prefix_bloom_size_ratio; } @@ -2684,7 +2754,7 @@ jdouble Java_org_rocksdb_Options_memtablePrefixBloomSizeRatio( void Java_org_rocksdb_Options_setMemtablePrefixBloomSizeRatio( JNIEnv*, jobject, jlong jhandle, jdouble jmemtable_prefix_bloom_size_ratio) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->memtable_prefix_bloom_size_ratio = static_cast(jmemtable_prefix_bloom_size_ratio); } @@ -2696,7 +2766,7 @@ void Java_org_rocksdb_Options_setMemtablePrefixBloomSizeRatio( */ jint Java_org_rocksdb_Options_bloomLocality( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->bloom_locality; + return reinterpret_cast(jhandle)->bloom_locality; } /* @@ -2706,7 +2776,7 @@ jint Java_org_rocksdb_Options_bloomLocality( */ void Java_org_rocksdb_Options_setBloomLocality( JNIEnv*, jobject, jlong jhandle, jint jbloom_locality) { - reinterpret_cast(jhandle)->bloom_locality = + reinterpret_cast(jhandle)->bloom_locality = static_cast(jbloom_locality); } @@ -2717,7 +2787,8 @@ void Java_org_rocksdb_Options_setBloomLocality( */ jlong Java_org_rocksdb_Options_maxSuccessiveMerges( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_successive_merges; + return reinterpret_cast(jhandle) + ->max_successive_merges; } /* @@ -2727,13 +2798,13 @@ jlong Java_org_rocksdb_Options_maxSuccessiveMerges( */ void Java_org_rocksdb_Options_setMaxSuccessiveMerges( JNIEnv* env, jobject, jlong jhandle, jlong jmax_successive_merges) { - auto s = - rocksdb::JniUtil::check_if_jlong_fits_size_t(jmax_successive_merges); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + jmax_successive_merges); if (s.ok()) { - reinterpret_cast(jhandle)->max_successive_merges = - jmax_successive_merges; + reinterpret_cast(jhandle) + ->max_successive_merges = jmax_successive_merges; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -2744,7 +2815,7 @@ void Java_org_rocksdb_Options_setMaxSuccessiveMerges( */ jboolean Java_org_rocksdb_Options_optimizeFiltersForHits( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->optimize_filters_for_hits; } @@ -2755,7 +2826,8 @@ jboolean Java_org_rocksdb_Options_optimizeFiltersForHits( */ void Java_org_rocksdb_Options_setOptimizeFiltersForHits( JNIEnv*, jobject, jlong jhandle, jboolean joptimize_filters_for_hits) { - reinterpret_cast(jhandle)->optimize_filters_for_hits = + reinterpret_cast(jhandle) + ->optimize_filters_for_hits = static_cast(joptimize_filters_for_hits); } @@ -2766,7 +2838,7 @@ void Java_org_rocksdb_Options_setOptimizeFiltersForHits( */ void Java_org_rocksdb_Options_optimizeForSmallDb( JNIEnv*, jobject, jlong jhandle) { - reinterpret_cast(jhandle)->OptimizeForSmallDb(); + reinterpret_cast(jhandle)->OptimizeForSmallDb(); } /* @@ -2776,8 +2848,8 @@ void Java_org_rocksdb_Options_optimizeForSmallDb( */ void Java_org_rocksdb_Options_optimizeForPointLookup( JNIEnv*, jobject, jlong jhandle, jlong block_cache_size_mb) { - reinterpret_cast(jhandle)->OptimizeForPointLookup( - block_cache_size_mb); + reinterpret_cast(jhandle) + ->OptimizeForPointLookup(block_cache_size_mb); } /* @@ -2787,8 +2859,8 @@ void Java_org_rocksdb_Options_optimizeForPointLookup( */ void Java_org_rocksdb_Options_optimizeLevelStyleCompaction( JNIEnv*, jobject, jlong jhandle, jlong memtable_memory_budget) { - reinterpret_cast(jhandle)->OptimizeLevelStyleCompaction( - memtable_memory_budget); + reinterpret_cast(jhandle) + ->OptimizeLevelStyleCompaction(memtable_memory_budget); } /* @@ -2798,7 +2870,7 @@ void Java_org_rocksdb_Options_optimizeLevelStyleCompaction( */ void Java_org_rocksdb_Options_optimizeUniversalStyleCompaction( JNIEnv*, jobject, jlong jhandle, jlong memtable_memory_budget) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->OptimizeUniversalStyleCompaction(memtable_memory_budget); } @@ -2809,7 +2881,7 @@ void Java_org_rocksdb_Options_optimizeUniversalStyleCompaction( */ void Java_org_rocksdb_Options_prepareForBulkLoad( JNIEnv*, jobject, jlong jhandle) { - reinterpret_cast(jhandle)->PrepareForBulkLoad(); + reinterpret_cast(jhandle)->PrepareForBulkLoad(); } /* @@ -2819,7 +2891,8 @@ void Java_org_rocksdb_Options_prepareForBulkLoad( */ jlong Java_org_rocksdb_Options_memtableHugePageSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->memtable_huge_page_size; + return reinterpret_cast(jhandle) + ->memtable_huge_page_size; } /* @@ -2829,13 +2902,13 @@ jlong Java_org_rocksdb_Options_memtableHugePageSize( */ void Java_org_rocksdb_Options_setMemtableHugePageSize( JNIEnv* env, jobject, jlong jhandle, jlong jmemtable_huge_page_size) { - auto s = - rocksdb::JniUtil::check_if_jlong_fits_size_t(jmemtable_huge_page_size); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + jmemtable_huge_page_size); if (s.ok()) { - reinterpret_cast(jhandle)->memtable_huge_page_size = - jmemtable_huge_page_size; + reinterpret_cast(jhandle) + ->memtable_huge_page_size = jmemtable_huge_page_size; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -2846,7 +2919,7 @@ void Java_org_rocksdb_Options_setMemtableHugePageSize( */ jlong Java_org_rocksdb_Options_softPendingCompactionBytesLimit( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->soft_pending_compaction_bytes_limit; } @@ -2858,7 +2931,7 @@ jlong Java_org_rocksdb_Options_softPendingCompactionBytesLimit( void Java_org_rocksdb_Options_setSoftPendingCompactionBytesLimit( JNIEnv*, jobject, jlong jhandle, jlong jsoft_pending_compaction_bytes_limit) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->soft_pending_compaction_bytes_limit = static_cast(jsoft_pending_compaction_bytes_limit); } @@ -2870,7 +2943,7 @@ void Java_org_rocksdb_Options_setSoftPendingCompactionBytesLimit( */ jlong Java_org_rocksdb_Options_hardPendingCompactionBytesLimit( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->hard_pending_compaction_bytes_limit; } @@ -2882,7 +2955,7 @@ jlong Java_org_rocksdb_Options_hardPendingCompactionBytesLimit( void Java_org_rocksdb_Options_setHardPendingCompactionBytesLimit( JNIEnv*, jobject, jlong jhandle, jlong jhard_pending_compaction_bytes_limit) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->hard_pending_compaction_bytes_limit = static_cast(jhard_pending_compaction_bytes_limit); } @@ -2894,7 +2967,7 @@ void Java_org_rocksdb_Options_setHardPendingCompactionBytesLimit( */ jint Java_org_rocksdb_Options_level0FileNumCompactionTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger; } @@ -2906,7 +2979,7 @@ jint Java_org_rocksdb_Options_level0FileNumCompactionTrigger( void Java_org_rocksdb_Options_setLevel0FileNumCompactionTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_file_num_compaction_trigger) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger = static_cast(jlevel0_file_num_compaction_trigger); } @@ -2918,7 +2991,7 @@ void Java_org_rocksdb_Options_setLevel0FileNumCompactionTrigger( */ jint Java_org_rocksdb_Options_level0SlowdownWritesTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_slowdown_writes_trigger; } @@ -2929,7 +3002,8 @@ jint Java_org_rocksdb_Options_level0SlowdownWritesTrigger( */ void Java_org_rocksdb_Options_setLevel0SlowdownWritesTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_slowdown_writes_trigger) { - reinterpret_cast(jhandle)->level0_slowdown_writes_trigger = + reinterpret_cast(jhandle) + ->level0_slowdown_writes_trigger = static_cast(jlevel0_slowdown_writes_trigger); } @@ -2940,7 +3014,7 @@ void Java_org_rocksdb_Options_setLevel0SlowdownWritesTrigger( */ jint Java_org_rocksdb_Options_level0StopWritesTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_stop_writes_trigger; } @@ -2951,7 +3025,8 @@ jint Java_org_rocksdb_Options_level0StopWritesTrigger( */ void Java_org_rocksdb_Options_setLevel0StopWritesTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_stop_writes_trigger) { - reinterpret_cast(jhandle)->level0_stop_writes_trigger = + reinterpret_cast(jhandle) + ->level0_stop_writes_trigger = static_cast(jlevel0_stop_writes_trigger); } @@ -2962,7 +3037,7 @@ void Java_org_rocksdb_Options_setLevel0StopWritesTrigger( */ jintArray Java_org_rocksdb_Options_maxBytesForLevelMultiplierAdditional( JNIEnv* env, jobject, jlong jhandle) { - auto mbflma = reinterpret_cast(jhandle) + auto mbflma = reinterpret_cast(jhandle) ->max_bytes_for_level_multiplier_additional; const size_t size = mbflma.size(); @@ -3009,7 +3084,7 @@ void Java_org_rocksdb_Options_setMaxBytesForLevelMultiplierAdditional( return; } - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->max_bytes_for_level_multiplier_additional.clear(); for (jsize i = 0; i < len; i++) { opt->max_bytes_for_level_multiplier_additional.push_back( @@ -3027,7 +3102,8 @@ void Java_org_rocksdb_Options_setMaxBytesForLevelMultiplierAdditional( */ jboolean Java_org_rocksdb_Options_paranoidFileChecks( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->paranoid_file_checks; + return reinterpret_cast(jhandle) + ->paranoid_file_checks; } /* @@ -3037,7 +3113,7 @@ jboolean Java_org_rocksdb_Options_paranoidFileChecks( */ void Java_org_rocksdb_Options_setParanoidFileChecks( JNIEnv*, jobject, jlong jhandle, jboolean jparanoid_file_checks) { - reinterpret_cast(jhandle)->paranoid_file_checks = + reinterpret_cast(jhandle)->paranoid_file_checks = static_cast(jparanoid_file_checks); } @@ -3048,9 +3124,9 @@ void Java_org_rocksdb_Options_setParanoidFileChecks( */ void Java_org_rocksdb_Options_setCompactionPriority( JNIEnv*, jobject, jlong jhandle, jbyte jcompaction_priority_value) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = reinterpret_cast(jhandle); opts->compaction_pri = - rocksdb::CompactionPriorityJni::toCppCompactionPriority( + ROCKSDB_NAMESPACE::CompactionPriorityJni::toCppCompactionPriority( jcompaction_priority_value); } @@ -3061,8 +3137,8 @@ void Java_org_rocksdb_Options_setCompactionPriority( */ jbyte Java_org_rocksdb_Options_compactionPriority( JNIEnv*, jobject, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); - return rocksdb::CompactionPriorityJni::toJavaCompactionPriority( + auto* opts = reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompactionPriorityJni::toJavaCompactionPriority( opts->compaction_pri); } @@ -3073,7 +3149,7 @@ jbyte Java_org_rocksdb_Options_compactionPriority( */ void Java_org_rocksdb_Options_setReportBgIoStats( JNIEnv*, jobject, jlong jhandle, jboolean jreport_bg_io_stats) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = reinterpret_cast(jhandle); opts->report_bg_io_stats = static_cast(jreport_bg_io_stats); } @@ -3084,7 +3160,7 @@ void Java_org_rocksdb_Options_setReportBgIoStats( */ jboolean Java_org_rocksdb_Options_reportBgIoStats( JNIEnv*, jobject, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = reinterpret_cast(jhandle); return static_cast(opts->report_bg_io_stats); } @@ -3095,7 +3171,7 @@ jboolean Java_org_rocksdb_Options_reportBgIoStats( */ void Java_org_rocksdb_Options_setTtl( JNIEnv*, jobject, jlong jhandle, jlong jttl) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = reinterpret_cast(jhandle); opts->ttl = static_cast(jttl); } @@ -3106,7 +3182,7 @@ void Java_org_rocksdb_Options_setTtl( */ jlong Java_org_rocksdb_Options_ttl( JNIEnv*, jobject, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = reinterpret_cast(jhandle); return static_cast(opts->ttl); } @@ -3118,9 +3194,10 @@ jlong Java_org_rocksdb_Options_ttl( void Java_org_rocksdb_Options_setCompactionOptionsUniversal( JNIEnv*, jobject, jlong jhandle, jlong jcompaction_options_universal_handle) { - auto* opts = reinterpret_cast(jhandle); - auto* opts_uni = reinterpret_cast( - jcompaction_options_universal_handle); + auto* opts = reinterpret_cast(jhandle); + auto* opts_uni = + reinterpret_cast( + jcompaction_options_universal_handle); opts->compaction_options_universal = *opts_uni; } @@ -3131,8 +3208,8 @@ void Java_org_rocksdb_Options_setCompactionOptionsUniversal( */ void Java_org_rocksdb_Options_setCompactionOptionsFIFO( JNIEnv*, jobject, jlong jhandle, jlong jcompaction_options_fifo_handle) { - auto* opts = reinterpret_cast(jhandle); - auto* opts_fifo = reinterpret_cast( + auto* opts = reinterpret_cast(jhandle); + auto* opts_fifo = reinterpret_cast( jcompaction_options_fifo_handle); opts->compaction_options_fifo = *opts_fifo; } @@ -3144,7 +3221,7 @@ void Java_org_rocksdb_Options_setCompactionOptionsFIFO( */ void Java_org_rocksdb_Options_setForceConsistencyChecks( JNIEnv*, jobject, jlong jhandle, jboolean jforce_consistency_checks) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = reinterpret_cast(jhandle); opts->force_consistency_checks = static_cast(jforce_consistency_checks); } @@ -3155,12 +3232,12 @@ void Java_org_rocksdb_Options_setForceConsistencyChecks( */ jboolean Java_org_rocksdb_Options_forceConsistencyChecks( JNIEnv*, jobject, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = reinterpret_cast(jhandle); return static_cast(opts->force_consistency_checks); } ////////////////////////////////////////////////////////////////////////////// -// rocksdb::ColumnFamilyOptions +// ROCKSDB_NAMESPACE::ColumnFamilyOptions /* * Class: org_rocksdb_ColumnFamilyOptions @@ -3169,7 +3246,7 @@ jboolean Java_org_rocksdb_Options_forceConsistencyChecks( */ jlong Java_org_rocksdb_ColumnFamilyOptions_newColumnFamilyOptions( JNIEnv*, jclass) { - auto* op = new rocksdb::ColumnFamilyOptions(); + auto* op = new ROCKSDB_NAMESPACE::ColumnFamilyOptions(); return reinterpret_cast(op); } @@ -3180,8 +3257,8 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_newColumnFamilyOptions( */ jlong Java_org_rocksdb_ColumnFamilyOptions_copyColumnFamilyOptions( JNIEnv*, jclass, jlong jhandle) { - auto new_opt = new rocksdb::ColumnFamilyOptions( - *(reinterpret_cast(jhandle))); + auto new_opt = new ROCKSDB_NAMESPACE::ColumnFamilyOptions( + *(reinterpret_cast(jhandle))); return reinterpret_cast(new_opt); } @@ -3192,8 +3269,8 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_copyColumnFamilyOptions( */ jlong Java_org_rocksdb_ColumnFamilyOptions_newColumnFamilyOptionsFromOptions( JNIEnv*, jclass, jlong joptions_handle) { - auto new_opt = new rocksdb::ColumnFamilyOptions( - *reinterpret_cast(joptions_handle)); + auto new_opt = new ROCKSDB_NAMESPACE::ColumnFamilyOptions( + *reinterpret_cast(joptions_handle)); return reinterpret_cast(new_opt); } @@ -3210,9 +3287,10 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_getColumnFamilyOptionsFromProps( return 0; } - auto* cf_options = new rocksdb::ColumnFamilyOptions(); - rocksdb::Status status = rocksdb::GetColumnFamilyOptionsFromString( - rocksdb::ColumnFamilyOptions(), opt_string, cf_options); + auto* cf_options = new ROCKSDB_NAMESPACE::ColumnFamilyOptions(); + ROCKSDB_NAMESPACE::Status status = + ROCKSDB_NAMESPACE::GetColumnFamilyOptionsFromString( + ROCKSDB_NAMESPACE::ColumnFamilyOptions(), opt_string, cf_options); env->ReleaseStringUTFChars(jopt_string, opt_string); @@ -3235,7 +3313,7 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_getColumnFamilyOptionsFromProps( */ void Java_org_rocksdb_ColumnFamilyOptions_disposeInternal( JNIEnv*, jobject, jlong handle) { - auto* cfo = reinterpret_cast(handle); + auto* cfo = reinterpret_cast(handle); assert(cfo != nullptr); delete cfo; } @@ -3247,7 +3325,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_disposeInternal( */ void Java_org_rocksdb_ColumnFamilyOptions_optimizeForSmallDb( JNIEnv*, jobject, jlong jhandle) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->OptimizeForSmallDb(); } @@ -3258,7 +3336,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_optimizeForSmallDb( */ void Java_org_rocksdb_ColumnFamilyOptions_optimizeForPointLookup( JNIEnv*, jobject, jlong jhandle, jlong block_cache_size_mb) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->OptimizeForPointLookup(block_cache_size_mb); } @@ -3269,7 +3347,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_optimizeForPointLookup( */ void Java_org_rocksdb_ColumnFamilyOptions_optimizeLevelStyleCompaction( JNIEnv*, jobject, jlong jhandle, jlong memtable_memory_budget) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->OptimizeLevelStyleCompaction(memtable_memory_budget); } @@ -3280,7 +3358,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_optimizeLevelStyleCompaction( */ void Java_org_rocksdb_ColumnFamilyOptions_optimizeUniversalStyleCompaction( JNIEnv*, jobject, jlong jhandle, jlong memtable_memory_budget) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->OptimizeUniversalStyleCompaction(memtable_memory_budget); } @@ -3293,12 +3371,12 @@ void Java_org_rocksdb_ColumnFamilyOptions_setComparatorHandle__JI( JNIEnv*, jobject, jlong jhandle, jint builtinComparator) { switch (builtinComparator) { case 1: - reinterpret_cast(jhandle)->comparator = - rocksdb::ReverseBytewiseComparator(); + reinterpret_cast(jhandle) + ->comparator = ROCKSDB_NAMESPACE::ReverseBytewiseComparator(); break; default: - reinterpret_cast(jhandle)->comparator = - rocksdb::BytewiseComparator(); + reinterpret_cast(jhandle) + ->comparator = ROCKSDB_NAMESPACE::BytewiseComparator(); break; } } @@ -3311,20 +3389,22 @@ void Java_org_rocksdb_ColumnFamilyOptions_setComparatorHandle__JI( void Java_org_rocksdb_ColumnFamilyOptions_setComparatorHandle__JJB( JNIEnv*, jobject, jlong jopt_handle, jlong jcomparator_handle, jbyte jcomparator_type) { - rocksdb::Comparator* comparator = nullptr; + ROCKSDB_NAMESPACE::Comparator* comparator = nullptr; switch (jcomparator_type) { // JAVA_COMPARATOR case 0x0: - comparator = - reinterpret_cast(jcomparator_handle); + comparator = reinterpret_cast( + jcomparator_handle); break; // JAVA_NATIVE_COMPARATOR_WRAPPER case 0x1: - comparator = reinterpret_cast(jcomparator_handle); + comparator = + reinterpret_cast(jcomparator_handle); break; } - auto* opt = reinterpret_cast(jopt_handle); + auto* opt = + reinterpret_cast(jopt_handle); opt->comparator = comparator; } @@ -3335,7 +3415,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setComparatorHandle__JJB( */ void Java_org_rocksdb_ColumnFamilyOptions_setMergeOperatorName( JNIEnv* env, jobject, jlong jhandle, jstring jop_name) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); const char* op_name = env->GetStringUTFChars(jop_name, nullptr); if (op_name == nullptr) { // exception thrown: OutOfMemoryError @@ -3343,7 +3424,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMergeOperatorName( } options->merge_operator = - rocksdb::MergeOperators::CreateFromStringId(op_name); + ROCKSDB_NAMESPACE::MergeOperators::CreateFromStringId(op_name); env->ReleaseStringUTFChars(jop_name, op_name); } @@ -3354,8 +3435,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMergeOperatorName( */ void Java_org_rocksdb_ColumnFamilyOptions_setMergeOperator( JNIEnv*, jobject, jlong jhandle, jlong mergeOperatorHandle) { - reinterpret_cast(jhandle)->merge_operator = - *(reinterpret_cast*>( + reinterpret_cast(jhandle) + ->merge_operator = + *(reinterpret_cast*>( mergeOperatorHandle)); } @@ -3366,9 +3448,10 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMergeOperator( */ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionFilterHandle( JNIEnv*, jobject, jlong jopt_handle, jlong jcompactionfilter_handle) { - reinterpret_cast(jopt_handle) + reinterpret_cast(jopt_handle) ->compaction_filter = - reinterpret_cast(jcompactionfilter_handle); + reinterpret_cast( + jcompactionfilter_handle); } /* @@ -3379,10 +3462,10 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionFilterHandle( void Java_org_rocksdb_ColumnFamilyOptions_setCompactionFilterFactoryHandle( JNIEnv*, jobject, jlong jopt_handle, jlong jcompactionfilterfactory_handle) { - auto* cff_factory = - reinterpret_cast*>( - jcompactionfilterfactory_handle); - reinterpret_cast(jopt_handle) + auto* cff_factory = reinterpret_cast< + std::shared_ptr*>( + jcompactionfilterfactory_handle); + reinterpret_cast(jopt_handle) ->compaction_filter_factory = *cff_factory; } @@ -3393,12 +3476,13 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionFilterFactoryHandle( */ void Java_org_rocksdb_ColumnFamilyOptions_setWriteBufferSize( JNIEnv* env, jobject, jlong jhandle, jlong jwrite_buffer_size) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(jwrite_buffer_size); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + jwrite_buffer_size); if (s.ok()) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->write_buffer_size = jwrite_buffer_size; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -3409,7 +3493,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setWriteBufferSize( */ jlong Java_org_rocksdb_ColumnFamilyOptions_writeBufferSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->write_buffer_size; } @@ -3420,7 +3504,7 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_writeBufferSize( */ void Java_org_rocksdb_ColumnFamilyOptions_setMaxWriteBufferNumber( JNIEnv*, jobject, jlong jhandle, jint jmax_write_buffer_number) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->max_write_buffer_number = jmax_write_buffer_number; } @@ -3431,7 +3515,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxWriteBufferNumber( */ jint Java_org_rocksdb_ColumnFamilyOptions_maxWriteBufferNumber( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_write_buffer_number; } @@ -3441,9 +3525,10 @@ jint Java_org_rocksdb_ColumnFamilyOptions_maxWriteBufferNumber( */ void Java_org_rocksdb_ColumnFamilyOptions_setMemTableFactory( JNIEnv*, jobject, jlong jhandle, jlong jfactory_handle) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->memtable_factory.reset( - reinterpret_cast(jfactory_handle)); + reinterpret_cast( + jfactory_handle)); } /* @@ -3453,8 +3538,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMemTableFactory( */ jstring Java_org_rocksdb_ColumnFamilyOptions_memTableFactoryName( JNIEnv* env, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - rocksdb::MemTableRepFactory* tf = opt->memtable_factory.get(); + auto* opt = + reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::MemTableRepFactory* tf = opt->memtable_factory.get(); // Should never be nullptr. // Default memtable factory is SkipListFactory @@ -3474,9 +3560,9 @@ jstring Java_org_rocksdb_ColumnFamilyOptions_memTableFactoryName( */ void Java_org_rocksdb_ColumnFamilyOptions_useFixedLengthPrefixExtractor( JNIEnv*, jobject, jlong jhandle, jint jprefix_length) { - reinterpret_cast(jhandle) - ->prefix_extractor.reset( - rocksdb::NewFixedPrefixTransform(static_cast(jprefix_length))); + reinterpret_cast(jhandle) + ->prefix_extractor.reset(ROCKSDB_NAMESPACE::NewFixedPrefixTransform( + static_cast(jprefix_length))); } /* @@ -3485,9 +3571,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_useFixedLengthPrefixExtractor( */ void Java_org_rocksdb_ColumnFamilyOptions_useCappedPrefixExtractor( JNIEnv*, jobject, jlong jhandle, jint jprefix_length) { - reinterpret_cast(jhandle) - ->prefix_extractor.reset( - rocksdb::NewCappedPrefixTransform(static_cast(jprefix_length))); + reinterpret_cast(jhandle) + ->prefix_extractor.reset(ROCKSDB_NAMESPACE::NewCappedPrefixTransform( + static_cast(jprefix_length))); } /* @@ -3496,8 +3582,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_useCappedPrefixExtractor( */ void Java_org_rocksdb_ColumnFamilyOptions_setTableFactory( JNIEnv*, jobject, jlong jhandle, jlong jfactory_handle) { - reinterpret_cast(jhandle)->table_factory.reset( - reinterpret_cast(jfactory_handle)); + reinterpret_cast(jhandle) + ->table_factory.reset( + reinterpret_cast(jfactory_handle)); } /* @@ -3506,8 +3593,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setTableFactory( */ jstring Java_org_rocksdb_ColumnFamilyOptions_tableFactoryName( JNIEnv* env, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - rocksdb::TableFactory* tf = opt->table_factory.get(); + auto* opt = + reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::TableFactory* tf = opt->table_factory.get(); // Should never be nullptr. // Default memtable factory is SkipListFactory @@ -3523,7 +3611,7 @@ jstring Java_org_rocksdb_ColumnFamilyOptions_tableFactoryName( */ jint Java_org_rocksdb_ColumnFamilyOptions_minWriteBufferNumberToMerge( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->min_write_buffer_number_to_merge; } @@ -3534,7 +3622,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_minWriteBufferNumberToMerge( */ void Java_org_rocksdb_ColumnFamilyOptions_setMinWriteBufferNumberToMerge( JNIEnv*, jobject, jlong jhandle, jint jmin_write_buffer_number_to_merge) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->min_write_buffer_number_to_merge = static_cast(jmin_write_buffer_number_to_merge); } @@ -3546,7 +3634,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMinWriteBufferNumberToMerge( */ jint Java_org_rocksdb_ColumnFamilyOptions_maxWriteBufferNumberToMaintain( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_write_buffer_number_to_maintain; } @@ -3558,7 +3646,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_maxWriteBufferNumberToMaintain( void Java_org_rocksdb_ColumnFamilyOptions_setMaxWriteBufferNumberToMaintain( JNIEnv*, jobject, jlong jhandle, jint jmax_write_buffer_number_to_maintain) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->max_write_buffer_number_to_maintain = static_cast(jmax_write_buffer_number_to_maintain); } @@ -3570,9 +3658,11 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxWriteBufferNumberToMaintain( */ void Java_org_rocksdb_ColumnFamilyOptions_setCompressionType( JNIEnv*, jobject, jlong jhandle, jbyte jcompression_type_value) { - auto* cf_opts = reinterpret_cast(jhandle); - cf_opts->compression = rocksdb::CompressionTypeJni::toCppCompressionType( - jcompression_type_value); + auto* cf_opts = + reinterpret_cast(jhandle); + cf_opts->compression = + ROCKSDB_NAMESPACE::CompressionTypeJni::toCppCompressionType( + jcompression_type_value); } /* @@ -3582,8 +3672,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompressionType( */ jbyte Java_org_rocksdb_ColumnFamilyOptions_compressionType( JNIEnv*, jobject, jlong jhandle) { - auto* cf_opts = reinterpret_cast(jhandle); - return rocksdb::CompressionTypeJni::toJavaCompressionType( + auto* cf_opts = + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( cf_opts->compression); } @@ -3594,7 +3685,8 @@ jbyte Java_org_rocksdb_ColumnFamilyOptions_compressionType( */ void Java_org_rocksdb_ColumnFamilyOptions_setCompressionPerLevel( JNIEnv* env, jobject, jlong jhandle, jbyteArray jcompressionLevels) { - auto* options = reinterpret_cast(jhandle); + auto* options = + reinterpret_cast(jhandle); auto uptr_compression_levels = rocksdb_compression_vector_helper(env, jcompressionLevels); if (!uptr_compression_levels) { @@ -3611,7 +3703,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompressionPerLevel( */ jbyteArray Java_org_rocksdb_ColumnFamilyOptions_compressionPerLevel( JNIEnv* env, jobject, jlong jhandle) { - auto* cf_options = reinterpret_cast(jhandle); + auto* cf_options = + reinterpret_cast(jhandle); return rocksdb_compression_list_helper(env, cf_options->compression_per_level); } @@ -3623,9 +3716,10 @@ jbyteArray Java_org_rocksdb_ColumnFamilyOptions_compressionPerLevel( */ void Java_org_rocksdb_ColumnFamilyOptions_setBottommostCompressionType( JNIEnv*, jobject, jlong jhandle, jbyte jcompression_type_value) { - auto* cf_options = reinterpret_cast(jhandle); + auto* cf_options = + reinterpret_cast(jhandle); cf_options->bottommost_compression = - rocksdb::CompressionTypeJni::toCppCompressionType( + ROCKSDB_NAMESPACE::CompressionTypeJni::toCppCompressionType( jcompression_type_value); } @@ -3636,8 +3730,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setBottommostCompressionType( */ jbyte Java_org_rocksdb_ColumnFamilyOptions_bottommostCompressionType( JNIEnv*, jobject, jlong jhandle) { - auto* cf_options = reinterpret_cast(jhandle); - return rocksdb::CompressionTypeJni::toJavaCompressionType( + auto* cf_options = + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( cf_options->bottommost_compression); } /* @@ -3648,9 +3743,10 @@ jbyte Java_org_rocksdb_ColumnFamilyOptions_bottommostCompressionType( void Java_org_rocksdb_ColumnFamilyOptions_setBottommostCompressionOptions( JNIEnv*, jobject, jlong jhandle, jlong jbottommost_compression_options_handle) { - auto* cf_options = reinterpret_cast(jhandle); + auto* cf_options = + reinterpret_cast(jhandle); auto* bottommost_compression_options = - reinterpret_cast( + reinterpret_cast( jbottommost_compression_options_handle); cf_options->bottommost_compression_opts = *bottommost_compression_options; } @@ -3662,9 +3758,11 @@ void Java_org_rocksdb_ColumnFamilyOptions_setBottommostCompressionOptions( */ void Java_org_rocksdb_ColumnFamilyOptions_setCompressionOptions( JNIEnv*, jobject, jlong jhandle, jlong jcompression_options_handle) { - auto* cf_options = reinterpret_cast(jhandle); - auto* compression_options = reinterpret_cast( - jcompression_options_handle); + auto* cf_options = + reinterpret_cast(jhandle); + auto* compression_options = + reinterpret_cast( + jcompression_options_handle); cf_options->compression_opts = *compression_options; } @@ -3675,9 +3773,11 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompressionOptions( */ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionStyle( JNIEnv*, jobject, jlong jhandle, jbyte jcompaction_style) { - auto* cf_options = reinterpret_cast(jhandle); + auto* cf_options = + reinterpret_cast(jhandle); cf_options->compaction_style = - rocksdb::CompactionStyleJni::toCppCompactionStyle(jcompaction_style); + ROCKSDB_NAMESPACE::CompactionStyleJni::toCppCompactionStyle( + jcompaction_style); } /* @@ -3687,8 +3787,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionStyle( */ jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionStyle( JNIEnv*, jobject, jlong jhandle) { - auto* cf_options = reinterpret_cast(jhandle); - return rocksdb::CompactionStyleJni::toJavaCompactionStyle( + auto* cf_options = + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompactionStyleJni::toJavaCompactionStyle( cf_options->compaction_style); } @@ -3699,7 +3800,7 @@ jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionStyle( */ void Java_org_rocksdb_ColumnFamilyOptions_setMaxTableFilesSizeFIFO( JNIEnv*, jobject, jlong jhandle, jlong jmax_table_files_size) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->compaction_options_fifo.max_table_files_size = static_cast(jmax_table_files_size); } @@ -3711,7 +3812,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxTableFilesSizeFIFO( */ jlong Java_org_rocksdb_ColumnFamilyOptions_maxTableFilesSizeFIFO( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->compaction_options_fifo.max_table_files_size; } @@ -3722,7 +3823,8 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_maxTableFilesSizeFIFO( */ jint Java_org_rocksdb_ColumnFamilyOptions_numLevels( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->num_levels; + return reinterpret_cast(jhandle) + ->num_levels; } /* @@ -3732,8 +3834,8 @@ jint Java_org_rocksdb_ColumnFamilyOptions_numLevels( */ void Java_org_rocksdb_ColumnFamilyOptions_setNumLevels( JNIEnv*, jobject, jlong jhandle, jint jnum_levels) { - reinterpret_cast(jhandle)->num_levels = - static_cast(jnum_levels); + reinterpret_cast(jhandle) + ->num_levels = static_cast(jnum_levels); } /* @@ -3743,7 +3845,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setNumLevels( */ jint Java_org_rocksdb_ColumnFamilyOptions_levelZeroFileNumCompactionTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger; } @@ -3755,7 +3857,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_levelZeroFileNumCompactionTrigger( void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroFileNumCompactionTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_file_num_compaction_trigger) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger = static_cast(jlevel0_file_num_compaction_trigger); } @@ -3767,7 +3869,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroFileNumCompactionTrigger( */ jint Java_org_rocksdb_ColumnFamilyOptions_levelZeroSlowdownWritesTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_slowdown_writes_trigger; } @@ -3778,7 +3880,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_levelZeroSlowdownWritesTrigger( */ void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroSlowdownWritesTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_slowdown_writes_trigger) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->level0_slowdown_writes_trigger = static_cast(jlevel0_slowdown_writes_trigger); } @@ -3790,7 +3892,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroSlowdownWritesTrigger( */ jint Java_org_rocksdb_ColumnFamilyOptions_levelZeroStopWritesTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_stop_writes_trigger; } @@ -3801,7 +3903,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_levelZeroStopWritesTrigger( */ void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroStopWritesTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_stop_writes_trigger) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->level0_stop_writes_trigger = static_cast(jlevel0_stop_writes_trigger); } @@ -3813,7 +3915,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroStopWritesTrigger( */ jlong Java_org_rocksdb_ColumnFamilyOptions_targetFileSizeBase( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->target_file_size_base; } @@ -3824,7 +3926,7 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_targetFileSizeBase( */ void Java_org_rocksdb_ColumnFamilyOptions_setTargetFileSizeBase( JNIEnv*, jobject, jlong jhandle, jlong jtarget_file_size_base) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->target_file_size_base = static_cast(jtarget_file_size_base); } @@ -3835,7 +3937,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setTargetFileSizeBase( */ jint Java_org_rocksdb_ColumnFamilyOptions_targetFileSizeMultiplier( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->target_file_size_multiplier; } @@ -3846,7 +3948,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_targetFileSizeMultiplier( */ void Java_org_rocksdb_ColumnFamilyOptions_setTargetFileSizeMultiplier( JNIEnv*, jobject, jlong jhandle, jint jtarget_file_size_multiplier) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->target_file_size_multiplier = static_cast(jtarget_file_size_multiplier); } @@ -3858,7 +3960,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setTargetFileSizeMultiplier( */ jlong Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelBase( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_bytes_for_level_base; } @@ -3869,7 +3971,7 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelBase( */ void Java_org_rocksdb_ColumnFamilyOptions_setMaxBytesForLevelBase( JNIEnv*, jobject, jlong jhandle, jlong jmax_bytes_for_level_base) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->max_bytes_for_level_base = static_cast(jmax_bytes_for_level_base); } @@ -3881,7 +3983,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxBytesForLevelBase( */ jboolean Java_org_rocksdb_ColumnFamilyOptions_levelCompactionDynamicLevelBytes( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level_compaction_dynamic_level_bytes; } @@ -3892,7 +3994,7 @@ jboolean Java_org_rocksdb_ColumnFamilyOptions_levelCompactionDynamicLevelBytes( */ void Java_org_rocksdb_ColumnFamilyOptions_setLevelCompactionDynamicLevelBytes( JNIEnv*, jobject, jlong jhandle, jboolean jenable_dynamic_level_bytes) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->level_compaction_dynamic_level_bytes = (jenable_dynamic_level_bytes); } @@ -3903,7 +4005,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setLevelCompactionDynamicLevelBytes( */ jdouble Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelMultiplier( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_bytes_for_level_multiplier; } @@ -3914,7 +4016,7 @@ jdouble Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelMultiplier( */ void Java_org_rocksdb_ColumnFamilyOptions_setMaxBytesForLevelMultiplier( JNIEnv*, jobject, jlong jhandle, jdouble jmax_bytes_for_level_multiplier) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->max_bytes_for_level_multiplier = static_cast(jmax_bytes_for_level_multiplier); } @@ -3927,7 +4029,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxBytesForLevelMultiplier( jlong Java_org_rocksdb_ColumnFamilyOptions_maxCompactionBytes( JNIEnv*, jobject, jlong jhandle) { return static_cast( - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->max_compaction_bytes); } @@ -3938,7 +4040,7 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_maxCompactionBytes( */ void Java_org_rocksdb_ColumnFamilyOptions_setMaxCompactionBytes( JNIEnv*, jobject, jlong jhandle, jlong jmax_compaction_bytes) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->max_compaction_bytes = static_cast(jmax_compaction_bytes); } @@ -3949,7 +4051,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxCompactionBytes( */ jlong Java_org_rocksdb_ColumnFamilyOptions_arenaBlockSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->arena_block_size; } @@ -3960,12 +4062,13 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_arenaBlockSize( */ void Java_org_rocksdb_ColumnFamilyOptions_setArenaBlockSize( JNIEnv* env, jobject, jlong jhandle, jlong jarena_block_size) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(jarena_block_size); + auto s = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(jarena_block_size); if (s.ok()) { - reinterpret_cast(jhandle)->arena_block_size = - jarena_block_size; + reinterpret_cast(jhandle) + ->arena_block_size = jarena_block_size; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -3976,7 +4079,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setArenaBlockSize( */ jboolean Java_org_rocksdb_ColumnFamilyOptions_disableAutoCompactions( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->disable_auto_compactions; } @@ -3987,7 +4090,7 @@ jboolean Java_org_rocksdb_ColumnFamilyOptions_disableAutoCompactions( */ void Java_org_rocksdb_ColumnFamilyOptions_setDisableAutoCompactions( JNIEnv*, jobject, jlong jhandle, jboolean jdisable_auto_compactions) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->disable_auto_compactions = static_cast(jdisable_auto_compactions); } @@ -3998,7 +4101,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setDisableAutoCompactions( */ jlong Java_org_rocksdb_ColumnFamilyOptions_maxSequentialSkipInIterations( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_sequential_skip_in_iterations; } @@ -4010,7 +4113,7 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_maxSequentialSkipInIterations( void Java_org_rocksdb_ColumnFamilyOptions_setMaxSequentialSkipInIterations( JNIEnv*, jobject, jlong jhandle, jlong jmax_sequential_skip_in_iterations) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->max_sequential_skip_in_iterations = static_cast(jmax_sequential_skip_in_iterations); } @@ -4022,7 +4125,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxSequentialSkipInIterations( */ jboolean Java_org_rocksdb_ColumnFamilyOptions_inplaceUpdateSupport( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->inplace_update_support; } @@ -4033,7 +4136,7 @@ jboolean Java_org_rocksdb_ColumnFamilyOptions_inplaceUpdateSupport( */ void Java_org_rocksdb_ColumnFamilyOptions_setInplaceUpdateSupport( JNIEnv*, jobject, jlong jhandle, jboolean jinplace_update_support) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->inplace_update_support = static_cast(jinplace_update_support); } @@ -4044,7 +4147,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setInplaceUpdateSupport( */ jlong Java_org_rocksdb_ColumnFamilyOptions_inplaceUpdateNumLocks( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->inplace_update_num_locks; } @@ -4055,13 +4158,13 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_inplaceUpdateNumLocks( */ void Java_org_rocksdb_ColumnFamilyOptions_setInplaceUpdateNumLocks( JNIEnv* env, jobject, jlong jhandle, jlong jinplace_update_num_locks) { - auto s = - rocksdb::JniUtil::check_if_jlong_fits_size_t(jinplace_update_num_locks); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + jinplace_update_num_locks); if (s.ok()) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->inplace_update_num_locks = jinplace_update_num_locks; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -4072,7 +4175,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setInplaceUpdateNumLocks( */ jdouble Java_org_rocksdb_ColumnFamilyOptions_memtablePrefixBloomSizeRatio( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->memtable_prefix_bloom_size_ratio; } @@ -4084,7 +4187,7 @@ jdouble Java_org_rocksdb_ColumnFamilyOptions_memtablePrefixBloomSizeRatio( void Java_org_rocksdb_ColumnFamilyOptions_setMemtablePrefixBloomSizeRatio( JNIEnv*, jobject, jlong jhandle, jdouble jmemtable_prefix_bloom_size_ratio) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->memtable_prefix_bloom_size_ratio = static_cast(jmemtable_prefix_bloom_size_ratio); } @@ -4096,7 +4199,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMemtablePrefixBloomSizeRatio( */ jint Java_org_rocksdb_ColumnFamilyOptions_bloomLocality( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->bloom_locality; } @@ -4107,8 +4210,8 @@ jint Java_org_rocksdb_ColumnFamilyOptions_bloomLocality( */ void Java_org_rocksdb_ColumnFamilyOptions_setBloomLocality( JNIEnv*, jobject, jlong jhandle, jint jbloom_locality) { - reinterpret_cast(jhandle)->bloom_locality = - static_cast(jbloom_locality); + reinterpret_cast(jhandle) + ->bloom_locality = static_cast(jbloom_locality); } /* @@ -4118,7 +4221,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setBloomLocality( */ jlong Java_org_rocksdb_ColumnFamilyOptions_maxSuccessiveMerges( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_successive_merges; } @@ -4129,13 +4232,13 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_maxSuccessiveMerges( */ void Java_org_rocksdb_ColumnFamilyOptions_setMaxSuccessiveMerges( JNIEnv* env, jobject, jlong jhandle, jlong jmax_successive_merges) { - auto s = - rocksdb::JniUtil::check_if_jlong_fits_size_t(jmax_successive_merges); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + jmax_successive_merges); if (s.ok()) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->max_successive_merges = jmax_successive_merges; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -4146,7 +4249,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxSuccessiveMerges( */ jboolean Java_org_rocksdb_ColumnFamilyOptions_optimizeFiltersForHits( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->optimize_filters_for_hits; } @@ -4157,7 +4260,7 @@ jboolean Java_org_rocksdb_ColumnFamilyOptions_optimizeFiltersForHits( */ void Java_org_rocksdb_ColumnFamilyOptions_setOptimizeFiltersForHits( JNIEnv*, jobject, jlong jhandle, jboolean joptimize_filters_for_hits) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->optimize_filters_for_hits = static_cast(joptimize_filters_for_hits); } @@ -4169,7 +4272,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setOptimizeFiltersForHits( */ jlong Java_org_rocksdb_ColumnFamilyOptions_memtableHugePageSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->memtable_huge_page_size; } @@ -4180,13 +4283,13 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_memtableHugePageSize( */ void Java_org_rocksdb_ColumnFamilyOptions_setMemtableHugePageSize( JNIEnv* env, jobject, jlong jhandle, jlong jmemtable_huge_page_size) { - auto s = - rocksdb::JniUtil::check_if_jlong_fits_size_t(jmemtable_huge_page_size); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + jmemtable_huge_page_size); if (s.ok()) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->memtable_huge_page_size = jmemtable_huge_page_size; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -4197,7 +4300,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMemtableHugePageSize( */ jlong Java_org_rocksdb_ColumnFamilyOptions_softPendingCompactionBytesLimit( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->soft_pending_compaction_bytes_limit; } @@ -4209,7 +4312,7 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_softPendingCompactionBytesLimit( void Java_org_rocksdb_ColumnFamilyOptions_setSoftPendingCompactionBytesLimit( JNIEnv*, jobject, jlong jhandle, jlong jsoft_pending_compaction_bytes_limit) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->soft_pending_compaction_bytes_limit = static_cast(jsoft_pending_compaction_bytes_limit); } @@ -4221,7 +4324,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setSoftPendingCompactionBytesLimit( */ jlong Java_org_rocksdb_ColumnFamilyOptions_hardPendingCompactionBytesLimit( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->hard_pending_compaction_bytes_limit; } @@ -4233,7 +4336,7 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_hardPendingCompactionBytesLimit( void Java_org_rocksdb_ColumnFamilyOptions_setHardPendingCompactionBytesLimit( JNIEnv*, jobject, jlong jhandle, jlong jhard_pending_compaction_bytes_limit) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->hard_pending_compaction_bytes_limit = static_cast(jhard_pending_compaction_bytes_limit); } @@ -4245,7 +4348,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setHardPendingCompactionBytesLimit( */ jint Java_org_rocksdb_ColumnFamilyOptions_level0FileNumCompactionTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger; } @@ -4257,7 +4360,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_level0FileNumCompactionTrigger( void Java_org_rocksdb_ColumnFamilyOptions_setLevel0FileNumCompactionTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_file_num_compaction_trigger) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger = static_cast(jlevel0_file_num_compaction_trigger); } @@ -4269,7 +4372,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setLevel0FileNumCompactionTrigger( */ jint Java_org_rocksdb_ColumnFamilyOptions_level0SlowdownWritesTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_slowdown_writes_trigger; } @@ -4280,7 +4383,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_level0SlowdownWritesTrigger( */ void Java_org_rocksdb_ColumnFamilyOptions_setLevel0SlowdownWritesTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_slowdown_writes_trigger) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->level0_slowdown_writes_trigger = static_cast(jlevel0_slowdown_writes_trigger); } @@ -4292,7 +4395,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setLevel0SlowdownWritesTrigger( */ jint Java_org_rocksdb_ColumnFamilyOptions_level0StopWritesTrigger( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->level0_stop_writes_trigger; } @@ -4303,7 +4406,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_level0StopWritesTrigger( */ void Java_org_rocksdb_ColumnFamilyOptions_setLevel0StopWritesTrigger( JNIEnv*, jobject, jlong jhandle, jint jlevel0_stop_writes_trigger) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->level0_stop_writes_trigger = static_cast(jlevel0_stop_writes_trigger); } @@ -4315,8 +4418,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setLevel0StopWritesTrigger( */ jintArray Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelMultiplierAdditional( JNIEnv* env, jobject, jlong jhandle) { - auto mbflma = reinterpret_cast(jhandle) - ->max_bytes_for_level_multiplier_additional; + auto mbflma = + reinterpret_cast(jhandle) + ->max_bytes_for_level_multiplier_additional; const size_t size = mbflma.size(); @@ -4361,7 +4465,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxBytesForLevelMultiplierAdditiona return; } - auto* cf_opt = reinterpret_cast(jhandle); + auto* cf_opt = + reinterpret_cast(jhandle); cf_opt->max_bytes_for_level_multiplier_additional.clear(); for (jsize i = 0; i < len; i++) { cf_opt->max_bytes_for_level_multiplier_additional.push_back( @@ -4379,7 +4484,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxBytesForLevelMultiplierAdditiona */ jboolean Java_org_rocksdb_ColumnFamilyOptions_paranoidFileChecks( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->paranoid_file_checks; } @@ -4390,7 +4495,7 @@ jboolean Java_org_rocksdb_ColumnFamilyOptions_paranoidFileChecks( */ void Java_org_rocksdb_ColumnFamilyOptions_setParanoidFileChecks( JNIEnv*, jobject, jlong jhandle, jboolean jparanoid_file_checks) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->paranoid_file_checks = static_cast(jparanoid_file_checks); } @@ -4401,9 +4506,10 @@ void Java_org_rocksdb_ColumnFamilyOptions_setParanoidFileChecks( */ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionPriority( JNIEnv*, jobject, jlong jhandle, jbyte jcompaction_priority_value) { - auto* cf_opts = reinterpret_cast(jhandle); + auto* cf_opts = + reinterpret_cast(jhandle); cf_opts->compaction_pri = - rocksdb::CompactionPriorityJni::toCppCompactionPriority( + ROCKSDB_NAMESPACE::CompactionPriorityJni::toCppCompactionPriority( jcompaction_priority_value); } @@ -4414,8 +4520,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionPriority( */ jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionPriority( JNIEnv*, jobject, jlong jhandle) { - auto* cf_opts = reinterpret_cast(jhandle); - return rocksdb::CompactionPriorityJni::toJavaCompactionPriority( + auto* cf_opts = + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::CompactionPriorityJni::toJavaCompactionPriority( cf_opts->compaction_pri); } @@ -4426,7 +4533,8 @@ jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionPriority( */ void Java_org_rocksdb_ColumnFamilyOptions_setReportBgIoStats( JNIEnv*, jobject, jlong jhandle, jboolean jreport_bg_io_stats) { - auto* cf_opts = reinterpret_cast(jhandle); + auto* cf_opts = + reinterpret_cast(jhandle); cf_opts->report_bg_io_stats = static_cast(jreport_bg_io_stats); } @@ -4437,7 +4545,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setReportBgIoStats( */ jboolean Java_org_rocksdb_ColumnFamilyOptions_reportBgIoStats( JNIEnv*, jobject, jlong jhandle) { - auto* cf_opts = reinterpret_cast(jhandle); + auto* cf_opts = + reinterpret_cast(jhandle); return static_cast(cf_opts->report_bg_io_stats); } @@ -4448,7 +4557,8 @@ jboolean Java_org_rocksdb_ColumnFamilyOptions_reportBgIoStats( */ void Java_org_rocksdb_ColumnFamilyOptions_setTtl( JNIEnv*, jobject, jlong jhandle, jlong jttl) { - auto* cf_opts = reinterpret_cast(jhandle); + auto* cf_opts = + reinterpret_cast(jhandle); cf_opts->ttl = static_cast(jttl); } @@ -4459,7 +4569,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setTtl( */ JNIEXPORT jlong JNICALL Java_org_rocksdb_ColumnFamilyOptions_ttl( JNIEnv*, jobject, jlong jhandle) { - auto* cf_opts = reinterpret_cast(jhandle); + auto* cf_opts = + reinterpret_cast(jhandle); return static_cast(cf_opts->ttl); } @@ -4471,9 +4582,11 @@ JNIEXPORT jlong JNICALL Java_org_rocksdb_ColumnFamilyOptions_ttl( void Java_org_rocksdb_ColumnFamilyOptions_setCompactionOptionsUniversal( JNIEnv*, jobject, jlong jhandle, jlong jcompaction_options_universal_handle) { - auto* cf_opts = reinterpret_cast(jhandle); - auto* opts_uni = reinterpret_cast( - jcompaction_options_universal_handle); + auto* cf_opts = + reinterpret_cast(jhandle); + auto* opts_uni = + reinterpret_cast( + jcompaction_options_universal_handle); cf_opts->compaction_options_universal = *opts_uni; } @@ -4484,8 +4597,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionOptionsUniversal( */ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionOptionsFIFO( JNIEnv*, jobject, jlong jhandle, jlong jcompaction_options_fifo_handle) { - auto* cf_opts = reinterpret_cast(jhandle); - auto* opts_fifo = reinterpret_cast( + auto* cf_opts = + reinterpret_cast(jhandle); + auto* opts_fifo = reinterpret_cast( jcompaction_options_fifo_handle); cf_opts->compaction_options_fifo = *opts_fifo; } @@ -4497,7 +4611,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionOptionsFIFO( */ void Java_org_rocksdb_ColumnFamilyOptions_setForceConsistencyChecks( JNIEnv*, jobject, jlong jhandle, jboolean jforce_consistency_checks) { - auto* cf_opts = reinterpret_cast(jhandle); + auto* cf_opts = + reinterpret_cast(jhandle); cf_opts->force_consistency_checks = static_cast(jforce_consistency_checks); } @@ -4509,12 +4624,13 @@ void Java_org_rocksdb_ColumnFamilyOptions_setForceConsistencyChecks( */ jboolean Java_org_rocksdb_ColumnFamilyOptions_forceConsistencyChecks( JNIEnv*, jobject, jlong jhandle) { - auto* cf_opts = reinterpret_cast(jhandle); + auto* cf_opts = + reinterpret_cast(jhandle); return static_cast(cf_opts->force_consistency_checks); } ///////////////////////////////////////////////////////////////////// -// rocksdb::DBOptions +// ROCKSDB_NAMESPACE::DBOptions /* * Class: org_rocksdb_DBOptions @@ -4523,7 +4639,7 @@ jboolean Java_org_rocksdb_ColumnFamilyOptions_forceConsistencyChecks( */ jlong Java_org_rocksdb_DBOptions_newDBOptions( JNIEnv*, jclass) { - auto* dbop = new rocksdb::DBOptions(); + auto* dbop = new ROCKSDB_NAMESPACE::DBOptions(); return reinterpret_cast(dbop); } @@ -4534,8 +4650,8 @@ jlong Java_org_rocksdb_DBOptions_newDBOptions( */ jlong Java_org_rocksdb_DBOptions_copyDBOptions( JNIEnv*, jclass, jlong jhandle) { - auto new_opt = - new rocksdb::DBOptions(*(reinterpret_cast(jhandle))); + auto new_opt = new ROCKSDB_NAMESPACE::DBOptions( + *(reinterpret_cast(jhandle))); return reinterpret_cast(new_opt); } @@ -4546,8 +4662,8 @@ jlong Java_org_rocksdb_DBOptions_copyDBOptions( */ jlong Java_org_rocksdb_DBOptions_newDBOptionsFromOptions( JNIEnv*, jclass, jlong joptions_handle) { - auto new_opt = - new rocksdb::DBOptions(*reinterpret_cast(joptions_handle)); + auto new_opt = new ROCKSDB_NAMESPACE::DBOptions( + *reinterpret_cast(joptions_handle)); return reinterpret_cast(new_opt); } @@ -4564,9 +4680,9 @@ jlong Java_org_rocksdb_DBOptions_getDBOptionsFromProps( return 0; } - auto* db_options = new rocksdb::DBOptions(); - rocksdb::Status status = rocksdb::GetDBOptionsFromString( - rocksdb::DBOptions(), opt_string, db_options); + auto* db_options = new ROCKSDB_NAMESPACE::DBOptions(); + ROCKSDB_NAMESPACE::Status status = ROCKSDB_NAMESPACE::GetDBOptionsFromString( + ROCKSDB_NAMESPACE::DBOptions(), opt_string, db_options); env->ReleaseStringUTFChars(jopt_string, opt_string); @@ -4589,7 +4705,7 @@ jlong Java_org_rocksdb_DBOptions_getDBOptionsFromProps( */ void Java_org_rocksdb_DBOptions_disposeInternal( JNIEnv*, jobject, jlong handle) { - auto* dbo = reinterpret_cast(handle); + auto* dbo = reinterpret_cast(handle); assert(dbo != nullptr); delete dbo; } @@ -4601,7 +4717,8 @@ void Java_org_rocksdb_DBOptions_disposeInternal( */ void Java_org_rocksdb_DBOptions_optimizeForSmallDb( JNIEnv*, jobject, jlong jhandle) { - reinterpret_cast(jhandle)->OptimizeForSmallDb(); + reinterpret_cast(jhandle) + ->OptimizeForSmallDb(); } /* @@ -4611,8 +4728,8 @@ void Java_org_rocksdb_DBOptions_optimizeForSmallDb( */ void Java_org_rocksdb_DBOptions_setEnv( JNIEnv*, jobject, jlong jhandle, jlong jenv_handle) { - reinterpret_cast(jhandle)->env = - reinterpret_cast(jenv_handle); + reinterpret_cast(jhandle)->env = + reinterpret_cast(jenv_handle); } /* @@ -4622,7 +4739,7 @@ void Java_org_rocksdb_DBOptions_setEnv( */ void Java_org_rocksdb_DBOptions_setIncreaseParallelism( JNIEnv*, jobject, jlong jhandle, jint totalThreads) { - reinterpret_cast(jhandle)->IncreaseParallelism( + reinterpret_cast(jhandle)->IncreaseParallelism( static_cast(totalThreads)); } @@ -4633,7 +4750,8 @@ void Java_org_rocksdb_DBOptions_setIncreaseParallelism( */ void Java_org_rocksdb_DBOptions_setCreateIfMissing( JNIEnv*, jobject, jlong jhandle, jboolean flag) { - reinterpret_cast(jhandle)->create_if_missing = flag; + reinterpret_cast(jhandle)->create_if_missing = + flag; } /* @@ -4643,7 +4761,8 @@ void Java_org_rocksdb_DBOptions_setCreateIfMissing( */ jboolean Java_org_rocksdb_DBOptions_createIfMissing( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->create_if_missing; + return reinterpret_cast(jhandle) + ->create_if_missing; } /* @@ -4653,7 +4772,7 @@ jboolean Java_org_rocksdb_DBOptions_createIfMissing( */ void Java_org_rocksdb_DBOptions_setCreateMissingColumnFamilies( JNIEnv*, jobject, jlong jhandle, jboolean flag) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->create_missing_column_families = flag; } @@ -4664,7 +4783,7 @@ void Java_org_rocksdb_DBOptions_setCreateMissingColumnFamilies( */ jboolean Java_org_rocksdb_DBOptions_createMissingColumnFamilies( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->create_missing_column_families; } @@ -4675,7 +4794,7 @@ jboolean Java_org_rocksdb_DBOptions_createMissingColumnFamilies( */ void Java_org_rocksdb_DBOptions_setErrorIfExists( JNIEnv*, jobject, jlong jhandle, jboolean error_if_exists) { - reinterpret_cast(jhandle)->error_if_exists = + reinterpret_cast(jhandle)->error_if_exists = static_cast(error_if_exists); } @@ -4686,7 +4805,8 @@ void Java_org_rocksdb_DBOptions_setErrorIfExists( */ jboolean Java_org_rocksdb_DBOptions_errorIfExists( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->error_if_exists; + return reinterpret_cast(jhandle) + ->error_if_exists; } /* @@ -4696,7 +4816,7 @@ jboolean Java_org_rocksdb_DBOptions_errorIfExists( */ void Java_org_rocksdb_DBOptions_setParanoidChecks( JNIEnv*, jobject, jlong jhandle, jboolean paranoid_checks) { - reinterpret_cast(jhandle)->paranoid_checks = + reinterpret_cast(jhandle)->paranoid_checks = static_cast(paranoid_checks); } @@ -4707,7 +4827,8 @@ void Java_org_rocksdb_DBOptions_setParanoidChecks( */ jboolean Java_org_rocksdb_DBOptions_paranoidChecks( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->paranoid_checks; + return reinterpret_cast(jhandle) + ->paranoid_checks; } /* @@ -4717,10 +4838,11 @@ jboolean Java_org_rocksdb_DBOptions_paranoidChecks( */ void Java_org_rocksdb_DBOptions_setRateLimiter( JNIEnv*, jobject, jlong jhandle, jlong jrate_limiter_handle) { - std::shared_ptr* pRateLimiter = - reinterpret_cast*>( + std::shared_ptr* pRateLimiter = + reinterpret_cast*>( jrate_limiter_handle); - reinterpret_cast(jhandle)->rate_limiter = *pRateLimiter; + reinterpret_cast(jhandle)->rate_limiter = + *pRateLimiter; } /* @@ -4731,9 +4853,9 @@ void Java_org_rocksdb_DBOptions_setRateLimiter( void Java_org_rocksdb_DBOptions_setSstFileManager( JNIEnv*, jobject, jlong jhandle, jlong jsst_file_manager_handle) { auto* sptr_sst_file_manager = - reinterpret_cast*>( + reinterpret_cast*>( jsst_file_manager_handle); - reinterpret_cast(jhandle)->sst_file_manager = + reinterpret_cast(jhandle)->sst_file_manager = *sptr_sst_file_manager; } @@ -4744,10 +4866,10 @@ void Java_org_rocksdb_DBOptions_setSstFileManager( */ void Java_org_rocksdb_DBOptions_setLogger( JNIEnv*, jobject, jlong jhandle, jlong jlogger_handle) { - std::shared_ptr* pLogger = - reinterpret_cast*>( + std::shared_ptr* pLogger = + reinterpret_cast*>( jlogger_handle); - reinterpret_cast(jhandle)->info_log = *pLogger; + reinterpret_cast(jhandle)->info_log = *pLogger; } /* @@ -4757,8 +4879,8 @@ void Java_org_rocksdb_DBOptions_setLogger( */ void Java_org_rocksdb_DBOptions_setInfoLogLevel( JNIEnv*, jobject, jlong jhandle, jbyte jlog_level) { - reinterpret_cast(jhandle)->info_log_level = - static_cast(jlog_level); + reinterpret_cast(jhandle)->info_log_level = + static_cast(jlog_level); } /* @@ -4769,7 +4891,7 @@ void Java_org_rocksdb_DBOptions_setInfoLogLevel( jbyte Java_org_rocksdb_DBOptions_infoLogLevel( JNIEnv*, jobject, jlong jhandle) { return static_cast( - reinterpret_cast(jhandle)->info_log_level); + reinterpret_cast(jhandle)->info_log_level); } /* @@ -4779,7 +4901,7 @@ jbyte Java_org_rocksdb_DBOptions_infoLogLevel( */ void Java_org_rocksdb_DBOptions_setMaxTotalWalSize( JNIEnv*, jobject, jlong jhandle, jlong jmax_total_wal_size) { - reinterpret_cast(jhandle)->max_total_wal_size = + reinterpret_cast(jhandle)->max_total_wal_size = static_cast(jmax_total_wal_size); } @@ -4790,7 +4912,8 @@ void Java_org_rocksdb_DBOptions_setMaxTotalWalSize( */ jlong Java_org_rocksdb_DBOptions_maxTotalWalSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_total_wal_size; + return reinterpret_cast(jhandle) + ->max_total_wal_size; } /* @@ -4800,7 +4923,7 @@ jlong Java_org_rocksdb_DBOptions_maxTotalWalSize( */ void Java_org_rocksdb_DBOptions_setMaxOpenFiles( JNIEnv*, jobject, jlong jhandle, jint max_open_files) { - reinterpret_cast(jhandle)->max_open_files = + reinterpret_cast(jhandle)->max_open_files = static_cast(max_open_files); } @@ -4811,7 +4934,8 @@ void Java_org_rocksdb_DBOptions_setMaxOpenFiles( */ jint Java_org_rocksdb_DBOptions_maxOpenFiles( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_open_files; + return reinterpret_cast(jhandle) + ->max_open_files; } /* @@ -4821,8 +4945,8 @@ jint Java_org_rocksdb_DBOptions_maxOpenFiles( */ void Java_org_rocksdb_DBOptions_setMaxFileOpeningThreads( JNIEnv*, jobject, jlong jhandle, jint jmax_file_opening_threads) { - reinterpret_cast(jhandle)->max_file_opening_threads = - static_cast(jmax_file_opening_threads); + reinterpret_cast(jhandle) + ->max_file_opening_threads = static_cast(jmax_file_opening_threads); } /* @@ -4832,7 +4956,7 @@ void Java_org_rocksdb_DBOptions_setMaxFileOpeningThreads( */ jint Java_org_rocksdb_DBOptions_maxFileOpeningThreads( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_file_opening_threads); } @@ -4843,9 +4967,10 @@ jint Java_org_rocksdb_DBOptions_maxFileOpeningThreads( */ void Java_org_rocksdb_DBOptions_setStatistics( JNIEnv*, jobject, jlong jhandle, jlong jstatistics_handle) { - auto* opt = reinterpret_cast(jhandle); - auto* pSptr = reinterpret_cast*>( - jstatistics_handle); + auto* opt = reinterpret_cast(jhandle); + auto* pSptr = + reinterpret_cast*>( + jstatistics_handle); opt->statistics = *pSptr; } @@ -4856,13 +4981,13 @@ void Java_org_rocksdb_DBOptions_setStatistics( */ jlong Java_org_rocksdb_DBOptions_statistics( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - std::shared_ptr sptr = opt->statistics; + auto* opt = reinterpret_cast(jhandle); + std::shared_ptr sptr = opt->statistics; if (sptr == nullptr) { return 0; } else { - std::shared_ptr* pSptr = - new std::shared_ptr(sptr); + std::shared_ptr* pSptr = + new std::shared_ptr(sptr); return reinterpret_cast(pSptr); } } @@ -4874,7 +4999,7 @@ jlong Java_org_rocksdb_DBOptions_statistics( */ void Java_org_rocksdb_DBOptions_setUseFsync( JNIEnv*, jobject, jlong jhandle, jboolean use_fsync) { - reinterpret_cast(jhandle)->use_fsync = + reinterpret_cast(jhandle)->use_fsync = static_cast(use_fsync); } @@ -4885,7 +5010,7 @@ void Java_org_rocksdb_DBOptions_setUseFsync( */ jboolean Java_org_rocksdb_DBOptions_useFsync( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->use_fsync; + return reinterpret_cast(jhandle)->use_fsync; } /* @@ -4896,7 +5021,7 @@ jboolean Java_org_rocksdb_DBOptions_useFsync( void Java_org_rocksdb_DBOptions_setDbPaths( JNIEnv* env, jobject, jlong jhandle, jobjectArray jpaths, jlongArray jtarget_sizes) { - std::vector db_paths; + std::vector db_paths; jlong* ptr_jtarget_size = env->GetLongArrayElements(jtarget_sizes, nullptr); if (ptr_jtarget_size == nullptr) { // exception thrown: OutOfMemoryError @@ -4913,7 +5038,7 @@ void Java_org_rocksdb_DBOptions_setDbPaths( env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT); return; } - std::string path = rocksdb::JniUtil::copyStdString( + std::string path = ROCKSDB_NAMESPACE::JniUtil::copyStdString( env, static_cast(jpath), &has_exception); env->DeleteLocalRef(jpath); @@ -4925,12 +5050,12 @@ void Java_org_rocksdb_DBOptions_setDbPaths( jlong jtarget_size = ptr_jtarget_size[i]; db_paths.push_back( - rocksdb::DbPath(path, static_cast(jtarget_size))); + ROCKSDB_NAMESPACE::DbPath(path, static_cast(jtarget_size))); } env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT); - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->db_paths = db_paths; } @@ -4941,7 +5066,7 @@ void Java_org_rocksdb_DBOptions_setDbPaths( */ jlong Java_org_rocksdb_DBOptions_dbPathsLen( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->db_paths.size()); } @@ -4959,10 +5084,10 @@ void Java_org_rocksdb_DBOptions_dbPaths( return; } - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); const jsize len = env->GetArrayLength(jpaths); for (jsize i = 0; i < len; i++) { - rocksdb::DbPath db_path = opt->db_paths[i]; + ROCKSDB_NAMESPACE::DbPath db_path = opt->db_paths[i]; jstring jpath = env->NewStringUTF(db_path.path.c_str()); if (jpath == nullptr) { @@ -4997,7 +5122,8 @@ void Java_org_rocksdb_DBOptions_setDbLogDir( return; } - reinterpret_cast(jhandle)->db_log_dir.assign(log_dir); + reinterpret_cast(jhandle)->db_log_dir.assign( + log_dir); env->ReleaseStringUTFChars(jdb_log_dir, log_dir); } @@ -5009,7 +5135,8 @@ void Java_org_rocksdb_DBOptions_setDbLogDir( jstring Java_org_rocksdb_DBOptions_dbLogDir( JNIEnv* env, jobject, jlong jhandle) { return env->NewStringUTF( - reinterpret_cast(jhandle)->db_log_dir.c_str()); + reinterpret_cast(jhandle) + ->db_log_dir.c_str()); } /* @@ -5020,7 +5147,8 @@ jstring Java_org_rocksdb_DBOptions_dbLogDir( void Java_org_rocksdb_DBOptions_setWalDir( JNIEnv* env, jobject, jlong jhandle, jstring jwal_dir) { const char* wal_dir = env->GetStringUTFChars(jwal_dir, 0); - reinterpret_cast(jhandle)->wal_dir.assign(wal_dir); + reinterpret_cast(jhandle)->wal_dir.assign( + wal_dir); env->ReleaseStringUTFChars(jwal_dir, wal_dir); } @@ -5032,7 +5160,8 @@ void Java_org_rocksdb_DBOptions_setWalDir( jstring Java_org_rocksdb_DBOptions_walDir( JNIEnv* env, jobject, jlong jhandle) { return env->NewStringUTF( - reinterpret_cast(jhandle)->wal_dir.c_str()); + reinterpret_cast(jhandle) + ->wal_dir.c_str()); } /* @@ -5042,7 +5171,7 @@ jstring Java_org_rocksdb_DBOptions_walDir( */ void Java_org_rocksdb_DBOptions_setDeleteObsoleteFilesPeriodMicros( JNIEnv*, jobject, jlong jhandle, jlong micros) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->delete_obsolete_files_period_micros = static_cast(micros); } @@ -5053,7 +5182,7 @@ void Java_org_rocksdb_DBOptions_setDeleteObsoleteFilesPeriodMicros( */ jlong Java_org_rocksdb_DBOptions_deleteObsoleteFilesPeriodMicros( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->delete_obsolete_files_period_micros; } @@ -5064,8 +5193,8 @@ jlong Java_org_rocksdb_DBOptions_deleteObsoleteFilesPeriodMicros( */ void Java_org_rocksdb_DBOptions_setBaseBackgroundCompactions( JNIEnv*, jobject, jlong jhandle, jint max) { - reinterpret_cast(jhandle)->base_background_compactions = - static_cast(max); + reinterpret_cast(jhandle) + ->base_background_compactions = static_cast(max); } /* @@ -5075,7 +5204,7 @@ void Java_org_rocksdb_DBOptions_setBaseBackgroundCompactions( */ jint Java_org_rocksdb_DBOptions_baseBackgroundCompactions( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->base_background_compactions; } @@ -5086,8 +5215,8 @@ jint Java_org_rocksdb_DBOptions_baseBackgroundCompactions( */ void Java_org_rocksdb_DBOptions_setMaxBackgroundCompactions( JNIEnv*, jobject, jlong jhandle, jint max) { - reinterpret_cast(jhandle)->max_background_compactions = - static_cast(max); + reinterpret_cast(jhandle) + ->max_background_compactions = static_cast(max); } /* @@ -5097,7 +5226,7 @@ void Java_org_rocksdb_DBOptions_setMaxBackgroundCompactions( */ jint Java_org_rocksdb_DBOptions_maxBackgroundCompactions( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->max_background_compactions; } @@ -5108,7 +5237,7 @@ jint Java_org_rocksdb_DBOptions_maxBackgroundCompactions( */ void Java_org_rocksdb_DBOptions_setMaxSubcompactions( JNIEnv*, jobject, jlong jhandle, jint max) { - reinterpret_cast(jhandle)->max_subcompactions = + reinterpret_cast(jhandle)->max_subcompactions = static_cast(max); } @@ -5119,7 +5248,8 @@ void Java_org_rocksdb_DBOptions_setMaxSubcompactions( */ jint Java_org_rocksdb_DBOptions_maxSubcompactions( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_subcompactions; + return reinterpret_cast(jhandle) + ->max_subcompactions; } /* @@ -5129,8 +5259,8 @@ jint Java_org_rocksdb_DBOptions_maxSubcompactions( */ void Java_org_rocksdb_DBOptions_setMaxBackgroundFlushes( JNIEnv*, jobject, jlong jhandle, jint max_background_flushes) { - reinterpret_cast(jhandle)->max_background_flushes = - static_cast(max_background_flushes); + reinterpret_cast(jhandle) + ->max_background_flushes = static_cast(max_background_flushes); } /* @@ -5140,7 +5270,8 @@ void Java_org_rocksdb_DBOptions_setMaxBackgroundFlushes( */ jint Java_org_rocksdb_DBOptions_maxBackgroundFlushes( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_background_flushes; + return reinterpret_cast(jhandle) + ->max_background_flushes; } /* @@ -5150,8 +5281,8 @@ jint Java_org_rocksdb_DBOptions_maxBackgroundFlushes( */ void Java_org_rocksdb_DBOptions_setMaxBackgroundJobs( JNIEnv*, jobject, jlong jhandle, jint max_background_jobs) { - reinterpret_cast(jhandle)->max_background_jobs = - static_cast(max_background_jobs); + reinterpret_cast(jhandle) + ->max_background_jobs = static_cast(max_background_jobs); } /* @@ -5161,7 +5292,8 @@ void Java_org_rocksdb_DBOptions_setMaxBackgroundJobs( */ jint Java_org_rocksdb_DBOptions_maxBackgroundJobs( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_background_jobs; + return reinterpret_cast(jhandle) + ->max_background_jobs; } /* @@ -5171,12 +5303,13 @@ jint Java_org_rocksdb_DBOptions_maxBackgroundJobs( */ void Java_org_rocksdb_DBOptions_setMaxLogFileSize( JNIEnv* env, jobject, jlong jhandle, jlong max_log_file_size) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(max_log_file_size); + auto s = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(max_log_file_size); if (s.ok()) { - reinterpret_cast(jhandle)->max_log_file_size = - max_log_file_size; + reinterpret_cast(jhandle) + ->max_log_file_size = max_log_file_size; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -5187,7 +5320,8 @@ void Java_org_rocksdb_DBOptions_setMaxLogFileSize( */ jlong Java_org_rocksdb_DBOptions_maxLogFileSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_log_file_size; + return reinterpret_cast(jhandle) + ->max_log_file_size; } /* @@ -5197,13 +5331,13 @@ jlong Java_org_rocksdb_DBOptions_maxLogFileSize( */ void Java_org_rocksdb_DBOptions_setLogFileTimeToRoll( JNIEnv* env, jobject, jlong jhandle, jlong log_file_time_to_roll) { - auto s = - rocksdb::JniUtil::check_if_jlong_fits_size_t(log_file_time_to_roll); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + log_file_time_to_roll); if (s.ok()) { - reinterpret_cast(jhandle)->log_file_time_to_roll = - log_file_time_to_roll; + reinterpret_cast(jhandle) + ->log_file_time_to_roll = log_file_time_to_roll; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -5214,7 +5348,8 @@ void Java_org_rocksdb_DBOptions_setLogFileTimeToRoll( */ jlong Java_org_rocksdb_DBOptions_logFileTimeToRoll( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->log_file_time_to_roll; + return reinterpret_cast(jhandle) + ->log_file_time_to_roll; } /* @@ -5224,12 +5359,13 @@ jlong Java_org_rocksdb_DBOptions_logFileTimeToRoll( */ void Java_org_rocksdb_DBOptions_setKeepLogFileNum( JNIEnv* env, jobject, jlong jhandle, jlong keep_log_file_num) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(keep_log_file_num); + auto s = + ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(keep_log_file_num); if (s.ok()) { - reinterpret_cast(jhandle)->keep_log_file_num = - keep_log_file_num; + reinterpret_cast(jhandle) + ->keep_log_file_num = keep_log_file_num; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -5240,7 +5376,8 @@ void Java_org_rocksdb_DBOptions_setKeepLogFileNum( */ jlong Java_org_rocksdb_DBOptions_keepLogFileNum( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->keep_log_file_num; + return reinterpret_cast(jhandle) + ->keep_log_file_num; } /* @@ -5250,12 +5387,13 @@ jlong Java_org_rocksdb_DBOptions_keepLogFileNum( */ void Java_org_rocksdb_DBOptions_setRecycleLogFileNum( JNIEnv* env, jobject, jlong jhandle, jlong recycle_log_file_num) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(recycle_log_file_num); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + recycle_log_file_num); if (s.ok()) { - reinterpret_cast(jhandle)->recycle_log_file_num = - recycle_log_file_num; + reinterpret_cast(jhandle) + ->recycle_log_file_num = recycle_log_file_num; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -5266,7 +5404,8 @@ void Java_org_rocksdb_DBOptions_setRecycleLogFileNum( */ jlong Java_org_rocksdb_DBOptions_recycleLogFileNum( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->recycle_log_file_num; + return reinterpret_cast(jhandle) + ->recycle_log_file_num; } /* @@ -5276,8 +5415,8 @@ jlong Java_org_rocksdb_DBOptions_recycleLogFileNum( */ void Java_org_rocksdb_DBOptions_setMaxManifestFileSize( JNIEnv*, jobject, jlong jhandle, jlong max_manifest_file_size) { - reinterpret_cast(jhandle)->max_manifest_file_size = - static_cast(max_manifest_file_size); + reinterpret_cast(jhandle) + ->max_manifest_file_size = static_cast(max_manifest_file_size); } /* @@ -5287,7 +5426,8 @@ void Java_org_rocksdb_DBOptions_setMaxManifestFileSize( */ jlong Java_org_rocksdb_DBOptions_maxManifestFileSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->max_manifest_file_size; + return reinterpret_cast(jhandle) + ->max_manifest_file_size; } /* @@ -5297,8 +5437,8 @@ jlong Java_org_rocksdb_DBOptions_maxManifestFileSize( */ void Java_org_rocksdb_DBOptions_setTableCacheNumshardbits( JNIEnv*, jobject, jlong jhandle, jint table_cache_numshardbits) { - reinterpret_cast(jhandle)->table_cache_numshardbits = - static_cast(table_cache_numshardbits); + reinterpret_cast(jhandle) + ->table_cache_numshardbits = static_cast(table_cache_numshardbits); } /* @@ -5308,7 +5448,7 @@ void Java_org_rocksdb_DBOptions_setTableCacheNumshardbits( */ jint Java_org_rocksdb_DBOptions_tableCacheNumshardbits( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->table_cache_numshardbits; } @@ -5319,7 +5459,7 @@ jint Java_org_rocksdb_DBOptions_tableCacheNumshardbits( */ void Java_org_rocksdb_DBOptions_setWalTtlSeconds( JNIEnv*, jobject, jlong jhandle, jlong WAL_ttl_seconds) { - reinterpret_cast(jhandle)->WAL_ttl_seconds = + reinterpret_cast(jhandle)->WAL_ttl_seconds = static_cast(WAL_ttl_seconds); } @@ -5330,7 +5470,8 @@ void Java_org_rocksdb_DBOptions_setWalTtlSeconds( */ jlong Java_org_rocksdb_DBOptions_walTtlSeconds( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->WAL_ttl_seconds; + return reinterpret_cast(jhandle) + ->WAL_ttl_seconds; } /* @@ -5340,7 +5481,7 @@ jlong Java_org_rocksdb_DBOptions_walTtlSeconds( */ void Java_org_rocksdb_DBOptions_setWalSizeLimitMB( JNIEnv*, jobject, jlong jhandle, jlong WAL_size_limit_MB) { - reinterpret_cast(jhandle)->WAL_size_limit_MB = + reinterpret_cast(jhandle)->WAL_size_limit_MB = static_cast(WAL_size_limit_MB); } @@ -5351,7 +5492,8 @@ void Java_org_rocksdb_DBOptions_setWalSizeLimitMB( */ jlong Java_org_rocksdb_DBOptions_walSizeLimitMB( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->WAL_size_limit_MB; + return reinterpret_cast(jhandle) + ->WAL_size_limit_MB; } /* @@ -5361,12 +5503,13 @@ jlong Java_org_rocksdb_DBOptions_walSizeLimitMB( */ void Java_org_rocksdb_DBOptions_setManifestPreallocationSize( JNIEnv* env, jobject, jlong jhandle, jlong preallocation_size) { - auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(preallocation_size); + auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( + preallocation_size); if (s.ok()) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->manifest_preallocation_size = preallocation_size; } else { - rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew(env, s); } } @@ -5377,7 +5520,7 @@ void Java_org_rocksdb_DBOptions_setManifestPreallocationSize( */ jlong Java_org_rocksdb_DBOptions_manifestPreallocationSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->manifest_preallocation_size; } @@ -5388,7 +5531,8 @@ jlong Java_org_rocksdb_DBOptions_manifestPreallocationSize( */ jboolean Java_org_rocksdb_DBOptions_useDirectReads( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->use_direct_reads; + return reinterpret_cast(jhandle) + ->use_direct_reads; } /* @@ -5398,7 +5542,7 @@ jboolean Java_org_rocksdb_DBOptions_useDirectReads( */ void Java_org_rocksdb_DBOptions_setUseDirectReads( JNIEnv*, jobject, jlong jhandle, jboolean use_direct_reads) { - reinterpret_cast(jhandle)->use_direct_reads = + reinterpret_cast(jhandle)->use_direct_reads = static_cast(use_direct_reads); } @@ -5409,7 +5553,7 @@ void Java_org_rocksdb_DBOptions_setUseDirectReads( */ jboolean Java_org_rocksdb_DBOptions_useDirectIoForFlushAndCompaction( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->use_direct_io_for_flush_and_compaction; } @@ -5421,7 +5565,7 @@ jboolean Java_org_rocksdb_DBOptions_useDirectIoForFlushAndCompaction( void Java_org_rocksdb_DBOptions_setUseDirectIoForFlushAndCompaction( JNIEnv*, jobject, jlong jhandle, jboolean use_direct_io_for_flush_and_compaction) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->use_direct_io_for_flush_and_compaction = static_cast(use_direct_io_for_flush_and_compaction); } @@ -5433,7 +5577,7 @@ void Java_org_rocksdb_DBOptions_setUseDirectIoForFlushAndCompaction( */ void Java_org_rocksdb_DBOptions_setAllowFAllocate( JNIEnv*, jobject, jlong jhandle, jboolean jallow_fallocate) { - reinterpret_cast(jhandle)->allow_fallocate = + reinterpret_cast(jhandle)->allow_fallocate = static_cast(jallow_fallocate); } @@ -5444,7 +5588,7 @@ void Java_org_rocksdb_DBOptions_setAllowFAllocate( */ jboolean Java_org_rocksdb_DBOptions_allowFAllocate( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_fallocate); } @@ -5455,7 +5599,7 @@ jboolean Java_org_rocksdb_DBOptions_allowFAllocate( */ void Java_org_rocksdb_DBOptions_setAllowMmapReads( JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_reads) { - reinterpret_cast(jhandle)->allow_mmap_reads = + reinterpret_cast(jhandle)->allow_mmap_reads = static_cast(allow_mmap_reads); } @@ -5466,7 +5610,8 @@ void Java_org_rocksdb_DBOptions_setAllowMmapReads( */ jboolean Java_org_rocksdb_DBOptions_allowMmapReads( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->allow_mmap_reads; + return reinterpret_cast(jhandle) + ->allow_mmap_reads; } /* @@ -5476,7 +5621,7 @@ jboolean Java_org_rocksdb_DBOptions_allowMmapReads( */ void Java_org_rocksdb_DBOptions_setAllowMmapWrites( JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_writes) { - reinterpret_cast(jhandle)->allow_mmap_writes = + reinterpret_cast(jhandle)->allow_mmap_writes = static_cast(allow_mmap_writes); } @@ -5487,7 +5632,8 @@ void Java_org_rocksdb_DBOptions_setAllowMmapWrites( */ jboolean Java_org_rocksdb_DBOptions_allowMmapWrites( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->allow_mmap_writes; + return reinterpret_cast(jhandle) + ->allow_mmap_writes; } /* @@ -5497,8 +5643,8 @@ jboolean Java_org_rocksdb_DBOptions_allowMmapWrites( */ void Java_org_rocksdb_DBOptions_setIsFdCloseOnExec( JNIEnv*, jobject, jlong jhandle, jboolean is_fd_close_on_exec) { - reinterpret_cast(jhandle)->is_fd_close_on_exec = - static_cast(is_fd_close_on_exec); + reinterpret_cast(jhandle) + ->is_fd_close_on_exec = static_cast(is_fd_close_on_exec); } /* @@ -5508,7 +5654,8 @@ void Java_org_rocksdb_DBOptions_setIsFdCloseOnExec( */ jboolean Java_org_rocksdb_DBOptions_isFdCloseOnExec( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->is_fd_close_on_exec; + return reinterpret_cast(jhandle) + ->is_fd_close_on_exec; } /* @@ -5518,7 +5665,8 @@ jboolean Java_org_rocksdb_DBOptions_isFdCloseOnExec( */ void Java_org_rocksdb_DBOptions_setStatsDumpPeriodSec( JNIEnv*, jobject, jlong jhandle, jint jstats_dump_period_sec) { - reinterpret_cast(jhandle)->stats_dump_period_sec = + reinterpret_cast(jhandle) + ->stats_dump_period_sec = static_cast(jstats_dump_period_sec); } @@ -5529,7 +5677,8 @@ void Java_org_rocksdb_DBOptions_setStatsDumpPeriodSec( */ jint Java_org_rocksdb_DBOptions_statsDumpPeriodSec( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->stats_dump_period_sec; + return reinterpret_cast(jhandle) + ->stats_dump_period_sec; } /* @@ -5539,7 +5688,8 @@ jint Java_org_rocksdb_DBOptions_statsDumpPeriodSec( */ void Java_org_rocksdb_DBOptions_setStatsPersistPeriodSec( JNIEnv*, jobject, jlong jhandle, jint jstats_persist_period_sec) { - reinterpret_cast(jhandle)->stats_persist_period_sec = + reinterpret_cast(jhandle) + ->stats_persist_period_sec = static_cast(jstats_persist_period_sec); } @@ -5550,7 +5700,8 @@ void Java_org_rocksdb_DBOptions_setStatsPersistPeriodSec( */ jint Java_org_rocksdb_DBOptions_statsPersistPeriodSec( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->stats_persist_period_sec; + return reinterpret_cast(jhandle) + ->stats_persist_period_sec; } /* @@ -5560,7 +5711,8 @@ jint Java_org_rocksdb_DBOptions_statsPersistPeriodSec( */ void Java_org_rocksdb_DBOptions_setStatsHistoryBufferSize( JNIEnv*, jobject, jlong jhandle, jlong jstats_history_buffer_size) { - reinterpret_cast(jhandle)->stats_history_buffer_size = + reinterpret_cast(jhandle) + ->stats_history_buffer_size = static_cast(jstats_history_buffer_size); } @@ -5571,7 +5723,8 @@ void Java_org_rocksdb_DBOptions_setStatsHistoryBufferSize( */ jlong Java_org_rocksdb_DBOptions_statsHistoryBufferSize( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->stats_history_buffer_size; + return reinterpret_cast(jhandle) + ->stats_history_buffer_size; } /* @@ -5581,8 +5734,8 @@ jlong Java_org_rocksdb_DBOptions_statsHistoryBufferSize( */ void Java_org_rocksdb_DBOptions_setAdviseRandomOnOpen( JNIEnv*, jobject, jlong jhandle, jboolean advise_random_on_open) { - reinterpret_cast(jhandle)->advise_random_on_open = - static_cast(advise_random_on_open); + reinterpret_cast(jhandle) + ->advise_random_on_open = static_cast(advise_random_on_open); } /* @@ -5592,7 +5745,8 @@ void Java_org_rocksdb_DBOptions_setAdviseRandomOnOpen( */ jboolean Java_org_rocksdb_DBOptions_adviseRandomOnOpen( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->advise_random_on_open; + return reinterpret_cast(jhandle) + ->advise_random_on_open; } /* @@ -5602,7 +5756,7 @@ jboolean Java_org_rocksdb_DBOptions_adviseRandomOnOpen( */ void Java_org_rocksdb_DBOptions_setDbWriteBufferSize( JNIEnv*, jobject, jlong jhandle, jlong jdb_write_buffer_size) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->db_write_buffer_size = static_cast(jdb_write_buffer_size); } @@ -5615,9 +5769,10 @@ void Java_org_rocksdb_DBOptions_setWriteBufferManager( JNIEnv*, jobject, jlong jdb_options_handle, jlong jwrite_buffer_manager_handle) { auto* write_buffer_manager = - reinterpret_cast *>(jwrite_buffer_manager_handle); - reinterpret_cast(jdb_options_handle)->write_buffer_manager = - *write_buffer_manager; + reinterpret_cast*>( + jwrite_buffer_manager_handle); + reinterpret_cast(jdb_options_handle) + ->write_buffer_manager = *write_buffer_manager; } /* @@ -5627,7 +5782,7 @@ void Java_org_rocksdb_DBOptions_setWriteBufferManager( */ jlong Java_org_rocksdb_DBOptions_dbWriteBufferSize( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->db_write_buffer_size); } @@ -5638,9 +5793,9 @@ jlong Java_org_rocksdb_DBOptions_dbWriteBufferSize( */ void Java_org_rocksdb_DBOptions_setAccessHintOnCompactionStart( JNIEnv*, jobject, jlong jhandle, jbyte jaccess_hint_value) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->access_hint_on_compaction_start = - rocksdb::AccessHintJni::toCppAccessHint(jaccess_hint_value); + ROCKSDB_NAMESPACE::AccessHintJni::toCppAccessHint(jaccess_hint_value); } /* @@ -5650,8 +5805,8 @@ void Java_org_rocksdb_DBOptions_setAccessHintOnCompactionStart( */ jbyte Java_org_rocksdb_DBOptions_accessHintOnCompactionStart( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - return rocksdb::AccessHintJni::toJavaAccessHint( + auto* opt = reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::AccessHintJni::toJavaAccessHint( opt->access_hint_on_compaction_start); } @@ -5663,7 +5818,7 @@ jbyte Java_org_rocksdb_DBOptions_accessHintOnCompactionStart( void Java_org_rocksdb_DBOptions_setNewTableReaderForCompactionInputs( JNIEnv*, jobject, jlong jhandle, jboolean jnew_table_reader_for_compaction_inputs) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->new_table_reader_for_compaction_inputs = static_cast(jnew_table_reader_for_compaction_inputs); } @@ -5675,7 +5830,7 @@ void Java_org_rocksdb_DBOptions_setNewTableReaderForCompactionInputs( */ jboolean Java_org_rocksdb_DBOptions_newTableReaderForCompactionInputs( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->new_table_reader_for_compaction_inputs); } @@ -5686,7 +5841,7 @@ jboolean Java_org_rocksdb_DBOptions_newTableReaderForCompactionInputs( */ void Java_org_rocksdb_DBOptions_setCompactionReadaheadSize( JNIEnv*, jobject, jlong jhandle, jlong jcompaction_readahead_size) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->compaction_readahead_size = static_cast(jcompaction_readahead_size); } @@ -5698,7 +5853,7 @@ void Java_org_rocksdb_DBOptions_setCompactionReadaheadSize( */ jlong Java_org_rocksdb_DBOptions_compactionReadaheadSize( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->compaction_readahead_size); } @@ -5709,7 +5864,7 @@ jlong Java_org_rocksdb_DBOptions_compactionReadaheadSize( */ void Java_org_rocksdb_DBOptions_setRandomAccessMaxBufferSize( JNIEnv*, jobject, jlong jhandle, jlong jrandom_access_max_buffer_size) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->random_access_max_buffer_size = static_cast(jrandom_access_max_buffer_size); } @@ -5721,7 +5876,7 @@ void Java_org_rocksdb_DBOptions_setRandomAccessMaxBufferSize( */ jlong Java_org_rocksdb_DBOptions_randomAccessMaxBufferSize( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->random_access_max_buffer_size); } @@ -5732,7 +5887,7 @@ jlong Java_org_rocksdb_DBOptions_randomAccessMaxBufferSize( */ void Java_org_rocksdb_DBOptions_setWritableFileMaxBufferSize( JNIEnv*, jobject, jlong jhandle, jlong jwritable_file_max_buffer_size) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->writable_file_max_buffer_size = static_cast(jwritable_file_max_buffer_size); } @@ -5744,7 +5899,7 @@ void Java_org_rocksdb_DBOptions_setWritableFileMaxBufferSize( */ jlong Java_org_rocksdb_DBOptions_writableFileMaxBufferSize( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->writable_file_max_buffer_size); } @@ -5755,7 +5910,7 @@ jlong Java_org_rocksdb_DBOptions_writableFileMaxBufferSize( */ void Java_org_rocksdb_DBOptions_setUseAdaptiveMutex( JNIEnv*, jobject, jlong jhandle, jboolean use_adaptive_mutex) { - reinterpret_cast(jhandle)->use_adaptive_mutex = + reinterpret_cast(jhandle)->use_adaptive_mutex = static_cast(use_adaptive_mutex); } @@ -5766,7 +5921,8 @@ void Java_org_rocksdb_DBOptions_setUseAdaptiveMutex( */ jboolean Java_org_rocksdb_DBOptions_useAdaptiveMutex( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->use_adaptive_mutex; + return reinterpret_cast(jhandle) + ->use_adaptive_mutex; } /* @@ -5776,7 +5932,7 @@ jboolean Java_org_rocksdb_DBOptions_useAdaptiveMutex( */ void Java_org_rocksdb_DBOptions_setBytesPerSync( JNIEnv*, jobject, jlong jhandle, jlong bytes_per_sync) { - reinterpret_cast(jhandle)->bytes_per_sync = + reinterpret_cast(jhandle)->bytes_per_sync = static_cast(bytes_per_sync); } @@ -5787,7 +5943,8 @@ void Java_org_rocksdb_DBOptions_setBytesPerSync( */ jlong Java_org_rocksdb_DBOptions_bytesPerSync( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->bytes_per_sync; + return reinterpret_cast(jhandle) + ->bytes_per_sync; } /* @@ -5797,7 +5954,7 @@ jlong Java_org_rocksdb_DBOptions_bytesPerSync( */ void Java_org_rocksdb_DBOptions_setWalBytesPerSync( JNIEnv*, jobject, jlong jhandle, jlong jwal_bytes_per_sync) { - reinterpret_cast(jhandle)->wal_bytes_per_sync = + reinterpret_cast(jhandle)->wal_bytes_per_sync = static_cast(jwal_bytes_per_sync); } @@ -5808,7 +5965,7 @@ void Java_org_rocksdb_DBOptions_setWalBytesPerSync( */ jlong Java_org_rocksdb_DBOptions_walBytesPerSync( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->wal_bytes_per_sync); } @@ -5819,8 +5976,8 @@ jlong Java_org_rocksdb_DBOptions_walBytesPerSync( */ void Java_org_rocksdb_DBOptions_setStrictBytesPerSync( JNIEnv*, jobject, jlong jhandle, jboolean jstrict_bytes_per_sync) { - reinterpret_cast(jhandle)->strict_bytes_per_sync = - jstrict_bytes_per_sync == JNI_TRUE; + reinterpret_cast(jhandle) + ->strict_bytes_per_sync = jstrict_bytes_per_sync == JNI_TRUE; } /* @@ -5831,7 +5988,8 @@ void Java_org_rocksdb_DBOptions_setStrictBytesPerSync( jboolean Java_org_rocksdb_DBOptions_strictBytesPerSync( JNIEnv*, jobject, jlong jhandle) { return static_cast( - reinterpret_cast(jhandle)->strict_bytes_per_sync); + reinterpret_cast(jhandle) + ->strict_bytes_per_sync); } /* @@ -5841,7 +5999,7 @@ jboolean Java_org_rocksdb_DBOptions_strictBytesPerSync( */ void Java_org_rocksdb_DBOptions_setDelayedWriteRate( JNIEnv*, jobject, jlong jhandle, jlong jdelayed_write_rate) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->delayed_write_rate = static_cast(jdelayed_write_rate); } @@ -5852,7 +6010,7 @@ void Java_org_rocksdb_DBOptions_setDelayedWriteRate( */ jlong Java_org_rocksdb_DBOptions_delayedWriteRate( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->delayed_write_rate); } @@ -5863,7 +6021,7 @@ jlong Java_org_rocksdb_DBOptions_delayedWriteRate( */ void Java_org_rocksdb_DBOptions_setEnablePipelinedWrite( JNIEnv*, jobject, jlong jhandle, jboolean jenable_pipelined_write) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->enable_pipelined_write = jenable_pipelined_write == JNI_TRUE; } @@ -5874,7 +6032,7 @@ void Java_org_rocksdb_DBOptions_setEnablePipelinedWrite( */ jboolean Java_org_rocksdb_DBOptions_enablePipelinedWrite( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->enable_pipelined_write); } @@ -5885,8 +6043,8 @@ jboolean Java_org_rocksdb_DBOptions_enablePipelinedWrite( */ void Java_org_rocksdb_DBOptions_setUnorderedWrite( JNIEnv*, jobject, jlong jhandle, jboolean junordered_write) { - auto* opt = reinterpret_cast(jhandle); - opt->unordered_write = junordered_write == JNI_TRUE; + auto* opt = reinterpret_cast(jhandle); + opt->unordered_write = junordered_write == JNI_TRUE; } /* @@ -5896,8 +6054,8 @@ void Java_org_rocksdb_DBOptions_setUnorderedWrite( */ jboolean Java_org_rocksdb_DBOptions_unorderedWrite( JNIEnv*, jobject, jlong jhandle) { -auto* opt = reinterpret_cast(jhandle); -return static_cast(opt->unordered_write); + auto* opt = reinterpret_cast(jhandle); + return static_cast(opt->unordered_write); } @@ -5908,7 +6066,7 @@ return static_cast(opt->unordered_write); */ void Java_org_rocksdb_DBOptions_setEnableThreadTracking( JNIEnv*, jobject, jlong jhandle, jboolean jenable_thread_tracking) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->enable_thread_tracking = jenable_thread_tracking == JNI_TRUE; } @@ -5919,7 +6077,7 @@ void Java_org_rocksdb_DBOptions_setEnableThreadTracking( */ jboolean Java_org_rocksdb_DBOptions_enableThreadTracking( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->enable_thread_tracking); } @@ -5930,7 +6088,7 @@ jboolean Java_org_rocksdb_DBOptions_enableThreadTracking( */ void Java_org_rocksdb_DBOptions_setAllowConcurrentMemtableWrite( JNIEnv*, jobject, jlong jhandle, jboolean allow) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->allow_concurrent_memtable_write = static_cast(allow); } @@ -5941,7 +6099,7 @@ void Java_org_rocksdb_DBOptions_setAllowConcurrentMemtableWrite( */ jboolean Java_org_rocksdb_DBOptions_allowConcurrentMemtableWrite( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->allow_concurrent_memtable_write; } @@ -5952,7 +6110,7 @@ jboolean Java_org_rocksdb_DBOptions_allowConcurrentMemtableWrite( */ void Java_org_rocksdb_DBOptions_setEnableWriteThreadAdaptiveYield( JNIEnv*, jobject, jlong jhandle, jboolean yield) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->enable_write_thread_adaptive_yield = static_cast(yield); } @@ -5963,7 +6121,7 @@ void Java_org_rocksdb_DBOptions_setEnableWriteThreadAdaptiveYield( */ jboolean Java_org_rocksdb_DBOptions_enableWriteThreadAdaptiveYield( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->enable_write_thread_adaptive_yield; } @@ -5974,8 +6132,8 @@ jboolean Java_org_rocksdb_DBOptions_enableWriteThreadAdaptiveYield( */ void Java_org_rocksdb_DBOptions_setWriteThreadMaxYieldUsec( JNIEnv*, jobject, jlong jhandle, jlong max) { - reinterpret_cast(jhandle)->write_thread_max_yield_usec = - static_cast(max); + reinterpret_cast(jhandle) + ->write_thread_max_yield_usec = static_cast(max); } /* @@ -5985,7 +6143,7 @@ void Java_org_rocksdb_DBOptions_setWriteThreadMaxYieldUsec( */ jlong Java_org_rocksdb_DBOptions_writeThreadMaxYieldUsec( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->write_thread_max_yield_usec; } @@ -5996,8 +6154,8 @@ jlong Java_org_rocksdb_DBOptions_writeThreadMaxYieldUsec( */ void Java_org_rocksdb_DBOptions_setWriteThreadSlowYieldUsec( JNIEnv*, jobject, jlong jhandle, jlong slow) { - reinterpret_cast(jhandle)->write_thread_slow_yield_usec = - static_cast(slow); + reinterpret_cast(jhandle) + ->write_thread_slow_yield_usec = static_cast(slow); } /* @@ -6007,7 +6165,7 @@ void Java_org_rocksdb_DBOptions_setWriteThreadSlowYieldUsec( */ jlong Java_org_rocksdb_DBOptions_writeThreadSlowYieldUsec( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->write_thread_slow_yield_usec; } @@ -6018,7 +6176,7 @@ jlong Java_org_rocksdb_DBOptions_writeThreadSlowYieldUsec( */ void Java_org_rocksdb_DBOptions_setSkipStatsUpdateOnDbOpen( JNIEnv*, jobject, jlong jhandle, jboolean jskip_stats_update_on_db_open) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->skip_stats_update_on_db_open = static_cast(jskip_stats_update_on_db_open); } @@ -6030,7 +6188,7 @@ void Java_org_rocksdb_DBOptions_setSkipStatsUpdateOnDbOpen( */ jboolean Java_org_rocksdb_DBOptions_skipStatsUpdateOnDbOpen( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->skip_stats_update_on_db_open); } @@ -6042,7 +6200,7 @@ jboolean Java_org_rocksdb_DBOptions_skipStatsUpdateOnDbOpen( void Java_org_rocksdb_DBOptions_setSkipCheckingSstFileSizesOnDbOpen( JNIEnv*, jobject, jlong jhandle, jboolean jskip_checking_sst_file_sizes_on_db_open) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->skip_checking_sst_file_sizes_on_db_open = static_cast(jskip_checking_sst_file_sizes_on_db_open); } @@ -6054,7 +6212,7 @@ void Java_org_rocksdb_DBOptions_setSkipCheckingSstFileSizesOnDbOpen( */ jboolean Java_org_rocksdb_DBOptions_skipCheckingSstFileSizesOnDbOpen( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->skip_checking_sst_file_sizes_on_db_open); } @@ -6065,9 +6223,10 @@ jboolean Java_org_rocksdb_DBOptions_skipCheckingSstFileSizesOnDbOpen( */ void Java_org_rocksdb_DBOptions_setWalRecoveryMode( JNIEnv*, jobject, jlong jhandle, jbyte jwal_recovery_mode_value) { - auto* opt = reinterpret_cast(jhandle); - opt->wal_recovery_mode = rocksdb::WALRecoveryModeJni::toCppWALRecoveryMode( - jwal_recovery_mode_value); + auto* opt = reinterpret_cast(jhandle); + opt->wal_recovery_mode = + ROCKSDB_NAMESPACE::WALRecoveryModeJni::toCppWALRecoveryMode( + jwal_recovery_mode_value); } /* @@ -6077,8 +6236,8 @@ void Java_org_rocksdb_DBOptions_setWalRecoveryMode( */ jbyte Java_org_rocksdb_DBOptions_walRecoveryMode( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); - return rocksdb::WALRecoveryModeJni::toJavaWALRecoveryMode( + auto* opt = reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::WALRecoveryModeJni::toJavaWALRecoveryMode( opt->wal_recovery_mode); } @@ -6089,7 +6248,7 @@ jbyte Java_org_rocksdb_DBOptions_walRecoveryMode( */ void Java_org_rocksdb_DBOptions_setAllow2pc( JNIEnv*, jobject, jlong jhandle, jboolean jallow_2pc) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->allow_2pc = static_cast(jallow_2pc); } @@ -6100,7 +6259,7 @@ void Java_org_rocksdb_DBOptions_setAllow2pc( */ jboolean Java_org_rocksdb_DBOptions_allow2pc( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_2pc); } @@ -6111,9 +6270,10 @@ jboolean Java_org_rocksdb_DBOptions_allow2pc( */ void Java_org_rocksdb_DBOptions_setRowCache( JNIEnv*, jobject, jlong jhandle, jlong jrow_cache_handle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); auto* row_cache = - reinterpret_cast*>(jrow_cache_handle); + reinterpret_cast*>( + jrow_cache_handle); opt->row_cache = *row_cache; } @@ -6124,9 +6284,9 @@ void Java_org_rocksdb_DBOptions_setRowCache( */ void Java_org_rocksdb_DBOptions_setWalFilter( JNIEnv*, jobject, jlong jhandle, jlong jwal_filter_handle) { - auto* opt = reinterpret_cast(jhandle); - auto* wal_filter = - reinterpret_cast(jwal_filter_handle); + auto* opt = reinterpret_cast(jhandle); + auto* wal_filter = reinterpret_cast( + jwal_filter_handle); opt->wal_filter = wal_filter; } @@ -6137,7 +6297,7 @@ void Java_org_rocksdb_DBOptions_setWalFilter( */ void Java_org_rocksdb_DBOptions_setFailIfOptionsFileError( JNIEnv*, jobject, jlong jhandle, jboolean jfail_if_options_file_error) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->fail_if_options_file_error = static_cast(jfail_if_options_file_error); } @@ -6149,7 +6309,7 @@ void Java_org_rocksdb_DBOptions_setFailIfOptionsFileError( */ jboolean Java_org_rocksdb_DBOptions_failIfOptionsFileError( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->fail_if_options_file_error); } @@ -6160,7 +6320,7 @@ jboolean Java_org_rocksdb_DBOptions_failIfOptionsFileError( */ void Java_org_rocksdb_DBOptions_setDumpMallocStats( JNIEnv*, jobject, jlong jhandle, jboolean jdump_malloc_stats) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->dump_malloc_stats = static_cast(jdump_malloc_stats); } @@ -6171,7 +6331,7 @@ void Java_org_rocksdb_DBOptions_setDumpMallocStats( */ jboolean Java_org_rocksdb_DBOptions_dumpMallocStats( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->dump_malloc_stats); } @@ -6182,7 +6342,7 @@ jboolean Java_org_rocksdb_DBOptions_dumpMallocStats( */ void Java_org_rocksdb_DBOptions_setAvoidFlushDuringRecovery( JNIEnv*, jobject, jlong jhandle, jboolean javoid_flush_during_recovery) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->avoid_flush_during_recovery = static_cast(javoid_flush_during_recovery); } @@ -6194,7 +6354,7 @@ void Java_org_rocksdb_DBOptions_setAvoidFlushDuringRecovery( */ jboolean Java_org_rocksdb_DBOptions_avoidFlushDuringRecovery( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->avoid_flush_during_recovery); } @@ -6205,7 +6365,7 @@ jboolean Java_org_rocksdb_DBOptions_avoidFlushDuringRecovery( */ void Java_org_rocksdb_DBOptions_setAllowIngestBehind( JNIEnv*, jobject, jlong jhandle, jboolean jallow_ingest_behind) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->allow_ingest_behind = jallow_ingest_behind == JNI_TRUE; } @@ -6216,7 +6376,7 @@ void Java_org_rocksdb_DBOptions_setAllowIngestBehind( */ jboolean Java_org_rocksdb_DBOptions_allowIngestBehind( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_ingest_behind); } @@ -6227,7 +6387,7 @@ jboolean Java_org_rocksdb_DBOptions_allowIngestBehind( */ void Java_org_rocksdb_DBOptions_setPreserveDeletes( JNIEnv*, jobject, jlong jhandle, jboolean jpreserve_deletes) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->preserve_deletes = jpreserve_deletes == JNI_TRUE; } @@ -6238,7 +6398,7 @@ void Java_org_rocksdb_DBOptions_setPreserveDeletes( */ jboolean Java_org_rocksdb_DBOptions_preserveDeletes( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->preserve_deletes); } @@ -6249,7 +6409,7 @@ jboolean Java_org_rocksdb_DBOptions_preserveDeletes( */ void Java_org_rocksdb_DBOptions_setTwoWriteQueues( JNIEnv*, jobject, jlong jhandle, jboolean jtwo_write_queues) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->two_write_queues = jtwo_write_queues == JNI_TRUE; } @@ -6260,7 +6420,7 @@ void Java_org_rocksdb_DBOptions_setTwoWriteQueues( */ jboolean Java_org_rocksdb_DBOptions_twoWriteQueues( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->two_write_queues); } @@ -6271,7 +6431,7 @@ jboolean Java_org_rocksdb_DBOptions_twoWriteQueues( */ void Java_org_rocksdb_DBOptions_setManualWalFlush( JNIEnv*, jobject, jlong jhandle, jboolean jmanual_wal_flush) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->manual_wal_flush = jmanual_wal_flush == JNI_TRUE; } @@ -6282,7 +6442,7 @@ void Java_org_rocksdb_DBOptions_setManualWalFlush( */ jboolean Java_org_rocksdb_DBOptions_manualWalFlush( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->manual_wal_flush); } @@ -6293,7 +6453,7 @@ jboolean Java_org_rocksdb_DBOptions_manualWalFlush( */ void Java_org_rocksdb_DBOptions_setAtomicFlush( JNIEnv*, jobject, jlong jhandle, jboolean jatomic_flush) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->atomic_flush = jatomic_flush == JNI_TRUE; } @@ -6304,7 +6464,7 @@ void Java_org_rocksdb_DBOptions_setAtomicFlush( */ jboolean Java_org_rocksdb_DBOptions_atomicFlush( JNIEnv *, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->atomic_flush); } @@ -6315,7 +6475,7 @@ jboolean Java_org_rocksdb_DBOptions_atomicFlush( */ void Java_org_rocksdb_DBOptions_setAvoidFlushDuringShutdown( JNIEnv*, jobject, jlong jhandle, jboolean javoid_flush_during_shutdown) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->avoid_flush_during_shutdown = static_cast(javoid_flush_during_shutdown); } @@ -6327,12 +6487,12 @@ void Java_org_rocksdb_DBOptions_setAvoidFlushDuringShutdown( */ jboolean Java_org_rocksdb_DBOptions_avoidFlushDuringShutdown( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->avoid_flush_during_shutdown); } ////////////////////////////////////////////////////////////////////////////// -// rocksdb::WriteOptions +// ROCKSDB_NAMESPACE::WriteOptions /* * Class: org_rocksdb_WriteOptions @@ -6341,7 +6501,7 @@ jboolean Java_org_rocksdb_DBOptions_avoidFlushDuringShutdown( */ jlong Java_org_rocksdb_WriteOptions_newWriteOptions( JNIEnv*, jclass) { - auto* op = new rocksdb::WriteOptions(); + auto* op = new ROCKSDB_NAMESPACE::WriteOptions(); return reinterpret_cast(op); } @@ -6352,8 +6512,8 @@ jlong Java_org_rocksdb_WriteOptions_newWriteOptions( */ jlong Java_org_rocksdb_WriteOptions_copyWriteOptions( JNIEnv*, jclass, jlong jhandle) { - auto new_opt = new rocksdb::WriteOptions( - *(reinterpret_cast(jhandle))); + auto new_opt = new ROCKSDB_NAMESPACE::WriteOptions( + *(reinterpret_cast(jhandle))); return reinterpret_cast(new_opt); } @@ -6364,7 +6524,8 @@ jlong Java_org_rocksdb_WriteOptions_copyWriteOptions( */ void Java_org_rocksdb_WriteOptions_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto* write_options = reinterpret_cast(jhandle); + auto* write_options = + reinterpret_cast(jhandle); assert(write_options != nullptr); delete write_options; } @@ -6376,7 +6537,7 @@ void Java_org_rocksdb_WriteOptions_disposeInternal( */ void Java_org_rocksdb_WriteOptions_setSync( JNIEnv*, jobject, jlong jhandle, jboolean jflag) { - reinterpret_cast(jhandle)->sync = jflag; + reinterpret_cast(jhandle)->sync = jflag; } /* @@ -6386,7 +6547,7 @@ void Java_org_rocksdb_WriteOptions_setSync( */ jboolean Java_org_rocksdb_WriteOptions_sync( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->sync; + return reinterpret_cast(jhandle)->sync; } /* @@ -6396,7 +6557,8 @@ jboolean Java_org_rocksdb_WriteOptions_sync( */ void Java_org_rocksdb_WriteOptions_setDisableWAL( JNIEnv*, jobject, jlong jhandle, jboolean jflag) { - reinterpret_cast(jhandle)->disableWAL = jflag; + reinterpret_cast(jhandle)->disableWAL = + jflag; } /* @@ -6406,7 +6568,8 @@ void Java_org_rocksdb_WriteOptions_setDisableWAL( */ jboolean Java_org_rocksdb_WriteOptions_disableWAL( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->disableWAL; + return reinterpret_cast(jhandle) + ->disableWAL; } /* @@ -6417,7 +6580,7 @@ jboolean Java_org_rocksdb_WriteOptions_disableWAL( void Java_org_rocksdb_WriteOptions_setIgnoreMissingColumnFamilies( JNIEnv*, jobject, jlong jhandle, jboolean jignore_missing_column_families) { - reinterpret_cast(jhandle) + reinterpret_cast(jhandle) ->ignore_missing_column_families = static_cast(jignore_missing_column_families); } @@ -6429,7 +6592,7 @@ void Java_org_rocksdb_WriteOptions_setIgnoreMissingColumnFamilies( */ jboolean Java_org_rocksdb_WriteOptions_ignoreMissingColumnFamilies( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle) + return reinterpret_cast(jhandle) ->ignore_missing_column_families; } @@ -6440,7 +6603,7 @@ jboolean Java_org_rocksdb_WriteOptions_ignoreMissingColumnFamilies( */ void Java_org_rocksdb_WriteOptions_setNoSlowdown( JNIEnv*, jobject, jlong jhandle, jboolean jno_slowdown) { - reinterpret_cast(jhandle)->no_slowdown = + reinterpret_cast(jhandle)->no_slowdown = static_cast(jno_slowdown); } @@ -6451,7 +6614,8 @@ void Java_org_rocksdb_WriteOptions_setNoSlowdown( */ jboolean Java_org_rocksdb_WriteOptions_noSlowdown( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->no_slowdown; + return reinterpret_cast(jhandle) + ->no_slowdown; } /* @@ -6461,7 +6625,7 @@ jboolean Java_org_rocksdb_WriteOptions_noSlowdown( */ void Java_org_rocksdb_WriteOptions_setLowPri( JNIEnv*, jobject, jlong jhandle, jboolean jlow_pri) { - reinterpret_cast(jhandle)->low_pri = + reinterpret_cast(jhandle)->low_pri = static_cast(jlow_pri); } @@ -6472,11 +6636,11 @@ void Java_org_rocksdb_WriteOptions_setLowPri( */ jboolean Java_org_rocksdb_WriteOptions_lowPri( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->low_pri; + return reinterpret_cast(jhandle)->low_pri; } ///////////////////////////////////////////////////////////////////// -// rocksdb::ReadOptions +// ROCKSDB_NAMESPACE::ReadOptions /* * Class: org_rocksdb_ReadOptions @@ -6485,7 +6649,7 @@ jboolean Java_org_rocksdb_WriteOptions_lowPri( */ jlong Java_org_rocksdb_ReadOptions_newReadOptions__( JNIEnv*, jclass) { - auto* read_options = new rocksdb::ReadOptions(); + auto* read_options = new ROCKSDB_NAMESPACE::ReadOptions(); return reinterpret_cast(read_options); } @@ -6496,9 +6660,8 @@ jlong Java_org_rocksdb_ReadOptions_newReadOptions__( */ jlong Java_org_rocksdb_ReadOptions_newReadOptions__ZZ( JNIEnv*, jclass, jboolean jverify_checksums, jboolean jfill_cache) { - auto* read_options = - new rocksdb::ReadOptions(static_cast(jverify_checksums), - static_cast(jfill_cache)); + auto* read_options = new ROCKSDB_NAMESPACE::ReadOptions( + static_cast(jverify_checksums), static_cast(jfill_cache)); return reinterpret_cast(read_options); } @@ -6509,8 +6672,8 @@ jlong Java_org_rocksdb_ReadOptions_newReadOptions__ZZ( */ jlong Java_org_rocksdb_ReadOptions_copyReadOptions( JNIEnv*, jclass, jlong jhandle) { - auto new_opt = new rocksdb::ReadOptions( - *(reinterpret_cast(jhandle))); + auto new_opt = new ROCKSDB_NAMESPACE::ReadOptions( + *(reinterpret_cast(jhandle))); return reinterpret_cast(new_opt); } @@ -6521,7 +6684,8 @@ jlong Java_org_rocksdb_ReadOptions_copyReadOptions( */ void Java_org_rocksdb_ReadOptions_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto* read_options = reinterpret_cast(jhandle); + auto* read_options = + reinterpret_cast(jhandle); assert(read_options != nullptr); delete read_options; } @@ -6533,7 +6697,7 @@ void Java_org_rocksdb_ReadOptions_disposeInternal( */ void Java_org_rocksdb_ReadOptions_setVerifyChecksums( JNIEnv*, jobject, jlong jhandle, jboolean jverify_checksums) { - reinterpret_cast(jhandle)->verify_checksums = + reinterpret_cast(jhandle)->verify_checksums = static_cast(jverify_checksums); } @@ -6544,7 +6708,8 @@ void Java_org_rocksdb_ReadOptions_setVerifyChecksums( */ jboolean Java_org_rocksdb_ReadOptions_verifyChecksums( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->verify_checksums; + return reinterpret_cast(jhandle) + ->verify_checksums; } /* @@ -6554,7 +6719,7 @@ jboolean Java_org_rocksdb_ReadOptions_verifyChecksums( */ void Java_org_rocksdb_ReadOptions_setFillCache( JNIEnv*, jobject, jlong jhandle, jboolean jfill_cache) { - reinterpret_cast(jhandle)->fill_cache = + reinterpret_cast(jhandle)->fill_cache = static_cast(jfill_cache); } @@ -6565,7 +6730,7 @@ void Java_org_rocksdb_ReadOptions_setFillCache( */ jboolean Java_org_rocksdb_ReadOptions_fillCache( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->fill_cache; + return reinterpret_cast(jhandle)->fill_cache; } /* @@ -6575,7 +6740,7 @@ jboolean Java_org_rocksdb_ReadOptions_fillCache( */ void Java_org_rocksdb_ReadOptions_setTailing( JNIEnv*, jobject, jlong jhandle, jboolean jtailing) { - reinterpret_cast(jhandle)->tailing = + reinterpret_cast(jhandle)->tailing = static_cast(jtailing); } @@ -6586,7 +6751,7 @@ void Java_org_rocksdb_ReadOptions_setTailing( */ jboolean Java_org_rocksdb_ReadOptions_tailing( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->tailing; + return reinterpret_cast(jhandle)->tailing; } /* @@ -6596,7 +6761,7 @@ jboolean Java_org_rocksdb_ReadOptions_tailing( */ jboolean Java_org_rocksdb_ReadOptions_managed( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->managed; + return reinterpret_cast(jhandle)->managed; } /* @@ -6606,7 +6771,7 @@ jboolean Java_org_rocksdb_ReadOptions_managed( */ void Java_org_rocksdb_ReadOptions_setManaged( JNIEnv*, jobject, jlong jhandle, jboolean jmanaged) { - reinterpret_cast(jhandle)->managed = + reinterpret_cast(jhandle)->managed = static_cast(jmanaged); } @@ -6617,7 +6782,8 @@ void Java_org_rocksdb_ReadOptions_setManaged( */ jboolean Java_org_rocksdb_ReadOptions_totalOrderSeek( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->total_order_seek; + return reinterpret_cast(jhandle) + ->total_order_seek; } /* @@ -6627,7 +6793,7 @@ jboolean Java_org_rocksdb_ReadOptions_totalOrderSeek( */ void Java_org_rocksdb_ReadOptions_setTotalOrderSeek( JNIEnv*, jobject, jlong jhandle, jboolean jtotal_order_seek) { - reinterpret_cast(jhandle)->total_order_seek = + reinterpret_cast(jhandle)->total_order_seek = static_cast(jtotal_order_seek); } @@ -6638,7 +6804,8 @@ void Java_org_rocksdb_ReadOptions_setTotalOrderSeek( */ jboolean Java_org_rocksdb_ReadOptions_prefixSameAsStart( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->prefix_same_as_start; + return reinterpret_cast(jhandle) + ->prefix_same_as_start; } /* @@ -6648,8 +6815,8 @@ jboolean Java_org_rocksdb_ReadOptions_prefixSameAsStart( */ void Java_org_rocksdb_ReadOptions_setPrefixSameAsStart( JNIEnv*, jobject, jlong jhandle, jboolean jprefix_same_as_start) { - reinterpret_cast(jhandle)->prefix_same_as_start = - static_cast(jprefix_same_as_start); + reinterpret_cast(jhandle) + ->prefix_same_as_start = static_cast(jprefix_same_as_start); } /* @@ -6659,7 +6826,7 @@ void Java_org_rocksdb_ReadOptions_setPrefixSameAsStart( */ jboolean Java_org_rocksdb_ReadOptions_pinData( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->pin_data; + return reinterpret_cast(jhandle)->pin_data; } /* @@ -6669,7 +6836,7 @@ jboolean Java_org_rocksdb_ReadOptions_pinData( */ void Java_org_rocksdb_ReadOptions_setPinData( JNIEnv*, jobject, jlong jhandle, jboolean jpin_data) { - reinterpret_cast(jhandle)->pin_data = + reinterpret_cast(jhandle)->pin_data = static_cast(jpin_data); } @@ -6680,7 +6847,7 @@ void Java_org_rocksdb_ReadOptions_setPinData( */ jboolean Java_org_rocksdb_ReadOptions_backgroundPurgeOnIteratorCleanup( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->background_purge_on_iterator_cleanup); } @@ -6692,7 +6859,7 @@ jboolean Java_org_rocksdb_ReadOptions_backgroundPurgeOnIteratorCleanup( void Java_org_rocksdb_ReadOptions_setBackgroundPurgeOnIteratorCleanup( JNIEnv*, jobject, jlong jhandle, jboolean jbackground_purge_on_iterator_cleanup) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->background_purge_on_iterator_cleanup = static_cast(jbackground_purge_on_iterator_cleanup); } @@ -6704,7 +6871,7 @@ void Java_org_rocksdb_ReadOptions_setBackgroundPurgeOnIteratorCleanup( */ jlong Java_org_rocksdb_ReadOptions_readaheadSize( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->readahead_size); } @@ -6715,7 +6882,7 @@ jlong Java_org_rocksdb_ReadOptions_readaheadSize( */ void Java_org_rocksdb_ReadOptions_setReadaheadSize( JNIEnv*, jobject, jlong jhandle, jlong jreadahead_size) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->readahead_size = static_cast(jreadahead_size); } @@ -6726,7 +6893,7 @@ void Java_org_rocksdb_ReadOptions_setReadaheadSize( */ jlong Java_org_rocksdb_ReadOptions_maxSkippableInternalKeys( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_skippable_internal_keys); } @@ -6737,7 +6904,7 @@ jlong Java_org_rocksdb_ReadOptions_maxSkippableInternalKeys( */ void Java_org_rocksdb_ReadOptions_setMaxSkippableInternalKeys( JNIEnv*, jobject, jlong jhandle, jlong jmax_skippable_internal_keys) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->max_skippable_internal_keys = static_cast(jmax_skippable_internal_keys); } @@ -6749,7 +6916,7 @@ void Java_org_rocksdb_ReadOptions_setMaxSkippableInternalKeys( */ jboolean Java_org_rocksdb_ReadOptions_ignoreRangeDeletions( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->ignore_range_deletions); } @@ -6760,7 +6927,7 @@ jboolean Java_org_rocksdb_ReadOptions_ignoreRangeDeletions( */ void Java_org_rocksdb_ReadOptions_setIgnoreRangeDeletions( JNIEnv*, jobject, jlong jhandle, jboolean jignore_range_deletions) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->ignore_range_deletions = static_cast(jignore_range_deletions); } @@ -6771,8 +6938,8 @@ void Java_org_rocksdb_ReadOptions_setIgnoreRangeDeletions( */ void Java_org_rocksdb_ReadOptions_setSnapshot( JNIEnv*, jobject, jlong jhandle, jlong jsnapshot) { - reinterpret_cast(jhandle)->snapshot = - reinterpret_cast(jsnapshot); + reinterpret_cast(jhandle)->snapshot = + reinterpret_cast(jsnapshot); } /* @@ -6782,7 +6949,8 @@ void Java_org_rocksdb_ReadOptions_setSnapshot( */ jlong Java_org_rocksdb_ReadOptions_snapshot( JNIEnv*, jobject, jlong jhandle) { - auto& snapshot = reinterpret_cast(jhandle)->snapshot; + auto& snapshot = + reinterpret_cast(jhandle)->snapshot; return reinterpret_cast(snapshot); } @@ -6794,7 +6962,7 @@ jlong Java_org_rocksdb_ReadOptions_snapshot( jbyte Java_org_rocksdb_ReadOptions_readTier( JNIEnv*, jobject, jlong jhandle) { return static_cast( - reinterpret_cast(jhandle)->read_tier); + reinterpret_cast(jhandle)->read_tier); } /* @@ -6804,8 +6972,8 @@ jbyte Java_org_rocksdb_ReadOptions_readTier( */ void Java_org_rocksdb_ReadOptions_setReadTier( JNIEnv*, jobject, jlong jhandle, jbyte jread_tier) { - reinterpret_cast(jhandle)->read_tier = - static_cast(jread_tier); + reinterpret_cast(jhandle)->read_tier = + static_cast(jread_tier); } /* @@ -6815,8 +6983,9 @@ void Java_org_rocksdb_ReadOptions_setReadTier( */ void Java_org_rocksdb_ReadOptions_setIterateUpperBound( JNIEnv*, jobject, jlong jhandle, jlong jupper_bound_slice_handle) { - reinterpret_cast(jhandle)->iterate_upper_bound = - reinterpret_cast(jupper_bound_slice_handle); + reinterpret_cast(jhandle) + ->iterate_upper_bound = + reinterpret_cast(jupper_bound_slice_handle); } /* @@ -6827,7 +6996,8 @@ void Java_org_rocksdb_ReadOptions_setIterateUpperBound( jlong Java_org_rocksdb_ReadOptions_iterateUpperBound( JNIEnv*, jobject, jlong jhandle) { auto& upper_bound_slice_handle = - reinterpret_cast(jhandle)->iterate_upper_bound; + reinterpret_cast(jhandle) + ->iterate_upper_bound; return reinterpret_cast(upper_bound_slice_handle); } @@ -6838,8 +7008,9 @@ jlong Java_org_rocksdb_ReadOptions_iterateUpperBound( */ void Java_org_rocksdb_ReadOptions_setIterateLowerBound( JNIEnv*, jobject, jlong jhandle, jlong jlower_bound_slice_handle) { - reinterpret_cast(jhandle)->iterate_lower_bound = - reinterpret_cast(jlower_bound_slice_handle); + reinterpret_cast(jhandle) + ->iterate_lower_bound = + reinterpret_cast(jlower_bound_slice_handle); } /* @@ -6850,7 +7021,8 @@ void Java_org_rocksdb_ReadOptions_setIterateLowerBound( jlong Java_org_rocksdb_ReadOptions_iterateLowerBound( JNIEnv*, jobject, jlong jhandle) { auto& lower_bound_slice_handle = - reinterpret_cast(jhandle)->iterate_lower_bound; + reinterpret_cast(jhandle) + ->iterate_lower_bound; return reinterpret_cast(lower_bound_slice_handle); } @@ -6861,9 +7033,10 @@ jlong Java_org_rocksdb_ReadOptions_iterateLowerBound( */ void Java_org_rocksdb_ReadOptions_setTableFilter( JNIEnv*, jobject, jlong jhandle, jlong jjni_table_filter_handle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); auto* jni_table_filter = - reinterpret_cast(jjni_table_filter_handle); + reinterpret_cast( + jjni_table_filter_handle); opt->table_filter = jni_table_filter->GetTableFilterFunction(); } @@ -6874,7 +7047,7 @@ void Java_org_rocksdb_ReadOptions_setTableFilter( */ void Java_org_rocksdb_ReadOptions_setIterStartSeqnum( JNIEnv*, jobject, jlong jhandle, jlong jiter_start_seqnum) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); opt->iter_start_seqnum = static_cast(jiter_start_seqnum); } @@ -6885,12 +7058,12 @@ void Java_org_rocksdb_ReadOptions_setIterStartSeqnum( */ jlong Java_org_rocksdb_ReadOptions_iterStartSeqnum( JNIEnv*, jobject, jlong jhandle) { - auto* opt = reinterpret_cast(jhandle); + auto* opt = reinterpret_cast(jhandle); return static_cast(opt->iter_start_seqnum); } ///////////////////////////////////////////////////////////////////// -// rocksdb::ComparatorOptions +// ROCKSDB_NAMESPACE::ComparatorOptions /* * Class: org_rocksdb_ComparatorOptions @@ -6899,7 +7072,7 @@ jlong Java_org_rocksdb_ReadOptions_iterStartSeqnum( */ jlong Java_org_rocksdb_ComparatorOptions_newComparatorOptions( JNIEnv*, jclass) { - auto* comparator_opt = new rocksdb::ComparatorJniCallbackOptions(); + auto* comparator_opt = new ROCKSDB_NAMESPACE::ComparatorJniCallbackOptions(); return reinterpret_cast(comparator_opt); } @@ -6911,9 +7084,11 @@ jlong Java_org_rocksdb_ComparatorOptions_newComparatorOptions( jbyte Java_org_rocksdb_ComparatorOptions_reusedSynchronisationType( JNIEnv *, jobject, jlong jhandle) { auto* comparator_opt = - reinterpret_cast(jhandle); - return rocksdb::ReusedSynchronisationTypeJni::toJavaReusedSynchronisationType( - comparator_opt->reused_synchronisation_type); + reinterpret_cast( + jhandle); + return ROCKSDB_NAMESPACE::ReusedSynchronisationTypeJni:: + toJavaReusedSynchronisationType( + comparator_opt->reused_synchronisation_type); } /* @@ -6924,9 +7099,11 @@ jbyte Java_org_rocksdb_ComparatorOptions_reusedSynchronisationType( void Java_org_rocksdb_ComparatorOptions_setReusedSynchronisationType( JNIEnv*, jobject, jlong jhandle, jbyte jreused_synhcronisation_type) { auto* comparator_opt = - reinterpret_cast(jhandle); + reinterpret_cast( + jhandle); comparator_opt->reused_synchronisation_type = - rocksdb::ReusedSynchronisationTypeJni::toCppReusedSynchronisationType(jreused_synhcronisation_type); + ROCKSDB_NAMESPACE::ReusedSynchronisationTypeJni:: + toCppReusedSynchronisationType(jreused_synhcronisation_type); } /* @@ -6937,7 +7114,8 @@ void Java_org_rocksdb_ComparatorOptions_setReusedSynchronisationType( jboolean Java_org_rocksdb_ComparatorOptions_useDirectBuffer( JNIEnv*, jobject, jlong jhandle) { return static_cast( - reinterpret_cast(jhandle) + reinterpret_cast( + jhandle) ->direct_buffer); } @@ -6948,8 +7126,8 @@ jboolean Java_org_rocksdb_ComparatorOptions_useDirectBuffer( */ void Java_org_rocksdb_ComparatorOptions_setUseDirectBuffer( JNIEnv*, jobject, jlong jhandle, jboolean jdirect_buffer) { - reinterpret_cast(jhandle) - ->direct_buffer = jdirect_buffer == JNI_TRUE; + reinterpret_cast(jhandle) + ->direct_buffer = jdirect_buffer == JNI_TRUE; } /* @@ -6960,8 +7138,9 @@ void Java_org_rocksdb_ComparatorOptions_setUseDirectBuffer( jint Java_org_rocksdb_ComparatorOptions_maxReusedBufferSize( JNIEnv*, jobject, jlong jhandle) { return static_cast( - reinterpret_cast(jhandle) - ->max_reused_buffer_size); + reinterpret_cast( + jhandle) + ->max_reused_buffer_size); } /* @@ -6971,9 +7150,8 @@ jint Java_org_rocksdb_ComparatorOptions_maxReusedBufferSize( */ void Java_org_rocksdb_ComparatorOptions_setMaxReusedBufferSize( JNIEnv*, jobject, jlong jhandle, jint jmax_reused_buffer_size) { - reinterpret_cast(jhandle) - ->max_reused_buffer_size - = static_cast(jmax_reused_buffer_size); + reinterpret_cast(jhandle) + ->max_reused_buffer_size = static_cast(jmax_reused_buffer_size); } /* @@ -6984,13 +7162,14 @@ void Java_org_rocksdb_ComparatorOptions_setMaxReusedBufferSize( void Java_org_rocksdb_ComparatorOptions_disposeInternal( JNIEnv*, jobject, jlong jhandle) { auto* comparator_opt = - reinterpret_cast(jhandle); + reinterpret_cast( + jhandle); assert(comparator_opt != nullptr); delete comparator_opt; } ///////////////////////////////////////////////////////////////////// -// rocksdb::FlushOptions +// ROCKSDB_NAMESPACE::FlushOptions /* * Class: org_rocksdb_FlushOptions @@ -6999,7 +7178,7 @@ void Java_org_rocksdb_ComparatorOptions_disposeInternal( */ jlong Java_org_rocksdb_FlushOptions_newFlushOptions( JNIEnv*, jclass) { - auto* flush_opt = new rocksdb::FlushOptions(); + auto* flush_opt = new ROCKSDB_NAMESPACE::FlushOptions(); return reinterpret_cast(flush_opt); } @@ -7010,7 +7189,7 @@ jlong Java_org_rocksdb_FlushOptions_newFlushOptions( */ void Java_org_rocksdb_FlushOptions_setWaitForFlush( JNIEnv*, jobject, jlong jhandle, jboolean jwait) { - reinterpret_cast(jhandle)->wait = + reinterpret_cast(jhandle)->wait = static_cast(jwait); } @@ -7021,7 +7200,7 @@ void Java_org_rocksdb_FlushOptions_setWaitForFlush( */ jboolean Java_org_rocksdb_FlushOptions_waitForFlush( JNIEnv*, jobject, jlong jhandle) { - return reinterpret_cast(jhandle)->wait; + return reinterpret_cast(jhandle)->wait; } /* @@ -7031,7 +7210,8 @@ jboolean Java_org_rocksdb_FlushOptions_waitForFlush( */ void Java_org_rocksdb_FlushOptions_setAllowWriteStall( JNIEnv*, jobject, jlong jhandle, jboolean jallow_write_stall) { - auto* flush_options = reinterpret_cast(jhandle); + auto* flush_options = + reinterpret_cast(jhandle); flush_options->allow_write_stall = jallow_write_stall == JNI_TRUE; } @@ -7042,7 +7222,8 @@ void Java_org_rocksdb_FlushOptions_setAllowWriteStall( */ jboolean Java_org_rocksdb_FlushOptions_allowWriteStall( JNIEnv*, jobject, jlong jhandle) { - auto* flush_options = reinterpret_cast(jhandle); + auto* flush_options = + reinterpret_cast(jhandle); return static_cast(flush_options->allow_write_stall); } @@ -7053,7 +7234,7 @@ jboolean Java_org_rocksdb_FlushOptions_allowWriteStall( */ void Java_org_rocksdb_FlushOptions_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto* flush_opt = reinterpret_cast(jhandle); + auto* flush_opt = reinterpret_cast(jhandle); assert(flush_opt != nullptr); delete flush_opt; } diff --git a/java/rocksjni/options_util.cc b/java/rocksjni/options_util.cc index 7dd0078455..e195adafaf 100644 --- a/java/rocksjni/options_util.cc +++ b/java/rocksjni/options_util.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling C++ rocksdb::OptionsUtil methods from Java side. +// calling C++ ROCKSDB_NAMESPACE::OptionsUtil methods from Java side. #include #include @@ -18,17 +18,18 @@ void build_column_family_descriptor_list( JNIEnv* env, jobject jcfds, - std::vector& cf_descs) { - jmethodID add_mid = rocksdb::ListJni::getListAddMethodId(env); + std::vector& cf_descs) { + jmethodID add_mid = ROCKSDB_NAMESPACE::ListJni::getListAddMethodId(env); if (add_mid == nullptr) { // exception occurred accessing method return; } // Column family descriptor - for (rocksdb::ColumnFamilyDescriptor& cfd : cf_descs) { + for (ROCKSDB_NAMESPACE::ColumnFamilyDescriptor& cfd : cf_descs) { // Construct a ColumnFamilyDescriptor java object - jobject jcfd = rocksdb::ColumnFamilyDescriptorJni::construct(env, &cfd); + jobject jcfd = + ROCKSDB_NAMESPACE::ColumnFamilyDescriptorJni::construct(env, &cfd); if (env->ExceptionCheck()) { // exception occurred constructing object if (jcfd != nullptr) { @@ -58,19 +59,20 @@ void Java_org_rocksdb_OptionsUtil_loadLatestOptions( JNIEnv* env, jclass /*jcls*/, jstring jdbpath, jlong jenv_handle, jlong jdb_opts_handle, jobject jcfds, jboolean ignore_unknown_options) { jboolean has_exception = JNI_FALSE; - auto db_path = rocksdb::JniUtil::copyStdString(env, jdbpath, &has_exception); + auto db_path = + ROCKSDB_NAMESPACE::JniUtil::copyStdString(env, jdbpath, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return; } - std::vector cf_descs; - rocksdb::Status s = rocksdb::LoadLatestOptions( - db_path, reinterpret_cast(jenv_handle), - reinterpret_cast(jdb_opts_handle), &cf_descs, - ignore_unknown_options); + std::vector cf_descs; + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::LoadLatestOptions( + db_path, reinterpret_cast(jenv_handle), + reinterpret_cast(jdb_opts_handle), + &cf_descs, ignore_unknown_options); if (!s.ok()) { // error, raise an exception - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } else { build_column_family_descriptor_list(env, jcfds, cf_descs); } @@ -85,19 +87,20 @@ void Java_org_rocksdb_OptionsUtil_loadOptionsFromFile( JNIEnv* env, jclass /*jcls*/, jstring jopts_file_name, jlong jenv_handle, jlong jdb_opts_handle, jobject jcfds, jboolean ignore_unknown_options) { jboolean has_exception = JNI_FALSE; - auto opts_file_name = rocksdb::JniUtil::copyStdString(env, jopts_file_name, &has_exception); + auto opts_file_name = ROCKSDB_NAMESPACE::JniUtil::copyStdString( + env, jopts_file_name, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return; } - std::vector cf_descs; - rocksdb::Status s = rocksdb::LoadOptionsFromFile( - opts_file_name, reinterpret_cast(jenv_handle), - reinterpret_cast(jdb_opts_handle), &cf_descs, - ignore_unknown_options); + std::vector cf_descs; + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::LoadOptionsFromFile( + opts_file_name, reinterpret_cast(jenv_handle), + reinterpret_cast(jdb_opts_handle), + &cf_descs, ignore_unknown_options); if (!s.ok()) { // error, raise an exception - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } else { build_column_family_descriptor_list(env, jcfds, cf_descs); } @@ -111,18 +114,19 @@ void Java_org_rocksdb_OptionsUtil_loadOptionsFromFile( jstring Java_org_rocksdb_OptionsUtil_getLatestOptionsFileName( JNIEnv* env, jclass /*jcls*/, jstring jdbpath, jlong jenv_handle) { jboolean has_exception = JNI_FALSE; - auto db_path = rocksdb::JniUtil::copyStdString(env, jdbpath, &has_exception); + auto db_path = + ROCKSDB_NAMESPACE::JniUtil::copyStdString(env, jdbpath, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return nullptr; } std::string options_file_name; - rocksdb::Status s = rocksdb::GetLatestOptionsFileName( - db_path, reinterpret_cast(jenv_handle), + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::GetLatestOptionsFileName( + db_path, reinterpret_cast(jenv_handle), &options_file_name); if (!s.ok()) { // error, raise an exception - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } else { return env->NewStringUTF(options_file_name.c_str()); diff --git a/java/rocksjni/persistent_cache.cc b/java/rocksjni/persistent_cache.cc index 2b6fc60ba2..6776022e83 100644 --- a/java/rocksjni/persistent_cache.cc +++ b/java/rocksjni/persistent_cache.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::PersistentCache. +// ROCKSDB_NAMESPACE::PersistentCache. #include #include @@ -22,20 +22,23 @@ jlong Java_org_rocksdb_PersistentCache_newPersistentCache( JNIEnv* env, jclass, jlong jenv_handle, jstring jpath, jlong jsz, jlong jlogger_handle, jboolean joptimized_for_nvm) { - auto* rocks_env = reinterpret_cast(jenv_handle); + auto* rocks_env = reinterpret_cast(jenv_handle); jboolean has_exception = JNI_FALSE; - std::string path = rocksdb::JniUtil::copyStdString(env, jpath, &has_exception); + std::string path = + ROCKSDB_NAMESPACE::JniUtil::copyStdString(env, jpath, &has_exception); if (has_exception == JNI_TRUE) { return 0; } auto* logger = - reinterpret_cast*>(jlogger_handle); - auto* cache = new std::shared_ptr(nullptr); - rocksdb::Status s = rocksdb::NewPersistentCache( + reinterpret_cast*>( + jlogger_handle); + auto* cache = + new std::shared_ptr(nullptr); + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::NewPersistentCache( rocks_env, path, static_cast(jsz), *logger, static_cast(joptimized_for_nvm), cache); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } return reinterpret_cast(cache); } @@ -48,6 +51,7 @@ jlong Java_org_rocksdb_PersistentCache_newPersistentCache( void Java_org_rocksdb_PersistentCache_disposeInternal( JNIEnv*, jobject, jlong jhandle) { auto* cache = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); delete cache; // delete std::shared_ptr } diff --git a/java/rocksjni/portal.h b/java/rocksjni/portal.h index b4f70f5f88..deb88af455 100644 --- a/java/rocksjni/portal.h +++ b/java/rocksjni/portal.h @@ -45,7 +45,7 @@ #undef DELETE #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class JavaClass { public: @@ -275,34 +275,36 @@ class SubCodeJni : public JavaClass { return mid; } - static rocksdb::Status::SubCode toCppSubCode(const jbyte jsub_code) { + static ROCKSDB_NAMESPACE::Status::SubCode toCppSubCode( + const jbyte jsub_code) { switch (jsub_code) { case 0x0: - return rocksdb::Status::SubCode::kNone; + return ROCKSDB_NAMESPACE::Status::SubCode::kNone; case 0x1: - return rocksdb::Status::SubCode::kMutexTimeout; + return ROCKSDB_NAMESPACE::Status::SubCode::kMutexTimeout; case 0x2: - return rocksdb::Status::SubCode::kLockTimeout; + return ROCKSDB_NAMESPACE::Status::SubCode::kLockTimeout; case 0x3: - return rocksdb::Status::SubCode::kLockLimit; + return ROCKSDB_NAMESPACE::Status::SubCode::kLockLimit; case 0x4: - return rocksdb::Status::SubCode::kNoSpace; + return ROCKSDB_NAMESPACE::Status::SubCode::kNoSpace; case 0x5: - return rocksdb::Status::SubCode::kDeadlock; + return ROCKSDB_NAMESPACE::Status::SubCode::kDeadlock; case 0x6: - return rocksdb::Status::SubCode::kStaleFile; + return ROCKSDB_NAMESPACE::Status::SubCode::kStaleFile; case 0x7: - return rocksdb::Status::SubCode::kMemoryLimit; + return ROCKSDB_NAMESPACE::Status::SubCode::kMemoryLimit; case 0x7F: default: - return rocksdb::Status::SubCode::kNone; + return ROCKSDB_NAMESPACE::Status::SubCode::kNone; } } }; // The portal class for org.rocksdb.Status -class StatusJni : public RocksDBNativeClass { +class StatusJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.Status @@ -382,10 +384,10 @@ class StatusJni : public RocksDBNativeClass { /** * Create a new Java org.rocksdb.Status object with the same properties as - * the provided C++ rocksdb::Status object + * the provided C++ ROCKSDB_NAMESPACE::Status object * * @param env A pointer to the Java environment - * @param status The rocksdb::Status object + * @param status The ROCKSDB_NAMESPACE::Status object * * @return A reference to a Java org.rocksdb.Status object, or nullptr * if an an exception occurs @@ -436,38 +438,38 @@ class StatusJni : public RocksDBNativeClass { } // Returns the equivalent org.rocksdb.Status.Code for the provided - // C++ rocksdb::Status::Code enum - static jbyte toJavaStatusCode(const rocksdb::Status::Code& code) { + // C++ ROCKSDB_NAMESPACE::Status::Code enum + static jbyte toJavaStatusCode(const ROCKSDB_NAMESPACE::Status::Code& code) { switch (code) { - case rocksdb::Status::Code::kOk: + case ROCKSDB_NAMESPACE::Status::Code::kOk: return 0x0; - case rocksdb::Status::Code::kNotFound: + case ROCKSDB_NAMESPACE::Status::Code::kNotFound: return 0x1; - case rocksdb::Status::Code::kCorruption: + case ROCKSDB_NAMESPACE::Status::Code::kCorruption: return 0x2; - case rocksdb::Status::Code::kNotSupported: + case ROCKSDB_NAMESPACE::Status::Code::kNotSupported: return 0x3; - case rocksdb::Status::Code::kInvalidArgument: + case ROCKSDB_NAMESPACE::Status::Code::kInvalidArgument: return 0x4; - case rocksdb::Status::Code::kIOError: + case ROCKSDB_NAMESPACE::Status::Code::kIOError: return 0x5; - case rocksdb::Status::Code::kMergeInProgress: + case ROCKSDB_NAMESPACE::Status::Code::kMergeInProgress: return 0x6; - case rocksdb::Status::Code::kIncomplete: + case ROCKSDB_NAMESPACE::Status::Code::kIncomplete: return 0x7; - case rocksdb::Status::Code::kShutdownInProgress: + case ROCKSDB_NAMESPACE::Status::Code::kShutdownInProgress: return 0x8; - case rocksdb::Status::Code::kTimedOut: + case ROCKSDB_NAMESPACE::Status::Code::kTimedOut: return 0x9; - case rocksdb::Status::Code::kAborted: + case ROCKSDB_NAMESPACE::Status::Code::kAborted: return 0xA; - case rocksdb::Status::Code::kBusy: + case ROCKSDB_NAMESPACE::Status::Code::kBusy: return 0xB; - case rocksdb::Status::Code::kExpired: + case ROCKSDB_NAMESPACE::Status::Code::kExpired: return 0xC; - case rocksdb::Status::Code::kTryAgain: + case ROCKSDB_NAMESPACE::Status::Code::kTryAgain: return 0xD; - case rocksdb::Status::Code::kColumnFamilyDropped: + case ROCKSDB_NAMESPACE::Status::Code::kColumnFamilyDropped: return 0xE; default: return 0x7F; // undefined @@ -475,122 +477,133 @@ class StatusJni : public RocksDBNativeClass { } // Returns the equivalent org.rocksdb.Status.SubCode for the provided - // C++ rocksdb::Status::SubCode enum - static jbyte toJavaStatusSubCode(const rocksdb::Status::SubCode& subCode) { + // C++ ROCKSDB_NAMESPACE::Status::SubCode enum + static jbyte toJavaStatusSubCode( + const ROCKSDB_NAMESPACE::Status::SubCode& subCode) { switch (subCode) { - case rocksdb::Status::SubCode::kNone: + case ROCKSDB_NAMESPACE::Status::SubCode::kNone: return 0x0; - case rocksdb::Status::SubCode::kMutexTimeout: + case ROCKSDB_NAMESPACE::Status::SubCode::kMutexTimeout: return 0x1; - case rocksdb::Status::SubCode::kLockTimeout: + case ROCKSDB_NAMESPACE::Status::SubCode::kLockTimeout: return 0x2; - case rocksdb::Status::SubCode::kLockLimit: + case ROCKSDB_NAMESPACE::Status::SubCode::kLockLimit: return 0x3; - case rocksdb::Status::SubCode::kNoSpace: + case ROCKSDB_NAMESPACE::Status::SubCode::kNoSpace: return 0x4; - case rocksdb::Status::SubCode::kDeadlock: + case ROCKSDB_NAMESPACE::Status::SubCode::kDeadlock: return 0x5; - case rocksdb::Status::SubCode::kStaleFile: + case ROCKSDB_NAMESPACE::Status::SubCode::kStaleFile: return 0x6; - case rocksdb::Status::SubCode::kMemoryLimit: + case ROCKSDB_NAMESPACE::Status::SubCode::kMemoryLimit: return 0x7; default: return 0x7F; // undefined } } - static std::unique_ptr toCppStatus( + static std::unique_ptr toCppStatus( const jbyte jcode_value, const jbyte jsub_code_value) { - std::unique_ptr status; + std::unique_ptr status; switch (jcode_value) { case 0x0: //Ok - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::OK())); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::OK())); break; case 0x1: //NotFound - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::NotFound( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::NotFound( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0x2: //Corruption - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::Corruption( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::Corruption( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0x3: //NotSupported - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::NotSupported( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status( + ROCKSDB_NAMESPACE::Status::NotSupported( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode( + jsub_code_value)))); break; case 0x4: //InvalidArgument - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::InvalidArgument( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status( + ROCKSDB_NAMESPACE::Status::InvalidArgument( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode( + jsub_code_value)))); break; case 0x5: //IOError - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::IOError( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::IOError( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0x6: //MergeInProgress - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::MergeInProgress( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status( + ROCKSDB_NAMESPACE::Status::MergeInProgress( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode( + jsub_code_value)))); break; case 0x7: //Incomplete - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::Incomplete( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::Incomplete( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0x8: //ShutdownInProgress - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::ShutdownInProgress( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status( + ROCKSDB_NAMESPACE::Status::ShutdownInProgress( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode( + jsub_code_value)))); break; case 0x9: //TimedOut - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::TimedOut( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::TimedOut( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0xA: //Aborted - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::Aborted( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::Aborted( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0xB: //Busy - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::Busy( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::Busy( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0xC: //Expired - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::Expired( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::Expired( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0xD: //TryAgain - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::TryAgain( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::TryAgain( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0xE: // ColumnFamilyDropped - status = std::unique_ptr( - new rocksdb::Status(rocksdb::Status::ColumnFamilyDropped( - rocksdb::SubCodeJni::toCppSubCode(jsub_code_value)))); + status = std::unique_ptr( + new ROCKSDB_NAMESPACE::Status( + ROCKSDB_NAMESPACE::Status::ColumnFamilyDropped( + ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode( + jsub_code_value)))); break; case 0x7F: default: @@ -599,8 +612,10 @@ class StatusJni : public RocksDBNativeClass { return status; } - // Returns the equivalent rocksdb::Status for the Java org.rocksdb.Status - static std::unique_ptr toCppStatus(JNIEnv* env, const jobject jstatus) { + // Returns the equivalent ROCKSDB_NAMESPACE::Status for the Java + // org.rocksdb.Status + static std::unique_ptr toCppStatus( + JNIEnv* env, const jobject jstatus) { jmethodID mid_code = getCodeMethod(env); if (mid_code == nullptr) { // exception occurred @@ -612,7 +627,7 @@ class StatusJni : public RocksDBNativeClass { return nullptr; } - jmethodID mid_code_value = rocksdb::CodeJni::getValueMethod(env); + jmethodID mid_code_value = ROCKSDB_NAMESPACE::CodeJni::getValueMethod(env); if (mid_code_value == nullptr) { // exception occurred return nullptr; @@ -642,7 +657,8 @@ class StatusJni : public RocksDBNativeClass { jbyte jsub_code_value = 0x0; // None if (jsubCode != nullptr) { - jmethodID mid_subCode_value = rocksdb::SubCodeJni::getValueMethod(env); + jmethodID mid_subCode_value = + ROCKSDB_NAMESPACE::SubCodeJni::getValueMethod(env); if (mid_subCode_value == nullptr) { // exception occurred return nullptr; @@ -674,7 +690,7 @@ class StatusJni : public RocksDBNativeClass { return nullptr; } - std::unique_ptr status = + std::unique_ptr status = toCppStatus(jcode_value, jsub_code_value); // delete all local refs @@ -732,7 +748,7 @@ class RocksDBExceptionJni : * @return true if an exception was thrown, false otherwise */ static bool ThrowNew(JNIEnv* env, std::unique_ptr& s) { - return rocksdb::RocksDBExceptionJni::ThrowNew(env, *(s.get())); + return ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, *(s.get())); } /** @@ -932,7 +948,7 @@ class RocksDBExceptionJni : return mid; } - static std::unique_ptr toCppStatus( + static std::unique_ptr toCppStatus( JNIEnv* env, jthrowable jrocksdb_exception) { if(!env->IsInstanceOf(jrocksdb_exception, getJClass(env))) { // not an instance of RocksDBException @@ -956,7 +972,7 @@ class RocksDBExceptionJni : return nullptr; // no status available } - return rocksdb::StatusJni::toCppStatus(env, jstatus); + return ROCKSDB_NAMESPACE::StatusJni::toCppStatus(env, jstatus); } }; @@ -1617,8 +1633,8 @@ class JniUtil { */ static std::vector copyStrings(JNIEnv* env, jobjectArray jss, jboolean* has_exception) { - return rocksdb::JniUtil::copyStrings(env, jss, - env->GetArrayLength(jss), has_exception); + return ROCKSDB_NAMESPACE::JniUtil::copyStrings( + env, jss, env->GetArrayLength(jss), has_exception); } /** @@ -1944,7 +1960,7 @@ class JniUtil { for (jsize i = 0; i < len; i++) { const std::string *str = &((*strings)[i]); - jstring js = rocksdb::JniUtil::toJavaString(env, str); + jstring js = ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, str); if (js == nullptr) { env->DeleteLocalRef(jstrings); return nullptr; @@ -2006,7 +2022,8 @@ class JniUtil { // OutOfMemoryError("Requested array size exceeds VM limit") coming from VM static const size_t MAX_JARRAY_SIZE = (static_cast(1)) << 31; if(size > MAX_JARRAY_SIZE) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, "Requested array size exceeds VM limit"); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Requested array size exceeds VM limit"); return nullptr; } @@ -2029,7 +2046,7 @@ class JniUtil { } /** - * Copies bytes from a rocksdb::Slice to a jByteArray + * Copies bytes from a ROCKSDB_NAMESPACE::Slice to a jByteArray * * @param env A pointer to the java environment * @param bytes The bytes to copy @@ -2037,7 +2054,8 @@ class JniUtil { * @return the Java byte[] or nullptr if an exception occurs * * @throws RocksDBException thrown - * if memory size to copy exceeds general java specific array size limitation. + * if memory size to copy exceeds general java specific array size + * limitation. */ static jbyteArray copyBytes(JNIEnv* env, const Slice& bytes) { return createJavaByteArrayWithSizeCheck(env, bytes.data(), bytes.size()); @@ -2049,10 +2067,11 @@ class JniUtil { * * TODO(AR) could be used for RocksDB->Put etc. */ - static std::unique_ptr kv_op( - std::function op, - JNIEnv* env, jobject /*jobj*/, - jbyteArray jkey, jint jkey_len, + static std::unique_ptr kv_op( + std::function + op, + JNIEnv* env, jobject /*jobj*/, jbyteArray jkey, jint jkey_len, jbyteArray jvalue, jint jvalue_len) { jbyte* key = env->GetByteArrayElements(jkey, nullptr); if(env->ExceptionCheck()) { @@ -2069,9 +2088,10 @@ class JniUtil { return nullptr; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_len); - rocksdb::Slice value_slice(reinterpret_cast(value), - jvalue_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + jkey_len); + ROCKSDB_NAMESPACE::Slice value_slice(reinterpret_cast(value), + jvalue_len); auto status = op(key_slice, value_slice); @@ -2082,7 +2102,8 @@ class JniUtil { env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); } - return std::unique_ptr(new rocksdb::Status(status)); + return std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(status)); } /* @@ -2091,17 +2112,17 @@ class JniUtil { * * TODO(AR) could be used for RocksDB->Delete etc. */ - static std::unique_ptr k_op( - std::function op, - JNIEnv* env, jobject /*jobj*/, - jbyteArray jkey, jint jkey_len) { + static std::unique_ptr k_op( + std::function op, + JNIEnv* env, jobject /*jobj*/, jbyteArray jkey, jint jkey_len) { jbyte* key = env->GetByteArrayElements(jkey, nullptr); if(env->ExceptionCheck()) { // exception thrown: OutOfMemoryError return nullptr; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + jkey_len); auto status = op(key_slice); @@ -2109,26 +2130,29 @@ class JniUtil { env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); } - return std::unique_ptr(new rocksdb::Status(status)); + return std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(status)); } /* * Helper for operations on a value * for example WriteBatchWithIndex->GetFromBatch */ - static jbyteArray v_op( - std::function op, - JNIEnv* env, jbyteArray jkey, jint jkey_len) { + static jbyteArray v_op(std::function + op, + JNIEnv* env, jbyteArray jkey, jint jkey_len) { jbyte* key = env->GetByteArrayElements(jkey, nullptr); if(env->ExceptionCheck()) { // exception thrown: OutOfMemoryError return nullptr; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + jkey_len); std::string value; - rocksdb::Status s = op(key_slice, &value); + ROCKSDB_NAMESPACE::Status s = op(key_slice, &value); if(key != nullptr) { env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); @@ -2159,7 +2183,7 @@ class JniUtil { return jret_value; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } @@ -2238,32 +2262,36 @@ class JniUtil { * Helper for operations on a key and value * for example WriteBatch->Put * - * TODO(AR) could be extended to cover returning rocksdb::Status + * TODO(AR) could be extended to cover returning ROCKSDB_NAMESPACE::Status * from `op` and used for RocksDB->Put etc. */ - static void kv_op_direct( - std::function op, JNIEnv* env, - jobject jkey, jint jkey_off, jint jkey_len, jobject jval, jint jval_off, - jint jval_len) { + static void kv_op_direct(std::function + op, + JNIEnv* env, jobject jkey, jint jkey_off, + jint jkey_len, jobject jval, jint jval_off, + jint jval_len) { char* key = reinterpret_cast(env->GetDirectBufferAddress(jkey)); if (key == nullptr || env->GetDirectBufferCapacity(jkey) < (jkey_off + jkey_len)) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, "Invalid key argument"); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Invalid key argument"); return; } char* value = reinterpret_cast(env->GetDirectBufferAddress(jval)); if (value == nullptr || env->GetDirectBufferCapacity(jval) < (jval_off + jval_len)) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, "Invalid value argument"); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Invalid value argument"); return; } key += jkey_off; value += jval_off; - rocksdb::Slice key_slice(key, jkey_len); - rocksdb::Slice value_slice(value, jval_len); + ROCKSDB_NAMESPACE::Slice key_slice(key, jkey_len); + ROCKSDB_NAMESPACE::Slice value_slice(value, jval_len); op(key_slice, value_slice); } @@ -2272,22 +2300,23 @@ class JniUtil { * Helper for operations on a key and value * for example WriteBatch->Delete * - * TODO(AR) could be extended to cover returning rocksdb::Status + * TODO(AR) could be extended to cover returning ROCKSDB_NAMESPACE::Status * from `op` and used for RocksDB->Delete etc. */ - static void k_op_direct(std::function op, + static void k_op_direct(std::function op, JNIEnv* env, jobject jkey, jint jkey_off, jint jkey_len) { char* key = reinterpret_cast(env->GetDirectBufferAddress(jkey)); if (key == nullptr || env->GetDirectBufferCapacity(jkey) < (jkey_off + jkey_len)) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, "Invalid key argument"); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Invalid key argument"); return; } key += jkey_off; - rocksdb::Slice key_slice(key, jkey_len); + ROCKSDB_NAMESPACE::Slice key_slice(key, jkey_len); return op(key_slice); } @@ -2299,7 +2328,8 @@ class JniUtil { reinterpret_cast(env->GetDirectBufferAddress(jtarget)); if (target == nullptr || env->GetDirectBufferCapacity(jtarget) < (jtarget_off + jtarget_len)) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, "Invalid target argument"); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Invalid target argument"); return 0; } @@ -2411,7 +2441,8 @@ class HashMapJni : public JavaClass { */ template static bool putAll(JNIEnv* env, const jobject jhash_map, iterator_type iterator, iterator_type end, const FnMapKV &fn_map_kv) { - const jmethodID jmid_put = rocksdb::MapJni::getMapPutMethodId(env); + const jmethodID jmid_put = + ROCKSDB_NAMESPACE::MapJni::getMapPutMethodId(env); if (jmid_put == nullptr) { return false; } @@ -2457,23 +2488,30 @@ class HashMapJni : public JavaClass { return nullptr; } - const rocksdb::HashMapJni::FnMapKV fn_map_kv = - [env](const std::pair& kv) { - jstring jkey = rocksdb::JniUtil::toJavaString(env, &(kv.first), false); - if (env->ExceptionCheck()) { - // an error occurred - return std::unique_ptr>(nullptr); - } + const ROCKSDB_NAMESPACE::HashMapJni::FnMapKV< + const std::string, const std::string, jobject, jobject> + fn_map_kv = + [env](const std::pair& kv) { + jstring jkey = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &(kv.first), false); + if (env->ExceptionCheck()) { + // an error occurred + return std::unique_ptr>(nullptr); + } - jstring jvalue = rocksdb::JniUtil::toJavaString(env, &(kv.second), true); - if (env->ExceptionCheck()) { - // an error occurred - env->DeleteLocalRef(jkey); - return std::unique_ptr>(nullptr); - } + jstring jvalue = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &(kv.second), true); + if (env->ExceptionCheck()) { + // an error occurred + env->DeleteLocalRef(jkey); + return std::unique_ptr>(nullptr); + } - return std::unique_ptr>(new std::pair(static_cast(jkey), static_cast(jvalue))); - }; + return std::unique_ptr>( + new std::pair( + static_cast(jkey), + static_cast(jvalue))); + }; if (!putAll(env, jhash_map, map->begin(), map->end(), fn_map_kv)) { // exception occurred @@ -2506,23 +2544,29 @@ class HashMapJni : public JavaClass { return nullptr; } - const rocksdb::HashMapJni::FnMapKV fn_map_kv = - [env](const std::pair& kv) { - jstring jkey = rocksdb::JniUtil::toJavaString(env, &(kv.first), false); - if (env->ExceptionCheck()) { - // an error occurred - return std::unique_ptr>(nullptr); - } + const ROCKSDB_NAMESPACE::HashMapJni::FnMapKV< + const std::string, const uint32_t, jobject, jobject> + fn_map_kv = + [env](const std::pair& kv) { + jstring jkey = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &(kv.first), false); + if (env->ExceptionCheck()) { + // an error occurred + return std::unique_ptr>(nullptr); + } - jobject jvalue = rocksdb::IntegerJni::valueOf(env, static_cast(kv.second)); - if (env->ExceptionCheck()) { - // an error occurred - env->DeleteLocalRef(jkey); - return std::unique_ptr>(nullptr); - } + jobject jvalue = ROCKSDB_NAMESPACE::IntegerJni::valueOf( + env, static_cast(kv.second)); + if (env->ExceptionCheck()) { + // an error occurred + env->DeleteLocalRef(jkey); + return std::unique_ptr>(nullptr); + } - return std::unique_ptr>(new std::pair(static_cast(jkey), jvalue)); - }; + return std::unique_ptr>( + new std::pair(static_cast(jkey), + jvalue)); + }; if (!putAll(env, jhash_map, map->begin(), map->end(), fn_map_kv)) { // exception occurred @@ -2551,23 +2595,29 @@ class HashMapJni : public JavaClass { return nullptr; } - const rocksdb::HashMapJni::FnMapKV fn_map_kv = - [env](const std::pair& kv) { - jstring jkey = rocksdb::JniUtil::toJavaString(env, &(kv.first), false); - if (env->ExceptionCheck()) { - // an error occurred - return std::unique_ptr>(nullptr); - } + const ROCKSDB_NAMESPACE::HashMapJni::FnMapKV< + const std::string, const uint64_t, jobject, jobject> + fn_map_kv = + [env](const std::pair& kv) { + jstring jkey = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &(kv.first), false); + if (env->ExceptionCheck()) { + // an error occurred + return std::unique_ptr>(nullptr); + } - jobject jvalue = rocksdb::LongJni::valueOf(env, static_cast(kv.second)); - if (env->ExceptionCheck()) { - // an error occurred - env->DeleteLocalRef(jkey); - return std::unique_ptr>(nullptr); - } + jobject jvalue = ROCKSDB_NAMESPACE::LongJni::valueOf( + env, static_cast(kv.second)); + if (env->ExceptionCheck()) { + // an error occurred + env->DeleteLocalRef(jkey); + return std::unique_ptr>(nullptr); + } - return std::unique_ptr>(new std::pair(static_cast(jkey), jvalue)); - }; + return std::unique_ptr>( + new std::pair(static_cast(jkey), + jvalue)); + }; if (!putAll(env, jhash_map, map->begin(), map->end(), fn_map_kv)) { // exception occurred @@ -2596,23 +2646,28 @@ class HashMapJni : public JavaClass { return nullptr; } - const rocksdb::HashMapJni::FnMapKV fn_map_kv = - [env](const std::pair& kv) { - jobject jkey = rocksdb::IntegerJni::valueOf(env, static_cast(kv.first)); - if (env->ExceptionCheck()) { - // an error occurred - return std::unique_ptr>(nullptr); - } + const ROCKSDB_NAMESPACE::HashMapJni::FnMapKV + fn_map_kv = [env](const std::pair& kv) { + jobject jkey = ROCKSDB_NAMESPACE::IntegerJni::valueOf( + env, static_cast(kv.first)); + if (env->ExceptionCheck()) { + // an error occurred + return std::unique_ptr>(nullptr); + } - jobject jvalue = rocksdb::LongJni::valueOf(env, static_cast(kv.second)); - if (env->ExceptionCheck()) { - // an error occurred - env->DeleteLocalRef(jkey); - return std::unique_ptr>(nullptr); - } + jobject jvalue = ROCKSDB_NAMESPACE::LongJni::valueOf( + env, static_cast(kv.second)); + if (env->ExceptionCheck()) { + // an error occurred + env->DeleteLocalRef(jkey); + return std::unique_ptr>(nullptr); + } - return std::unique_ptr>(new std::pair(static_cast(jkey), jvalue)); - }; + return std::unique_ptr>( + new std::pair(static_cast(jkey), + jvalue)); + }; if (!putAll(env, jhash_map, map->begin(), map->end(), fn_map_kv)) { // exception occurred @@ -2624,7 +2679,8 @@ class HashMapJni : public JavaClass { }; // The portal class for org.rocksdb.RocksDB -class RocksDBJni : public RocksDBNativeClass { +class RocksDBJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.RocksDB @@ -2641,8 +2697,8 @@ class RocksDBJni : public RocksDBNativeClass { }; // The portal class for org.rocksdb.Options -class OptionsJni : public RocksDBNativeClass< - rocksdb::Options*, OptionsJni> { +class OptionsJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.Options @@ -2659,8 +2715,8 @@ class OptionsJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.DBOptions -class DBOptionsJni : public RocksDBNativeClass< - rocksdb::DBOptions*, DBOptionsJni> { +class DBOptionsJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.DBOptions @@ -2678,7 +2734,7 @@ class DBOptionsJni : public RocksDBNativeClass< // The portal class for org.rocksdb.ColumnFamilyOptions class ColumnFamilyOptionsJni - : public RocksDBNativeClass { public: /** @@ -2697,16 +2753,17 @@ class ColumnFamilyOptionsJni /** * Create a new Java org.rocksdb.ColumnFamilyOptions object with the same - * properties as the provided C++ rocksdb::ColumnFamilyOptions object + * properties as the provided C++ ROCKSDB_NAMESPACE::ColumnFamilyOptions + * object * * @param env A pointer to the Java environment - * @param cfoptions A pointer to rocksdb::ColumnFamilyOptions object + * @param cfoptions A pointer to ROCKSDB_NAMESPACE::ColumnFamilyOptions object * * @return A reference to a Java org.rocksdb.ColumnFamilyOptions object, or * nullptr if an an exception occurs */ static jobject construct(JNIEnv* env, const ColumnFamilyOptions* cfoptions) { - auto* cfo = new rocksdb::ColumnFamilyOptions(*cfoptions); + auto* cfo = new ROCKSDB_NAMESPACE::ColumnFamilyOptions(*cfoptions); jclass jclazz = getJClass(env); if(jclazz == nullptr) { // exception occurred accessing class @@ -2729,8 +2786,9 @@ class ColumnFamilyOptionsJni }; // The portal class for org.rocksdb.WriteOptions -class WriteOptionsJni : public RocksDBNativeClass< - rocksdb::WriteOptions*, WriteOptionsJni> { +class WriteOptionsJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.WriteOptions @@ -2747,8 +2805,9 @@ class WriteOptionsJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.ReadOptions -class ReadOptionsJni : public RocksDBNativeClass< - rocksdb::ReadOptions*, ReadOptionsJni> { +class ReadOptionsJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.ReadOptions @@ -2765,8 +2824,8 @@ class ReadOptionsJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.WriteBatch -class WriteBatchJni : public RocksDBNativeClass< - rocksdb::WriteBatch*, WriteBatchJni> { +class WriteBatchJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.WriteBatch @@ -2785,7 +2844,7 @@ class WriteBatchJni : public RocksDBNativeClass< * Create a new Java org.rocksdb.WriteBatch object * * @param env A pointer to the Java environment - * @param wb A pointer to rocksdb::WriteBatch object + * @param wb A pointer to ROCKSDB_NAMESPACE::WriteBatch object * * @return A reference to a Java org.rocksdb.WriteBatch object, or * nullptr if an an exception occurs @@ -2813,9 +2872,10 @@ class WriteBatchJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.WriteBatch.Handler -class WriteBatchHandlerJni : public RocksDBNativeClass< - const rocksdb::WriteBatchHandlerJniCallback*, - WriteBatchHandlerJni> { +class WriteBatchHandlerJni + : public RocksDBNativeClass< + const ROCKSDB_NAMESPACE::WriteBatchHandlerJniCallback*, + WriteBatchHandlerJni> { public: /** * Get the Java Class org.rocksdb.WriteBatch.Handler @@ -3231,7 +3291,8 @@ class WriteBatchSavePointJni : public JavaClass { * Create a new Java org.rocksdb.WriteBatch.SavePoint object * * @param env A pointer to the Java environment - * @param savePoint A pointer to rocksdb::WriteBatch::SavePoint object + * @param savePoint A pointer to ROCKSDB_NAMESPACE::WriteBatch::SavePoint + * object * * @return A reference to a Java org.rocksdb.WriteBatch.SavePoint object, or * nullptr if an an exception occurs @@ -3262,8 +3323,9 @@ class WriteBatchSavePointJni : public JavaClass { }; // The portal class for org.rocksdb.WriteBatchWithIndex -class WriteBatchWithIndexJni : public RocksDBNativeClass< - rocksdb::WriteBatchWithIndex*, WriteBatchWithIndexJni> { +class WriteBatchWithIndexJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.WriteBatchWithIndex @@ -3318,8 +3380,9 @@ class HistogramDataJni : public JavaClass { }; // The portal class for org.rocksdb.BackupableDBOptions -class BackupableDBOptionsJni : public RocksDBNativeClass< - rocksdb::BackupableDBOptions*, BackupableDBOptionsJni> { +class BackupableDBOptionsJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.BackupableDBOptions @@ -3337,8 +3400,9 @@ class BackupableDBOptionsJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.BackupEngine -class BackupEngineJni : public RocksDBNativeClass< - rocksdb::BackupEngine*, BackupEngineJni> { +class BackupEngineJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.BackupableEngine @@ -3355,8 +3419,8 @@ class BackupEngineJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.RocksIterator -class IteratorJni : public RocksDBNativeClass< - rocksdb::Iterator*, IteratorJni> { +class IteratorJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.RocksIterator @@ -3373,8 +3437,9 @@ class IteratorJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.Filter -class FilterJni : public RocksDBNativeClass< - std::shared_ptr*, FilterJni> { +class FilterJni + : public RocksDBNativeClass< + std::shared_ptr*, FilterJni> { public: /** * Get the Java Class org.rocksdb.Filter @@ -3391,8 +3456,9 @@ class FilterJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.ColumnFamilyHandle -class ColumnFamilyHandleJni : public RocksDBNativeClass< - rocksdb::ColumnFamilyHandle*, ColumnFamilyHandleJni> { +class ColumnFamilyHandleJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.ColumnFamilyHandle @@ -3410,8 +3476,9 @@ class ColumnFamilyHandleJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.FlushOptions -class FlushOptionsJni : public RocksDBNativeClass< - rocksdb::FlushOptions*, FlushOptionsJni> { +class FlushOptionsJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.FlushOptions @@ -3428,8 +3495,10 @@ class FlushOptionsJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.ComparatorOptions -class ComparatorOptionsJni : public RocksDBNativeClass< - rocksdb::ComparatorJniCallbackOptions*, ComparatorOptionsJni> { +class ComparatorOptionsJni + : public RocksDBNativeClass< + ROCKSDB_NAMESPACE::ComparatorJniCallbackOptions*, + ComparatorOptionsJni> { public: /** * Get the Java Class org.rocksdb.ComparatorOptions @@ -3446,9 +3515,10 @@ class ComparatorOptionsJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.AbstractCompactionFilterFactory -class AbstractCompactionFilterFactoryJni : public RocksDBNativeClass< - const rocksdb::CompactionFilterFactoryJniCallback*, - AbstractCompactionFilterFactoryJni> { +class AbstractCompactionFilterFactoryJni + : public RocksDBNativeClass< + const ROCKSDB_NAMESPACE::CompactionFilterFactoryJniCallback*, + AbstractCompactionFilterFactoryJni> { public: /** * Get the Java Class org.rocksdb.AbstractCompactionFilterFactory @@ -3509,9 +3579,10 @@ class AbstractCompactionFilterFactoryJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.AbstractTransactionNotifier -class AbstractTransactionNotifierJni : public RocksDBNativeClass< - const rocksdb::TransactionNotifierJniCallback*, - AbstractTransactionNotifierJni> { +class AbstractTransactionNotifierJni + : public RocksDBNativeClass< + const ROCKSDB_NAMESPACE::TransactionNotifierJniCallback*, + AbstractTransactionNotifierJni> { public: static jclass getJClass(JNIEnv* env) { return RocksDBNativeClass::getJClass(env, @@ -3603,9 +3674,9 @@ class AbstractComparatorJniBridge : public JavaClass { }; // The portal class for org.rocksdb.AbstractComparator -class AbstractComparatorJni : public RocksDBNativeClass< - const rocksdb::ComparatorJniCallback*, - AbstractComparatorJni> { +class AbstractComparatorJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.AbstractComparator @@ -3644,8 +3715,9 @@ class AbstractComparatorJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.AbstractSlice -class AbstractSliceJni : public NativeRocksMutableObject< - const rocksdb::Slice*, AbstractSliceJni> { +class AbstractSliceJni + : public NativeRocksMutableObject { public: /** * Get the Java Class org.rocksdb.AbstractSlice @@ -3662,8 +3734,9 @@ class AbstractSliceJni : public NativeRocksMutableObject< }; // The portal class for org.rocksdb.Slice -class SliceJni : public NativeRocksMutableObject< - const rocksdb::Slice*, AbstractSliceJni> { +class SliceJni + : public NativeRocksMutableObject { public: /** * Get the Java Class org.rocksdb.Slice @@ -3709,8 +3782,9 @@ class SliceJni : public NativeRocksMutableObject< }; // The portal class for org.rocksdb.DirectSlice -class DirectSliceJni : public NativeRocksMutableObject< - const rocksdb::Slice*, AbstractSliceJni> { +class DirectSliceJni + : public NativeRocksMutableObject { public: /** * Get the Java Class org.rocksdb.DirectSlice @@ -3834,19 +3908,21 @@ class BackupInfoListJni { */ static jobject getBackupInfo(JNIEnv* env, std::vector backup_infos) { - jclass jarray_list_clazz = rocksdb::ListJni::getArrayListClass(env); + jclass jarray_list_clazz = + ROCKSDB_NAMESPACE::ListJni::getArrayListClass(env); if(jarray_list_clazz == nullptr) { // exception occurred accessing class return nullptr; } - jmethodID cstr_mid = rocksdb::ListJni::getArrayListConstructorMethodId(env); + jmethodID cstr_mid = + ROCKSDB_NAMESPACE::ListJni::getArrayListConstructorMethodId(env); if(cstr_mid == nullptr) { // exception occurred accessing method return nullptr; } - jmethodID add_mid = rocksdb::ListJni::getListAddMethodId(env); + jmethodID add_mid = ROCKSDB_NAMESPACE::ListJni::getListAddMethodId(env); if(add_mid == nullptr) { // exception occurred accessing method return nullptr; @@ -3865,7 +3941,7 @@ class BackupInfoListJni { for (auto it = backup_infos.begin(); it != end; ++it) { auto backup_info = *it; - jobject obj = rocksdb::BackupInfoJni::construct0( + jobject obj = ROCKSDB_NAMESPACE::BackupInfoJni::construct0( env, backup_info.backup_id, backup_info.timestamp, backup_info.size, backup_info.number_files, backup_info.app_metadata); if(env->ExceptionCheck()) { @@ -4011,22 +4087,22 @@ class WriteTypeJni : public JavaClass { } // Returns the equivalent org.rocksdb.WBWIRocksIterator.WriteType for the - // provided C++ rocksdb::WriteType enum - static jbyte toJavaWriteType(const rocksdb::WriteType& writeType) { + // provided C++ ROCKSDB_NAMESPACE::WriteType enum + static jbyte toJavaWriteType(const ROCKSDB_NAMESPACE::WriteType& writeType) { switch (writeType) { - case rocksdb::WriteType::kPutRecord: + case ROCKSDB_NAMESPACE::WriteType::kPutRecord: return 0x0; - case rocksdb::WriteType::kMergeRecord: + case ROCKSDB_NAMESPACE::WriteType::kMergeRecord: return 0x1; - case rocksdb::WriteType::kDeleteRecord: + case ROCKSDB_NAMESPACE::WriteType::kDeleteRecord: return 0x2; - case rocksdb::WriteType::kSingleDeleteRecord: + case ROCKSDB_NAMESPACE::WriteType::kSingleDeleteRecord: return 0x3; - case rocksdb::WriteType::kDeleteRangeRecord: + case ROCKSDB_NAMESPACE::WriteType::kDeleteRangeRecord: return 0x4; - case rocksdb::WriteType::kLogDataRecord: + case ROCKSDB_NAMESPACE::WriteType::kLogDataRecord: return 0x5; - case rocksdb::WriteType::kXIDRecord: + case ROCKSDB_NAMESPACE::WriteType::kXIDRecord: return 0x6; default: return 0x7F; // undefined @@ -4217,8 +4293,9 @@ class InfoLogLevelJni : public JavaClass { }; // The portal class for org.rocksdb.Logger -class LoggerJni : public RocksDBNativeClass< - std::shared_ptr*, LoggerJni> { +class LoggerJni + : public RocksDBNativeClass< + std::shared_ptr*, LoggerJni> { public: /** * Get the Java Class org/rocksdb/Logger @@ -4275,17 +4352,18 @@ class BatchResultJni : public JavaClass { /** * Create a new Java org.rocksdb.TransactionLogIterator.BatchResult object - * with the same properties as the provided C++ rocksdb::BatchResult object + * with the same properties as the provided C++ ROCKSDB_NAMESPACE::BatchResult + * object * * @param env A pointer to the Java environment - * @param batch_result The rocksdb::BatchResult object + * @param batch_result The ROCKSDB_NAMESPACE::BatchResult object * * @return A reference to a Java * org.rocksdb.TransactionLogIterator.BatchResult object, * or nullptr if an an exception occurs */ static jobject construct(JNIEnv* env, - rocksdb::BatchResult& batch_result) { + ROCKSDB_NAMESPACE::BatchResult& batch_result) { jclass jclazz = getJClass(env); if(jclazz == nullptr) { // exception occurred accessing class @@ -4314,40 +4392,44 @@ class BatchResultJni : public JavaClass { // The portal class for org.rocksdb.BottommostLevelCompaction class BottommostLevelCompactionJni { public: - // Returns the equivalent org.rocksdb.BottommostLevelCompaction for the provided - // C++ rocksdb::BottommostLevelCompaction enum + // Returns the equivalent org.rocksdb.BottommostLevelCompaction for the + // provided C++ ROCKSDB_NAMESPACE::BottommostLevelCompaction enum static jint toJavaBottommostLevelCompaction( - const rocksdb::BottommostLevelCompaction& bottommost_level_compaction) { + const ROCKSDB_NAMESPACE::BottommostLevelCompaction& + bottommost_level_compaction) { switch(bottommost_level_compaction) { - case rocksdb::BottommostLevelCompaction::kSkip: + case ROCKSDB_NAMESPACE::BottommostLevelCompaction::kSkip: return 0x0; - case rocksdb::BottommostLevelCompaction::kIfHaveCompactionFilter: + case ROCKSDB_NAMESPACE::BottommostLevelCompaction:: + kIfHaveCompactionFilter: return 0x1; - case rocksdb::BottommostLevelCompaction::kForce: + case ROCKSDB_NAMESPACE::BottommostLevelCompaction::kForce: return 0x2; - case rocksdb::BottommostLevelCompaction::kForceOptimized: + case ROCKSDB_NAMESPACE::BottommostLevelCompaction::kForceOptimized: return 0x3; default: return 0x7F; // undefined } } - // Returns the equivalent C++ rocksdb::BottommostLevelCompaction enum for the - // provided Java org.rocksdb.BottommostLevelCompaction - static rocksdb::BottommostLevelCompaction toCppBottommostLevelCompaction( - jint bottommost_level_compaction) { + // Returns the equivalent C++ ROCKSDB_NAMESPACE::BottommostLevelCompaction + // enum for the provided Java org.rocksdb.BottommostLevelCompaction + static ROCKSDB_NAMESPACE::BottommostLevelCompaction + toCppBottommostLevelCompaction(jint bottommost_level_compaction) { switch(bottommost_level_compaction) { case 0x0: - return rocksdb::BottommostLevelCompaction::kSkip; + return ROCKSDB_NAMESPACE::BottommostLevelCompaction::kSkip; case 0x1: - return rocksdb::BottommostLevelCompaction::kIfHaveCompactionFilter; + return ROCKSDB_NAMESPACE::BottommostLevelCompaction:: + kIfHaveCompactionFilter; case 0x2: - return rocksdb::BottommostLevelCompaction::kForce; + return ROCKSDB_NAMESPACE::BottommostLevelCompaction::kForce; case 0x3: - return rocksdb::BottommostLevelCompaction::kForceOptimized; + return ROCKSDB_NAMESPACE::BottommostLevelCompaction::kForceOptimized; default: // undefined/default - return rocksdb::BottommostLevelCompaction::kIfHaveCompactionFilter; + return ROCKSDB_NAMESPACE::BottommostLevelCompaction:: + kIfHaveCompactionFilter; } } }; @@ -4356,31 +4438,36 @@ class BottommostLevelCompactionJni { class CompactionStopStyleJni { public: // Returns the equivalent org.rocksdb.CompactionStopStyle for the provided - // C++ rocksdb::CompactionStopStyle enum + // C++ ROCKSDB_NAMESPACE::CompactionStopStyle enum static jbyte toJavaCompactionStopStyle( - const rocksdb::CompactionStopStyle& compaction_stop_style) { + const ROCKSDB_NAMESPACE::CompactionStopStyle& compaction_stop_style) { switch(compaction_stop_style) { - case rocksdb::CompactionStopStyle::kCompactionStopStyleSimilarSize: + case ROCKSDB_NAMESPACE::CompactionStopStyle:: + kCompactionStopStyleSimilarSize: return 0x0; - case rocksdb::CompactionStopStyle::kCompactionStopStyleTotalSize: + case ROCKSDB_NAMESPACE::CompactionStopStyle:: + kCompactionStopStyleTotalSize: return 0x1; default: return 0x7F; // undefined } } - // Returns the equivalent C++ rocksdb::CompactionStopStyle enum for the - // provided Java org.rocksdb.CompactionStopStyle - static rocksdb::CompactionStopStyle toCppCompactionStopStyle( + // Returns the equivalent C++ ROCKSDB_NAMESPACE::CompactionStopStyle enum for + // the provided Java org.rocksdb.CompactionStopStyle + static ROCKSDB_NAMESPACE::CompactionStopStyle toCppCompactionStopStyle( jbyte jcompaction_stop_style) { switch(jcompaction_stop_style) { case 0x0: - return rocksdb::CompactionStopStyle::kCompactionStopStyleSimilarSize; + return ROCKSDB_NAMESPACE::CompactionStopStyle:: + kCompactionStopStyleSimilarSize; case 0x1: - return rocksdb::CompactionStopStyle::kCompactionStopStyleTotalSize; + return ROCKSDB_NAMESPACE::CompactionStopStyle:: + kCompactionStopStyleTotalSize; default: // undefined/default - return rocksdb::CompactionStopStyle::kCompactionStopStyleSimilarSize; + return ROCKSDB_NAMESPACE::CompactionStopStyle:: + kCompactionStopStyleSimilarSize; } } }; @@ -4389,56 +4476,56 @@ class CompactionStopStyleJni { class CompressionTypeJni { public: // Returns the equivalent org.rocksdb.CompressionType for the provided - // C++ rocksdb::CompressionType enum + // C++ ROCKSDB_NAMESPACE::CompressionType enum static jbyte toJavaCompressionType( - const rocksdb::CompressionType& compression_type) { + const ROCKSDB_NAMESPACE::CompressionType& compression_type) { switch(compression_type) { - case rocksdb::CompressionType::kNoCompression: + case ROCKSDB_NAMESPACE::CompressionType::kNoCompression: return 0x0; - case rocksdb::CompressionType::kSnappyCompression: + case ROCKSDB_NAMESPACE::CompressionType::kSnappyCompression: return 0x1; - case rocksdb::CompressionType::kZlibCompression: + case ROCKSDB_NAMESPACE::CompressionType::kZlibCompression: return 0x2; - case rocksdb::CompressionType::kBZip2Compression: + case ROCKSDB_NAMESPACE::CompressionType::kBZip2Compression: return 0x3; - case rocksdb::CompressionType::kLZ4Compression: + case ROCKSDB_NAMESPACE::CompressionType::kLZ4Compression: return 0x4; - case rocksdb::CompressionType::kLZ4HCCompression: + case ROCKSDB_NAMESPACE::CompressionType::kLZ4HCCompression: return 0x5; - case rocksdb::CompressionType::kXpressCompression: + case ROCKSDB_NAMESPACE::CompressionType::kXpressCompression: return 0x6; - case rocksdb::CompressionType::kZSTD: + case ROCKSDB_NAMESPACE::CompressionType::kZSTD: return 0x7; - case rocksdb::CompressionType::kDisableCompressionOption: + case ROCKSDB_NAMESPACE::CompressionType::kDisableCompressionOption: default: return 0x7F; } } - // Returns the equivalent C++ rocksdb::CompressionType enum for the + // Returns the equivalent C++ ROCKSDB_NAMESPACE::CompressionType enum for the // provided Java org.rocksdb.CompressionType - static rocksdb::CompressionType toCppCompressionType( + static ROCKSDB_NAMESPACE::CompressionType toCppCompressionType( jbyte jcompression_type) { switch(jcompression_type) { case 0x0: - return rocksdb::CompressionType::kNoCompression; + return ROCKSDB_NAMESPACE::CompressionType::kNoCompression; case 0x1: - return rocksdb::CompressionType::kSnappyCompression; + return ROCKSDB_NAMESPACE::CompressionType::kSnappyCompression; case 0x2: - return rocksdb::CompressionType::kZlibCompression; + return ROCKSDB_NAMESPACE::CompressionType::kZlibCompression; case 0x3: - return rocksdb::CompressionType::kBZip2Compression; + return ROCKSDB_NAMESPACE::CompressionType::kBZip2Compression; case 0x4: - return rocksdb::CompressionType::kLZ4Compression; + return ROCKSDB_NAMESPACE::CompressionType::kLZ4Compression; case 0x5: - return rocksdb::CompressionType::kLZ4HCCompression; + return ROCKSDB_NAMESPACE::CompressionType::kLZ4HCCompression; case 0x6: - return rocksdb::CompressionType::kXpressCompression; + return ROCKSDB_NAMESPACE::CompressionType::kXpressCompression; case 0x7: - return rocksdb::CompressionType::kZSTD; + return ROCKSDB_NAMESPACE::CompressionType::kZSTD; case 0x7F: default: - return rocksdb::CompressionType::kDisableCompressionOption; + return ROCKSDB_NAMESPACE::CompressionType::kDisableCompressionOption; } } }; @@ -4447,39 +4534,39 @@ class CompressionTypeJni { class CompactionPriorityJni { public: // Returns the equivalent org.rocksdb.CompactionPriority for the provided - // C++ rocksdb::CompactionPri enum + // C++ ROCKSDB_NAMESPACE::CompactionPri enum static jbyte toJavaCompactionPriority( - const rocksdb::CompactionPri& compaction_priority) { + const ROCKSDB_NAMESPACE::CompactionPri& compaction_priority) { switch(compaction_priority) { - case rocksdb::CompactionPri::kByCompensatedSize: + case ROCKSDB_NAMESPACE::CompactionPri::kByCompensatedSize: return 0x0; - case rocksdb::CompactionPri::kOldestLargestSeqFirst: + case ROCKSDB_NAMESPACE::CompactionPri::kOldestLargestSeqFirst: return 0x1; - case rocksdb::CompactionPri::kOldestSmallestSeqFirst: + case ROCKSDB_NAMESPACE::CompactionPri::kOldestSmallestSeqFirst: return 0x2; - case rocksdb::CompactionPri::kMinOverlappingRatio: + case ROCKSDB_NAMESPACE::CompactionPri::kMinOverlappingRatio: return 0x3; default: return 0x0; // undefined } } - // Returns the equivalent C++ rocksdb::CompactionPri enum for the + // Returns the equivalent C++ ROCKSDB_NAMESPACE::CompactionPri enum for the // provided Java org.rocksdb.CompactionPriority - static rocksdb::CompactionPri toCppCompactionPriority( + static ROCKSDB_NAMESPACE::CompactionPri toCppCompactionPriority( jbyte jcompaction_priority) { switch(jcompaction_priority) { case 0x0: - return rocksdb::CompactionPri::kByCompensatedSize; + return ROCKSDB_NAMESPACE::CompactionPri::kByCompensatedSize; case 0x1: - return rocksdb::CompactionPri::kOldestLargestSeqFirst; + return ROCKSDB_NAMESPACE::CompactionPri::kOldestLargestSeqFirst; case 0x2: - return rocksdb::CompactionPri::kOldestSmallestSeqFirst; + return ROCKSDB_NAMESPACE::CompactionPri::kOldestSmallestSeqFirst; case 0x3: - return rocksdb::CompactionPri::kMinOverlappingRatio; + return ROCKSDB_NAMESPACE::CompactionPri::kMinOverlappingRatio; default: // undefined/default - return rocksdb::CompactionPri::kByCompensatedSize; + return ROCKSDB_NAMESPACE::CompactionPri::kByCompensatedSize; } } }; @@ -4488,17 +4575,17 @@ class CompactionPriorityJni { class AccessHintJni { public: // Returns the equivalent org.rocksdb.AccessHint for the provided - // C++ rocksdb::DBOptions::AccessHint enum + // C++ ROCKSDB_NAMESPACE::DBOptions::AccessHint enum static jbyte toJavaAccessHint( - const rocksdb::DBOptions::AccessHint& access_hint) { + const ROCKSDB_NAMESPACE::DBOptions::AccessHint& access_hint) { switch(access_hint) { - case rocksdb::DBOptions::AccessHint::NONE: + case ROCKSDB_NAMESPACE::DBOptions::AccessHint::NONE: return 0x0; - case rocksdb::DBOptions::AccessHint::NORMAL: + case ROCKSDB_NAMESPACE::DBOptions::AccessHint::NORMAL: return 0x1; - case rocksdb::DBOptions::AccessHint::SEQUENTIAL: + case ROCKSDB_NAMESPACE::DBOptions::AccessHint::SEQUENTIAL: return 0x2; - case rocksdb::DBOptions::AccessHint::WILLNEED: + case ROCKSDB_NAMESPACE::DBOptions::AccessHint::WILLNEED: return 0x3; default: // undefined/default @@ -4506,21 +4593,22 @@ class AccessHintJni { } } - // Returns the equivalent C++ rocksdb::DBOptions::AccessHint enum for the - // provided Java org.rocksdb.AccessHint - static rocksdb::DBOptions::AccessHint toCppAccessHint(jbyte jaccess_hint) { + // Returns the equivalent C++ ROCKSDB_NAMESPACE::DBOptions::AccessHint enum + // for the provided Java org.rocksdb.AccessHint + static ROCKSDB_NAMESPACE::DBOptions::AccessHint toCppAccessHint( + jbyte jaccess_hint) { switch(jaccess_hint) { case 0x0: - return rocksdb::DBOptions::AccessHint::NONE; + return ROCKSDB_NAMESPACE::DBOptions::AccessHint::NONE; case 0x1: - return rocksdb::DBOptions::AccessHint::NORMAL; + return ROCKSDB_NAMESPACE::DBOptions::AccessHint::NORMAL; case 0x2: - return rocksdb::DBOptions::AccessHint::SEQUENTIAL; + return ROCKSDB_NAMESPACE::DBOptions::AccessHint::SEQUENTIAL; case 0x3: - return rocksdb::DBOptions::AccessHint::WILLNEED; + return ROCKSDB_NAMESPACE::DBOptions::AccessHint::WILLNEED; default: // undefined/default - return rocksdb::DBOptions::AccessHint::NORMAL; + return ROCKSDB_NAMESPACE::DBOptions::AccessHint::NORMAL; } } }; @@ -4529,17 +4617,17 @@ class AccessHintJni { class WALRecoveryModeJni { public: // Returns the equivalent org.rocksdb.WALRecoveryMode for the provided - // C++ rocksdb::WALRecoveryMode enum + // C++ ROCKSDB_NAMESPACE::WALRecoveryMode enum static jbyte toJavaWALRecoveryMode( - const rocksdb::WALRecoveryMode& wal_recovery_mode) { + const ROCKSDB_NAMESPACE::WALRecoveryMode& wal_recovery_mode) { switch(wal_recovery_mode) { - case rocksdb::WALRecoveryMode::kTolerateCorruptedTailRecords: + case ROCKSDB_NAMESPACE::WALRecoveryMode::kTolerateCorruptedTailRecords: return 0x0; - case rocksdb::WALRecoveryMode::kAbsoluteConsistency: + case ROCKSDB_NAMESPACE::WALRecoveryMode::kAbsoluteConsistency: return 0x1; - case rocksdb::WALRecoveryMode::kPointInTimeRecovery: + case ROCKSDB_NAMESPACE::WALRecoveryMode::kPointInTimeRecovery: return 0x2; - case rocksdb::WALRecoveryMode::kSkipAnyCorruptedRecords: + case ROCKSDB_NAMESPACE::WALRecoveryMode::kSkipAnyCorruptedRecords: return 0x3; default: // undefined/default @@ -4547,21 +4635,23 @@ class WALRecoveryModeJni { } } - // Returns the equivalent C++ rocksdb::WALRecoveryMode enum for the + // Returns the equivalent C++ ROCKSDB_NAMESPACE::WALRecoveryMode enum for the // provided Java org.rocksdb.WALRecoveryMode - static rocksdb::WALRecoveryMode toCppWALRecoveryMode(jbyte jwal_recovery_mode) { + static ROCKSDB_NAMESPACE::WALRecoveryMode toCppWALRecoveryMode( + jbyte jwal_recovery_mode) { switch(jwal_recovery_mode) { case 0x0: - return rocksdb::WALRecoveryMode::kTolerateCorruptedTailRecords; + return ROCKSDB_NAMESPACE::WALRecoveryMode:: + kTolerateCorruptedTailRecords; case 0x1: - return rocksdb::WALRecoveryMode::kAbsoluteConsistency; + return ROCKSDB_NAMESPACE::WALRecoveryMode::kAbsoluteConsistency; case 0x2: - return rocksdb::WALRecoveryMode::kPointInTimeRecovery; + return ROCKSDB_NAMESPACE::WALRecoveryMode::kPointInTimeRecovery; case 0x3: - return rocksdb::WALRecoveryMode::kSkipAnyCorruptedRecords; + return ROCKSDB_NAMESPACE::WALRecoveryMode::kSkipAnyCorruptedRecords; default: // undefined/default - return rocksdb::WALRecoveryMode::kPointInTimeRecovery; + return ROCKSDB_NAMESPACE::WALRecoveryMode::kPointInTimeRecovery; } } }; @@ -4570,292 +4660,291 @@ class WALRecoveryModeJni { class TickerTypeJni { public: // Returns the equivalent org.rocksdb.TickerType for the provided - // C++ rocksdb::Tickers enum - static jbyte toJavaTickerType( - const rocksdb::Tickers& tickers) { + // C++ ROCKSDB_NAMESPACE::Tickers enum + static jbyte toJavaTickerType(const ROCKSDB_NAMESPACE::Tickers& tickers) { switch(tickers) { - case rocksdb::Tickers::BLOCK_CACHE_MISS: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_MISS: return 0x0; - case rocksdb::Tickers::BLOCK_CACHE_HIT: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_HIT: return 0x1; - case rocksdb::Tickers::BLOCK_CACHE_ADD: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_ADD: return 0x2; - case rocksdb::Tickers::BLOCK_CACHE_ADD_FAILURES: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_ADD_FAILURES: return 0x3; - case rocksdb::Tickers::BLOCK_CACHE_INDEX_MISS: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_MISS: return 0x4; - case rocksdb::Tickers::BLOCK_CACHE_INDEX_HIT: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_HIT: return 0x5; - case rocksdb::Tickers::BLOCK_CACHE_INDEX_ADD: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_ADD: return 0x6; - case rocksdb::Tickers::BLOCK_CACHE_INDEX_BYTES_INSERT: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_BYTES_INSERT: return 0x7; - case rocksdb::Tickers::BLOCK_CACHE_INDEX_BYTES_EVICT: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_BYTES_EVICT: return 0x8; - case rocksdb::Tickers::BLOCK_CACHE_FILTER_MISS: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_MISS: return 0x9; - case rocksdb::Tickers::BLOCK_CACHE_FILTER_HIT: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_HIT: return 0xA; - case rocksdb::Tickers::BLOCK_CACHE_FILTER_ADD: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_ADD: return 0xB; - case rocksdb::Tickers::BLOCK_CACHE_FILTER_BYTES_INSERT: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_BYTES_INSERT: return 0xC; - case rocksdb::Tickers::BLOCK_CACHE_FILTER_BYTES_EVICT: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_BYTES_EVICT: return 0xD; - case rocksdb::Tickers::BLOCK_CACHE_DATA_MISS: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_MISS: return 0xE; - case rocksdb::Tickers::BLOCK_CACHE_DATA_HIT: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_HIT: return 0xF; - case rocksdb::Tickers::BLOCK_CACHE_DATA_ADD: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_ADD: return 0x10; - case rocksdb::Tickers::BLOCK_CACHE_DATA_BYTES_INSERT: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_BYTES_INSERT: return 0x11; - case rocksdb::Tickers::BLOCK_CACHE_BYTES_READ: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_BYTES_READ: return 0x12; - case rocksdb::Tickers::BLOCK_CACHE_BYTES_WRITE: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_BYTES_WRITE: return 0x13; - case rocksdb::Tickers::BLOOM_FILTER_USEFUL: + case ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_USEFUL: return 0x14; - case rocksdb::Tickers::PERSISTENT_CACHE_HIT: + case ROCKSDB_NAMESPACE::Tickers::PERSISTENT_CACHE_HIT: return 0x15; - case rocksdb::Tickers::PERSISTENT_CACHE_MISS: + case ROCKSDB_NAMESPACE::Tickers::PERSISTENT_CACHE_MISS: return 0x16; - case rocksdb::Tickers::SIM_BLOCK_CACHE_HIT: + case ROCKSDB_NAMESPACE::Tickers::SIM_BLOCK_CACHE_HIT: return 0x17; - case rocksdb::Tickers::SIM_BLOCK_CACHE_MISS: + case ROCKSDB_NAMESPACE::Tickers::SIM_BLOCK_CACHE_MISS: return 0x18; - case rocksdb::Tickers::MEMTABLE_HIT: + case ROCKSDB_NAMESPACE::Tickers::MEMTABLE_HIT: return 0x19; - case rocksdb::Tickers::MEMTABLE_MISS: + case ROCKSDB_NAMESPACE::Tickers::MEMTABLE_MISS: return 0x1A; - case rocksdb::Tickers::GET_HIT_L0: + case ROCKSDB_NAMESPACE::Tickers::GET_HIT_L0: return 0x1B; - case rocksdb::Tickers::GET_HIT_L1: + case ROCKSDB_NAMESPACE::Tickers::GET_HIT_L1: return 0x1C; - case rocksdb::Tickers::GET_HIT_L2_AND_UP: + case ROCKSDB_NAMESPACE::Tickers::GET_HIT_L2_AND_UP: return 0x1D; - case rocksdb::Tickers::COMPACTION_KEY_DROP_NEWER_ENTRY: + case ROCKSDB_NAMESPACE::Tickers::COMPACTION_KEY_DROP_NEWER_ENTRY: return 0x1E; - case rocksdb::Tickers::COMPACTION_KEY_DROP_OBSOLETE: + case ROCKSDB_NAMESPACE::Tickers::COMPACTION_KEY_DROP_OBSOLETE: return 0x1F; - case rocksdb::Tickers::COMPACTION_KEY_DROP_RANGE_DEL: + case ROCKSDB_NAMESPACE::Tickers::COMPACTION_KEY_DROP_RANGE_DEL: return 0x20; - case rocksdb::Tickers::COMPACTION_KEY_DROP_USER: + case ROCKSDB_NAMESPACE::Tickers::COMPACTION_KEY_DROP_USER: return 0x21; - case rocksdb::Tickers::COMPACTION_RANGE_DEL_DROP_OBSOLETE: + case ROCKSDB_NAMESPACE::Tickers::COMPACTION_RANGE_DEL_DROP_OBSOLETE: return 0x22; - case rocksdb::Tickers::NUMBER_KEYS_WRITTEN: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_KEYS_WRITTEN: return 0x23; - case rocksdb::Tickers::NUMBER_KEYS_READ: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_KEYS_READ: return 0x24; - case rocksdb::Tickers::NUMBER_KEYS_UPDATED: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_KEYS_UPDATED: return 0x25; - case rocksdb::Tickers::BYTES_WRITTEN: + case ROCKSDB_NAMESPACE::Tickers::BYTES_WRITTEN: return 0x26; - case rocksdb::Tickers::BYTES_READ: + case ROCKSDB_NAMESPACE::Tickers::BYTES_READ: return 0x27; - case rocksdb::Tickers::NUMBER_DB_SEEK: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_SEEK: return 0x28; - case rocksdb::Tickers::NUMBER_DB_NEXT: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_NEXT: return 0x29; - case rocksdb::Tickers::NUMBER_DB_PREV: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_PREV: return 0x2A; - case rocksdb::Tickers::NUMBER_DB_SEEK_FOUND: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_SEEK_FOUND: return 0x2B; - case rocksdb::Tickers::NUMBER_DB_NEXT_FOUND: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_NEXT_FOUND: return 0x2C; - case rocksdb::Tickers::NUMBER_DB_PREV_FOUND: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_PREV_FOUND: return 0x2D; - case rocksdb::Tickers::ITER_BYTES_READ: + case ROCKSDB_NAMESPACE::Tickers::ITER_BYTES_READ: return 0x2E; - case rocksdb::Tickers::NO_FILE_CLOSES: + case ROCKSDB_NAMESPACE::Tickers::NO_FILE_CLOSES: return 0x2F; - case rocksdb::Tickers::NO_FILE_OPENS: + case ROCKSDB_NAMESPACE::Tickers::NO_FILE_OPENS: return 0x30; - case rocksdb::Tickers::NO_FILE_ERRORS: + case ROCKSDB_NAMESPACE::Tickers::NO_FILE_ERRORS: return 0x31; - case rocksdb::Tickers::STALL_L0_SLOWDOWN_MICROS: + case ROCKSDB_NAMESPACE::Tickers::STALL_L0_SLOWDOWN_MICROS: return 0x32; - case rocksdb::Tickers::STALL_MEMTABLE_COMPACTION_MICROS: + case ROCKSDB_NAMESPACE::Tickers::STALL_MEMTABLE_COMPACTION_MICROS: return 0x33; - case rocksdb::Tickers::STALL_L0_NUM_FILES_MICROS: + case ROCKSDB_NAMESPACE::Tickers::STALL_L0_NUM_FILES_MICROS: return 0x34; - case rocksdb::Tickers::STALL_MICROS: + case ROCKSDB_NAMESPACE::Tickers::STALL_MICROS: return 0x35; - case rocksdb::Tickers::DB_MUTEX_WAIT_MICROS: + case ROCKSDB_NAMESPACE::Tickers::DB_MUTEX_WAIT_MICROS: return 0x36; - case rocksdb::Tickers::RATE_LIMIT_DELAY_MILLIS: + case ROCKSDB_NAMESPACE::Tickers::RATE_LIMIT_DELAY_MILLIS: return 0x37; - case rocksdb::Tickers::NO_ITERATORS: + case ROCKSDB_NAMESPACE::Tickers::NO_ITERATORS: return 0x38; - case rocksdb::Tickers::NUMBER_MULTIGET_CALLS: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_CALLS: return 0x39; - case rocksdb::Tickers::NUMBER_MULTIGET_KEYS_READ: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_KEYS_READ: return 0x3A; - case rocksdb::Tickers::NUMBER_MULTIGET_BYTES_READ: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_BYTES_READ: return 0x3B; - case rocksdb::Tickers::NUMBER_FILTERED_DELETES: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_FILTERED_DELETES: return 0x3C; - case rocksdb::Tickers::NUMBER_MERGE_FAILURES: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_MERGE_FAILURES: return 0x3D; - case rocksdb::Tickers::BLOOM_FILTER_PREFIX_CHECKED: + case ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_PREFIX_CHECKED: return 0x3E; - case rocksdb::Tickers::BLOOM_FILTER_PREFIX_USEFUL: + case ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_PREFIX_USEFUL: return 0x3F; - case rocksdb::Tickers::NUMBER_OF_RESEEKS_IN_ITERATION: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_OF_RESEEKS_IN_ITERATION: return 0x40; - case rocksdb::Tickers::GET_UPDATES_SINCE_CALLS: + case ROCKSDB_NAMESPACE::Tickers::GET_UPDATES_SINCE_CALLS: return 0x41; - case rocksdb::Tickers::BLOCK_CACHE_COMPRESSED_MISS: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_COMPRESSED_MISS: return 0x42; - case rocksdb::Tickers::BLOCK_CACHE_COMPRESSED_HIT: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_COMPRESSED_HIT: return 0x43; - case rocksdb::Tickers::BLOCK_CACHE_COMPRESSED_ADD: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_COMPRESSED_ADD: return 0x44; - case rocksdb::Tickers::BLOCK_CACHE_COMPRESSED_ADD_FAILURES: + case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_COMPRESSED_ADD_FAILURES: return 0x45; - case rocksdb::Tickers::WAL_FILE_SYNCED: + case ROCKSDB_NAMESPACE::Tickers::WAL_FILE_SYNCED: return 0x46; - case rocksdb::Tickers::WAL_FILE_BYTES: + case ROCKSDB_NAMESPACE::Tickers::WAL_FILE_BYTES: return 0x47; - case rocksdb::Tickers::WRITE_DONE_BY_SELF: + case ROCKSDB_NAMESPACE::Tickers::WRITE_DONE_BY_SELF: return 0x48; - case rocksdb::Tickers::WRITE_DONE_BY_OTHER: + case ROCKSDB_NAMESPACE::Tickers::WRITE_DONE_BY_OTHER: return 0x49; - case rocksdb::Tickers::WRITE_TIMEDOUT: + case ROCKSDB_NAMESPACE::Tickers::WRITE_TIMEDOUT: return 0x4A; - case rocksdb::Tickers::WRITE_WITH_WAL: + case ROCKSDB_NAMESPACE::Tickers::WRITE_WITH_WAL: return 0x4B; - case rocksdb::Tickers::COMPACT_READ_BYTES: + case ROCKSDB_NAMESPACE::Tickers::COMPACT_READ_BYTES: return 0x4C; - case rocksdb::Tickers::COMPACT_WRITE_BYTES: + case ROCKSDB_NAMESPACE::Tickers::COMPACT_WRITE_BYTES: return 0x4D; - case rocksdb::Tickers::FLUSH_WRITE_BYTES: + case ROCKSDB_NAMESPACE::Tickers::FLUSH_WRITE_BYTES: return 0x4E; - case rocksdb::Tickers::NUMBER_DIRECT_LOAD_TABLE_PROPERTIES: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_DIRECT_LOAD_TABLE_PROPERTIES: return 0x4F; - case rocksdb::Tickers::NUMBER_SUPERVERSION_ACQUIRES: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_SUPERVERSION_ACQUIRES: return 0x50; - case rocksdb::Tickers::NUMBER_SUPERVERSION_RELEASES: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_SUPERVERSION_RELEASES: return 0x51; - case rocksdb::Tickers::NUMBER_SUPERVERSION_CLEANUPS: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_SUPERVERSION_CLEANUPS: return 0x52; - case rocksdb::Tickers::NUMBER_BLOCK_COMPRESSED: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_BLOCK_COMPRESSED: return 0x53; - case rocksdb::Tickers::NUMBER_BLOCK_DECOMPRESSED: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_BLOCK_DECOMPRESSED: return 0x54; - case rocksdb::Tickers::NUMBER_BLOCK_NOT_COMPRESSED: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_BLOCK_NOT_COMPRESSED: return 0x55; - case rocksdb::Tickers::MERGE_OPERATION_TOTAL_TIME: + case ROCKSDB_NAMESPACE::Tickers::MERGE_OPERATION_TOTAL_TIME: return 0x56; - case rocksdb::Tickers::FILTER_OPERATION_TOTAL_TIME: + case ROCKSDB_NAMESPACE::Tickers::FILTER_OPERATION_TOTAL_TIME: return 0x57; - case rocksdb::Tickers::ROW_CACHE_HIT: + case ROCKSDB_NAMESPACE::Tickers::ROW_CACHE_HIT: return 0x58; - case rocksdb::Tickers::ROW_CACHE_MISS: + case ROCKSDB_NAMESPACE::Tickers::ROW_CACHE_MISS: return 0x59; - case rocksdb::Tickers::READ_AMP_ESTIMATE_USEFUL_BYTES: + case ROCKSDB_NAMESPACE::Tickers::READ_AMP_ESTIMATE_USEFUL_BYTES: return 0x5A; - case rocksdb::Tickers::READ_AMP_TOTAL_READ_BYTES: + case ROCKSDB_NAMESPACE::Tickers::READ_AMP_TOTAL_READ_BYTES: return 0x5B; - case rocksdb::Tickers::NUMBER_RATE_LIMITER_DRAINS: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_RATE_LIMITER_DRAINS: return 0x5C; - case rocksdb::Tickers::NUMBER_ITER_SKIP: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_ITER_SKIP: return 0x5D; - case rocksdb::Tickers::NUMBER_MULTIGET_KEYS_FOUND: + case ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_KEYS_FOUND: return 0x5E; - case rocksdb::Tickers::NO_ITERATOR_CREATED: + case ROCKSDB_NAMESPACE::Tickers::NO_ITERATOR_CREATED: // -0x01 to fixate the new value that incorrectly changed TICKER_ENUM_MAX. return -0x01; - case rocksdb::Tickers::NO_ITERATOR_DELETED: + case ROCKSDB_NAMESPACE::Tickers::NO_ITERATOR_DELETED: return 0x60; - case rocksdb::Tickers::COMPACTION_OPTIMIZED_DEL_DROP_OBSOLETE: + case ROCKSDB_NAMESPACE::Tickers::COMPACTION_OPTIMIZED_DEL_DROP_OBSOLETE: return 0x61; - case rocksdb::Tickers::COMPACTION_CANCELLED: + case ROCKSDB_NAMESPACE::Tickers::COMPACTION_CANCELLED: return 0x62; - case rocksdb::Tickers::BLOOM_FILTER_FULL_POSITIVE: + case ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_FULL_POSITIVE: return 0x63; - case rocksdb::Tickers::BLOOM_FILTER_FULL_TRUE_POSITIVE: + case ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_FULL_TRUE_POSITIVE: return 0x64; - case rocksdb::Tickers::BLOB_DB_NUM_PUT: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_PUT: return 0x65; - case rocksdb::Tickers::BLOB_DB_NUM_WRITE: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_WRITE: return 0x66; - case rocksdb::Tickers::BLOB_DB_NUM_GET: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_GET: return 0x67; - case rocksdb::Tickers::BLOB_DB_NUM_MULTIGET: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_MULTIGET: return 0x68; - case rocksdb::Tickers::BLOB_DB_NUM_SEEK: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_SEEK: return 0x69; - case rocksdb::Tickers::BLOB_DB_NUM_NEXT: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_NEXT: return 0x6A; - case rocksdb::Tickers::BLOB_DB_NUM_PREV: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_PREV: return 0x6B; - case rocksdb::Tickers::BLOB_DB_NUM_KEYS_WRITTEN: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_KEYS_WRITTEN: return 0x6C; - case rocksdb::Tickers::BLOB_DB_NUM_KEYS_READ: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_KEYS_READ: return 0x6D; - case rocksdb::Tickers::BLOB_DB_BYTES_WRITTEN: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BYTES_WRITTEN: return 0x6E; - case rocksdb::Tickers::BLOB_DB_BYTES_READ: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BYTES_READ: return 0x6F; - case rocksdb::Tickers::BLOB_DB_WRITE_INLINED: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_WRITE_INLINED: return 0x70; - case rocksdb::Tickers::BLOB_DB_WRITE_INLINED_TTL: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_WRITE_INLINED_TTL: return 0x71; - case rocksdb::Tickers::BLOB_DB_WRITE_BLOB: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_WRITE_BLOB: return 0x72; - case rocksdb::Tickers::BLOB_DB_WRITE_BLOB_TTL: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_WRITE_BLOB_TTL: return 0x73; - case rocksdb::Tickers::BLOB_DB_BLOB_FILE_BYTES_WRITTEN: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_FILE_BYTES_WRITTEN: return 0x74; - case rocksdb::Tickers::BLOB_DB_BLOB_FILE_BYTES_READ: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_FILE_BYTES_READ: return 0x75; - case rocksdb::Tickers::BLOB_DB_BLOB_FILE_SYNCED: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_FILE_SYNCED: return 0x76; - case rocksdb::Tickers::BLOB_DB_BLOB_INDEX_EXPIRED_COUNT: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_INDEX_EXPIRED_COUNT: return 0x77; - case rocksdb::Tickers::BLOB_DB_BLOB_INDEX_EXPIRED_SIZE: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_INDEX_EXPIRED_SIZE: return 0x78; - case rocksdb::Tickers::BLOB_DB_BLOB_INDEX_EVICTED_COUNT: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_INDEX_EVICTED_COUNT: return 0x79; - case rocksdb::Tickers::BLOB_DB_BLOB_INDEX_EVICTED_SIZE: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_INDEX_EVICTED_SIZE: return 0x7A; - case rocksdb::Tickers::BLOB_DB_GC_NUM_FILES: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_NUM_FILES: return 0x7B; - case rocksdb::Tickers::BLOB_DB_GC_NUM_NEW_FILES: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_NUM_NEW_FILES: return 0x7C; - case rocksdb::Tickers::BLOB_DB_GC_FAILURES: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_FAILURES: return 0x7D; - case rocksdb::Tickers::BLOB_DB_GC_NUM_KEYS_OVERWRITTEN: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_NUM_KEYS_OVERWRITTEN: return 0x7E; - case rocksdb::Tickers::BLOB_DB_GC_NUM_KEYS_EXPIRED: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_NUM_KEYS_EXPIRED: return 0x7F; - case rocksdb::Tickers::BLOB_DB_GC_NUM_KEYS_RELOCATED: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_NUM_KEYS_RELOCATED: return -0x02; - case rocksdb::Tickers::BLOB_DB_GC_BYTES_OVERWRITTEN: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_BYTES_OVERWRITTEN: return -0x03; - case rocksdb::Tickers::BLOB_DB_GC_BYTES_EXPIRED: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_BYTES_EXPIRED: return -0x04; - case rocksdb::Tickers::BLOB_DB_GC_BYTES_RELOCATED: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_BYTES_RELOCATED: return -0x05; - case rocksdb::Tickers::BLOB_DB_FIFO_NUM_FILES_EVICTED: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_FIFO_NUM_FILES_EVICTED: return -0x06; - case rocksdb::Tickers::BLOB_DB_FIFO_NUM_KEYS_EVICTED: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_FIFO_NUM_KEYS_EVICTED: return -0x07; - case rocksdb::Tickers::BLOB_DB_FIFO_BYTES_EVICTED: + case ROCKSDB_NAMESPACE::Tickers::BLOB_DB_FIFO_BYTES_EVICTED: return -0x08; - case rocksdb::Tickers::TXN_PREPARE_MUTEX_OVERHEAD: + case ROCKSDB_NAMESPACE::Tickers::TXN_PREPARE_MUTEX_OVERHEAD: return -0x09; - case rocksdb::Tickers::TXN_OLD_COMMIT_MAP_MUTEX_OVERHEAD: + case ROCKSDB_NAMESPACE::Tickers::TXN_OLD_COMMIT_MAP_MUTEX_OVERHEAD: return -0x0A; - case rocksdb::Tickers::TXN_DUPLICATE_KEY_OVERHEAD: + case ROCKSDB_NAMESPACE::Tickers::TXN_DUPLICATE_KEY_OVERHEAD: return -0x0B; - case rocksdb::Tickers::TXN_SNAPSHOT_MUTEX_OVERHEAD: + case ROCKSDB_NAMESPACE::Tickers::TXN_SNAPSHOT_MUTEX_OVERHEAD: return -0x0C; - case rocksdb::Tickers::TXN_GET_TRY_AGAIN: + case ROCKSDB_NAMESPACE::Tickers::TXN_GET_TRY_AGAIN: return -0x0D; - case rocksdb::Tickers::TICKER_ENUM_MAX: + case ROCKSDB_NAMESPACE::Tickers::TICKER_ENUM_MAX: // 0x5F for backwards compatibility on current minor version. return 0x5F; default: @@ -4864,298 +4953,299 @@ class TickerTypeJni { } } - // Returns the equivalent C++ rocksdb::Tickers enum for the + // Returns the equivalent C++ ROCKSDB_NAMESPACE::Tickers enum for the // provided Java org.rocksdb.TickerType - static rocksdb::Tickers toCppTickers(jbyte jticker_type) { + static ROCKSDB_NAMESPACE::Tickers toCppTickers(jbyte jticker_type) { switch(jticker_type) { case 0x0: - return rocksdb::Tickers::BLOCK_CACHE_MISS; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_MISS; case 0x1: - return rocksdb::Tickers::BLOCK_CACHE_HIT; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_HIT; case 0x2: - return rocksdb::Tickers::BLOCK_CACHE_ADD; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_ADD; case 0x3: - return rocksdb::Tickers::BLOCK_CACHE_ADD_FAILURES; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_ADD_FAILURES; case 0x4: - return rocksdb::Tickers::BLOCK_CACHE_INDEX_MISS; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_MISS; case 0x5: - return rocksdb::Tickers::BLOCK_CACHE_INDEX_HIT; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_HIT; case 0x6: - return rocksdb::Tickers::BLOCK_CACHE_INDEX_ADD; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_ADD; case 0x7: - return rocksdb::Tickers::BLOCK_CACHE_INDEX_BYTES_INSERT; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_BYTES_INSERT; case 0x8: - return rocksdb::Tickers::BLOCK_CACHE_INDEX_BYTES_EVICT; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_BYTES_EVICT; case 0x9: - return rocksdb::Tickers::BLOCK_CACHE_FILTER_MISS; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_MISS; case 0xA: - return rocksdb::Tickers::BLOCK_CACHE_FILTER_HIT; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_HIT; case 0xB: - return rocksdb::Tickers::BLOCK_CACHE_FILTER_ADD; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_ADD; case 0xC: - return rocksdb::Tickers::BLOCK_CACHE_FILTER_BYTES_INSERT; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_BYTES_INSERT; case 0xD: - return rocksdb::Tickers::BLOCK_CACHE_FILTER_BYTES_EVICT; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_BYTES_EVICT; case 0xE: - return rocksdb::Tickers::BLOCK_CACHE_DATA_MISS; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_MISS; case 0xF: - return rocksdb::Tickers::BLOCK_CACHE_DATA_HIT; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_HIT; case 0x10: - return rocksdb::Tickers::BLOCK_CACHE_DATA_ADD; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_ADD; case 0x11: - return rocksdb::Tickers::BLOCK_CACHE_DATA_BYTES_INSERT; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_BYTES_INSERT; case 0x12: - return rocksdb::Tickers::BLOCK_CACHE_BYTES_READ; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_BYTES_READ; case 0x13: - return rocksdb::Tickers::BLOCK_CACHE_BYTES_WRITE; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_BYTES_WRITE; case 0x14: - return rocksdb::Tickers::BLOOM_FILTER_USEFUL; + return ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_USEFUL; case 0x15: - return rocksdb::Tickers::PERSISTENT_CACHE_HIT; + return ROCKSDB_NAMESPACE::Tickers::PERSISTENT_CACHE_HIT; case 0x16: - return rocksdb::Tickers::PERSISTENT_CACHE_MISS; + return ROCKSDB_NAMESPACE::Tickers::PERSISTENT_CACHE_MISS; case 0x17: - return rocksdb::Tickers::SIM_BLOCK_CACHE_HIT; + return ROCKSDB_NAMESPACE::Tickers::SIM_BLOCK_CACHE_HIT; case 0x18: - return rocksdb::Tickers::SIM_BLOCK_CACHE_MISS; + return ROCKSDB_NAMESPACE::Tickers::SIM_BLOCK_CACHE_MISS; case 0x19: - return rocksdb::Tickers::MEMTABLE_HIT; + return ROCKSDB_NAMESPACE::Tickers::MEMTABLE_HIT; case 0x1A: - return rocksdb::Tickers::MEMTABLE_MISS; + return ROCKSDB_NAMESPACE::Tickers::MEMTABLE_MISS; case 0x1B: - return rocksdb::Tickers::GET_HIT_L0; + return ROCKSDB_NAMESPACE::Tickers::GET_HIT_L0; case 0x1C: - return rocksdb::Tickers::GET_HIT_L1; + return ROCKSDB_NAMESPACE::Tickers::GET_HIT_L1; case 0x1D: - return rocksdb::Tickers::GET_HIT_L2_AND_UP; + return ROCKSDB_NAMESPACE::Tickers::GET_HIT_L2_AND_UP; case 0x1E: - return rocksdb::Tickers::COMPACTION_KEY_DROP_NEWER_ENTRY; + return ROCKSDB_NAMESPACE::Tickers::COMPACTION_KEY_DROP_NEWER_ENTRY; case 0x1F: - return rocksdb::Tickers::COMPACTION_KEY_DROP_OBSOLETE; + return ROCKSDB_NAMESPACE::Tickers::COMPACTION_KEY_DROP_OBSOLETE; case 0x20: - return rocksdb::Tickers::COMPACTION_KEY_DROP_RANGE_DEL; + return ROCKSDB_NAMESPACE::Tickers::COMPACTION_KEY_DROP_RANGE_DEL; case 0x21: - return rocksdb::Tickers::COMPACTION_KEY_DROP_USER; + return ROCKSDB_NAMESPACE::Tickers::COMPACTION_KEY_DROP_USER; case 0x22: - return rocksdb::Tickers::COMPACTION_RANGE_DEL_DROP_OBSOLETE; + return ROCKSDB_NAMESPACE::Tickers::COMPACTION_RANGE_DEL_DROP_OBSOLETE; case 0x23: - return rocksdb::Tickers::NUMBER_KEYS_WRITTEN; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_KEYS_WRITTEN; case 0x24: - return rocksdb::Tickers::NUMBER_KEYS_READ; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_KEYS_READ; case 0x25: - return rocksdb::Tickers::NUMBER_KEYS_UPDATED; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_KEYS_UPDATED; case 0x26: - return rocksdb::Tickers::BYTES_WRITTEN; + return ROCKSDB_NAMESPACE::Tickers::BYTES_WRITTEN; case 0x27: - return rocksdb::Tickers::BYTES_READ; + return ROCKSDB_NAMESPACE::Tickers::BYTES_READ; case 0x28: - return rocksdb::Tickers::NUMBER_DB_SEEK; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_SEEK; case 0x29: - return rocksdb::Tickers::NUMBER_DB_NEXT; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_NEXT; case 0x2A: - return rocksdb::Tickers::NUMBER_DB_PREV; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_PREV; case 0x2B: - return rocksdb::Tickers::NUMBER_DB_SEEK_FOUND; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_SEEK_FOUND; case 0x2C: - return rocksdb::Tickers::NUMBER_DB_NEXT_FOUND; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_NEXT_FOUND; case 0x2D: - return rocksdb::Tickers::NUMBER_DB_PREV_FOUND; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_PREV_FOUND; case 0x2E: - return rocksdb::Tickers::ITER_BYTES_READ; + return ROCKSDB_NAMESPACE::Tickers::ITER_BYTES_READ; case 0x2F: - return rocksdb::Tickers::NO_FILE_CLOSES; + return ROCKSDB_NAMESPACE::Tickers::NO_FILE_CLOSES; case 0x30: - return rocksdb::Tickers::NO_FILE_OPENS; + return ROCKSDB_NAMESPACE::Tickers::NO_FILE_OPENS; case 0x31: - return rocksdb::Tickers::NO_FILE_ERRORS; + return ROCKSDB_NAMESPACE::Tickers::NO_FILE_ERRORS; case 0x32: - return rocksdb::Tickers::STALL_L0_SLOWDOWN_MICROS; + return ROCKSDB_NAMESPACE::Tickers::STALL_L0_SLOWDOWN_MICROS; case 0x33: - return rocksdb::Tickers::STALL_MEMTABLE_COMPACTION_MICROS; + return ROCKSDB_NAMESPACE::Tickers::STALL_MEMTABLE_COMPACTION_MICROS; case 0x34: - return rocksdb::Tickers::STALL_L0_NUM_FILES_MICROS; + return ROCKSDB_NAMESPACE::Tickers::STALL_L0_NUM_FILES_MICROS; case 0x35: - return rocksdb::Tickers::STALL_MICROS; + return ROCKSDB_NAMESPACE::Tickers::STALL_MICROS; case 0x36: - return rocksdb::Tickers::DB_MUTEX_WAIT_MICROS; + return ROCKSDB_NAMESPACE::Tickers::DB_MUTEX_WAIT_MICROS; case 0x37: - return rocksdb::Tickers::RATE_LIMIT_DELAY_MILLIS; + return ROCKSDB_NAMESPACE::Tickers::RATE_LIMIT_DELAY_MILLIS; case 0x38: - return rocksdb::Tickers::NO_ITERATORS; + return ROCKSDB_NAMESPACE::Tickers::NO_ITERATORS; case 0x39: - return rocksdb::Tickers::NUMBER_MULTIGET_CALLS; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_CALLS; case 0x3A: - return rocksdb::Tickers::NUMBER_MULTIGET_KEYS_READ; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_KEYS_READ; case 0x3B: - return rocksdb::Tickers::NUMBER_MULTIGET_BYTES_READ; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_BYTES_READ; case 0x3C: - return rocksdb::Tickers::NUMBER_FILTERED_DELETES; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_FILTERED_DELETES; case 0x3D: - return rocksdb::Tickers::NUMBER_MERGE_FAILURES; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_MERGE_FAILURES; case 0x3E: - return rocksdb::Tickers::BLOOM_FILTER_PREFIX_CHECKED; + return ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_PREFIX_CHECKED; case 0x3F: - return rocksdb::Tickers::BLOOM_FILTER_PREFIX_USEFUL; + return ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_PREFIX_USEFUL; case 0x40: - return rocksdb::Tickers::NUMBER_OF_RESEEKS_IN_ITERATION; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_OF_RESEEKS_IN_ITERATION; case 0x41: - return rocksdb::Tickers::GET_UPDATES_SINCE_CALLS; + return ROCKSDB_NAMESPACE::Tickers::GET_UPDATES_SINCE_CALLS; case 0x42: - return rocksdb::Tickers::BLOCK_CACHE_COMPRESSED_MISS; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_COMPRESSED_MISS; case 0x43: - return rocksdb::Tickers::BLOCK_CACHE_COMPRESSED_HIT; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_COMPRESSED_HIT; case 0x44: - return rocksdb::Tickers::BLOCK_CACHE_COMPRESSED_ADD; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_COMPRESSED_ADD; case 0x45: - return rocksdb::Tickers::BLOCK_CACHE_COMPRESSED_ADD_FAILURES; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_COMPRESSED_ADD_FAILURES; case 0x46: - return rocksdb::Tickers::WAL_FILE_SYNCED; + return ROCKSDB_NAMESPACE::Tickers::WAL_FILE_SYNCED; case 0x47: - return rocksdb::Tickers::WAL_FILE_BYTES; + return ROCKSDB_NAMESPACE::Tickers::WAL_FILE_BYTES; case 0x48: - return rocksdb::Tickers::WRITE_DONE_BY_SELF; + return ROCKSDB_NAMESPACE::Tickers::WRITE_DONE_BY_SELF; case 0x49: - return rocksdb::Tickers::WRITE_DONE_BY_OTHER; + return ROCKSDB_NAMESPACE::Tickers::WRITE_DONE_BY_OTHER; case 0x4A: - return rocksdb::Tickers::WRITE_TIMEDOUT; + return ROCKSDB_NAMESPACE::Tickers::WRITE_TIMEDOUT; case 0x4B: - return rocksdb::Tickers::WRITE_WITH_WAL; + return ROCKSDB_NAMESPACE::Tickers::WRITE_WITH_WAL; case 0x4C: - return rocksdb::Tickers::COMPACT_READ_BYTES; + return ROCKSDB_NAMESPACE::Tickers::COMPACT_READ_BYTES; case 0x4D: - return rocksdb::Tickers::COMPACT_WRITE_BYTES; + return ROCKSDB_NAMESPACE::Tickers::COMPACT_WRITE_BYTES; case 0x4E: - return rocksdb::Tickers::FLUSH_WRITE_BYTES; + return ROCKSDB_NAMESPACE::Tickers::FLUSH_WRITE_BYTES; case 0x4F: - return rocksdb::Tickers::NUMBER_DIRECT_LOAD_TABLE_PROPERTIES; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_DIRECT_LOAD_TABLE_PROPERTIES; case 0x50: - return rocksdb::Tickers::NUMBER_SUPERVERSION_ACQUIRES; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_SUPERVERSION_ACQUIRES; case 0x51: - return rocksdb::Tickers::NUMBER_SUPERVERSION_RELEASES; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_SUPERVERSION_RELEASES; case 0x52: - return rocksdb::Tickers::NUMBER_SUPERVERSION_CLEANUPS; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_SUPERVERSION_CLEANUPS; case 0x53: - return rocksdb::Tickers::NUMBER_BLOCK_COMPRESSED; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_BLOCK_COMPRESSED; case 0x54: - return rocksdb::Tickers::NUMBER_BLOCK_DECOMPRESSED; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_BLOCK_DECOMPRESSED; case 0x55: - return rocksdb::Tickers::NUMBER_BLOCK_NOT_COMPRESSED; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_BLOCK_NOT_COMPRESSED; case 0x56: - return rocksdb::Tickers::MERGE_OPERATION_TOTAL_TIME; + return ROCKSDB_NAMESPACE::Tickers::MERGE_OPERATION_TOTAL_TIME; case 0x57: - return rocksdb::Tickers::FILTER_OPERATION_TOTAL_TIME; + return ROCKSDB_NAMESPACE::Tickers::FILTER_OPERATION_TOTAL_TIME; case 0x58: - return rocksdb::Tickers::ROW_CACHE_HIT; + return ROCKSDB_NAMESPACE::Tickers::ROW_CACHE_HIT; case 0x59: - return rocksdb::Tickers::ROW_CACHE_MISS; + return ROCKSDB_NAMESPACE::Tickers::ROW_CACHE_MISS; case 0x5A: - return rocksdb::Tickers::READ_AMP_ESTIMATE_USEFUL_BYTES; + return ROCKSDB_NAMESPACE::Tickers::READ_AMP_ESTIMATE_USEFUL_BYTES; case 0x5B: - return rocksdb::Tickers::READ_AMP_TOTAL_READ_BYTES; + return ROCKSDB_NAMESPACE::Tickers::READ_AMP_TOTAL_READ_BYTES; case 0x5C: - return rocksdb::Tickers::NUMBER_RATE_LIMITER_DRAINS; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_RATE_LIMITER_DRAINS; case 0x5D: - return rocksdb::Tickers::NUMBER_ITER_SKIP; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_ITER_SKIP; case 0x5E: - return rocksdb::Tickers::NUMBER_MULTIGET_KEYS_FOUND; + return ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_KEYS_FOUND; case -0x01: // -0x01 to fixate the new value that incorrectly changed TICKER_ENUM_MAX. - return rocksdb::Tickers::NO_ITERATOR_CREATED; + return ROCKSDB_NAMESPACE::Tickers::NO_ITERATOR_CREATED; case 0x60: - return rocksdb::Tickers::NO_ITERATOR_DELETED; + return ROCKSDB_NAMESPACE::Tickers::NO_ITERATOR_DELETED; case 0x61: - return rocksdb::Tickers::COMPACTION_OPTIMIZED_DEL_DROP_OBSOLETE; + return ROCKSDB_NAMESPACE::Tickers:: + COMPACTION_OPTIMIZED_DEL_DROP_OBSOLETE; case 0x62: - return rocksdb::Tickers::COMPACTION_CANCELLED; + return ROCKSDB_NAMESPACE::Tickers::COMPACTION_CANCELLED; case 0x63: - return rocksdb::Tickers::BLOOM_FILTER_FULL_POSITIVE; + return ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_FULL_POSITIVE; case 0x64: - return rocksdb::Tickers::BLOOM_FILTER_FULL_TRUE_POSITIVE; + return ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_FULL_TRUE_POSITIVE; case 0x65: - return rocksdb::Tickers::BLOB_DB_NUM_PUT; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_PUT; case 0x66: - return rocksdb::Tickers::BLOB_DB_NUM_WRITE; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_WRITE; case 0x67: - return rocksdb::Tickers::BLOB_DB_NUM_GET; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_GET; case 0x68: - return rocksdb::Tickers::BLOB_DB_NUM_MULTIGET; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_MULTIGET; case 0x69: - return rocksdb::Tickers::BLOB_DB_NUM_SEEK; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_SEEK; case 0x6A: - return rocksdb::Tickers::BLOB_DB_NUM_NEXT; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_NEXT; case 0x6B: - return rocksdb::Tickers::BLOB_DB_NUM_PREV; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_PREV; case 0x6C: - return rocksdb::Tickers::BLOB_DB_NUM_KEYS_WRITTEN; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_KEYS_WRITTEN; case 0x6D: - return rocksdb::Tickers::BLOB_DB_NUM_KEYS_READ; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_NUM_KEYS_READ; case 0x6E: - return rocksdb::Tickers::BLOB_DB_BYTES_WRITTEN; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BYTES_WRITTEN; case 0x6F: - return rocksdb::Tickers::BLOB_DB_BYTES_READ; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BYTES_READ; case 0x70: - return rocksdb::Tickers::BLOB_DB_WRITE_INLINED; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_WRITE_INLINED; case 0x71: - return rocksdb::Tickers::BLOB_DB_WRITE_INLINED_TTL; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_WRITE_INLINED_TTL; case 0x72: - return rocksdb::Tickers::BLOB_DB_WRITE_BLOB; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_WRITE_BLOB; case 0x73: - return rocksdb::Tickers::BLOB_DB_WRITE_BLOB_TTL; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_WRITE_BLOB_TTL; case 0x74: - return rocksdb::Tickers::BLOB_DB_BLOB_FILE_BYTES_WRITTEN; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_FILE_BYTES_WRITTEN; case 0x75: - return rocksdb::Tickers::BLOB_DB_BLOB_FILE_BYTES_READ; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_FILE_BYTES_READ; case 0x76: - return rocksdb::Tickers::BLOB_DB_BLOB_FILE_SYNCED; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_FILE_SYNCED; case 0x77: - return rocksdb::Tickers::BLOB_DB_BLOB_INDEX_EXPIRED_COUNT; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_INDEX_EXPIRED_COUNT; case 0x78: - return rocksdb::Tickers::BLOB_DB_BLOB_INDEX_EXPIRED_SIZE; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_INDEX_EXPIRED_SIZE; case 0x79: - return rocksdb::Tickers::BLOB_DB_BLOB_INDEX_EVICTED_COUNT; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_INDEX_EVICTED_COUNT; case 0x7A: - return rocksdb::Tickers::BLOB_DB_BLOB_INDEX_EVICTED_SIZE; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_BLOB_INDEX_EVICTED_SIZE; case 0x7B: - return rocksdb::Tickers::BLOB_DB_GC_NUM_FILES; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_NUM_FILES; case 0x7C: - return rocksdb::Tickers::BLOB_DB_GC_NUM_NEW_FILES; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_NUM_NEW_FILES; case 0x7D: - return rocksdb::Tickers::BLOB_DB_GC_FAILURES; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_FAILURES; case 0x7E: - return rocksdb::Tickers::BLOB_DB_GC_NUM_KEYS_OVERWRITTEN; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_NUM_KEYS_OVERWRITTEN; case 0x7F: - return rocksdb::Tickers::BLOB_DB_GC_NUM_KEYS_EXPIRED; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_NUM_KEYS_EXPIRED; case -0x02: - return rocksdb::Tickers::BLOB_DB_GC_NUM_KEYS_RELOCATED; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_NUM_KEYS_RELOCATED; case -0x03: - return rocksdb::Tickers::BLOB_DB_GC_BYTES_OVERWRITTEN; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_BYTES_OVERWRITTEN; case -0x04: - return rocksdb::Tickers::BLOB_DB_GC_BYTES_EXPIRED; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_BYTES_EXPIRED; case -0x05: - return rocksdb::Tickers::BLOB_DB_GC_BYTES_RELOCATED; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_GC_BYTES_RELOCATED; case -0x06: - return rocksdb::Tickers::BLOB_DB_FIFO_NUM_FILES_EVICTED; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_FIFO_NUM_FILES_EVICTED; case -0x07: - return rocksdb::Tickers::BLOB_DB_FIFO_NUM_KEYS_EVICTED; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_FIFO_NUM_KEYS_EVICTED; case -0x08: - return rocksdb::Tickers::BLOB_DB_FIFO_BYTES_EVICTED; + return ROCKSDB_NAMESPACE::Tickers::BLOB_DB_FIFO_BYTES_EVICTED; case -0x09: - return rocksdb::Tickers::TXN_PREPARE_MUTEX_OVERHEAD; + return ROCKSDB_NAMESPACE::Tickers::TXN_PREPARE_MUTEX_OVERHEAD; case -0x0A: - return rocksdb::Tickers::TXN_OLD_COMMIT_MAP_MUTEX_OVERHEAD; + return ROCKSDB_NAMESPACE::Tickers::TXN_OLD_COMMIT_MAP_MUTEX_OVERHEAD; case -0x0B: - return rocksdb::Tickers::TXN_DUPLICATE_KEY_OVERHEAD; + return ROCKSDB_NAMESPACE::Tickers::TXN_DUPLICATE_KEY_OVERHEAD; case -0x0C: - return rocksdb::Tickers::TXN_SNAPSHOT_MUTEX_OVERHEAD; + return ROCKSDB_NAMESPACE::Tickers::TXN_SNAPSHOT_MUTEX_OVERHEAD; case -0x0D: - return rocksdb::Tickers::TXN_GET_TRY_AGAIN; + return ROCKSDB_NAMESPACE::Tickers::TXN_GET_TRY_AGAIN; case 0x5F: // 0x5F for backwards compatibility on current minor version. - return rocksdb::Tickers::TICKER_ENUM_MAX; + return ROCKSDB_NAMESPACE::Tickers::TICKER_ENUM_MAX; default: // undefined/default - return rocksdb::Tickers::BLOCK_CACHE_MISS; + return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_MISS; } } }; @@ -5164,104 +5254,104 @@ class TickerTypeJni { class HistogramTypeJni { public: // Returns the equivalent org.rocksdb.HistogramType for the provided - // C++ rocksdb::Histograms enum + // C++ ROCKSDB_NAMESPACE::Histograms enum static jbyte toJavaHistogramsType( - const rocksdb::Histograms& histograms) { + const ROCKSDB_NAMESPACE::Histograms& histograms) { switch(histograms) { - case rocksdb::Histograms::DB_GET: + case ROCKSDB_NAMESPACE::Histograms::DB_GET: return 0x0; - case rocksdb::Histograms::DB_WRITE: + case ROCKSDB_NAMESPACE::Histograms::DB_WRITE: return 0x1; - case rocksdb::Histograms::COMPACTION_TIME: + case ROCKSDB_NAMESPACE::Histograms::COMPACTION_TIME: return 0x2; - case rocksdb::Histograms::SUBCOMPACTION_SETUP_TIME: + case ROCKSDB_NAMESPACE::Histograms::SUBCOMPACTION_SETUP_TIME: return 0x3; - case rocksdb::Histograms::TABLE_SYNC_MICROS: + case ROCKSDB_NAMESPACE::Histograms::TABLE_SYNC_MICROS: return 0x4; - case rocksdb::Histograms::COMPACTION_OUTFILE_SYNC_MICROS: + case ROCKSDB_NAMESPACE::Histograms::COMPACTION_OUTFILE_SYNC_MICROS: return 0x5; - case rocksdb::Histograms::WAL_FILE_SYNC_MICROS: + case ROCKSDB_NAMESPACE::Histograms::WAL_FILE_SYNC_MICROS: return 0x6; - case rocksdb::Histograms::MANIFEST_FILE_SYNC_MICROS: + case ROCKSDB_NAMESPACE::Histograms::MANIFEST_FILE_SYNC_MICROS: return 0x7; - case rocksdb::Histograms::TABLE_OPEN_IO_MICROS: + case ROCKSDB_NAMESPACE::Histograms::TABLE_OPEN_IO_MICROS: return 0x8; - case rocksdb::Histograms::DB_MULTIGET: + case ROCKSDB_NAMESPACE::Histograms::DB_MULTIGET: return 0x9; - case rocksdb::Histograms::READ_BLOCK_COMPACTION_MICROS: + case ROCKSDB_NAMESPACE::Histograms::READ_BLOCK_COMPACTION_MICROS: return 0xA; - case rocksdb::Histograms::READ_BLOCK_GET_MICROS: + case ROCKSDB_NAMESPACE::Histograms::READ_BLOCK_GET_MICROS: return 0xB; - case rocksdb::Histograms::WRITE_RAW_BLOCK_MICROS: + case ROCKSDB_NAMESPACE::Histograms::WRITE_RAW_BLOCK_MICROS: return 0xC; - case rocksdb::Histograms::STALL_L0_SLOWDOWN_COUNT: + case ROCKSDB_NAMESPACE::Histograms::STALL_L0_SLOWDOWN_COUNT: return 0xD; - case rocksdb::Histograms::STALL_MEMTABLE_COMPACTION_COUNT: + case ROCKSDB_NAMESPACE::Histograms::STALL_MEMTABLE_COMPACTION_COUNT: return 0xE; - case rocksdb::Histograms::STALL_L0_NUM_FILES_COUNT: + case ROCKSDB_NAMESPACE::Histograms::STALL_L0_NUM_FILES_COUNT: return 0xF; - case rocksdb::Histograms::HARD_RATE_LIMIT_DELAY_COUNT: + case ROCKSDB_NAMESPACE::Histograms::HARD_RATE_LIMIT_DELAY_COUNT: return 0x10; - case rocksdb::Histograms::SOFT_RATE_LIMIT_DELAY_COUNT: + case ROCKSDB_NAMESPACE::Histograms::SOFT_RATE_LIMIT_DELAY_COUNT: return 0x11; - case rocksdb::Histograms::NUM_FILES_IN_SINGLE_COMPACTION: + case ROCKSDB_NAMESPACE::Histograms::NUM_FILES_IN_SINGLE_COMPACTION: return 0x12; - case rocksdb::Histograms::DB_SEEK: + case ROCKSDB_NAMESPACE::Histograms::DB_SEEK: return 0x13; - case rocksdb::Histograms::WRITE_STALL: + case ROCKSDB_NAMESPACE::Histograms::WRITE_STALL: return 0x14; - case rocksdb::Histograms::SST_READ_MICROS: + case ROCKSDB_NAMESPACE::Histograms::SST_READ_MICROS: return 0x15; - case rocksdb::Histograms::NUM_SUBCOMPACTIONS_SCHEDULED: + case ROCKSDB_NAMESPACE::Histograms::NUM_SUBCOMPACTIONS_SCHEDULED: return 0x16; - case rocksdb::Histograms::BYTES_PER_READ: + case ROCKSDB_NAMESPACE::Histograms::BYTES_PER_READ: return 0x17; - case rocksdb::Histograms::BYTES_PER_WRITE: + case ROCKSDB_NAMESPACE::Histograms::BYTES_PER_WRITE: return 0x18; - case rocksdb::Histograms::BYTES_PER_MULTIGET: + case ROCKSDB_NAMESPACE::Histograms::BYTES_PER_MULTIGET: return 0x19; - case rocksdb::Histograms::BYTES_COMPRESSED: + case ROCKSDB_NAMESPACE::Histograms::BYTES_COMPRESSED: return 0x1A; - case rocksdb::Histograms::BYTES_DECOMPRESSED: + case ROCKSDB_NAMESPACE::Histograms::BYTES_DECOMPRESSED: return 0x1B; - case rocksdb::Histograms::COMPRESSION_TIMES_NANOS: + case ROCKSDB_NAMESPACE::Histograms::COMPRESSION_TIMES_NANOS: return 0x1C; - case rocksdb::Histograms::DECOMPRESSION_TIMES_NANOS: + case ROCKSDB_NAMESPACE::Histograms::DECOMPRESSION_TIMES_NANOS: return 0x1D; - case rocksdb::Histograms::READ_NUM_MERGE_OPERANDS: + case ROCKSDB_NAMESPACE::Histograms::READ_NUM_MERGE_OPERANDS: return 0x1E; // 0x20 to skip 0x1F so TICKER_ENUM_MAX remains unchanged for minor version compatibility. - case rocksdb::Histograms::FLUSH_TIME: + case ROCKSDB_NAMESPACE::Histograms::FLUSH_TIME: return 0x20; - case rocksdb::Histograms::BLOB_DB_KEY_SIZE: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_KEY_SIZE: return 0x21; - case rocksdb::Histograms::BLOB_DB_VALUE_SIZE: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_VALUE_SIZE: return 0x22; - case rocksdb::Histograms::BLOB_DB_WRITE_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_WRITE_MICROS: return 0x23; - case rocksdb::Histograms::BLOB_DB_GET_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_GET_MICROS: return 0x24; - case rocksdb::Histograms::BLOB_DB_MULTIGET_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_MULTIGET_MICROS: return 0x25; - case rocksdb::Histograms::BLOB_DB_SEEK_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_SEEK_MICROS: return 0x26; - case rocksdb::Histograms::BLOB_DB_NEXT_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_NEXT_MICROS: return 0x27; - case rocksdb::Histograms::BLOB_DB_PREV_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_PREV_MICROS: return 0x28; - case rocksdb::Histograms::BLOB_DB_BLOB_FILE_WRITE_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_BLOB_FILE_WRITE_MICROS: return 0x29; - case rocksdb::Histograms::BLOB_DB_BLOB_FILE_READ_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_BLOB_FILE_READ_MICROS: return 0x2A; - case rocksdb::Histograms::BLOB_DB_BLOB_FILE_SYNC_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_BLOB_FILE_SYNC_MICROS: return 0x2B; - case rocksdb::Histograms::BLOB_DB_GC_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_GC_MICROS: return 0x2C; - case rocksdb::Histograms::BLOB_DB_COMPRESSION_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_COMPRESSION_MICROS: return 0x2D; - case rocksdb::Histograms::BLOB_DB_DECOMPRESSION_MICROS: + case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_DECOMPRESSION_MICROS: return 0x2E; - case rocksdb::Histograms::HISTOGRAM_ENUM_MAX: + case ROCKSDB_NAMESPACE::Histograms::HISTOGRAM_ENUM_MAX: // 0x1F for backwards compatibility on current minor version. return 0x1F; @@ -5271,110 +5361,110 @@ class HistogramTypeJni { } } - // Returns the equivalent C++ rocksdb::Histograms enum for the + // Returns the equivalent C++ ROCKSDB_NAMESPACE::Histograms enum for the // provided Java org.rocksdb.HistogramsType - static rocksdb::Histograms toCppHistograms(jbyte jhistograms_type) { + static ROCKSDB_NAMESPACE::Histograms toCppHistograms(jbyte jhistograms_type) { switch(jhistograms_type) { case 0x0: - return rocksdb::Histograms::DB_GET; + return ROCKSDB_NAMESPACE::Histograms::DB_GET; case 0x1: - return rocksdb::Histograms::DB_WRITE; + return ROCKSDB_NAMESPACE::Histograms::DB_WRITE; case 0x2: - return rocksdb::Histograms::COMPACTION_TIME; + return ROCKSDB_NAMESPACE::Histograms::COMPACTION_TIME; case 0x3: - return rocksdb::Histograms::SUBCOMPACTION_SETUP_TIME; + return ROCKSDB_NAMESPACE::Histograms::SUBCOMPACTION_SETUP_TIME; case 0x4: - return rocksdb::Histograms::TABLE_SYNC_MICROS; + return ROCKSDB_NAMESPACE::Histograms::TABLE_SYNC_MICROS; case 0x5: - return rocksdb::Histograms::COMPACTION_OUTFILE_SYNC_MICROS; + return ROCKSDB_NAMESPACE::Histograms::COMPACTION_OUTFILE_SYNC_MICROS; case 0x6: - return rocksdb::Histograms::WAL_FILE_SYNC_MICROS; + return ROCKSDB_NAMESPACE::Histograms::WAL_FILE_SYNC_MICROS; case 0x7: - return rocksdb::Histograms::MANIFEST_FILE_SYNC_MICROS; + return ROCKSDB_NAMESPACE::Histograms::MANIFEST_FILE_SYNC_MICROS; case 0x8: - return rocksdb::Histograms::TABLE_OPEN_IO_MICROS; + return ROCKSDB_NAMESPACE::Histograms::TABLE_OPEN_IO_MICROS; case 0x9: - return rocksdb::Histograms::DB_MULTIGET; + return ROCKSDB_NAMESPACE::Histograms::DB_MULTIGET; case 0xA: - return rocksdb::Histograms::READ_BLOCK_COMPACTION_MICROS; + return ROCKSDB_NAMESPACE::Histograms::READ_BLOCK_COMPACTION_MICROS; case 0xB: - return rocksdb::Histograms::READ_BLOCK_GET_MICROS; + return ROCKSDB_NAMESPACE::Histograms::READ_BLOCK_GET_MICROS; case 0xC: - return rocksdb::Histograms::WRITE_RAW_BLOCK_MICROS; + return ROCKSDB_NAMESPACE::Histograms::WRITE_RAW_BLOCK_MICROS; case 0xD: - return rocksdb::Histograms::STALL_L0_SLOWDOWN_COUNT; + return ROCKSDB_NAMESPACE::Histograms::STALL_L0_SLOWDOWN_COUNT; case 0xE: - return rocksdb::Histograms::STALL_MEMTABLE_COMPACTION_COUNT; + return ROCKSDB_NAMESPACE::Histograms::STALL_MEMTABLE_COMPACTION_COUNT; case 0xF: - return rocksdb::Histograms::STALL_L0_NUM_FILES_COUNT; + return ROCKSDB_NAMESPACE::Histograms::STALL_L0_NUM_FILES_COUNT; case 0x10: - return rocksdb::Histograms::HARD_RATE_LIMIT_DELAY_COUNT; + return ROCKSDB_NAMESPACE::Histograms::HARD_RATE_LIMIT_DELAY_COUNT; case 0x11: - return rocksdb::Histograms::SOFT_RATE_LIMIT_DELAY_COUNT; + return ROCKSDB_NAMESPACE::Histograms::SOFT_RATE_LIMIT_DELAY_COUNT; case 0x12: - return rocksdb::Histograms::NUM_FILES_IN_SINGLE_COMPACTION; + return ROCKSDB_NAMESPACE::Histograms::NUM_FILES_IN_SINGLE_COMPACTION; case 0x13: - return rocksdb::Histograms::DB_SEEK; + return ROCKSDB_NAMESPACE::Histograms::DB_SEEK; case 0x14: - return rocksdb::Histograms::WRITE_STALL; + return ROCKSDB_NAMESPACE::Histograms::WRITE_STALL; case 0x15: - return rocksdb::Histograms::SST_READ_MICROS; + return ROCKSDB_NAMESPACE::Histograms::SST_READ_MICROS; case 0x16: - return rocksdb::Histograms::NUM_SUBCOMPACTIONS_SCHEDULED; + return ROCKSDB_NAMESPACE::Histograms::NUM_SUBCOMPACTIONS_SCHEDULED; case 0x17: - return rocksdb::Histograms::BYTES_PER_READ; + return ROCKSDB_NAMESPACE::Histograms::BYTES_PER_READ; case 0x18: - return rocksdb::Histograms::BYTES_PER_WRITE; + return ROCKSDB_NAMESPACE::Histograms::BYTES_PER_WRITE; case 0x19: - return rocksdb::Histograms::BYTES_PER_MULTIGET; + return ROCKSDB_NAMESPACE::Histograms::BYTES_PER_MULTIGET; case 0x1A: - return rocksdb::Histograms::BYTES_COMPRESSED; + return ROCKSDB_NAMESPACE::Histograms::BYTES_COMPRESSED; case 0x1B: - return rocksdb::Histograms::BYTES_DECOMPRESSED; + return ROCKSDB_NAMESPACE::Histograms::BYTES_DECOMPRESSED; case 0x1C: - return rocksdb::Histograms::COMPRESSION_TIMES_NANOS; + return ROCKSDB_NAMESPACE::Histograms::COMPRESSION_TIMES_NANOS; case 0x1D: - return rocksdb::Histograms::DECOMPRESSION_TIMES_NANOS; + return ROCKSDB_NAMESPACE::Histograms::DECOMPRESSION_TIMES_NANOS; case 0x1E: - return rocksdb::Histograms::READ_NUM_MERGE_OPERANDS; + return ROCKSDB_NAMESPACE::Histograms::READ_NUM_MERGE_OPERANDS; // 0x20 to skip 0x1F so TICKER_ENUM_MAX remains unchanged for minor version compatibility. case 0x20: - return rocksdb::Histograms::FLUSH_TIME; + return ROCKSDB_NAMESPACE::Histograms::FLUSH_TIME; case 0x21: - return rocksdb::Histograms::BLOB_DB_KEY_SIZE; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_KEY_SIZE; case 0x22: - return rocksdb::Histograms::BLOB_DB_VALUE_SIZE; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_VALUE_SIZE; case 0x23: - return rocksdb::Histograms::BLOB_DB_WRITE_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_WRITE_MICROS; case 0x24: - return rocksdb::Histograms::BLOB_DB_GET_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_GET_MICROS; case 0x25: - return rocksdb::Histograms::BLOB_DB_MULTIGET_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_MULTIGET_MICROS; case 0x26: - return rocksdb::Histograms::BLOB_DB_SEEK_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_SEEK_MICROS; case 0x27: - return rocksdb::Histograms::BLOB_DB_NEXT_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_NEXT_MICROS; case 0x28: - return rocksdb::Histograms::BLOB_DB_PREV_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_PREV_MICROS; case 0x29: - return rocksdb::Histograms::BLOB_DB_BLOB_FILE_WRITE_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_BLOB_FILE_WRITE_MICROS; case 0x2A: - return rocksdb::Histograms::BLOB_DB_BLOB_FILE_READ_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_BLOB_FILE_READ_MICROS; case 0x2B: - return rocksdb::Histograms::BLOB_DB_BLOB_FILE_SYNC_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_BLOB_FILE_SYNC_MICROS; case 0x2C: - return rocksdb::Histograms::BLOB_DB_GC_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_GC_MICROS; case 0x2D: - return rocksdb::Histograms::BLOB_DB_COMPRESSION_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_COMPRESSION_MICROS; case 0x2E: - return rocksdb::Histograms::BLOB_DB_DECOMPRESSION_MICROS; + return ROCKSDB_NAMESPACE::Histograms::BLOB_DB_DECOMPRESSION_MICROS; case 0x1F: // 0x1F for backwards compatibility on current minor version. - return rocksdb::Histograms::HISTOGRAM_ENUM_MAX; + return ROCKSDB_NAMESPACE::Histograms::HISTOGRAM_ENUM_MAX; default: // undefined/default - return rocksdb::Histograms::DB_GET; + return ROCKSDB_NAMESPACE::Histograms::DB_GET; } } }; @@ -5383,15 +5473,15 @@ class HistogramTypeJni { class StatsLevelJni { public: // Returns the equivalent org.rocksdb.StatsLevel for the provided - // C++ rocksdb::StatsLevel enum + // C++ ROCKSDB_NAMESPACE::StatsLevel enum static jbyte toJavaStatsLevel( - const rocksdb::StatsLevel& stats_level) { + const ROCKSDB_NAMESPACE::StatsLevel& stats_level) { switch(stats_level) { - case rocksdb::StatsLevel::kExceptDetailedTimers: + case ROCKSDB_NAMESPACE::StatsLevel::kExceptDetailedTimers: return 0x0; - case rocksdb::StatsLevel::kExceptTimeForMutex: + case ROCKSDB_NAMESPACE::StatsLevel::kExceptTimeForMutex: return 0x1; - case rocksdb::StatsLevel::kAll: + case ROCKSDB_NAMESPACE::StatsLevel::kAll: return 0x2; default: @@ -5400,20 +5490,20 @@ class StatsLevelJni { } } - // Returns the equivalent C++ rocksdb::StatsLevel enum for the + // Returns the equivalent C++ ROCKSDB_NAMESPACE::StatsLevel enum for the // provided Java org.rocksdb.StatsLevel - static rocksdb::StatsLevel toCppStatsLevel(jbyte jstats_level) { + static ROCKSDB_NAMESPACE::StatsLevel toCppStatsLevel(jbyte jstats_level) { switch(jstats_level) { case 0x0: - return rocksdb::StatsLevel::kExceptDetailedTimers; + return ROCKSDB_NAMESPACE::StatsLevel::kExceptDetailedTimers; case 0x1: - return rocksdb::StatsLevel::kExceptTimeForMutex; + return ROCKSDB_NAMESPACE::StatsLevel::kExceptTimeForMutex; case 0x2: - return rocksdb::StatsLevel::kAll; + return ROCKSDB_NAMESPACE::StatsLevel::kAll; default: // undefined/default - return rocksdb::StatsLevel::kExceptDetailedTimers; + return ROCKSDB_NAMESPACE::StatsLevel::kExceptDetailedTimers; } } }; @@ -5422,15 +5512,15 @@ class StatsLevelJni { class RateLimiterModeJni { public: // Returns the equivalent org.rocksdb.RateLimiterMode for the provided - // C++ rocksdb::RateLimiter::Mode enum + // C++ ROCKSDB_NAMESPACE::RateLimiter::Mode enum static jbyte toJavaRateLimiterMode( - const rocksdb::RateLimiter::Mode& rate_limiter_mode) { + const ROCKSDB_NAMESPACE::RateLimiter::Mode& rate_limiter_mode) { switch(rate_limiter_mode) { - case rocksdb::RateLimiter::Mode::kReadsOnly: + case ROCKSDB_NAMESPACE::RateLimiter::Mode::kReadsOnly: return 0x0; - case rocksdb::RateLimiter::Mode::kWritesOnly: + case ROCKSDB_NAMESPACE::RateLimiter::Mode::kWritesOnly: return 0x1; - case rocksdb::RateLimiter::Mode::kAllIo: + case ROCKSDB_NAMESPACE::RateLimiter::Mode::kAllIo: return 0x2; default: @@ -5439,20 +5529,21 @@ class RateLimiterModeJni { } } - // Returns the equivalent C++ rocksdb::RateLimiter::Mode enum for the - // provided Java org.rocksdb.RateLimiterMode - static rocksdb::RateLimiter::Mode toCppRateLimiterMode(jbyte jrate_limiter_mode) { + // Returns the equivalent C++ ROCKSDB_NAMESPACE::RateLimiter::Mode enum for + // the provided Java org.rocksdb.RateLimiterMode + static ROCKSDB_NAMESPACE::RateLimiter::Mode toCppRateLimiterMode( + jbyte jrate_limiter_mode) { switch(jrate_limiter_mode) { case 0x0: - return rocksdb::RateLimiter::Mode::kReadsOnly; + return ROCKSDB_NAMESPACE::RateLimiter::Mode::kReadsOnly; case 0x1: - return rocksdb::RateLimiter::Mode::kWritesOnly; + return ROCKSDB_NAMESPACE::RateLimiter::Mode::kWritesOnly; case 0x2: - return rocksdb::RateLimiter::Mode::kAllIo; + return ROCKSDB_NAMESPACE::RateLimiter::Mode::kAllIo; default: // undefined/default - return rocksdb::RateLimiter::Mode::kWritesOnly; + return ROCKSDB_NAMESPACE::RateLimiter::Mode::kWritesOnly; } } }; @@ -5460,43 +5551,43 @@ class RateLimiterModeJni { // The portal class for org.rocksdb.MemoryUsageType class MemoryUsageTypeJni { public: - // Returns the equivalent org.rocksdb.MemoryUsageType for the provided - // C++ rocksdb::MemoryUtil::UsageType enum - static jbyte toJavaMemoryUsageType( - const rocksdb::MemoryUtil::UsageType& usage_type) { - switch(usage_type) { - case rocksdb::MemoryUtil::UsageType::kMemTableTotal: - return 0x0; - case rocksdb::MemoryUtil::UsageType::kMemTableUnFlushed: - return 0x1; - case rocksdb::MemoryUtil::UsageType::kTableReadersTotal: - return 0x2; - case rocksdb::MemoryUtil::UsageType::kCacheTotal: - return 0x3; - default: - // undefined: use kNumUsageTypes - return 0x4; - } - } + // Returns the equivalent org.rocksdb.MemoryUsageType for the provided + // C++ ROCKSDB_NAMESPACE::MemoryUtil::UsageType enum + static jbyte toJavaMemoryUsageType( + const ROCKSDB_NAMESPACE::MemoryUtil::UsageType& usage_type) { + switch (usage_type) { + case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableTotal: + return 0x0; + case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableUnFlushed: + return 0x1; + case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kTableReadersTotal: + return 0x2; + case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kCacheTotal: + return 0x3; + default: + // undefined: use kNumUsageTypes + return 0x4; + } + } - // Returns the equivalent C++ rocksdb::MemoryUtil::UsageType enum for the - // provided Java org.rocksdb.MemoryUsageType - static rocksdb::MemoryUtil::UsageType toCppMemoryUsageType( - jbyte usage_type) { - switch(usage_type) { - case 0x0: - return rocksdb::MemoryUtil::UsageType::kMemTableTotal; - case 0x1: - return rocksdb::MemoryUtil::UsageType::kMemTableUnFlushed; - case 0x2: - return rocksdb::MemoryUtil::UsageType::kTableReadersTotal; - case 0x3: - return rocksdb::MemoryUtil::UsageType::kCacheTotal; - default: - // undefined/default: use kNumUsageTypes - return rocksdb::MemoryUtil::UsageType::kNumUsageTypes; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::MemoryUtil::UsageType enum for + // the provided Java org.rocksdb.MemoryUsageType + static ROCKSDB_NAMESPACE::MemoryUtil::UsageType toCppMemoryUsageType( + jbyte usage_type) { + switch (usage_type) { + case 0x0: + return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableTotal; + case 0x1: + return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableUnFlushed; + case 0x2: + return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kTableReadersTotal; + case 0x3: + return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kCacheTotal; + default: + // undefined/default: use kNumUsageTypes + return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kNumUsageTypes; + } + } }; // The portal class for org.rocksdb.Transaction @@ -5614,9 +5705,10 @@ class TransactionDBJni : public JavaClass { * org.rocksdb.Transaction.WaitingTransactions object, * or nullptr if an an exception occurs */ - static jobject newDeadlockInfo(JNIEnv* env, jobject jtransaction_db, - const rocksdb::TransactionID transaction_id, - const uint32_t column_family_id, const std::string &waiting_key, + static jobject newDeadlockInfo( + JNIEnv* env, jobject jtransaction_db, + const ROCKSDB_NAMESPACE::TransactionID transaction_id, + const uint32_t column_family_id, const std::string& waiting_key, const bool exclusive) { jclass jclazz = getJClass(env); if(jclazz == nullptr) { @@ -5654,38 +5746,38 @@ class TransactionDBJni : public JavaClass { // The portal class for org.rocksdb.TxnDBWritePolicy class TxnDBWritePolicyJni { public: - // Returns the equivalent org.rocksdb.TxnDBWritePolicy for the provided - // C++ rocksdb::TxnDBWritePolicy enum - static jbyte toJavaTxnDBWritePolicy( - const rocksdb::TxnDBWritePolicy& txndb_write_policy) { - switch(txndb_write_policy) { - case rocksdb::TxnDBWritePolicy::WRITE_COMMITTED: - return 0x0; - case rocksdb::TxnDBWritePolicy::WRITE_PREPARED: - return 0x1; - case rocksdb::TxnDBWritePolicy::WRITE_UNPREPARED: - return 0x2; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.TxnDBWritePolicy for the provided + // C++ ROCKSDB_NAMESPACE::TxnDBWritePolicy enum + static jbyte toJavaTxnDBWritePolicy( + const ROCKSDB_NAMESPACE::TxnDBWritePolicy& txndb_write_policy) { + switch (txndb_write_policy) { + case ROCKSDB_NAMESPACE::TxnDBWritePolicy::WRITE_COMMITTED: + return 0x0; + case ROCKSDB_NAMESPACE::TxnDBWritePolicy::WRITE_PREPARED: + return 0x1; + case ROCKSDB_NAMESPACE::TxnDBWritePolicy::WRITE_UNPREPARED: + return 0x2; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::TxnDBWritePolicy enum for the - // provided Java org.rocksdb.TxnDBWritePolicy - static rocksdb::TxnDBWritePolicy toCppTxnDBWritePolicy( - jbyte jtxndb_write_policy) { - switch(jtxndb_write_policy) { - case 0x0: - return rocksdb::TxnDBWritePolicy::WRITE_COMMITTED; - case 0x1: - return rocksdb::TxnDBWritePolicy::WRITE_PREPARED; - case 0x2: - return rocksdb::TxnDBWritePolicy::WRITE_UNPREPARED; - default: - // undefined/default - return rocksdb::TxnDBWritePolicy::WRITE_COMMITTED; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::TxnDBWritePolicy enum for the + // provided Java org.rocksdb.TxnDBWritePolicy + static ROCKSDB_NAMESPACE::TxnDBWritePolicy toCppTxnDBWritePolicy( + jbyte jtxndb_write_policy) { + switch (jtxndb_write_policy) { + case 0x0: + return ROCKSDB_NAMESPACE::TxnDBWritePolicy::WRITE_COMMITTED; + case 0x1: + return ROCKSDB_NAMESPACE::TxnDBWritePolicy::WRITE_PREPARED; + case 0x2: + return ROCKSDB_NAMESPACE::TxnDBWritePolicy::WRITE_UNPREPARED; + default: + // undefined/default + return ROCKSDB_NAMESPACE::TxnDBWritePolicy::WRITE_COMMITTED; + } + } }; // The portal class for org.rocksdb.TransactionDB.KeyLockInfo @@ -5707,17 +5799,18 @@ class KeyLockInfoJni : public JavaClass { /** * Create a new Java org.rocksdb.TransactionDB.KeyLockInfo object - * with the same properties as the provided C++ rocksdb::KeyLockInfo object + * with the same properties as the provided C++ ROCKSDB_NAMESPACE::KeyLockInfo + * object * * @param env A pointer to the Java environment - * @param key_lock_info The rocksdb::KeyLockInfo object + * @param key_lock_info The ROCKSDB_NAMESPACE::KeyLockInfo object * * @return A reference to a Java * org.rocksdb.TransactionDB.KeyLockInfo object, * or nullptr if an an exception occurs */ - static jobject construct(JNIEnv* env, - const rocksdb::KeyLockInfo& key_lock_info) { + static jobject construct( + JNIEnv* env, const ROCKSDB_NAMESPACE::KeyLockInfo& key_lock_info) { jclass jclazz = getJClass(env); if(jclazz == nullptr) { // exception occurred accessing class @@ -5827,7 +5920,10 @@ class DeadlockPathJni : public JavaClass { } }; -class AbstractTableFilterJni : public RocksDBNativeClass { +class AbstractTableFilterJni + : public RocksDBNativeClass< + const ROCKSDB_NAMESPACE::TableFilterJniCallback*, + AbstractTableFilterJni> { public: /** * Get the Java Method: TableFilter#filter(TableProperties) @@ -5867,7 +5963,8 @@ class TablePropertiesJni : public JavaClass { * @return A reference to a Java org.rocksdb.TableProperties object, or * nullptr if an an exception occurs */ - static jobject fromCppTableProperties(JNIEnv* env, const rocksdb::TableProperties& table_properties) { + static jobject fromCppTableProperties( + JNIEnv* env, const ROCKSDB_NAMESPACE::TableProperties& table_properties) { jclass jclazz = getJClass(env); if (jclazz == nullptr) { // exception occurred accessing class @@ -5880,20 +5977,23 @@ class TablePropertiesJni : public JavaClass { return nullptr; } - jbyteArray jcolumn_family_name = rocksdb::JniUtil::copyBytes(env, table_properties.column_family_name); + jbyteArray jcolumn_family_name = ROCKSDB_NAMESPACE::JniUtil::copyBytes( + env, table_properties.column_family_name); if (jcolumn_family_name == nullptr) { // exception occurred creating java string return nullptr; } - jstring jfilter_policy_name = rocksdb::JniUtil::toJavaString(env, &table_properties.filter_policy_name, true); + jstring jfilter_policy_name = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &table_properties.filter_policy_name, true); if (env->ExceptionCheck()) { // exception occurred creating java string env->DeleteLocalRef(jcolumn_family_name); return nullptr; } - jstring jcomparator_name = rocksdb::JniUtil::toJavaString(env, &table_properties.comparator_name, true); + jstring jcomparator_name = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &table_properties.comparator_name, true); if (env->ExceptionCheck()) { // exception occurred creating java string env->DeleteLocalRef(jcolumn_family_name); @@ -5901,7 +6001,8 @@ class TablePropertiesJni : public JavaClass { return nullptr; } - jstring jmerge_operator_name = rocksdb::JniUtil::toJavaString(env, &table_properties.merge_operator_name, true); + jstring jmerge_operator_name = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &table_properties.merge_operator_name, true); if (env->ExceptionCheck()) { // exception occurred creating java string env->DeleteLocalRef(jcolumn_family_name); @@ -5910,7 +6011,8 @@ class TablePropertiesJni : public JavaClass { return nullptr; } - jstring jprefix_extractor_name = rocksdb::JniUtil::toJavaString(env, &table_properties.prefix_extractor_name, true); + jstring jprefix_extractor_name = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &table_properties.prefix_extractor_name, true); if (env->ExceptionCheck()) { // exception occurred creating java string env->DeleteLocalRef(jcolumn_family_name); @@ -5920,7 +6022,9 @@ class TablePropertiesJni : public JavaClass { return nullptr; } - jstring jproperty_collectors_names = rocksdb::JniUtil::toJavaString(env, &table_properties.property_collectors_names, true); + jstring jproperty_collectors_names = + ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &table_properties.property_collectors_names, true); if (env->ExceptionCheck()) { // exception occurred creating java string env->DeleteLocalRef(jcolumn_family_name); @@ -5931,7 +6035,8 @@ class TablePropertiesJni : public JavaClass { return nullptr; } - jstring jcompression_name = rocksdb::JniUtil::toJavaString(env, &table_properties.compression_name, true); + jstring jcompression_name = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &table_properties.compression_name, true); if (env->ExceptionCheck()) { // exception occurred creating java string env->DeleteLocalRef(jcolumn_family_name); @@ -5944,7 +6049,9 @@ class TablePropertiesJni : public JavaClass { } // Map - jobject juser_collected_properties = rocksdb::HashMapJni::fromCppMap(env, &table_properties.user_collected_properties); + jobject juser_collected_properties = + ROCKSDB_NAMESPACE::HashMapJni::fromCppMap( + env, &table_properties.user_collected_properties); if (env->ExceptionCheck()) { // exception occurred creating java map env->DeleteLocalRef(jcolumn_family_name); @@ -5958,7 +6065,8 @@ class TablePropertiesJni : public JavaClass { } // Map - jobject jreadable_properties = rocksdb::HashMapJni::fromCppMap(env, &table_properties.readable_properties); + jobject jreadable_properties = ROCKSDB_NAMESPACE::HashMapJni::fromCppMap( + env, &table_properties.readable_properties); if (env->ExceptionCheck()) { // exception occurred creating java map env->DeleteLocalRef(jcolumn_family_name); @@ -5973,7 +6081,8 @@ class TablePropertiesJni : public JavaClass { } // Map - jobject jproperties_offsets = rocksdb::HashMapJni::fromCppMap(env, &table_properties.properties_offsets); + jobject jproperties_offsets = ROCKSDB_NAMESPACE::HashMapJni::fromCppMap( + env, &table_properties.properties_offsets); if (env->ExceptionCheck()) { // exception occurred creating java map env->DeleteLocalRef(jcolumn_family_name); @@ -6050,10 +6159,11 @@ class ColumnFamilyDescriptorJni : public JavaClass { /** * Create a new Java org.rocksdb.ColumnFamilyDescriptor object with the same - * properties as the provided C++ rocksdb::ColumnFamilyDescriptor object + * properties as the provided C++ ROCKSDB_NAMESPACE::ColumnFamilyDescriptor + * object * * @param env A pointer to the Java environment - * @param cfd A pointer to rocksdb::ColumnFamilyDescriptor object + * @param cfd A pointer to ROCKSDB_NAMESPACE::ColumnFamilyDescriptor object * * @return A reference to a Java org.rocksdb.ColumnFamilyDescriptor object, or * nullptr if an an exception occurs @@ -6130,338 +6240,367 @@ class ColumnFamilyDescriptorJni : public JavaClass { // The portal class for org.rocksdb.IndexType class IndexTypeJni { public: - // Returns the equivalent org.rocksdb.IndexType for the provided - // C++ rocksdb::IndexType enum - static jbyte toJavaIndexType( - const rocksdb::BlockBasedTableOptions::IndexType& index_type) { - switch(index_type) { - case rocksdb::BlockBasedTableOptions::IndexType::kBinarySearch: - return 0x0; - case rocksdb::BlockBasedTableOptions::IndexType::kHashSearch: - return 0x1; - case rocksdb::BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch: - return 0x2; - case rocksdb::BlockBasedTableOptions::IndexType::kBinarySearchWithFirstKey: - return 0x3; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.IndexType for the provided + // C++ ROCKSDB_NAMESPACE::IndexType enum + static jbyte toJavaIndexType( + const ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType& index_type) { + switch (index_type) { + case ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType::kBinarySearch: + return 0x0; + case ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType::kHashSearch: + return 0x1; + case ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType:: + kTwoLevelIndexSearch: + return 0x2; + case ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType:: + kBinarySearchWithFirstKey: + return 0x3; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::IndexType enum for the - // provided Java org.rocksdb.IndexType - static rocksdb::BlockBasedTableOptions::IndexType toCppIndexType( - jbyte jindex_type) { - switch(jindex_type) { - case 0x0: - return rocksdb::BlockBasedTableOptions::IndexType::kBinarySearch; - case 0x1: - return rocksdb::BlockBasedTableOptions::IndexType::kHashSearch; - case 0x2: - return rocksdb::BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch; - case 0x3: - return rocksdb::BlockBasedTableOptions::IndexType:: - kBinarySearchWithFirstKey; - default: - // undefined/default - return rocksdb::BlockBasedTableOptions::IndexType::kBinarySearch; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::IndexType enum for the + // provided Java org.rocksdb.IndexType + static ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType toCppIndexType( + jbyte jindex_type) { + switch (jindex_type) { + case 0x0: + return ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType:: + kBinarySearch; + case 0x1: + return ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType:: + kHashSearch; + case 0x2: + return ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType:: + kTwoLevelIndexSearch; + case 0x3: + return ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType:: + kBinarySearchWithFirstKey; + default: + // undefined/default + return ROCKSDB_NAMESPACE::BlockBasedTableOptions::IndexType:: + kBinarySearch; + } + } }; // The portal class for org.rocksdb.DataBlockIndexType class DataBlockIndexTypeJni { public: - // Returns the equivalent org.rocksdb.DataBlockIndexType for the provided - // C++ rocksdb::DataBlockIndexType enum - static jbyte toJavaDataBlockIndexType( - const rocksdb::BlockBasedTableOptions::DataBlockIndexType& index_type) { - switch(index_type) { - case rocksdb::BlockBasedTableOptions::DataBlockIndexType::kDataBlockBinarySearch: - return 0x0; - case rocksdb::BlockBasedTableOptions::DataBlockIndexType::kDataBlockBinaryAndHash: - return 0x1; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.DataBlockIndexType for the provided + // C++ ROCKSDB_NAMESPACE::DataBlockIndexType enum + static jbyte toJavaDataBlockIndexType( + const ROCKSDB_NAMESPACE::BlockBasedTableOptions::DataBlockIndexType& + index_type) { + switch (index_type) { + case ROCKSDB_NAMESPACE::BlockBasedTableOptions::DataBlockIndexType:: + kDataBlockBinarySearch: + return 0x0; + case ROCKSDB_NAMESPACE::BlockBasedTableOptions::DataBlockIndexType:: + kDataBlockBinaryAndHash: + return 0x1; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::DataBlockIndexType enum for the - // provided Java org.rocksdb.DataBlockIndexType - static rocksdb::BlockBasedTableOptions::DataBlockIndexType toCppDataBlockIndexType( - jbyte jindex_type) { - switch(jindex_type) { - case 0x0: - return rocksdb::BlockBasedTableOptions::DataBlockIndexType::kDataBlockBinarySearch; - case 0x1: - return rocksdb::BlockBasedTableOptions::DataBlockIndexType::kDataBlockBinaryAndHash; - default: - // undefined/default - return rocksdb::BlockBasedTableOptions::DataBlockIndexType::kDataBlockBinarySearch; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::DataBlockIndexType enum for + // the provided Java org.rocksdb.DataBlockIndexType + static ROCKSDB_NAMESPACE::BlockBasedTableOptions::DataBlockIndexType + toCppDataBlockIndexType(jbyte jindex_type) { + switch (jindex_type) { + case 0x0: + return ROCKSDB_NAMESPACE::BlockBasedTableOptions::DataBlockIndexType:: + kDataBlockBinarySearch; + case 0x1: + return ROCKSDB_NAMESPACE::BlockBasedTableOptions::DataBlockIndexType:: + kDataBlockBinaryAndHash; + default: + // undefined/default + return ROCKSDB_NAMESPACE::BlockBasedTableOptions::DataBlockIndexType:: + kDataBlockBinarySearch; + } + } }; // The portal class for org.rocksdb.ChecksumType class ChecksumTypeJni { public: - // Returns the equivalent org.rocksdb.ChecksumType for the provided - // C++ rocksdb::ChecksumType enum - static jbyte toJavaChecksumType( - const rocksdb::ChecksumType& checksum_type) { - switch(checksum_type) { - case rocksdb::ChecksumType::kNoChecksum: - return 0x0; - case rocksdb::ChecksumType::kCRC32c: - return 0x1; - case rocksdb::ChecksumType::kxxHash: - return 0x2; - case rocksdb::ChecksumType::kxxHash64: - return 0x3; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.ChecksumType for the provided + // C++ ROCKSDB_NAMESPACE::ChecksumType enum + static jbyte toJavaChecksumType( + const ROCKSDB_NAMESPACE::ChecksumType& checksum_type) { + switch (checksum_type) { + case ROCKSDB_NAMESPACE::ChecksumType::kNoChecksum: + return 0x0; + case ROCKSDB_NAMESPACE::ChecksumType::kCRC32c: + return 0x1; + case ROCKSDB_NAMESPACE::ChecksumType::kxxHash: + return 0x2; + case ROCKSDB_NAMESPACE::ChecksumType::kxxHash64: + return 0x3; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::ChecksumType enum for the - // provided Java org.rocksdb.ChecksumType - static rocksdb::ChecksumType toCppChecksumType( - jbyte jchecksum_type) { - switch(jchecksum_type) { - case 0x0: - return rocksdb::ChecksumType::kNoChecksum; - case 0x1: - return rocksdb::ChecksumType::kCRC32c; - case 0x2: - return rocksdb::ChecksumType::kxxHash; - case 0x3: - return rocksdb::ChecksumType::kxxHash64; - default: - // undefined/default - return rocksdb::ChecksumType::kCRC32c; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::ChecksumType enum for the + // provided Java org.rocksdb.ChecksumType + static ROCKSDB_NAMESPACE::ChecksumType toCppChecksumType( + jbyte jchecksum_type) { + switch (jchecksum_type) { + case 0x0: + return ROCKSDB_NAMESPACE::ChecksumType::kNoChecksum; + case 0x1: + return ROCKSDB_NAMESPACE::ChecksumType::kCRC32c; + case 0x2: + return ROCKSDB_NAMESPACE::ChecksumType::kxxHash; + case 0x3: + return ROCKSDB_NAMESPACE::ChecksumType::kxxHash64; + default: + // undefined/default + return ROCKSDB_NAMESPACE::ChecksumType::kCRC32c; + } + } }; // The portal class for org.rocksdb.Priority class PriorityJni { public: - // Returns the equivalent org.rocksdb.Priority for the provided - // C++ rocksdb::Env::Priority enum - static jbyte toJavaPriority( - const rocksdb::Env::Priority& priority) { - switch(priority) { - case rocksdb::Env::Priority::BOTTOM: - return 0x0; - case rocksdb::Env::Priority::LOW: - return 0x1; - case rocksdb::Env::Priority::HIGH: - return 0x2; - case rocksdb::Env::Priority::TOTAL: - return 0x3; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.Priority for the provided + // C++ ROCKSDB_NAMESPACE::Env::Priority enum + static jbyte toJavaPriority( + const ROCKSDB_NAMESPACE::Env::Priority& priority) { + switch (priority) { + case ROCKSDB_NAMESPACE::Env::Priority::BOTTOM: + return 0x0; + case ROCKSDB_NAMESPACE::Env::Priority::LOW: + return 0x1; + case ROCKSDB_NAMESPACE::Env::Priority::HIGH: + return 0x2; + case ROCKSDB_NAMESPACE::Env::Priority::TOTAL: + return 0x3; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::env::Priority enum for the - // provided Java org.rocksdb.Priority - static rocksdb::Env::Priority toCppPriority( - jbyte jpriority) { - switch(jpriority) { - case 0x0: - return rocksdb::Env::Priority::BOTTOM; - case 0x1: - return rocksdb::Env::Priority::LOW; - case 0x2: - return rocksdb::Env::Priority::HIGH; - case 0x3: - return rocksdb::Env::Priority::TOTAL; - default: - // undefined/default - return rocksdb::Env::Priority::LOW; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::env::Priority enum for the + // provided Java org.rocksdb.Priority + static ROCKSDB_NAMESPACE::Env::Priority toCppPriority(jbyte jpriority) { + switch (jpriority) { + case 0x0: + return ROCKSDB_NAMESPACE::Env::Priority::BOTTOM; + case 0x1: + return ROCKSDB_NAMESPACE::Env::Priority::LOW; + case 0x2: + return ROCKSDB_NAMESPACE::Env::Priority::HIGH; + case 0x3: + return ROCKSDB_NAMESPACE::Env::Priority::TOTAL; + default: + // undefined/default + return ROCKSDB_NAMESPACE::Env::Priority::LOW; + } + } }; // The portal class for org.rocksdb.ThreadType class ThreadTypeJni { public: - // Returns the equivalent org.rocksdb.ThreadType for the provided - // C++ rocksdb::ThreadStatus::ThreadType enum - static jbyte toJavaThreadType( - const rocksdb::ThreadStatus::ThreadType& thread_type) { - switch(thread_type) { - case rocksdb::ThreadStatus::ThreadType::HIGH_PRIORITY: - return 0x0; - case rocksdb::ThreadStatus::ThreadType::LOW_PRIORITY: - return 0x1; - case rocksdb::ThreadStatus::ThreadType::USER: - return 0x2; - case rocksdb::ThreadStatus::ThreadType::BOTTOM_PRIORITY: - return 0x3; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.ThreadType for the provided + // C++ ROCKSDB_NAMESPACE::ThreadStatus::ThreadType enum + static jbyte toJavaThreadType( + const ROCKSDB_NAMESPACE::ThreadStatus::ThreadType& thread_type) { + switch (thread_type) { + case ROCKSDB_NAMESPACE::ThreadStatus::ThreadType::HIGH_PRIORITY: + return 0x0; + case ROCKSDB_NAMESPACE::ThreadStatus::ThreadType::LOW_PRIORITY: + return 0x1; + case ROCKSDB_NAMESPACE::ThreadStatus::ThreadType::USER: + return 0x2; + case ROCKSDB_NAMESPACE::ThreadStatus::ThreadType::BOTTOM_PRIORITY: + return 0x3; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::ThreadStatus::ThreadType enum for the - // provided Java org.rocksdb.ThreadType - static rocksdb::ThreadStatus::ThreadType toCppThreadType( - jbyte jthread_type) { - switch(jthread_type) { - case 0x0: - return rocksdb::ThreadStatus::ThreadType::HIGH_PRIORITY; - case 0x1: - return rocksdb::ThreadStatus::ThreadType::LOW_PRIORITY; - case 0x2: - return ThreadStatus::ThreadType::USER; - case 0x3: - return rocksdb::ThreadStatus::ThreadType::BOTTOM_PRIORITY; - default: - // undefined/default - return rocksdb::ThreadStatus::ThreadType::LOW_PRIORITY; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::ThreadStatus::ThreadType enum + // for the provided Java org.rocksdb.ThreadType + static ROCKSDB_NAMESPACE::ThreadStatus::ThreadType toCppThreadType( + jbyte jthread_type) { + switch (jthread_type) { + case 0x0: + return ROCKSDB_NAMESPACE::ThreadStatus::ThreadType::HIGH_PRIORITY; + case 0x1: + return ROCKSDB_NAMESPACE::ThreadStatus::ThreadType::LOW_PRIORITY; + case 0x2: + return ThreadStatus::ThreadType::USER; + case 0x3: + return ROCKSDB_NAMESPACE::ThreadStatus::ThreadType::BOTTOM_PRIORITY; + default: + // undefined/default + return ROCKSDB_NAMESPACE::ThreadStatus::ThreadType::LOW_PRIORITY; + } + } }; // The portal class for org.rocksdb.OperationType class OperationTypeJni { public: - // Returns the equivalent org.rocksdb.OperationType for the provided - // C++ rocksdb::ThreadStatus::OperationType enum - static jbyte toJavaOperationType( - const rocksdb::ThreadStatus::OperationType& operation_type) { - switch(operation_type) { - case rocksdb::ThreadStatus::OperationType::OP_UNKNOWN: - return 0x0; - case rocksdb::ThreadStatus::OperationType::OP_COMPACTION: - return 0x1; - case rocksdb::ThreadStatus::OperationType::OP_FLUSH: - return 0x2; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.OperationType for the provided + // C++ ROCKSDB_NAMESPACE::ThreadStatus::OperationType enum + static jbyte toJavaOperationType( + const ROCKSDB_NAMESPACE::ThreadStatus::OperationType& operation_type) { + switch (operation_type) { + case ROCKSDB_NAMESPACE::ThreadStatus::OperationType::OP_UNKNOWN: + return 0x0; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationType::OP_COMPACTION: + return 0x1; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationType::OP_FLUSH: + return 0x2; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::ThreadStatus::OperationType enum for the - // provided Java org.rocksdb.OperationType - static rocksdb::ThreadStatus::OperationType toCppOperationType( - jbyte joperation_type) { - switch(joperation_type) { - case 0x0: - return rocksdb::ThreadStatus::OperationType::OP_UNKNOWN; - case 0x1: - return rocksdb::ThreadStatus::OperationType::OP_COMPACTION; - case 0x2: - return rocksdb::ThreadStatus::OperationType::OP_FLUSH; - default: - // undefined/default - return rocksdb::ThreadStatus::OperationType::OP_UNKNOWN; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::ThreadStatus::OperationType + // enum for the provided Java org.rocksdb.OperationType + static ROCKSDB_NAMESPACE::ThreadStatus::OperationType toCppOperationType( + jbyte joperation_type) { + switch (joperation_type) { + case 0x0: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationType::OP_UNKNOWN; + case 0x1: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationType::OP_COMPACTION; + case 0x2: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationType::OP_FLUSH; + default: + // undefined/default + return ROCKSDB_NAMESPACE::ThreadStatus::OperationType::OP_UNKNOWN; + } + } }; // The portal class for org.rocksdb.OperationStage class OperationStageJni { public: - // Returns the equivalent org.rocksdb.OperationStage for the provided - // C++ rocksdb::ThreadStatus::OperationStage enum - static jbyte toJavaOperationStage( - const rocksdb::ThreadStatus::OperationStage& operation_stage) { - switch(operation_stage) { - case rocksdb::ThreadStatus::OperationStage::STAGE_UNKNOWN: - return 0x0; - case rocksdb::ThreadStatus::OperationStage::STAGE_FLUSH_RUN: - return 0x1; - case rocksdb::ThreadStatus::OperationStage::STAGE_FLUSH_WRITE_L0: - return 0x2; - case rocksdb::ThreadStatus::OperationStage::STAGE_COMPACTION_PREPARE: - return 0x3; - case rocksdb::ThreadStatus::OperationStage::STAGE_COMPACTION_RUN: - return 0x4; - case rocksdb::ThreadStatus::OperationStage::STAGE_COMPACTION_PROCESS_KV: - return 0x5; - case rocksdb::ThreadStatus::OperationStage::STAGE_COMPACTION_INSTALL: - return 0x6; - case rocksdb::ThreadStatus::OperationStage::STAGE_COMPACTION_SYNC_FILE: - return 0x7; - case rocksdb::ThreadStatus::OperationStage::STAGE_PICK_MEMTABLES_TO_FLUSH: - return 0x8; - case rocksdb::ThreadStatus::OperationStage::STAGE_MEMTABLE_ROLLBACK: - return 0x9; - case rocksdb::ThreadStatus::OperationStage::STAGE_MEMTABLE_INSTALL_FLUSH_RESULTS: - return 0xA; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.OperationStage for the provided + // C++ ROCKSDB_NAMESPACE::ThreadStatus::OperationStage enum + static jbyte toJavaOperationStage( + const ROCKSDB_NAMESPACE::ThreadStatus::OperationStage& operation_stage) { + switch (operation_stage) { + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage::STAGE_UNKNOWN: + return 0x0; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage::STAGE_FLUSH_RUN: + return 0x1; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_FLUSH_WRITE_L0: + return 0x2; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_COMPACTION_PREPARE: + return 0x3; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_COMPACTION_RUN: + return 0x4; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_COMPACTION_PROCESS_KV: + return 0x5; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_COMPACTION_INSTALL: + return 0x6; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_COMPACTION_SYNC_FILE: + return 0x7; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_PICK_MEMTABLES_TO_FLUSH: + return 0x8; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_MEMTABLE_ROLLBACK: + return 0x9; + case ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_MEMTABLE_INSTALL_FLUSH_RESULTS: + return 0xA; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::ThreadStatus::OperationStage enum for the - // provided Java org.rocksdb.OperationStage - static rocksdb::ThreadStatus::OperationStage toCppOperationStage( - jbyte joperation_stage) { - switch(joperation_stage) { - case 0x0: - return rocksdb::ThreadStatus::OperationStage::STAGE_UNKNOWN; - case 0x1: - return rocksdb::ThreadStatus::OperationStage::STAGE_FLUSH_RUN; - case 0x2: - return rocksdb::ThreadStatus::OperationStage::STAGE_FLUSH_WRITE_L0; - case 0x3: - return rocksdb::ThreadStatus::OperationStage::STAGE_COMPACTION_PREPARE; - case 0x4: - return rocksdb::ThreadStatus::OperationStage::STAGE_COMPACTION_RUN; - case 0x5: - return rocksdb::ThreadStatus::OperationStage::STAGE_COMPACTION_PROCESS_KV; - case 0x6: - return rocksdb::ThreadStatus::OperationStage::STAGE_COMPACTION_INSTALL; - case 0x7: - return rocksdb::ThreadStatus::OperationStage::STAGE_COMPACTION_SYNC_FILE; - case 0x8: - return rocksdb::ThreadStatus::OperationStage::STAGE_PICK_MEMTABLES_TO_FLUSH; - case 0x9: - return rocksdb::ThreadStatus::OperationStage::STAGE_MEMTABLE_ROLLBACK; - case 0xA: - return rocksdb::ThreadStatus::OperationStage::STAGE_MEMTABLE_INSTALL_FLUSH_RESULTS; - default: - // undefined/default - return rocksdb::ThreadStatus::OperationStage::STAGE_UNKNOWN; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::ThreadStatus::OperationStage + // enum for the provided Java org.rocksdb.OperationStage + static ROCKSDB_NAMESPACE::ThreadStatus::OperationStage toCppOperationStage( + jbyte joperation_stage) { + switch (joperation_stage) { + case 0x0: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage::STAGE_UNKNOWN; + case 0x1: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage::STAGE_FLUSH_RUN; + case 0x2: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_FLUSH_WRITE_L0; + case 0x3: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_COMPACTION_PREPARE; + case 0x4: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_COMPACTION_RUN; + case 0x5: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_COMPACTION_PROCESS_KV; + case 0x6: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_COMPACTION_INSTALL; + case 0x7: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_COMPACTION_SYNC_FILE; + case 0x8: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_PICK_MEMTABLES_TO_FLUSH; + case 0x9: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_MEMTABLE_ROLLBACK; + case 0xA: + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage:: + STAGE_MEMTABLE_INSTALL_FLUSH_RESULTS; + default: + // undefined/default + return ROCKSDB_NAMESPACE::ThreadStatus::OperationStage::STAGE_UNKNOWN; + } + } }; // The portal class for org.rocksdb.StateType class StateTypeJni { public: - // Returns the equivalent org.rocksdb.StateType for the provided - // C++ rocksdb::ThreadStatus::StateType enum - static jbyte toJavaStateType( - const rocksdb::ThreadStatus::StateType& state_type) { - switch(state_type) { - case rocksdb::ThreadStatus::StateType::STATE_UNKNOWN: - return 0x0; - case rocksdb::ThreadStatus::StateType::STATE_MUTEX_WAIT: - return 0x1; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.StateType for the provided + // C++ ROCKSDB_NAMESPACE::ThreadStatus::StateType enum + static jbyte toJavaStateType( + const ROCKSDB_NAMESPACE::ThreadStatus::StateType& state_type) { + switch (state_type) { + case ROCKSDB_NAMESPACE::ThreadStatus::StateType::STATE_UNKNOWN: + return 0x0; + case ROCKSDB_NAMESPACE::ThreadStatus::StateType::STATE_MUTEX_WAIT: + return 0x1; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::ThreadStatus::StateType enum for the - // provided Java org.rocksdb.StateType - static rocksdb::ThreadStatus::StateType toCppStateType( - jbyte jstate_type) { - switch(jstate_type) { - case 0x0: - return rocksdb::ThreadStatus::StateType::STATE_UNKNOWN; - case 0x1: - return rocksdb::ThreadStatus::StateType::STATE_MUTEX_WAIT; - default: - // undefined/default - return rocksdb::ThreadStatus::StateType::STATE_UNKNOWN; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::ThreadStatus::StateType enum + // for the provided Java org.rocksdb.StateType + static ROCKSDB_NAMESPACE::ThreadStatus::StateType toCppStateType( + jbyte jstate_type) { + switch (jstate_type) { + case 0x0: + return ROCKSDB_NAMESPACE::ThreadStatus::StateType::STATE_UNKNOWN; + case 0x1: + return ROCKSDB_NAMESPACE::ThreadStatus::StateType::STATE_MUTEX_WAIT; + default: + // undefined/default + return ROCKSDB_NAMESPACE::ThreadStatus::StateType::STATE_UNKNOWN; + } + } }; // The portal class for org.rocksdb.ThreadStatus @@ -6483,16 +6622,16 @@ class ThreadStatusJni : public JavaClass { /** * Create a new Java org.rocksdb.ThreadStatus object with the same - * properties as the provided C++ rocksdb::ThreadStatus object + * properties as the provided C++ ROCKSDB_NAMESPACE::ThreadStatus object * * @param env A pointer to the Java environment - * @param thread_status A pointer to rocksdb::ThreadStatus object + * @param thread_status A pointer to ROCKSDB_NAMESPACE::ThreadStatus object * * @return A reference to a Java org.rocksdb.ColumnFamilyOptions object, or * nullptr if an an exception occurs */ - static jobject construct(JNIEnv* env, - const rocksdb::ThreadStatus* thread_status) { + static jobject construct( + JNIEnv* env, const ROCKSDB_NAMESPACE::ThreadStatus* thread_status) { jclass jclazz = getJClass(env); if(jclazz == nullptr) { // exception occurred accessing class @@ -6521,7 +6660,8 @@ class ThreadStatusJni : public JavaClass { } // long[] - const jsize len = static_cast(rocksdb::ThreadStatus::kNumOperationProperties); + const jsize len = static_cast( + ROCKSDB_NAMESPACE::ThreadStatus::kNumOperationProperties); jlongArray joperation_properties = env->NewLongArray(len); if (joperation_properties == nullptr) { @@ -6573,160 +6713,159 @@ class ThreadStatusJni : public JavaClass { // The portal class for org.rocksdb.CompactionStyle class CompactionStyleJni { public: - // Returns the equivalent org.rocksdb.CompactionStyle for the provided - // C++ rocksdb::CompactionStyle enum - static jbyte toJavaCompactionStyle( - const rocksdb::CompactionStyle& compaction_style) { - switch(compaction_style) { - case rocksdb::CompactionStyle::kCompactionStyleLevel: - return 0x0; - case rocksdb::CompactionStyle::kCompactionStyleUniversal: - return 0x1; - case rocksdb::CompactionStyle::kCompactionStyleFIFO: - return 0x2; - case rocksdb::CompactionStyle::kCompactionStyleNone: - return 0x3; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.CompactionStyle for the provided + // C++ ROCKSDB_NAMESPACE::CompactionStyle enum + static jbyte toJavaCompactionStyle( + const ROCKSDB_NAMESPACE::CompactionStyle& compaction_style) { + switch (compaction_style) { + case ROCKSDB_NAMESPACE::CompactionStyle::kCompactionStyleLevel: + return 0x0; + case ROCKSDB_NAMESPACE::CompactionStyle::kCompactionStyleUniversal: + return 0x1; + case ROCKSDB_NAMESPACE::CompactionStyle::kCompactionStyleFIFO: + return 0x2; + case ROCKSDB_NAMESPACE::CompactionStyle::kCompactionStyleNone: + return 0x3; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::CompactionStyle enum for the - // provided Java org.rocksdb.CompactionStyle - static rocksdb::CompactionStyle toCppCompactionStyle( - jbyte jcompaction_style) { - switch(jcompaction_style) { - case 0x0: - return rocksdb::CompactionStyle::kCompactionStyleLevel; - case 0x1: - return rocksdb::CompactionStyle::kCompactionStyleUniversal; - case 0x2: - return rocksdb::CompactionStyle::kCompactionStyleFIFO; - case 0x3: - return rocksdb::CompactionStyle::kCompactionStyleNone; - default: - // undefined/default - return rocksdb::CompactionStyle::kCompactionStyleLevel; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::CompactionStyle enum for the + // provided Java org.rocksdb.CompactionStyle + static ROCKSDB_NAMESPACE::CompactionStyle toCppCompactionStyle( + jbyte jcompaction_style) { + switch (jcompaction_style) { + case 0x0: + return ROCKSDB_NAMESPACE::CompactionStyle::kCompactionStyleLevel; + case 0x1: + return ROCKSDB_NAMESPACE::CompactionStyle::kCompactionStyleUniversal; + case 0x2: + return ROCKSDB_NAMESPACE::CompactionStyle::kCompactionStyleFIFO; + case 0x3: + return ROCKSDB_NAMESPACE::CompactionStyle::kCompactionStyleNone; + default: + // undefined/default + return ROCKSDB_NAMESPACE::CompactionStyle::kCompactionStyleLevel; + } + } }; // The portal class for org.rocksdb.CompactionReason class CompactionReasonJni { public: - // Returns the equivalent org.rocksdb.CompactionReason for the provided - // C++ rocksdb::CompactionReason enum - static jbyte toJavaCompactionReason( - const rocksdb::CompactionReason& compaction_reason) { - switch(compaction_reason) { - case rocksdb::CompactionReason::kUnknown: - return 0x0; - case rocksdb::CompactionReason::kLevelL0FilesNum: - return 0x1; - case rocksdb::CompactionReason::kLevelMaxLevelSize: - return 0x2; - case rocksdb::CompactionReason::kUniversalSizeAmplification: - return 0x3; - case rocksdb::CompactionReason::kUniversalSizeRatio: - return 0x4; - case rocksdb::CompactionReason::kUniversalSortedRunNum: - return 0x5; - case rocksdb::CompactionReason::kFIFOMaxSize: - return 0x6; - case rocksdb::CompactionReason::kFIFOReduceNumFiles: - return 0x7; - case rocksdb::CompactionReason::kFIFOTtl: - return 0x8; - case rocksdb::CompactionReason::kManualCompaction: - return 0x9; - case rocksdb::CompactionReason::kFilesMarkedForCompaction: - return 0x10; - case rocksdb::CompactionReason::kBottommostFiles: - return 0x0A; - case rocksdb::CompactionReason::kTtl: - return 0x0B; - case rocksdb::CompactionReason::kFlush: - return 0x0C; - case rocksdb::CompactionReason::kExternalSstIngestion: - return 0x0D; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.CompactionReason for the provided + // C++ ROCKSDB_NAMESPACE::CompactionReason enum + static jbyte toJavaCompactionReason( + const ROCKSDB_NAMESPACE::CompactionReason& compaction_reason) { + switch (compaction_reason) { + case ROCKSDB_NAMESPACE::CompactionReason::kUnknown: + return 0x0; + case ROCKSDB_NAMESPACE::CompactionReason::kLevelL0FilesNum: + return 0x1; + case ROCKSDB_NAMESPACE::CompactionReason::kLevelMaxLevelSize: + return 0x2; + case ROCKSDB_NAMESPACE::CompactionReason::kUniversalSizeAmplification: + return 0x3; + case ROCKSDB_NAMESPACE::CompactionReason::kUniversalSizeRatio: + return 0x4; + case ROCKSDB_NAMESPACE::CompactionReason::kUniversalSortedRunNum: + return 0x5; + case ROCKSDB_NAMESPACE::CompactionReason::kFIFOMaxSize: + return 0x6; + case ROCKSDB_NAMESPACE::CompactionReason::kFIFOReduceNumFiles: + return 0x7; + case ROCKSDB_NAMESPACE::CompactionReason::kFIFOTtl: + return 0x8; + case ROCKSDB_NAMESPACE::CompactionReason::kManualCompaction: + return 0x9; + case ROCKSDB_NAMESPACE::CompactionReason::kFilesMarkedForCompaction: + return 0x10; + case ROCKSDB_NAMESPACE::CompactionReason::kBottommostFiles: + return 0x0A; + case ROCKSDB_NAMESPACE::CompactionReason::kTtl: + return 0x0B; + case ROCKSDB_NAMESPACE::CompactionReason::kFlush: + return 0x0C; + case ROCKSDB_NAMESPACE::CompactionReason::kExternalSstIngestion: + return 0x0D; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::CompactionReason enum for the - // provided Java org.rocksdb.CompactionReason - static rocksdb::CompactionReason toCppCompactionReason( - jbyte jcompaction_reason) { - switch(jcompaction_reason) { - case 0x0: - return rocksdb::CompactionReason::kUnknown; - case 0x1: - return rocksdb::CompactionReason::kLevelL0FilesNum; - case 0x2: - return rocksdb::CompactionReason::kLevelMaxLevelSize; - case 0x3: - return rocksdb::CompactionReason::kUniversalSizeAmplification; - case 0x4: - return rocksdb::CompactionReason::kUniversalSizeRatio; - case 0x5: - return rocksdb::CompactionReason::kUniversalSortedRunNum; - case 0x6: - return rocksdb::CompactionReason::kFIFOMaxSize; - case 0x7: - return rocksdb::CompactionReason::kFIFOReduceNumFiles; - case 0x8: - return rocksdb::CompactionReason::kFIFOTtl; - case 0x9: - return rocksdb::CompactionReason::kManualCompaction; - case 0x10: - return rocksdb::CompactionReason::kFilesMarkedForCompaction; - case 0x0A: - return rocksdb::CompactionReason::kBottommostFiles; - case 0x0B: - return rocksdb::CompactionReason::kTtl; - case 0x0C: - return rocksdb::CompactionReason::kFlush; - case 0x0D: - return rocksdb::CompactionReason::kExternalSstIngestion; - default: - // undefined/default - return rocksdb::CompactionReason::kUnknown; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::CompactionReason enum for the + // provided Java org.rocksdb.CompactionReason + static ROCKSDB_NAMESPACE::CompactionReason toCppCompactionReason( + jbyte jcompaction_reason) { + switch (jcompaction_reason) { + case 0x0: + return ROCKSDB_NAMESPACE::CompactionReason::kUnknown; + case 0x1: + return ROCKSDB_NAMESPACE::CompactionReason::kLevelL0FilesNum; + case 0x2: + return ROCKSDB_NAMESPACE::CompactionReason::kLevelMaxLevelSize; + case 0x3: + return ROCKSDB_NAMESPACE::CompactionReason::kUniversalSizeAmplification; + case 0x4: + return ROCKSDB_NAMESPACE::CompactionReason::kUniversalSizeRatio; + case 0x5: + return ROCKSDB_NAMESPACE::CompactionReason::kUniversalSortedRunNum; + case 0x6: + return ROCKSDB_NAMESPACE::CompactionReason::kFIFOMaxSize; + case 0x7: + return ROCKSDB_NAMESPACE::CompactionReason::kFIFOReduceNumFiles; + case 0x8: + return ROCKSDB_NAMESPACE::CompactionReason::kFIFOTtl; + case 0x9: + return ROCKSDB_NAMESPACE::CompactionReason::kManualCompaction; + case 0x10: + return ROCKSDB_NAMESPACE::CompactionReason::kFilesMarkedForCompaction; + case 0x0A: + return ROCKSDB_NAMESPACE::CompactionReason::kBottommostFiles; + case 0x0B: + return ROCKSDB_NAMESPACE::CompactionReason::kTtl; + case 0x0C: + return ROCKSDB_NAMESPACE::CompactionReason::kFlush; + case 0x0D: + return ROCKSDB_NAMESPACE::CompactionReason::kExternalSstIngestion; + default: + // undefined/default + return ROCKSDB_NAMESPACE::CompactionReason::kUnknown; + } + } }; // The portal class for org.rocksdb.WalFileType class WalFileTypeJni { public: - // Returns the equivalent org.rocksdb.WalFileType for the provided - // C++ rocksdb::WalFileType enum - static jbyte toJavaWalFileType( - const rocksdb::WalFileType& wal_file_type) { - switch(wal_file_type) { - case rocksdb::WalFileType::kArchivedLogFile: - return 0x0; - case rocksdb::WalFileType::kAliveLogFile: - return 0x1; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.WalFileType for the provided + // C++ ROCKSDB_NAMESPACE::WalFileType enum + static jbyte toJavaWalFileType( + const ROCKSDB_NAMESPACE::WalFileType& wal_file_type) { + switch (wal_file_type) { + case ROCKSDB_NAMESPACE::WalFileType::kArchivedLogFile: + return 0x0; + case ROCKSDB_NAMESPACE::WalFileType::kAliveLogFile: + return 0x1; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::WalFileType enum for the - // provided Java org.rocksdb.WalFileType - static rocksdb::WalFileType toCppWalFileType( - jbyte jwal_file_type) { - switch(jwal_file_type) { - case 0x0: - return rocksdb::WalFileType::kArchivedLogFile; - case 0x1: - return rocksdb::WalFileType::kAliveLogFile; - default: - // undefined/default - return rocksdb::WalFileType::kAliveLogFile; - } - } + // Returns the equivalent C++ ROCKSDB_NAMESPACE::WalFileType enum for the + // provided Java org.rocksdb.WalFileType + static ROCKSDB_NAMESPACE::WalFileType toCppWalFileType(jbyte jwal_file_type) { + switch (jwal_file_type) { + case 0x0: + return ROCKSDB_NAMESPACE::WalFileType::kArchivedLogFile; + case 0x1: + return ROCKSDB_NAMESPACE::WalFileType::kAliveLogFile; + default: + // undefined/default + return ROCKSDB_NAMESPACE::WalFileType::kAliveLogFile; + } + } }; class LogFileJni : public JavaClass { @@ -6740,7 +6879,8 @@ class LogFileJni : public JavaClass { * @return A reference to a Java org.rocksdb.LogFile object, or * nullptr if an an exception occurs */ - static jobject fromCppLogFile(JNIEnv* env, rocksdb::LogFile* log_file) { + static jobject fromCppLogFile(JNIEnv* env, + ROCKSDB_NAMESPACE::LogFile* log_file) { jclass jclazz = getJClass(env); if (jclazz == nullptr) { // exception occurred accessing class @@ -6754,19 +6894,18 @@ class LogFileJni : public JavaClass { } std::string path_name = log_file->PathName(); - jstring jpath_name = rocksdb::JniUtil::toJavaString(env, &path_name, true); + jstring jpath_name = + ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &path_name, true); if (env->ExceptionCheck()) { // exception occurred creating java string return nullptr; } - jobject jlog_file = env->NewObject(jclazz, mid, - jpath_name, - static_cast(log_file->LogNumber()), - rocksdb::WalFileTypeJni::toJavaWalFileType(log_file->Type()), + jobject jlog_file = env->NewObject( + jclazz, mid, jpath_name, static_cast(log_file->LogNumber()), + ROCKSDB_NAMESPACE::WalFileTypeJni::toJavaWalFileType(log_file->Type()), static_cast(log_file->StartSequence()), - static_cast(log_file->SizeFileBytes()) - ); + static_cast(log_file->SizeFileBytes())); if (env->ExceptionCheck()) { env->DeleteLocalRef(jpath_name); @@ -6795,8 +6934,8 @@ class LiveFileMetaDataJni : public JavaClass { * @return A reference to a Java org.rocksdb.LiveFileMetaData object, or * nullptr if an an exception occurs */ - static jobject fromCppLiveFileMetaData(JNIEnv* env, - rocksdb::LiveFileMetaData* live_file_meta_data) { + static jobject fromCppLiveFileMetaData( + JNIEnv* env, ROCKSDB_NAMESPACE::LiveFileMetaData* live_file_meta_data) { jclass jclazz = getJClass(env); if (jclazz == nullptr) { // exception occurred accessing class @@ -6809,14 +6948,14 @@ class LiveFileMetaDataJni : public JavaClass { return nullptr; } - jbyteArray jcolumn_family_name = rocksdb::JniUtil::copyBytes( + jbyteArray jcolumn_family_name = ROCKSDB_NAMESPACE::JniUtil::copyBytes( env, live_file_meta_data->column_family_name); if (jcolumn_family_name == nullptr) { // exception occurred creating java byte array return nullptr; } - jstring jfile_name = rocksdb::JniUtil::toJavaString( + jstring jfile_name = ROCKSDB_NAMESPACE::JniUtil::toJavaString( env, &live_file_meta_data->name, true); if (env->ExceptionCheck()) { // exception occurred creating java string @@ -6824,7 +6963,7 @@ class LiveFileMetaDataJni : public JavaClass { return nullptr; } - jstring jpath = rocksdb::JniUtil::toJavaString( + jstring jpath = ROCKSDB_NAMESPACE::JniUtil::toJavaString( env, &live_file_meta_data->db_path, true); if (env->ExceptionCheck()) { // exception occurred creating java string @@ -6833,7 +6972,7 @@ class LiveFileMetaDataJni : public JavaClass { return nullptr; } - jbyteArray jsmallest_key = rocksdb::JniUtil::copyBytes( + jbyteArray jsmallest_key = ROCKSDB_NAMESPACE::JniUtil::copyBytes( env, live_file_meta_data->smallestkey); if (jsmallest_key == nullptr) { // exception occurred creating java byte array @@ -6843,7 +6982,7 @@ class LiveFileMetaDataJni : public JavaClass { return nullptr; } - jbyteArray jlargest_key = rocksdb::JniUtil::copyBytes( + jbyteArray jlargest_key = ROCKSDB_NAMESPACE::JniUtil::copyBytes( env, live_file_meta_data->largestkey); if (jlargest_key == nullptr) { // exception occurred creating java byte array @@ -6905,8 +7044,9 @@ class SstFileMetaDataJni : public JavaClass { * @return A reference to a Java org.rocksdb.SstFileMetaData object, or * nullptr if an an exception occurs */ - static jobject fromCppSstFileMetaData(JNIEnv* env, - const rocksdb::SstFileMetaData* sst_file_meta_data) { + static jobject fromCppSstFileMetaData( + JNIEnv* env, + const ROCKSDB_NAMESPACE::SstFileMetaData* sst_file_meta_data) { jclass jclazz = getJClass(env); if (jclazz == nullptr) { // exception occurred accessing class @@ -6919,14 +7059,14 @@ class SstFileMetaDataJni : public JavaClass { return nullptr; } - jstring jfile_name = rocksdb::JniUtil::toJavaString( + jstring jfile_name = ROCKSDB_NAMESPACE::JniUtil::toJavaString( env, &sst_file_meta_data->name, true); if (jfile_name == nullptr) { // exception occurred creating java byte array return nullptr; } - jstring jpath = rocksdb::JniUtil::toJavaString( + jstring jpath = ROCKSDB_NAMESPACE::JniUtil::toJavaString( env, &sst_file_meta_data->db_path, true); if (jpath == nullptr) { // exception occurred creating java byte array @@ -6934,7 +7074,7 @@ class SstFileMetaDataJni : public JavaClass { return nullptr; } - jbyteArray jsmallest_key = rocksdb::JniUtil::copyBytes( + jbyteArray jsmallest_key = ROCKSDB_NAMESPACE::JniUtil::copyBytes( env, sst_file_meta_data->smallestkey); if (jsmallest_key == nullptr) { // exception occurred creating java byte array @@ -6943,7 +7083,7 @@ class SstFileMetaDataJni : public JavaClass { return nullptr; } - jbyteArray jlargest_key = rocksdb::JniUtil::copyBytes( + jbyteArray jlargest_key = ROCKSDB_NAMESPACE::JniUtil::copyBytes( env, sst_file_meta_data->largestkey); if (jlargest_key == nullptr) { // exception occurred creating java byte array @@ -7000,8 +7140,8 @@ class LevelMetaDataJni : public JavaClass { * @return A reference to a Java org.rocksdb.LevelMetaData object, or * nullptr if an an exception occurs */ - static jobject fromCppLevelMetaData(JNIEnv* env, - const rocksdb::LevelMetaData* level_meta_data) { + static jobject fromCppLevelMetaData( + JNIEnv* env, const ROCKSDB_NAMESPACE::LevelMetaData* level_meta_data) { jclass jclazz = getJClass(env); if (jclazz == nullptr) { // exception occurred accessing class @@ -7067,8 +7207,9 @@ class ColumnFamilyMetaDataJni : public JavaClass { * @return A reference to a Java org.rocksdb.ColumnFamilyMetaData object, or * nullptr if an an exception occurs */ - static jobject fromCppColumnFamilyMetaData(JNIEnv* env, - const rocksdb::ColumnFamilyMetaData* column_famly_meta_data) { + static jobject fromCppColumnFamilyMetaData( + JNIEnv* env, + const ROCKSDB_NAMESPACE::ColumnFamilyMetaData* column_famly_meta_data) { jclass jclazz = getJClass(env); if (jclazz == nullptr) { // exception occurred accessing class @@ -7081,7 +7222,7 @@ class ColumnFamilyMetaDataJni : public JavaClass { return nullptr; } - jbyteArray jname = rocksdb::JniUtil::copyBytes( + jbyteArray jname = ROCKSDB_NAMESPACE::JniUtil::copyBytes( env, column_famly_meta_data->name); if (jname == nullptr) { // exception occurred creating java byte array @@ -7136,9 +7277,10 @@ class ColumnFamilyMetaDataJni : public JavaClass { }; // The portal class for org.rocksdb.AbstractTraceWriter -class AbstractTraceWriterJni : public RocksDBNativeClass< - const rocksdb::TraceWriterJniCallback*, - AbstractTraceWriterJni> { +class AbstractTraceWriterJni + : public RocksDBNativeClass< + const ROCKSDB_NAMESPACE::TraceWriterJniCallback*, + AbstractTraceWriterJni> { public: /** * Get the Java Class org.rocksdb.AbstractTraceWriter @@ -7219,9 +7361,9 @@ class AbstractTraceWriterJni : public RocksDBNativeClass< }; // The portal class for org.rocksdb.AbstractWalFilter -class AbstractWalFilterJni : public RocksDBNativeClass< - const rocksdb::WalFilterJniCallback*, - AbstractWalFilterJni> { +class AbstractWalFilterJni + : public RocksDBNativeClass { public: /** * Get the Java Class org.rocksdb.AbstractWalFilter @@ -7305,79 +7447,88 @@ class AbstractWalFilterJni : public RocksDBNativeClass< // The portal class for org.rocksdb.WalProcessingOption class WalProcessingOptionJni { public: - // Returns the equivalent org.rocksdb.WalProcessingOption for the provided - // C++ rocksdb::WalFilter::WalProcessingOption enum - static jbyte toJavaWalProcessingOption( - const rocksdb::WalFilter::WalProcessingOption& wal_processing_option) { - switch(wal_processing_option) { - case rocksdb::WalFilter::WalProcessingOption::kContinueProcessing: - return 0x0; - case rocksdb::WalFilter::WalProcessingOption::kIgnoreCurrentRecord: - return 0x1; - case rocksdb::WalFilter::WalProcessingOption::kStopReplay: - return 0x2; - case rocksdb::WalFilter::WalProcessingOption::kCorruptedRecord: - return 0x3; - default: - return 0x7F; // undefined - } - } + // Returns the equivalent org.rocksdb.WalProcessingOption for the provided + // C++ ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption enum + static jbyte toJavaWalProcessingOption( + const ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption& + wal_processing_option) { + switch (wal_processing_option) { + case ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption:: + kContinueProcessing: + return 0x0; + case ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption:: + kIgnoreCurrentRecord: + return 0x1; + case ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption::kStopReplay: + return 0x2; + case ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption::kCorruptedRecord: + return 0x3; + default: + return 0x7F; // undefined + } + } - // Returns the equivalent C++ rocksdb::WalFilter::WalProcessingOption enum for - // the provided Java org.rocksdb.WalProcessingOption - static rocksdb::WalFilter::WalProcessingOption toCppWalProcessingOption( - jbyte jwal_processing_option) { - switch(jwal_processing_option) { - case 0x0: - return rocksdb::WalFilter::WalProcessingOption::kContinueProcessing; - case 0x1: - return rocksdb::WalFilter::WalProcessingOption::kIgnoreCurrentRecord; - case 0x2: - return rocksdb::WalFilter::WalProcessingOption::kStopReplay; - case 0x3: - return rocksdb::WalFilter::WalProcessingOption::kCorruptedRecord; - default: - // undefined/default - return rocksdb::WalFilter::WalProcessingOption::kCorruptedRecord; - } - } + // Returns the equivalent C++ + // ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption enum for the provided + // Java org.rocksdb.WalProcessingOption + static ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption + toCppWalProcessingOption(jbyte jwal_processing_option) { + switch (jwal_processing_option) { + case 0x0: + return ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption:: + kContinueProcessing; + case 0x1: + return ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption:: + kIgnoreCurrentRecord; + case 0x2: + return ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption::kStopReplay; + case 0x3: + return ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption:: + kCorruptedRecord; + default: + // undefined/default + return ROCKSDB_NAMESPACE::WalFilter::WalProcessingOption:: + kCorruptedRecord; + } + } }; // The portal class for org.rocksdb.ReusedSynchronisationType class ReusedSynchronisationTypeJni { public: - // Returns the equivalent org.rocksdb.ReusedSynchronisationType for the provided - // C++ rocksdb::ReusedSynchronisationType enum + // Returns the equivalent org.rocksdb.ReusedSynchronisationType for the + // provided C++ ROCKSDB_NAMESPACE::ReusedSynchronisationType enum static jbyte toJavaReusedSynchronisationType( - const rocksdb::ReusedSynchronisationType& reused_synchronisation_type) { + const ROCKSDB_NAMESPACE::ReusedSynchronisationType& + reused_synchronisation_type) { switch(reused_synchronisation_type) { - case rocksdb::ReusedSynchronisationType::MUTEX: + case ROCKSDB_NAMESPACE::ReusedSynchronisationType::MUTEX: return 0x0; - case rocksdb::ReusedSynchronisationType::ADAPTIVE_MUTEX: + case ROCKSDB_NAMESPACE::ReusedSynchronisationType::ADAPTIVE_MUTEX: return 0x1; - case rocksdb::ReusedSynchronisationType::THREAD_LOCAL: + case ROCKSDB_NAMESPACE::ReusedSynchronisationType::THREAD_LOCAL: return 0x2; default: return 0x7F; // undefined } } - // Returns the equivalent C++ rocksdb::ReusedSynchronisationType enum for the - // provided Java org.rocksdb.ReusedSynchronisationType - static rocksdb::ReusedSynchronisationType toCppReusedSynchronisationType( - jbyte reused_synchronisation_type) { + // Returns the equivalent C++ ROCKSDB_NAMESPACE::ReusedSynchronisationType + // enum for the provided Java org.rocksdb.ReusedSynchronisationType + static ROCKSDB_NAMESPACE::ReusedSynchronisationType + toCppReusedSynchronisationType(jbyte reused_synchronisation_type) { switch(reused_synchronisation_type) { case 0x0: - return rocksdb::ReusedSynchronisationType::MUTEX; + return ROCKSDB_NAMESPACE::ReusedSynchronisationType::MUTEX; case 0x1: - return rocksdb::ReusedSynchronisationType::ADAPTIVE_MUTEX; + return ROCKSDB_NAMESPACE::ReusedSynchronisationType::ADAPTIVE_MUTEX; case 0x2: - return rocksdb::ReusedSynchronisationType::THREAD_LOCAL; + return ROCKSDB_NAMESPACE::ReusedSynchronisationType::THREAD_LOCAL; default: // undefined/default - return rocksdb::ReusedSynchronisationType::ADAPTIVE_MUTEX; + return ROCKSDB_NAMESPACE::ReusedSynchronisationType::ADAPTIVE_MUTEX; } } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_PORTAL_H_ diff --git a/java/rocksjni/ratelimiterjni.cc b/java/rocksjni/ratelimiterjni.cc index 0804c2fbca..96b440dcc1 100644 --- a/java/rocksjni/ratelimiterjni.cc +++ b/java/rocksjni/ratelimiterjni.cc @@ -19,9 +19,10 @@ jlong Java_org_rocksdb_RateLimiter_newRateLimiterHandle( jlong jrefill_period_micros, jint jfairness, jbyte jrate_limiter_mode, jboolean jauto_tune) { auto rate_limiter_mode = - rocksdb::RateLimiterModeJni::toCppRateLimiterMode(jrate_limiter_mode); - auto* sptr_rate_limiter = - new std::shared_ptr(rocksdb::NewGenericRateLimiter( + ROCKSDB_NAMESPACE::RateLimiterModeJni::toCppRateLimiterMode( + jrate_limiter_mode); + auto* sptr_rate_limiter = new std::shared_ptr( + ROCKSDB_NAMESPACE::NewGenericRateLimiter( static_cast(jrate_bytes_per_second), static_cast(jrefill_period_micros), static_cast(jfairness), rate_limiter_mode, jauto_tune)); @@ -38,7 +39,8 @@ void Java_org_rocksdb_RateLimiter_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* handle = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); delete handle; // delete std::shared_ptr } @@ -51,7 +53,7 @@ void Java_org_rocksdb_RateLimiter_setBytesPerSecond(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jlong jbytes_per_second) { - reinterpret_cast*>(handle) + reinterpret_cast*>(handle) ->get() ->SetBytesPerSecond(jbytes_per_second); } @@ -64,7 +66,8 @@ void Java_org_rocksdb_RateLimiter_setBytesPerSecond(JNIEnv* /*env*/, jlong Java_org_rocksdb_RateLimiter_getBytesPerSecond(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - return reinterpret_cast*>(handle) + return reinterpret_cast*>( + handle) ->get() ->GetBytesPerSecond(); } @@ -76,9 +79,9 @@ jlong Java_org_rocksdb_RateLimiter_getBytesPerSecond(JNIEnv* /*env*/, */ void Java_org_rocksdb_RateLimiter_request(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jlong jbytes) { - reinterpret_cast*>(handle) + reinterpret_cast*>(handle) ->get() - ->Request(jbytes, rocksdb::Env::IO_TOTAL); + ->Request(jbytes, ROCKSDB_NAMESPACE::Env::IO_TOTAL); } /* @@ -89,7 +92,8 @@ void Java_org_rocksdb_RateLimiter_request(JNIEnv* /*env*/, jobject /*jobj*/, jlong Java_org_rocksdb_RateLimiter_getSingleBurstBytes(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - return reinterpret_cast*>(handle) + return reinterpret_cast*>( + handle) ->get() ->GetSingleBurstBytes(); } @@ -102,7 +106,8 @@ jlong Java_org_rocksdb_RateLimiter_getSingleBurstBytes(JNIEnv* /*env*/, jlong Java_org_rocksdb_RateLimiter_getTotalBytesThrough(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - return reinterpret_cast*>(handle) + return reinterpret_cast*>( + handle) ->get() ->GetTotalBytesThrough(); } @@ -115,7 +120,8 @@ jlong Java_org_rocksdb_RateLimiter_getTotalBytesThrough(JNIEnv* /*env*/, jlong Java_org_rocksdb_RateLimiter_getTotalRequests(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - return reinterpret_cast*>(handle) + return reinterpret_cast*>( + handle) ->get() ->GetTotalRequests(); } diff --git a/java/rocksjni/remove_emptyvalue_compactionfilterjni.cc b/java/rocksjni/remove_emptyvalue_compactionfilterjni.cc index ede150fa62..8f0037b39f 100644 --- a/java/rocksjni/remove_emptyvalue_compactionfilterjni.cc +++ b/java/rocksjni/remove_emptyvalue_compactionfilterjni.cc @@ -15,7 +15,8 @@ */ jlong Java_org_rocksdb_RemoveEmptyValueCompactionFilter_createNewRemoveEmptyValueCompactionFilter0( JNIEnv* /*env*/, jclass /*jcls*/) { - auto* compaction_filter = new rocksdb::RemoveEmptyValueCompactionFilter(); + auto* compaction_filter = + new ROCKSDB_NAMESPACE::RemoveEmptyValueCompactionFilter(); // set the native handle to our native compaction filter return reinterpret_cast(compaction_filter); diff --git a/java/rocksjni/restorejni.cc b/java/rocksjni/restorejni.cc index beca74fb56..9b605c7040 100644 --- a/java/rocksjni/restorejni.cc +++ b/java/rocksjni/restorejni.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling C++ rocksdb::RestoreOptions methods +// calling C++ ROCKSDB_NAMESPACE::RestoreOptions methods // from Java side. #include @@ -22,7 +22,7 @@ */ jlong Java_org_rocksdb_RestoreOptions_newRestoreOptions( JNIEnv* /*env*/, jclass /*jcls*/, jboolean keep_log_files) { - auto* ropt = new rocksdb::RestoreOptions(keep_log_files); + auto* ropt = new ROCKSDB_NAMESPACE::RestoreOptions(keep_log_files); return reinterpret_cast(ropt); } @@ -34,7 +34,7 @@ jlong Java_org_rocksdb_RestoreOptions_newRestoreOptions( void Java_org_rocksdb_RestoreOptions_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* ropt = reinterpret_cast(jhandle); + auto* ropt = reinterpret_cast(jhandle); assert(ropt); delete ropt; } diff --git a/java/rocksjni/rocks_callback_object.cc b/java/rocksjni/rocks_callback_object.cc index 874ef3375a..73aa861379 100644 --- a/java/rocksjni/rocks_callback_object.cc +++ b/java/rocksjni/rocks_callback_object.cc @@ -26,6 +26,6 @@ void Java_org_rocksdb_RocksCallbackObject_disposeInternal(JNIEnv* /*env*/, // JniCallback -> ComparatorJniCallback // I think this is okay, as Comparator and JniCallback both have virtual // destructors... - delete reinterpret_cast(handle); + delete reinterpret_cast(handle); // @lint-ignore TXT4 T25377293 Grandfathered in } \ No newline at end of file diff --git a/java/rocksjni/rocksdb_exception_test.cc b/java/rocksjni/rocksdb_exception_test.cc index 6e5978121b..d0fd834baa 100644 --- a/java/rocksjni/rocksdb_exception_test.cc +++ b/java/rocksjni/rocksdb_exception_test.cc @@ -18,7 +18,8 @@ */ void Java_org_rocksdb_RocksDBExceptionTest_raiseException(JNIEnv* env, jobject /*jobj*/) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, std::string("test message")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, + std::string("test message")); } /* @@ -28,8 +29,8 @@ void Java_org_rocksdb_RocksDBExceptionTest_raiseException(JNIEnv* env, */ void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCode( JNIEnv* env, jobject /*jobj*/) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, "test message", - rocksdb::Status::NotSupported()); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "test message", ROCKSDB_NAMESPACE::Status::NotSupported()); } /* @@ -39,7 +40,8 @@ void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCode( */ void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionNoMsgWithStatusCode( JNIEnv* env, jobject /*jobj*/) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, rocksdb::Status::NotSupported()); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::NotSupported()); } /* @@ -49,9 +51,10 @@ void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionNoMsgWithStatusCode( */ void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCodeSubCode( JNIEnv* env, jobject /*jobj*/) { - rocksdb::RocksDBExceptionJni::ThrowNew( + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, "test message", - rocksdb::Status::TimedOut(rocksdb::Status::SubCode::kLockTimeout)); + ROCKSDB_NAMESPACE::Status::TimedOut( + ROCKSDB_NAMESPACE::Status::SubCode::kLockTimeout)); } /* @@ -61,8 +64,9 @@ void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCodeSubCode( */ void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionNoMsgWithStatusCodeSubCode( JNIEnv* env, jobject /*jobj*/) { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::TimedOut(rocksdb::Status::SubCode::kLockTimeout)); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::TimedOut( + ROCKSDB_NAMESPACE::Status::SubCode::kLockTimeout)); } /* @@ -72,7 +76,7 @@ void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionNoMsgWithStatusCodeSubC */ void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCodeState( JNIEnv* env, jobject /*jobj*/) { - rocksdb::Slice state("test state"); - rocksdb::RocksDBExceptionJni::ThrowNew(env, "test message", - rocksdb::Status::NotSupported(state)); + ROCKSDB_NAMESPACE::Slice state("test state"); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "test message", ROCKSDB_NAMESPACE::Status::NotSupported(state)); } diff --git a/java/rocksjni/rocksjni.cc b/java/rocksjni/rocksjni.cc index 0342eef5fe..84175913a6 100644 --- a/java/rocksjni/rocksjni.cc +++ b/java/rocksjni/rocksjni.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::DB methods from Java side. +// calling c++ ROCKSDB_NAMESPACE::DB methods from Java side. #include #include @@ -28,27 +28,27 @@ #undef min #endif -jlong rocksdb_open_helper( - JNIEnv* env, jlong jopt_handle, jstring jdb_path, - std::function - open_fn) { +jlong rocksdb_open_helper(JNIEnv* env, jlong jopt_handle, jstring jdb_path, + std::function + open_fn) { const char* db_path = env->GetStringUTFChars(jdb_path, nullptr); if (db_path == nullptr) { // exception thrown: OutOfMemoryError return 0; } - auto* opt = reinterpret_cast(jopt_handle); - rocksdb::DB* db = nullptr; - rocksdb::Status s = open_fn(*opt, db_path, &db); + auto* opt = reinterpret_cast(jopt_handle); + ROCKSDB_NAMESPACE::DB* db = nullptr; + ROCKSDB_NAMESPACE::Status s = open_fn(*opt, db_path, &db); env->ReleaseStringUTFChars(jdb_path, db_path); if (s.ok()) { return reinterpret_cast(db); } else { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return 0; } } @@ -60,11 +60,11 @@ jlong rocksdb_open_helper( */ jlong Java_org_rocksdb_RocksDB_open__JLjava_lang_String_2( JNIEnv* env, jclass, jlong jopt_handle, jstring jdb_path) { - return rocksdb_open_helper( - env, jopt_handle, jdb_path, - (rocksdb::Status(*)(const rocksdb::Options&, const std::string&, - rocksdb::DB**)) & - rocksdb::DB::Open); + return rocksdb_open_helper(env, jopt_handle, jdb_path, + (ROCKSDB_NAMESPACE::Status(*)( + const ROCKSDB_NAMESPACE::Options&, + const std::string&, ROCKSDB_NAMESPACE::DB**)) & + ROCKSDB_NAMESPACE::DB::Open); } /* @@ -74,21 +74,22 @@ jlong Java_org_rocksdb_RocksDB_open__JLjava_lang_String_2( */ jlong Java_org_rocksdb_RocksDB_openROnly__JLjava_lang_String_2( JNIEnv* env, jclass, jlong jopt_handle, jstring jdb_path) { - return rocksdb_open_helper(env, jopt_handle, jdb_path, - [](const rocksdb::Options& options, - const std::string& db_path, rocksdb::DB** db) { - return rocksdb::DB::OpenForReadOnly(options, - db_path, db); - }); + return rocksdb_open_helper( + env, jopt_handle, jdb_path, + [](const ROCKSDB_NAMESPACE::Options& options, const std::string& db_path, + ROCKSDB_NAMESPACE::DB** db) { + return ROCKSDB_NAMESPACE::DB::OpenForReadOnly(options, db_path, db); + }); } jlongArray rocksdb_open_helper( JNIEnv* env, jlong jopt_handle, jstring jdb_path, jobjectArray jcolumn_names, jlongArray jcolumn_options, - std::function&, - std::vector*, rocksdb::DB**)> + std::function&, + std::vector*, + ROCKSDB_NAMESPACE::DB**)> open_fn) { const char* db_path = env->GetStringUTFChars(jdb_path, nullptr); if (db_path == nullptr) { @@ -104,18 +105,18 @@ jlongArray rocksdb_open_helper( return nullptr; } - std::vector column_families; + std::vector column_families; jboolean has_exception = JNI_FALSE; - rocksdb::JniUtil::byteStrings( + ROCKSDB_NAMESPACE::JniUtil::byteStrings( env, jcolumn_names, [](const char* str_data, const size_t str_len) { return std::string(str_data, str_len); }, [&jco, &column_families](size_t idx, std::string cf_name) { - rocksdb::ColumnFamilyOptions* cf_options = - reinterpret_cast(jco[idx]); + ROCKSDB_NAMESPACE::ColumnFamilyOptions* cf_options = + reinterpret_cast(jco[idx]); column_families.push_back( - rocksdb::ColumnFamilyDescriptor(cf_name, *cf_options)); + ROCKSDB_NAMESPACE::ColumnFamilyDescriptor(cf_name, *cf_options)); }, &has_exception); @@ -127,17 +128,18 @@ jlongArray rocksdb_open_helper( return nullptr; } - auto* opt = reinterpret_cast(jopt_handle); - std::vector cf_handles; - rocksdb::DB* db = nullptr; - rocksdb::Status s = open_fn(*opt, db_path, column_families, &cf_handles, &db); + auto* opt = reinterpret_cast(jopt_handle); + std::vector cf_handles; + ROCKSDB_NAMESPACE::DB* db = nullptr; + ROCKSDB_NAMESPACE::Status s = + open_fn(*opt, db_path, column_families, &cf_handles, &db); // we have now finished with db_path env->ReleaseStringUTFChars(jdb_path, db_path); // check if open operation was successful if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } @@ -175,11 +177,14 @@ jlongArray Java_org_rocksdb_RocksDB_openROnly__JLjava_lang_String_2_3_3B_3J( jobjectArray jcolumn_names, jlongArray jcolumn_options) { return rocksdb_open_helper( env, jopt_handle, jdb_path, jcolumn_names, jcolumn_options, - [](const rocksdb::DBOptions& options, const std::string& db_path, - const std::vector& column_families, - std::vector* handles, rocksdb::DB** db) { - return rocksdb::DB::OpenForReadOnly(options, db_path, column_families, - handles, db); + [](const ROCKSDB_NAMESPACE::DBOptions& options, + const std::string& db_path, + const std::vector& + column_families, + std::vector* handles, + ROCKSDB_NAMESPACE::DB** db) { + return ROCKSDB_NAMESPACE::DB::OpenForReadOnly( + options, db_path, column_families, handles, db); }); } @@ -193,11 +198,12 @@ jlongArray Java_org_rocksdb_RocksDB_open__JLjava_lang_String_2_3_3B_3J( jobjectArray jcolumn_names, jlongArray jcolumn_options) { return rocksdb_open_helper( env, jopt_handle, jdb_path, jcolumn_names, jcolumn_options, - (rocksdb::Status(*)(const rocksdb::DBOptions&, const std::string&, - const std::vector&, - std::vector*, - rocksdb::DB**)) & - rocksdb::DB::Open); + (ROCKSDB_NAMESPACE::Status(*)( + const ROCKSDB_NAMESPACE::DBOptions&, const std::string&, + const std::vector&, + std::vector*, + ROCKSDB_NAMESPACE::DB**)) & + ROCKSDB_NAMESPACE::DB::Open); } /* @@ -207,7 +213,7 @@ jlongArray Java_org_rocksdb_RocksDB_open__JLjava_lang_String_2_3_3B_3J( */ void Java_org_rocksdb_RocksDB_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto* db = reinterpret_cast(jhandle); + auto* db = reinterpret_cast(jhandle); assert(db != nullptr); delete db; } @@ -219,10 +225,10 @@ void Java_org_rocksdb_RocksDB_disposeInternal( */ void Java_org_rocksdb_RocksDB_closeDatabase( JNIEnv* env, jclass, jlong jhandle) { - auto* db = reinterpret_cast(jhandle); + auto* db = reinterpret_cast(jhandle); assert(db != nullptr); - rocksdb::Status s = db->Close(); - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::Status s = db->Close(); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -239,14 +245,14 @@ jobjectArray Java_org_rocksdb_RocksDB_listColumnFamilies( return nullptr; } - auto* opt = reinterpret_cast(jopt_handle); - rocksdb::Status s = - rocksdb::DB::ListColumnFamilies(*opt, db_path, &column_family_names); + auto* opt = reinterpret_cast(jopt_handle); + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::DB::ListColumnFamilies( + *opt, db_path, &column_family_names); env->ReleaseStringUTFChars(jdb_path, db_path); jobjectArray jcolumn_family_names = - rocksdb::JniUtil::stringsBytes(env, column_family_names); + ROCKSDB_NAMESPACE::JniUtil::stringsBytes(env, column_family_names); return jcolumn_family_names; } @@ -259,24 +265,27 @@ jobjectArray Java_org_rocksdb_RocksDB_listColumnFamilies( jlong Java_org_rocksdb_RocksDB_createColumnFamily( JNIEnv* env, jobject, jlong jhandle, jbyteArray jcf_name, jint jcf_name_len, jlong jcf_options_handle) { - auto* db = reinterpret_cast(jhandle); + auto* db = reinterpret_cast(jhandle); jboolean has_exception = JNI_FALSE; const std::string cf_name = - rocksdb::JniUtil::byteString(env, jcf_name, jcf_name_len, + ROCKSDB_NAMESPACE::JniUtil::byteString( + env, jcf_name, jcf_name_len, [](const char* str, const size_t len) { - return std::string(str, len); - }, &has_exception); + return std::string(str, len); + }, + &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return 0; } - auto* cf_options = - reinterpret_cast(jcf_options_handle); - rocksdb::ColumnFamilyHandle *cf_handle; - rocksdb::Status s = db->CreateColumnFamily(*cf_options, cf_name, &cf_handle); + auto* cf_options = reinterpret_cast( + jcf_options_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; + ROCKSDB_NAMESPACE::Status s = + db->CreateColumnFamily(*cf_options, cf_name, &cf_handle); if (!s.ok()) { // error occurred - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return 0; } return reinterpret_cast(cf_handle); @@ -290,34 +299,32 @@ jlong Java_org_rocksdb_RocksDB_createColumnFamily( jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__JJ_3_3B( JNIEnv* env, jobject, jlong jhandle, jlong jcf_options_handle, jobjectArray jcf_names) { - auto* db = reinterpret_cast(jhandle); - auto* cf_options = - reinterpret_cast(jcf_options_handle); + auto* db = reinterpret_cast(jhandle); + auto* cf_options = reinterpret_cast( + jcf_options_handle); jboolean has_exception = JNI_FALSE; std::vector cf_names; - rocksdb::JniUtil::byteStrings(env, jcf_names, - [](const char* str, const size_t len) { - return std::string(str, len); - }, - [&cf_names](const size_t, std::string str) { - cf_names.push_back(str); - }, + ROCKSDB_NAMESPACE::JniUtil::byteStrings( + env, jcf_names, + [](const char* str, const size_t len) { return std::string(str, len); }, + [&cf_names](const size_t, std::string str) { cf_names.push_back(str); }, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return nullptr; } - std::vector cf_handles; - rocksdb::Status s = db->CreateColumnFamilies(*cf_options, cf_names, &cf_handles); + std::vector cf_handles; + ROCKSDB_NAMESPACE::Status s = + db->CreateColumnFamilies(*cf_options, cf_names, &cf_handles); if (!s.ok()) { // error occurred - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } - jlongArray jcf_handles = rocksdb::JniUtil::toJPointers( - env, cf_handles, &has_exception); + jlongArray jcf_handles = ROCKSDB_NAMESPACE::JniUtil::toJPointers< + ROCKSDB_NAMESPACE::ColumnFamilyHandle>(env, cf_handles, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return nullptr; @@ -333,9 +340,9 @@ jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__JJ_3_3B( jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__J_3J_3_3B( JNIEnv* env, jobject, jlong jhandle, jlongArray jcf_options_handles, jobjectArray jcf_names) { - auto* db = reinterpret_cast(jhandle); + auto* db = reinterpret_cast(jhandle); const jsize jlen = env->GetArrayLength(jcf_options_handles); - std::vector cf_descriptors; + std::vector cf_descriptors; cf_descriptors.reserve(jlen); jboolean jcf_options_handles_is_copy = JNI_FALSE; @@ -348,21 +355,23 @@ jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__J_3J_3_3B( // extract the column family descriptors jboolean has_exception = JNI_FALSE; for (jsize i = 0; i < jlen; i++) { - auto* cf_options = reinterpret_cast( - jcf_options_handles_elems[i]); + auto* cf_options = + reinterpret_cast( + jcf_options_handles_elems[i]); jbyteArray jcf_name = static_cast( env->GetObjectArrayElement(jcf_names, i)); if (env->ExceptionCheck()) { // exception thrown: ArrayIndexOutOfBoundsException env->ReleaseLongArrayElements(jcf_options_handles, jcf_options_handles_elems, JNI_ABORT); return nullptr; - } + } const std::string cf_name = - rocksdb::JniUtil::byteString(env, jcf_name, - [](const char* str, const size_t len) { - return std::string(str, len); - }, - &has_exception); + ROCKSDB_NAMESPACE::JniUtil::byteString( + env, jcf_name, + [](const char* str, const size_t len) { + return std::string(str, len); + }, + &has_exception); if (has_exception == JNI_TRUE) { // exception occurred env->DeleteLocalRef(jcf_name); @@ -370,24 +379,26 @@ jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__J_3J_3_3B( return nullptr; } - cf_descriptors.push_back(rocksdb::ColumnFamilyDescriptor(cf_name, *cf_options)); + cf_descriptors.push_back( + ROCKSDB_NAMESPACE::ColumnFamilyDescriptor(cf_name, *cf_options)); env->DeleteLocalRef(jcf_name); } - std::vector cf_handles; - rocksdb::Status s = db->CreateColumnFamilies(cf_descriptors, &cf_handles); + std::vector cf_handles; + ROCKSDB_NAMESPACE::Status s = + db->CreateColumnFamilies(cf_descriptors, &cf_handles); env->ReleaseLongArrayElements(jcf_options_handles, jcf_options_handles_elems, JNI_ABORT); if (!s.ok()) { // error occurred - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } - jlongArray jcf_handles = rocksdb::JniUtil::toJPointers( - env, cf_handles, &has_exception); + jlongArray jcf_handles = ROCKSDB_NAMESPACE::JniUtil::toJPointers< + ROCKSDB_NAMESPACE::ColumnFamilyHandle>(env, cf_handles, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return nullptr; @@ -403,11 +414,12 @@ jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__J_3J_3_3B( void Java_org_rocksdb_RocksDB_dropColumnFamily( JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle) { - auto* db_handle = reinterpret_cast(jdb_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); - rocksdb::Status s = db_handle->DropColumnFamily(cf_handle); + auto* db_handle = reinterpret_cast(jdb_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); + ROCKSDB_NAMESPACE::Status s = db_handle->DropColumnFamily(cf_handle); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -419,9 +431,9 @@ void Java_org_rocksdb_RocksDB_dropColumnFamily( void Java_org_rocksdb_RocksDB_dropColumnFamilies( JNIEnv* env, jobject, jlong jdb_handle, jlongArray jcolumn_family_handles) { - auto* db_handle = reinterpret_cast(jdb_handle); + auto* db_handle = reinterpret_cast(jdb_handle); - std::vector cf_handles; + std::vector cf_handles; if (jcolumn_family_handles != nullptr) { const jsize len_cols = env->GetArrayLength(jcolumn_family_handles); @@ -432,30 +444,30 @@ void Java_org_rocksdb_RocksDB_dropColumnFamilies( } for (jsize i = 0; i < len_cols; i++) { - auto* cf_handle = reinterpret_cast(jcfh[i]); + auto* cf_handle = + reinterpret_cast(jcfh[i]); cf_handles.push_back(cf_handle); } env->ReleaseLongArrayElements(jcolumn_family_handles, jcfh, JNI_ABORT); } - rocksdb::Status s = db_handle->DropColumnFamilies(cf_handles); + ROCKSDB_NAMESPACE::Status s = db_handle->DropColumnFamilies(cf_handles); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } ////////////////////////////////////////////////////////////////////////////// -// rocksdb::DB::Put +// ROCKSDB_NAMESPACE::DB::Put /** * @return true if the put succeeded, false if a Java Exception was thrown */ -bool rocksdb_put_helper( - JNIEnv* env, rocksdb::DB* db, - const rocksdb::WriteOptions& write_options, - rocksdb::ColumnFamilyHandle* cf_handle, jbyteArray jkey, - jint jkey_off, jint jkey_len, jbyteArray jval, - jint jval_off, jint jval_len) { +bool rocksdb_put_helper(JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, + const ROCKSDB_NAMESPACE::WriteOptions& write_options, + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle, + jbyteArray jkey, jint jkey_off, jint jkey_len, + jbyteArray jval, jint jval_off, jint jval_len) { jbyte* key = new jbyte[jkey_len]; env->GetByteArrayRegion(jkey, jkey_off, jkey_len, key); if (env->ExceptionCheck()) { @@ -473,10 +485,11 @@ bool rocksdb_put_helper( return false; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_len); - rocksdb::Slice value_slice(reinterpret_cast(value), jval_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), jkey_len); + ROCKSDB_NAMESPACE::Slice value_slice(reinterpret_cast(value), + jval_len); - rocksdb::Status s; + ROCKSDB_NAMESPACE::Status s; if (cf_handle != nullptr) { s = db->Put(write_options, cf_handle, key_slice, value_slice); } else { @@ -491,7 +504,7 @@ bool rocksdb_put_helper( if (s.ok()) { return true; } else { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return false; } } @@ -505,9 +518,9 @@ void Java_org_rocksdb_RocksDB_put__J_3BII_3BII( JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len) { - auto* db = reinterpret_cast(jdb_handle); - static const rocksdb::WriteOptions default_write_options = - rocksdb::WriteOptions(); + auto* db = reinterpret_cast(jdb_handle); + static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = + ROCKSDB_NAMESPACE::WriteOptions(); rocksdb_put_helper(env, db, default_write_options, nullptr, jkey, jkey_off, jkey_len, jval, jval_off, jval_len); } @@ -522,16 +535,18 @@ void Java_org_rocksdb_RocksDB_put__J_3BII_3BIIJ( jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - static const rocksdb::WriteOptions default_write_options = - rocksdb::WriteOptions(); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db = reinterpret_cast(jdb_handle); + static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = + ROCKSDB_NAMESPACE::WriteOptions(); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_put_helper(env, db, default_write_options, cf_handle, jkey, jkey_off, jkey_len, jval, jval_off, jval_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); } } @@ -545,9 +560,9 @@ void Java_org_rocksdb_RocksDB_put__JJ_3BII_3BII( jlong jwrite_options_handle, jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options_handle); + reinterpret_cast(jwrite_options_handle); rocksdb_put_helper(env, db, *write_options, nullptr, jkey, jkey_off, jkey_len, jval, jval_off, jval_len); } @@ -562,16 +577,18 @@ void Java_org_rocksdb_RocksDB_put__JJ_3BII_3BIIJ( jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + reinterpret_cast(jwrite_options_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_put_helper(env, db, *write_options, cf_handle, jkey, jkey_off, jkey_len, jval, jval_off, jval_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); } } @@ -584,13 +601,15 @@ void Java_org_rocksdb_RocksDB_putDirect( JNIEnv* env, jobject /*jdb*/, jlong jdb_handle, jlong jwrite_options_handle, jobject jkey, jint jkey_off, jint jkey_len, jobject jval, jint jval_off, jint jval_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); - auto put = [&env, &db, &cf_handle, &write_options](rocksdb::Slice& key, - rocksdb::Slice& value) { - rocksdb::Status s; + reinterpret_cast(jwrite_options_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); + auto put = [&env, &db, &cf_handle, &write_options]( + ROCKSDB_NAMESPACE::Slice& key, + ROCKSDB_NAMESPACE::Slice& value) { + ROCKSDB_NAMESPACE::Status s; if (cf_handle == nullptr) { s = db->Put(*write_options, key, value); } else { @@ -599,22 +618,22 @@ void Java_org_rocksdb_RocksDB_putDirect( if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); }; - rocksdb::JniUtil::kv_op_direct(put, env, jkey, jkey_off, jkey_len, jval, - jval_off, jval_len); + ROCKSDB_NAMESPACE::JniUtil::kv_op_direct(put, env, jkey, jkey_off, jkey_len, + jval, jval_off, jval_len); } ////////////////////////////////////////////////////////////////////////////// -// rocksdb::DB::Delete() +// ROCKSDB_NAMESPACE::DB::Delete() /** * @return true if the delete succeeded, false if a Java Exception was thrown */ -bool rocksdb_delete_helper( - JNIEnv* env, rocksdb::DB* db, const rocksdb::WriteOptions& write_options, - rocksdb::ColumnFamilyHandle* cf_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len) { +bool rocksdb_delete_helper(JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, + const ROCKSDB_NAMESPACE::WriteOptions& write_options, + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle, + jbyteArray jkey, jint jkey_off, jint jkey_len) { jbyte* key = new jbyte[jkey_len]; env->GetByteArrayRegion(jkey, jkey_off, jkey_len, key); if (env->ExceptionCheck()) { @@ -622,9 +641,9 @@ bool rocksdb_delete_helper( delete[] key; return false; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), jkey_len); - rocksdb::Status s; + ROCKSDB_NAMESPACE::Status s; if (cf_handle != nullptr) { s = db->Delete(write_options, cf_handle, key_slice); } else { @@ -639,7 +658,7 @@ bool rocksdb_delete_helper( return true; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return false; } @@ -651,9 +670,9 @@ bool rocksdb_delete_helper( void Java_org_rocksdb_RocksDB_delete__J_3BII( JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jkey, jint jkey_off, jint jkey_len) { - auto* db = reinterpret_cast(jdb_handle); - static const rocksdb::WriteOptions default_write_options = - rocksdb::WriteOptions(); + auto* db = reinterpret_cast(jdb_handle); + static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = + ROCKSDB_NAMESPACE::WriteOptions(); rocksdb_delete_helper(env, db, default_write_options, nullptr, jkey, jkey_off, jkey_len); } @@ -667,16 +686,18 @@ void Java_org_rocksdb_RocksDB_delete__J_3BIIJ( JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jkey, jint jkey_off, jint jkey_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - static const rocksdb::WriteOptions default_write_options = - rocksdb::WriteOptions(); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db = reinterpret_cast(jdb_handle); + static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = + ROCKSDB_NAMESPACE::WriteOptions(); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_delete_helper(env, db, default_write_options, cf_handle, jkey, jkey_off, jkey_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); } } @@ -690,9 +711,9 @@ void Java_org_rocksdb_RocksDB_delete__JJ_3BII( jlong jdb_handle, jlong jwrite_options, jbyteArray jkey, jint jkey_off, jint jkey_len) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options); + reinterpret_cast(jwrite_options); rocksdb_delete_helper(env, db, *write_options, nullptr, jkey, jkey_off, jkey_len); } @@ -705,38 +726,40 @@ void Java_org_rocksdb_RocksDB_delete__JJ_3BII( void Java_org_rocksdb_RocksDB_delete__JJ_3BIIJ( JNIEnv* env, jobject, jlong jdb_handle, jlong jwrite_options, jbyteArray jkey, jint jkey_off, jint jkey_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options); - auto* cf_handle = reinterpret_cast(jcf_handle); + reinterpret_cast(jwrite_options); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_delete_helper(env, db, *write_options, cf_handle, jkey, jkey_off, jkey_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); } } ////////////////////////////////////////////////////////////////////////////// -// rocksdb::DB::SingleDelete() +// ROCKSDB_NAMESPACE::DB::SingleDelete() /** * @return true if the single delete succeeded, false if a Java Exception * was thrown */ bool rocksdb_single_delete_helper( - JNIEnv* env, rocksdb::DB* db, - const rocksdb::WriteOptions& write_options, - rocksdb::ColumnFamilyHandle* cf_handle, - jbyteArray jkey, jint jkey_len) { + JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, + const ROCKSDB_NAMESPACE::WriteOptions& write_options, + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle, jbyteArray jkey, + jint jkey_len) { jbyte* key = env->GetByteArrayElements(jkey, nullptr); if (key == nullptr) { // exception thrown: OutOfMemoryError return false; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), jkey_len); - rocksdb::Status s; + ROCKSDB_NAMESPACE::Status s; if (cf_handle != nullptr) { s = db->SingleDelete(write_options, cf_handle, key_slice); } else { @@ -753,7 +776,7 @@ bool rocksdb_single_delete_helper( return true; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return false; } @@ -767,9 +790,9 @@ void Java_org_rocksdb_RocksDB_singleDelete__J_3BI( jlong jdb_handle, jbyteArray jkey, jint jkey_len) { - auto* db = reinterpret_cast(jdb_handle); - static const rocksdb::WriteOptions default_write_options = - rocksdb::WriteOptions(); + auto* db = reinterpret_cast(jdb_handle); + static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = + ROCKSDB_NAMESPACE::WriteOptions(); rocksdb_single_delete_helper(env, db, default_write_options, nullptr, jkey, jkey_len); } @@ -782,16 +805,18 @@ void Java_org_rocksdb_RocksDB_singleDelete__J_3BI( void Java_org_rocksdb_RocksDB_singleDelete__J_3BIJ( JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jkey, jint jkey_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - static const rocksdb::WriteOptions default_write_options = - rocksdb::WriteOptions(); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db = reinterpret_cast(jdb_handle); + static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = + ROCKSDB_NAMESPACE::WriteOptions(); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_single_delete_helper(env, db, default_write_options, cf_handle, jkey, jkey_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); } } @@ -805,9 +830,9 @@ void Java_org_rocksdb_RocksDB_singleDelete__JJ_3BI( jlong jwrite_options, jbyteArray jkey, jint jkey_len) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options); + reinterpret_cast(jwrite_options); rocksdb_single_delete_helper(env, db, *write_options, nullptr, jkey, jkey_len); } @@ -820,31 +845,33 @@ void Java_org_rocksdb_RocksDB_singleDelete__JJ_3BI( void Java_org_rocksdb_RocksDB_singleDelete__JJ_3BIJ( JNIEnv* env, jobject, jlong jdb_handle, jlong jwrite_options, jbyteArray jkey, jint jkey_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options); - auto* cf_handle = reinterpret_cast(jcf_handle); + reinterpret_cast(jwrite_options); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_single_delete_helper(env, db, *write_options, cf_handle, jkey, jkey_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); } } ////////////////////////////////////////////////////////////////////////////// -// rocksdb::DB::DeleteRange() +// ROCKSDB_NAMESPACE::DB::DeleteRange() /** * @return true if the delete range succeeded, false if a Java Exception * was thrown */ bool rocksdb_delete_range_helper( - JNIEnv* env, rocksdb::DB* db, - const rocksdb::WriteOptions& write_options, - rocksdb::ColumnFamilyHandle* cf_handle, - jbyteArray jbegin_key, jint jbegin_key_off, jint jbegin_key_len, - jbyteArray jend_key, jint jend_key_off, jint jend_key_len) { + JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, + const ROCKSDB_NAMESPACE::WriteOptions& write_options, + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle, jbyteArray jbegin_key, + jint jbegin_key_off, jint jbegin_key_len, jbyteArray jend_key, + jint jend_key_off, jint jend_key_len) { jbyte* begin_key = new jbyte[jbegin_key_len]; env->GetByteArrayRegion(jbegin_key, jbegin_key_off, jbegin_key_len, begin_key); @@ -853,8 +880,8 @@ bool rocksdb_delete_range_helper( delete[] begin_key; return false; } - rocksdb::Slice begin_key_slice(reinterpret_cast(begin_key), - jbegin_key_len); + ROCKSDB_NAMESPACE::Slice begin_key_slice(reinterpret_cast(begin_key), + jbegin_key_len); jbyte* end_key = new jbyte[jend_key_len]; env->GetByteArrayRegion(jend_key, jend_key_off, jend_key_len, end_key); @@ -864,9 +891,10 @@ bool rocksdb_delete_range_helper( delete[] end_key; return false; } - rocksdb::Slice end_key_slice(reinterpret_cast(end_key), jend_key_len); + ROCKSDB_NAMESPACE::Slice end_key_slice(reinterpret_cast(end_key), + jend_key_len); - rocksdb::Status s = + ROCKSDB_NAMESPACE::Status s = db->DeleteRange(write_options, cf_handle, begin_key_slice, end_key_slice); // cleanup @@ -877,7 +905,7 @@ bool rocksdb_delete_range_helper( return true; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return false; } @@ -890,17 +918,18 @@ void Java_org_rocksdb_RocksDB_deleteRange__J_3BII_3BII( JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jbegin_key, jint jbegin_key_off, jint jbegin_key_len, jbyteArray jend_key, jint jend_key_off, jint jend_key_len) { - auto* db = reinterpret_cast(jdb_handle); - static const rocksdb::WriteOptions default_write_options = - rocksdb::WriteOptions(); + auto* db = reinterpret_cast(jdb_handle); + static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = + ROCKSDB_NAMESPACE::WriteOptions(); rocksdb_delete_range_helper(env, db, default_write_options, nullptr, jbegin_key, jbegin_key_off, jbegin_key_len, jend_key, jend_key_off, jend_key_len); } jint rocksdb_get_helper_direct( - JNIEnv* env, rocksdb::DB* db, const rocksdb::ReadOptions& read_options, - rocksdb::ColumnFamilyHandle* column_family_handle, jobject jkey, + JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, + const ROCKSDB_NAMESPACE::ReadOptions& read_options, + ROCKSDB_NAMESPACE::ColumnFamilyHandle* column_family_handle, jobject jkey, jint jkey_off, jint jkey_len, jobject jval, jint jval_off, jint jval_len, bool* has_exception) { static const int kNotFound = -1; @@ -909,14 +938,14 @@ jint rocksdb_get_helper_direct( char* key = reinterpret_cast(env->GetDirectBufferAddress(jkey)); if (key == nullptr) { - rocksdb::RocksDBExceptionJni::ThrowNew( + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, "Invalid key argument (argument is not a valid direct ByteBuffer)"); *has_exception = true; return kArgumentError; } if (env->GetDirectBufferCapacity(jkey) < (jkey_off + jkey_len)) { - rocksdb::RocksDBExceptionJni::ThrowNew( + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, "Invalid key argument. Capacity is less than requested region (offset " "+ length)."); @@ -926,7 +955,7 @@ jint rocksdb_get_helper_direct( char* value = reinterpret_cast(env->GetDirectBufferAddress(jval)); if (value == nullptr) { - rocksdb::RocksDBExceptionJni::ThrowNew( + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, "Invalid value argument (argument is not a valid direct ByteBuffer)"); *has_exception = true; @@ -934,7 +963,7 @@ jint rocksdb_get_helper_direct( } if (env->GetDirectBufferCapacity(jval) < (jval_off + jval_len)) { - rocksdb::RocksDBExceptionJni::ThrowNew( + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, "Invalid value argument. Capacity is less than requested region " "(offset + length)."); @@ -945,12 +974,12 @@ jint rocksdb_get_helper_direct( key += jkey_off; value += jval_off; - rocksdb::Slice key_slice(key, jkey_len); + ROCKSDB_NAMESPACE::Slice key_slice(key, jkey_len); // TODO(yhchiang): we might save one memory allocation here by adding // a DB::Get() function which takes preallocated jbyte* as input. std::string cvalue; - rocksdb::Status s; + ROCKSDB_NAMESPACE::Status s; if (column_family_handle != nullptr) { s = db->Get(read_options, column_family_handle, key_slice, &cvalue); } else { @@ -968,7 +997,7 @@ jint rocksdb_get_helper_direct( // throwing an exception. As a result, the execution flow will // not stop here, and codes after this throw will still be // executed. - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); // Return a dummy const value to avoid compilation error, although // java side might not have a chance to get the return value :) @@ -994,17 +1023,19 @@ void Java_org_rocksdb_RocksDB_deleteRange__J_3BII_3BIIJ( jbyteArray jbegin_key, jint jbegin_key_off, jint jbegin_key_len, jbyteArray jend_key, jint jend_key_off, jint jend_key_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - static const rocksdb::WriteOptions default_write_options = - rocksdb::WriteOptions(); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db = reinterpret_cast(jdb_handle); + static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = + ROCKSDB_NAMESPACE::WriteOptions(); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_delete_range_helper(env, db, default_write_options, cf_handle, jbegin_key, jbegin_key_off, jbegin_key_len, jend_key, jend_key_off, jend_key_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); } } @@ -1017,9 +1048,9 @@ void Java_org_rocksdb_RocksDB_deleteRange__JJ_3BII_3BII( JNIEnv* env, jobject, jlong jdb_handle, jlong jwrite_options, jbyteArray jbegin_key, jint jbegin_key_off, jint jbegin_key_len, jbyteArray jend_key, jint jend_key_off, jint jend_key_len) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options); + reinterpret_cast(jwrite_options); rocksdb_delete_range_helper(env, db, *write_options, nullptr, jbegin_key, jbegin_key_off, jbegin_key_len, jend_key, jend_key_off, jend_key_len); @@ -1035,17 +1066,19 @@ void Java_org_rocksdb_RocksDB_deleteRange__JJ_3BII_3BIIJ( jbyteArray jbegin_key, jint jbegin_key_off, jint jbegin_key_len, jbyteArray jend_key, jint jend_key_off, jint jend_key_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options); - auto* cf_handle = reinterpret_cast(jcf_handle); + reinterpret_cast(jwrite_options); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_delete_range_helper(env, db, *write_options, cf_handle, jbegin_key, jbegin_key_off, jbegin_key_len, jend_key, jend_key_off, jend_key_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); } } @@ -1060,27 +1093,29 @@ jint Java_org_rocksdb_RocksDB_getDirect(JNIEnv* env, jobject /*jdb*/, jint jkey_len, jobject jval, jint jval_off, jint jval_len, jlong jcf_handle) { - auto* db_handle = reinterpret_cast(jdb_handle); - auto* ro_opt = reinterpret_cast(jropt_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db_handle = reinterpret_cast(jdb_handle); + auto* ro_opt = + reinterpret_cast(jropt_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); bool has_exception = false; return rocksdb_get_helper_direct( - env, db_handle, ro_opt == nullptr ? rocksdb::ReadOptions() : *ro_opt, - cf_handle, jkey, jkey_off, jkey_len, jval, jval_off, jval_len, - &has_exception); + env, db_handle, + ro_opt == nullptr ? ROCKSDB_NAMESPACE::ReadOptions() : *ro_opt, cf_handle, + jkey, jkey_off, jkey_len, jval, jval_off, jval_len, &has_exception); } ////////////////////////////////////////////////////////////////////////////// -// rocksdb::DB::Merge +// ROCKSDB_NAMESPACE::DB::Merge /** * @return true if the merge succeeded, false if a Java Exception was thrown */ -bool rocksdb_merge_helper( - JNIEnv* env, rocksdb::DB* db, const rocksdb::WriteOptions& write_options, - rocksdb::ColumnFamilyHandle* cf_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len) { +bool rocksdb_merge_helper(JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, + const ROCKSDB_NAMESPACE::WriteOptions& write_options, + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle, + jbyteArray jkey, jint jkey_off, jint jkey_len, + jbyteArray jval, jint jval_off, jint jval_len) { jbyte* key = new jbyte[jkey_len]; env->GetByteArrayRegion(jkey, jkey_off, jkey_len, key); if (env->ExceptionCheck()) { @@ -1088,7 +1123,7 @@ bool rocksdb_merge_helper( delete[] key; return false; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), jkey_len); jbyte* value = new jbyte[jval_len]; env->GetByteArrayRegion(jval, jval_off, jval_len, value); @@ -1098,9 +1133,10 @@ bool rocksdb_merge_helper( delete[] key; return false; } - rocksdb::Slice value_slice(reinterpret_cast(value), jval_len); + ROCKSDB_NAMESPACE::Slice value_slice(reinterpret_cast(value), + jval_len); - rocksdb::Status s; + ROCKSDB_NAMESPACE::Status s; if (cf_handle != nullptr) { s = db->Merge(write_options, cf_handle, key_slice, value_slice); } else { @@ -1115,7 +1151,7 @@ bool rocksdb_merge_helper( return true; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return false; } @@ -1128,9 +1164,9 @@ void Java_org_rocksdb_RocksDB_merge__J_3BII_3BII( JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len) { - auto* db = reinterpret_cast(jdb_handle); - static const rocksdb::WriteOptions default_write_options = - rocksdb::WriteOptions(); + auto* db = reinterpret_cast(jdb_handle); + static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = + ROCKSDB_NAMESPACE::WriteOptions(); rocksdb_merge_helper(env, db, default_write_options, nullptr, jkey, jkey_off, jkey_len, jval, jval_off, jval_len); } @@ -1145,16 +1181,18 @@ void Java_org_rocksdb_RocksDB_merge__J_3BII_3BIIJ( jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - static const rocksdb::WriteOptions default_write_options = - rocksdb::WriteOptions(); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db = reinterpret_cast(jdb_handle); + static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = + ROCKSDB_NAMESPACE::WriteOptions(); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_merge_helper(env, db, default_write_options, cf_handle, jkey, jkey_off, jkey_len, jval, jval_off, jval_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); } } @@ -1167,9 +1205,9 @@ void Java_org_rocksdb_RocksDB_merge__JJ_3BII_3BII( JNIEnv* env, jobject, jlong jdb_handle, jlong jwrite_options_handle, jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options_handle); + reinterpret_cast(jwrite_options_handle); rocksdb_merge_helper(env, db, *write_options, nullptr, jkey, jkey_off, jkey_len, jval, jval_off, jval_len); } @@ -1183,23 +1221,25 @@ void Java_org_rocksdb_RocksDB_merge__JJ_3BII_3BIIJ( JNIEnv* env, jobject, jlong jdb_handle, jlong jwrite_options_handle, jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + reinterpret_cast(jwrite_options_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_merge_helper(env, db, *write_options, cf_handle, jkey, jkey_off, jkey_len, jval, jval_off, jval_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); } } -jlong rocksdb_iterator_helper(rocksdb::DB* db, - rocksdb::ReadOptions read_options, - rocksdb::ColumnFamilyHandle* cf_handle) { - rocksdb::Iterator* iterator = nullptr; +jlong rocksdb_iterator_helper( + ROCKSDB_NAMESPACE::DB* db, ROCKSDB_NAMESPACE::ReadOptions read_options, + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle) { + ROCKSDB_NAMESPACE::Iterator* iterator = nullptr; if (cf_handle != nullptr) { iterator = db->NewIterator(read_options, cf_handle); } else { @@ -1218,12 +1258,14 @@ void Java_org_rocksdb_RocksDB_deleteDirect(JNIEnv* env, jobject /*jdb*/, jlong jwrite_options, jobject jkey, jint jkey_offset, jint jkey_len, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options); - auto* cf_handle = reinterpret_cast(jcf_handle); - auto remove = [&env, &db, &write_options, &cf_handle](rocksdb::Slice& key) { - rocksdb::Status s; + reinterpret_cast(jwrite_options); + auto* cf_handle = + reinterpret_cast(jcf_handle); + auto remove = [&env, &db, &write_options, + &cf_handle](ROCKSDB_NAMESPACE::Slice& key) { + ROCKSDB_NAMESPACE::Status s; if (cf_handle == nullptr) { s = db->Delete(*write_options, key); } else { @@ -1232,13 +1274,14 @@ void Java_org_rocksdb_RocksDB_deleteDirect(JNIEnv* env, jobject /*jdb*/, if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); }; - rocksdb::JniUtil::k_op_direct(remove, env, jkey, jkey_offset, jkey_len); + ROCKSDB_NAMESPACE::JniUtil::k_op_direct(remove, env, jkey, jkey_offset, + jkey_len); } ////////////////////////////////////////////////////////////////////////////// -// rocksdb::DB::Write +// ROCKSDB_NAMESPACE::DB::Write /* * Class: org_rocksdb_RocksDB * Method: write0 @@ -1247,15 +1290,15 @@ void Java_org_rocksdb_RocksDB_deleteDirect(JNIEnv* env, jobject /*jdb*/, void Java_org_rocksdb_RocksDB_write0( JNIEnv* env, jobject, jlong jdb_handle, jlong jwrite_options_handle, jlong jwb_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - auto* wb = reinterpret_cast(jwb_handle); + reinterpret_cast(jwrite_options_handle); + auto* wb = reinterpret_cast(jwb_handle); - rocksdb::Status s = db->Write(*write_options, wb); + ROCKSDB_NAMESPACE::Status s = db->Write(*write_options, wb); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -1267,26 +1310,27 @@ void Java_org_rocksdb_RocksDB_write0( void Java_org_rocksdb_RocksDB_write1( JNIEnv* env, jobject, jlong jdb_handle, jlong jwrite_options_handle, jlong jwbwi_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - auto* wbwi = reinterpret_cast(jwbwi_handle); + reinterpret_cast(jwrite_options_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); auto* wb = wbwi->GetWriteBatch(); - rocksdb::Status s = db->Write(*write_options, wb); + ROCKSDB_NAMESPACE::Status s = db->Write(*write_options, wb); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } ////////////////////////////////////////////////////////////////////////////// -// rocksdb::DB::Get +// ROCKSDB_NAMESPACE::DB::Get jbyteArray rocksdb_get_helper( - JNIEnv* env, rocksdb::DB* db, - const rocksdb::ReadOptions& read_opt, - rocksdb::ColumnFamilyHandle* column_family_handle, + JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, + const ROCKSDB_NAMESPACE::ReadOptions& read_opt, + ROCKSDB_NAMESPACE::ColumnFamilyHandle* column_family_handle, jbyteArray jkey, jint jkey_off, jint jkey_len) { jbyte* key = new jbyte[jkey_len]; env->GetByteArrayRegion(jkey, jkey_off, jkey_len, key); @@ -1296,10 +1340,10 @@ jbyteArray rocksdb_get_helper( return nullptr; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), jkey_len); std::string value; - rocksdb::Status s; + ROCKSDB_NAMESPACE::Status s; if (column_family_handle != nullptr) { s = db->Get(read_opt, column_family_handle, key_slice, &value); } else { @@ -1315,7 +1359,7 @@ jbyteArray rocksdb_get_helper( } if (s.ok()) { - jbyteArray jret_value = rocksdb::JniUtil::copyBytes(env, value); + jbyteArray jret_value = ROCKSDB_NAMESPACE::JniUtil::copyBytes(env, value); if (jret_value == nullptr) { // exception occurred return nullptr; @@ -1323,7 +1367,7 @@ jbyteArray rocksdb_get_helper( return jret_value; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } @@ -1335,8 +1379,9 @@ jbyteArray rocksdb_get_helper( jbyteArray Java_org_rocksdb_RocksDB_get__J_3BII( JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jkey, jint jkey_off, jint jkey_len) { - return rocksdb_get_helper(env, reinterpret_cast(jdb_handle), - rocksdb::ReadOptions(), nullptr, jkey, jkey_off, jkey_len); + return rocksdb_get_helper( + env, reinterpret_cast(jdb_handle), + ROCKSDB_NAMESPACE::ReadOptions(), nullptr, jkey, jkey_off, jkey_len); } /* @@ -1347,14 +1392,16 @@ jbyteArray Java_org_rocksdb_RocksDB_get__J_3BII( jbyteArray Java_org_rocksdb_RocksDB_get__J_3BIIJ( JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jkey, jint jkey_off, jint jkey_len, jlong jcf_handle) { - auto db_handle = reinterpret_cast(jdb_handle); - auto cf_handle = reinterpret_cast(jcf_handle); + auto db_handle = reinterpret_cast(jdb_handle); + auto cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { - return rocksdb_get_helper(env, db_handle, rocksdb::ReadOptions(), cf_handle, - jkey, jkey_off, jkey_len); + return rocksdb_get_helper(env, db_handle, ROCKSDB_NAMESPACE::ReadOptions(), + cf_handle, jkey, jkey_off, jkey_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); return nullptr; } } @@ -1369,9 +1416,9 @@ jbyteArray Java_org_rocksdb_RocksDB_get__JJ_3BII( jlong jdb_handle, jlong jropt_handle, jbyteArray jkey, jint jkey_off, jint jkey_len) { return rocksdb_get_helper( - env, reinterpret_cast(jdb_handle), - *reinterpret_cast(jropt_handle), nullptr, jkey, - jkey_off, jkey_len); + env, reinterpret_cast(jdb_handle), + *reinterpret_cast(jropt_handle), nullptr, + jkey, jkey_off, jkey_len); } /* @@ -1382,25 +1429,28 @@ jbyteArray Java_org_rocksdb_RocksDB_get__JJ_3BII( jbyteArray Java_org_rocksdb_RocksDB_get__JJ_3BIIJ( JNIEnv* env, jobject, jlong jdb_handle, jlong jropt_handle, jbyteArray jkey, jint jkey_off, jint jkey_len, jlong jcf_handle) { - auto* db_handle = reinterpret_cast(jdb_handle); - auto& ro_opt = *reinterpret_cast(jropt_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db_handle = reinterpret_cast(jdb_handle); + auto& ro_opt = + *reinterpret_cast(jropt_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { return rocksdb_get_helper( env, db_handle, ro_opt, cf_handle, jkey, jkey_off, jkey_len); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); return nullptr; } } jint rocksdb_get_helper( - JNIEnv* env, rocksdb::DB* db, const rocksdb::ReadOptions& read_options, - rocksdb::ColumnFamilyHandle* column_family_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len, - bool* has_exception) { + JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, + const ROCKSDB_NAMESPACE::ReadOptions& read_options, + ROCKSDB_NAMESPACE::ColumnFamilyHandle* column_family_handle, + jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len, bool* has_exception) { static const int kNotFound = -1; static const int kStatusError = -2; @@ -1412,12 +1462,12 @@ jint rocksdb_get_helper( *has_exception = true; return kStatusError; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), jkey_len); // TODO(yhchiang): we might save one memory allocation here by adding // a DB::Get() function which takes preallocated jbyte* as input. std::string cvalue; - rocksdb::Status s; + ROCKSDB_NAMESPACE::Status s; if (column_family_handle != nullptr) { s = db->Get(read_options, column_family_handle, key_slice, &cvalue); } else { @@ -1438,7 +1488,7 @@ jint rocksdb_get_helper( // throwing an exception. As a result, the execution flow will // not stop here, and codes after this throw will still be // executed. - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); // Return a dummy const value to avoid compilation error, although // java side might not have a chance to get the return value :) @@ -1461,7 +1511,6 @@ jint rocksdb_get_helper( return cvalue_len; } - /* * Class: org_rocksdb_RocksDB * Method: get @@ -1472,9 +1521,10 @@ jint Java_org_rocksdb_RocksDB_get__J_3BII_3BII( jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len) { bool has_exception = false; - return rocksdb_get_helper(env, reinterpret_cast(jdb_handle), - rocksdb::ReadOptions(), nullptr, jkey, jkey_off, - jkey_len, jval, jval_off, jval_len, &has_exception); + return rocksdb_get_helper( + env, reinterpret_cast(jdb_handle), + ROCKSDB_NAMESPACE::ReadOptions(), nullptr, jkey, jkey_off, jkey_len, jval, + jval_off, jval_len, &has_exception); } /* @@ -1487,16 +1537,18 @@ jint Java_org_rocksdb_RocksDB_get__J_3BII_3BIIJ( jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len, jlong jcf_handle) { - auto* db_handle = reinterpret_cast(jdb_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db_handle = reinterpret_cast(jdb_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { bool has_exception = false; - return rocksdb_get_helper(env, db_handle, rocksdb::ReadOptions(), cf_handle, - jkey, jkey_off, jkey_len, jval, jval_off, - jval_len, &has_exception); + return rocksdb_get_helper(env, db_handle, ROCKSDB_NAMESPACE::ReadOptions(), + cf_handle, jkey, jkey_off, jkey_len, jval, + jval_off, jval_len, &has_exception); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); // will never be evaluated return 0; } @@ -1513,9 +1565,9 @@ jint Java_org_rocksdb_RocksDB_get__JJ_3BII_3BII( jbyteArray jval, jint jval_off, jint jval_len) { bool has_exception = false; return rocksdb_get_helper( - env, reinterpret_cast(jdb_handle), - *reinterpret_cast(jropt_handle), nullptr, jkey, - jkey_off, jkey_len, jval, jval_off, jval_len, &has_exception); + env, reinterpret_cast(jdb_handle), + *reinterpret_cast(jropt_handle), nullptr, + jkey, jkey_off, jkey_len, jval, jval_off, jval_len, &has_exception); } /* @@ -1528,9 +1580,11 @@ jint Java_org_rocksdb_RocksDB_get__JJ_3BII_3BIIJ( jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len, jlong jcf_handle) { - auto* db_handle = reinterpret_cast(jdb_handle); - auto& ro_opt = *reinterpret_cast(jropt_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db_handle = reinterpret_cast(jdb_handle); + auto& ro_opt = + *reinterpret_cast(jropt_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { bool has_exception = false; return rocksdb_get_helper(env, db_handle, ro_opt, cf_handle, @@ -1538,8 +1592,9 @@ jint Java_org_rocksdb_RocksDB_get__JJ_3BII_3BIIJ( jval, jval_off, jval_len, &has_exception); } else { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Invalid ColumnFamilyHandle.")); // will never be evaluated return 0; } @@ -1560,11 +1615,12 @@ inline void multi_get_helper_release_keys( * * @return byte[][] of values or nullptr if an exception occurs */ -jobjectArray multi_get_helper( - JNIEnv* env, jobject, rocksdb::DB* db, const rocksdb::ReadOptions& rOpt, - jobjectArray jkeys, jintArray jkey_offs, jintArray jkey_lens, - jlongArray jcolumn_family_handles) { - std::vector cf_handles; +jobjectArray multi_get_helper(JNIEnv* env, jobject, ROCKSDB_NAMESPACE::DB* db, + const ROCKSDB_NAMESPACE::ReadOptions& rOpt, + jobjectArray jkeys, jintArray jkey_offs, + jintArray jkey_lens, + jlongArray jcolumn_family_handles) { + std::vector cf_handles; if (jcolumn_family_handles != nullptr) { const jsize len_cols = env->GetArrayLength(jcolumn_family_handles); @@ -1575,7 +1631,8 @@ jobjectArray multi_get_helper( } for (jsize i = 0; i < len_cols; i++) { - auto* cf_handle = reinterpret_cast(jcfh[i]); + auto* cf_handle = + reinterpret_cast(jcfh[i]); cf_handles.push_back(cf_handle); } env->ReleaseLongArrayElements(jcolumn_family_handles, jcfh, JNI_ABORT); @@ -1600,7 +1657,7 @@ jobjectArray multi_get_helper( return nullptr; } - std::vector keys; + std::vector keys; std::vector> keys_to_free; for (jsize i = 0; i < len_keys; i++) { jobject jkey = env->GetObjectArrayElement(jkeys, i); @@ -1627,7 +1684,7 @@ jobjectArray multi_get_helper( return nullptr; } - rocksdb::Slice key_slice(reinterpret_cast(key), len_key); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), len_key); keys.push_back(key_slice); keys_to_free.push_back(std::pair(key, jkey)); @@ -1638,7 +1695,7 @@ jobjectArray multi_get_helper( env->ReleaseIntArrayElements(jkey_offs, jkey_off, JNI_ABORT); std::vector values; - std::vector s; + std::vector s; if (cf_handles.size() == 0) { s = db->MultiGet(rOpt, keys, &values); } else { @@ -1649,8 +1706,8 @@ jobjectArray multi_get_helper( multi_get_helper_release_keys(env, keys_to_free); // prepare the results - jobjectArray jresults = - rocksdb::ByteJni::new2dByteArray(env, static_cast(s.size())); + jobjectArray jresults = ROCKSDB_NAMESPACE::ByteJni::new2dByteArray( + env, static_cast(s.size())); if (jresults == nullptr) { // exception occurred return nullptr; @@ -1663,7 +1720,8 @@ jobjectArray multi_get_helper( return nullptr; } // add to the jresults - for (std::vector::size_type i = 0; i != s.size(); i++) { + for (std::vector::size_type i = 0; i != s.size(); + i++) { if (s[i].ok()) { std::string* value = &values[i]; const jsize jvalue_len = static_cast(value->size()); @@ -1704,9 +1762,9 @@ jobjectArray multi_get_helper( jobjectArray Java_org_rocksdb_RocksDB_multiGet__J_3_3B_3I_3I( JNIEnv* env, jobject jdb, jlong jdb_handle, jobjectArray jkeys, jintArray jkey_offs, jintArray jkey_lens) { - return multi_get_helper(env, jdb, reinterpret_cast(jdb_handle), - rocksdb::ReadOptions(), jkeys, jkey_offs, jkey_lens, - nullptr); + return multi_get_helper( + env, jdb, reinterpret_cast(jdb_handle), + ROCKSDB_NAMESPACE::ReadOptions(), jkeys, jkey_offs, jkey_lens, nullptr); } /* @@ -1718,9 +1776,10 @@ jobjectArray Java_org_rocksdb_RocksDB_multiGet__J_3_3B_3I_3I_3J( JNIEnv* env, jobject jdb, jlong jdb_handle, jobjectArray jkeys, jintArray jkey_offs, jintArray jkey_lens, jlongArray jcolumn_family_handles) { - return multi_get_helper(env, jdb, reinterpret_cast(jdb_handle), - rocksdb::ReadOptions(), jkeys, jkey_offs, jkey_lens, - jcolumn_family_handles); + return multi_get_helper(env, jdb, + reinterpret_cast(jdb_handle), + ROCKSDB_NAMESPACE::ReadOptions(), jkeys, jkey_offs, + jkey_lens, jcolumn_family_handles); } /* @@ -1732,9 +1791,9 @@ jobjectArray Java_org_rocksdb_RocksDB_multiGet__JJ_3_3B_3I_3I( JNIEnv* env, jobject jdb, jlong jdb_handle, jlong jropt_handle, jobjectArray jkeys, jintArray jkey_offs, jintArray jkey_lens) { return multi_get_helper( - env, jdb, reinterpret_cast(jdb_handle), - *reinterpret_cast(jropt_handle), jkeys, jkey_offs, - jkey_lens, nullptr); + env, jdb, reinterpret_cast(jdb_handle), + *reinterpret_cast(jropt_handle), jkeys, + jkey_offs, jkey_lens, nullptr); } /* @@ -1747,37 +1806,40 @@ jobjectArray Java_org_rocksdb_RocksDB_multiGet__JJ_3_3B_3I_3I_3J( jobjectArray jkeys, jintArray jkey_offs, jintArray jkey_lens, jlongArray jcolumn_family_handles) { return multi_get_helper( - env, jdb, reinterpret_cast(jdb_handle), - *reinterpret_cast(jropt_handle), jkeys, jkey_offs, - jkey_lens, jcolumn_family_handles); + env, jdb, reinterpret_cast(jdb_handle), + *reinterpret_cast(jropt_handle), jkeys, + jkey_offs, jkey_lens, jcolumn_family_handles); } ////////////////////////////////////////////////////////////////////////////// -// rocksdb::DB::KeyMayExist +// ROCKSDB_NAMESPACE::DB::KeyMayExist bool key_may_exist_helper(JNIEnv* env, jlong jdb_handle, jlong jcf_handle, jlong jread_opts_handle, jbyteArray jkey, jint jkey_offset, jint jkey_len, bool* has_exception, std::string* value, bool* value_found) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; - if (jcf_handle == 0) { - cf_handle = db->DefaultColumnFamily(); + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; + if (jcf_handle == 0) { + cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } - rocksdb::ReadOptions read_opts = - jread_opts_handle == 0 ? rocksdb::ReadOptions() - : *(reinterpret_cast(jread_opts_handle)); + ROCKSDB_NAMESPACE::ReadOptions read_opts = + jread_opts_handle == 0 + ? ROCKSDB_NAMESPACE::ReadOptions() + : *(reinterpret_cast( + jread_opts_handle)); - jbyte* key = new jbyte[jkey_len]; - env->GetByteArrayRegion(jkey, jkey_offset, jkey_len, key); - if (env->ExceptionCheck()) { - // exception thrown: ArrayIndexOutOfBoundsException - delete[] key; - *has_exception = true; - return false; + jbyte* key = new jbyte[jkey_len]; + env->GetByteArrayRegion(jkey, jkey_offset, jkey_len, key); + if (env->ExceptionCheck()) { + // exception thrown: ArrayIndexOutOfBoundsException + delete[] key; + *has_exception = true; + return false; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), jkey_len); const bool exists = db->KeyMayExist( read_opts, cf_handle, key_slice, value, value_found); @@ -1850,7 +1912,7 @@ jobjectArray Java_org_rocksdb_RocksDB_keyMayExistFoundValue( result_flags[0] = 2; } - jobjectArray jresults = rocksdb::ByteJni::new2dByteArray(env, 2); + jobjectArray jresults = ROCKSDB_NAMESPACE::ByteJni::new2dByteArray(env, 2); if (jresults == nullptr) { // exception occurred return nullptr; @@ -1913,8 +1975,8 @@ jobjectArray Java_org_rocksdb_RocksDB_keyMayExistFoundValue( */ jlong Java_org_rocksdb_RocksDB_iterator__J( JNIEnv*, jobject, jlong db_handle) { - auto* db = reinterpret_cast(db_handle); - return rocksdb_iterator_helper(db, rocksdb::ReadOptions(), nullptr); + auto* db = reinterpret_cast(db_handle); + return rocksdb_iterator_helper(db, ROCKSDB_NAMESPACE::ReadOptions(), nullptr); } /* @@ -1924,9 +1986,9 @@ jlong Java_org_rocksdb_RocksDB_iterator__J( */ jlong Java_org_rocksdb_RocksDB_iterator__JJ( JNIEnv*, jobject, jlong db_handle, jlong jread_options_handle) { - auto* db = reinterpret_cast(db_handle); + auto* db = reinterpret_cast(db_handle); auto& read_options = - *reinterpret_cast(jread_options_handle); + *reinterpret_cast(jread_options_handle); return rocksdb_iterator_helper(db, read_options, nullptr); } @@ -1937,9 +1999,11 @@ jlong Java_org_rocksdb_RocksDB_iterator__JJ( */ jlong Java_org_rocksdb_RocksDB_iteratorCF__JJ( JNIEnv*, jobject, jlong db_handle, jlong jcf_handle) { - auto* db = reinterpret_cast(db_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); - return rocksdb_iterator_helper(db, rocksdb::ReadOptions(), cf_handle); + auto* db = reinterpret_cast(db_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); + return rocksdb_iterator_helper(db, ROCKSDB_NAMESPACE::ReadOptions(), + cf_handle); } /* @@ -1950,10 +2014,11 @@ jlong Java_org_rocksdb_RocksDB_iteratorCF__JJ( jlong Java_org_rocksdb_RocksDB_iteratorCF__JJJ( JNIEnv*, jobject, jlong db_handle, jlong jcf_handle, jlong jread_options_handle) { - auto* db = reinterpret_cast(db_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db = reinterpret_cast(db_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); auto& read_options = - *reinterpret_cast(jread_options_handle); + *reinterpret_cast(jread_options_handle); return rocksdb_iterator_helper(db, read_options, cf_handle); } @@ -1966,11 +2031,11 @@ jlongArray Java_org_rocksdb_RocksDB_iterators( JNIEnv* env, jobject, jlong db_handle, jlongArray jcolumn_family_handles, jlong jread_options_handle) { - auto* db = reinterpret_cast(db_handle); + auto* db = reinterpret_cast(db_handle); auto& read_options = - *reinterpret_cast(jread_options_handle); + *reinterpret_cast(jread_options_handle); - std::vector cf_handles; + std::vector cf_handles; if (jcolumn_family_handles != nullptr) { const jsize len_cols = env->GetArrayLength(jcolumn_family_handles); jlong* jcfh = env->GetLongArrayElements(jcolumn_family_handles, nullptr); @@ -1980,15 +2045,17 @@ jlongArray Java_org_rocksdb_RocksDB_iterators( } for (jsize i = 0; i < len_cols; i++) { - auto* cf_handle = reinterpret_cast(jcfh[i]); + auto* cf_handle = + reinterpret_cast(jcfh[i]); cf_handles.push_back(cf_handle); } env->ReleaseLongArrayElements(jcolumn_family_handles, jcfh, JNI_ABORT); } - std::vector iterators; - rocksdb::Status s = db->NewIterators(read_options, cf_handles, &iterators); + std::vector iterators; + ROCKSDB_NAMESPACE::Status s = + db->NewIterators(read_options, cf_handles, &iterators); if (s.ok()) { jlongArray jLongArray = env->NewLongArray(static_cast(iterators.size())); @@ -1997,8 +2064,8 @@ jlongArray Java_org_rocksdb_RocksDB_iterators( return nullptr; } - for (std::vector::size_type i = 0; i < iterators.size(); - i++) { + for (std::vector::size_type i = 0; + i < iterators.size(); i++) { env->SetLongArrayRegion( jLongArray, static_cast(i), 1, const_cast(reinterpret_cast(&iterators[i]))); @@ -2011,7 +2078,7 @@ jlongArray Java_org_rocksdb_RocksDB_iterators( return jLongArray; } else { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } } @@ -2022,8 +2089,8 @@ jlongArray Java_org_rocksdb_RocksDB_iterators( */ jlong Java_org_rocksdb_RocksDB_getSnapshot( JNIEnv*, jobject, jlong db_handle) { - auto* db = reinterpret_cast(db_handle); - const rocksdb::Snapshot* snapshot = db->GetSnapshot(); + auto* db = reinterpret_cast(db_handle); + const ROCKSDB_NAMESPACE::Snapshot* snapshot = db->GetSnapshot(); return reinterpret_cast(snapshot); } @@ -2034,8 +2101,9 @@ jlong Java_org_rocksdb_RocksDB_getSnapshot( void Java_org_rocksdb_RocksDB_releaseSnapshot( JNIEnv*, jobject, jlong db_handle, jlong snapshot_handle) { - auto* db = reinterpret_cast(db_handle); - auto* snapshot = reinterpret_cast(snapshot_handle); + auto* db = reinterpret_cast(db_handle); + auto* snapshot = + reinterpret_cast(snapshot_handle); db->ReleaseSnapshot(snapshot); } @@ -2052,15 +2120,15 @@ jstring Java_org_rocksdb_RocksDB_getProperty( // exception thrown: OutOfMemoryError return nullptr; } - rocksdb::Slice property_name(property, jproperty_len); + ROCKSDB_NAMESPACE::Slice property_name(property, jproperty_len); - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } std::string property_value; @@ -2071,7 +2139,8 @@ jstring Java_org_rocksdb_RocksDB_getProperty( return env->NewStringUTF(property_value.c_str()); } - rocksdb::RocksDBExceptionJni::ThrowNew(env, rocksdb::Status::NotFound()); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::NotFound()); return nullptr; } @@ -2088,15 +2157,15 @@ jobject Java_org_rocksdb_RocksDB_getMapProperty( // exception thrown: OutOfMemoryError return nullptr; } - rocksdb::Slice property_name(property, jproperty_len); - - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + ROCKSDB_NAMESPACE::Slice property_name(property, jproperty_len); + + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } std::map property_value; @@ -2104,10 +2173,11 @@ jobject Java_org_rocksdb_RocksDB_getMapProperty( env->ReleaseStringUTFChars(jproperty, property); if (retCode) { - return rocksdb::HashMapJni::fromCppMap(env, &property_value); + return ROCKSDB_NAMESPACE::HashMapJni::fromCppMap(env, &property_value); } - rocksdb::RocksDBExceptionJni::ThrowNew(env, rocksdb::Status::NotFound()); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::NotFound()); return nullptr; } @@ -2124,15 +2194,15 @@ jlong Java_org_rocksdb_RocksDB_getLongProperty( // exception thrown: OutOfMemoryError return 0; } - rocksdb::Slice property_name(property, jproperty_len); + ROCKSDB_NAMESPACE::Slice property_name(property, jproperty_len); - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } uint64_t property_value; @@ -2143,7 +2213,8 @@ jlong Java_org_rocksdb_RocksDB_getLongProperty( return property_value; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, rocksdb::Status::NotFound()); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::NotFound()); return 0; } @@ -2154,7 +2225,7 @@ jlong Java_org_rocksdb_RocksDB_getLongProperty( */ void Java_org_rocksdb_RocksDB_resetStats( JNIEnv *, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); db->ResetStats(); } @@ -2170,8 +2241,8 @@ jlong Java_org_rocksdb_RocksDB_getAggregatedLongProperty( if (property == nullptr) { return 0; } - rocksdb::Slice property_name(property, jproperty_len); - auto* db = reinterpret_cast(db_handle); + ROCKSDB_NAMESPACE::Slice property_name(property, jproperty_len); + auto* db = reinterpret_cast(db_handle); uint64_t property_value = 0; bool retCode = db->GetAggregatedIntProperty(property_name, &property_value); env->ReleaseStringUTFChars(jproperty, property); @@ -2180,7 +2251,8 @@ jlong Java_org_rocksdb_RocksDB_getAggregatedLongProperty( return property_value; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, rocksdb::Status::NotFound()); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::NotFound()); return 0; } @@ -2203,21 +2275,21 @@ jlongArray Java_org_rocksdb_RocksDB_getApproximateSizes( return nullptr; } - auto ranges = std::unique_ptr( - new rocksdb::Range[range_count]); + auto ranges = std::unique_ptr( + new ROCKSDB_NAMESPACE::Range[range_count]); for (jsize i = 0; i < jlen; ++i) { - auto* start = reinterpret_cast(jranges[i]); - auto* limit = reinterpret_cast(jranges[++i]); - ranges.get()[i] = rocksdb::Range(*start, *limit); + auto* start = reinterpret_cast(jranges[i]); + auto* limit = reinterpret_cast(jranges[++i]); + ranges.get()[i] = ROCKSDB_NAMESPACE::Range(*start, *limit); } - - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } auto sizes = std::unique_ptr(new uint64_t[range_count]); @@ -2259,17 +2331,17 @@ jlongArray Java_org_rocksdb_RocksDB_getApproximateSizes( jlongArray Java_org_rocksdb_RocksDB_getApproximateMemTableStats( JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle, jlong jstartHandle, jlong jlimitHandle) { - auto* start = reinterpret_cast(jstartHandle); - auto* limit = reinterpret_cast( jlimitHandle); - const rocksdb::Range range(*start, *limit); + auto* start = reinterpret_cast(jstartHandle); + auto* limit = reinterpret_cast(jlimitHandle); + const ROCKSDB_NAMESPACE::Range range(*start, *limit); - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } uint64_t count = 0; @@ -2313,10 +2385,9 @@ void Java_org_rocksdb_RocksDB_compactRange( std::string str_begin; if (jbegin_len > 0) { - str_begin = rocksdb::JniUtil::byteString(env, jbegin, jbegin_len, - [](const char* str, const size_t len) { - return std::string(str, len); - }, + str_begin = ROCKSDB_NAMESPACE::JniUtil::byteString( + env, jbegin, jbegin_len, + [](const char* str, const size_t len) { return std::string(str, len); }, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred @@ -2326,10 +2397,9 @@ void Java_org_rocksdb_RocksDB_compactRange( std::string str_end; if (jend_len > 0) { - str_end = rocksdb::JniUtil::byteString(env, jend, jend_len, - [](const char* str, const size_t len) { - return std::string(str, len); - }, + str_end = ROCKSDB_NAMESPACE::JniUtil::byteString( + env, jend, jend_len, + [](const char* str, const size_t len) { return std::string(str, len); }, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred @@ -2337,30 +2407,31 @@ void Java_org_rocksdb_RocksDB_compactRange( } } - rocksdb::CompactRangeOptions *compact_range_opts = nullptr; + ROCKSDB_NAMESPACE::CompactRangeOptions* compact_range_opts = nullptr; if (jcompact_range_opts_handle == 0) { // NOTE: we DO own the pointer! - compact_range_opts = new rocksdb::CompactRangeOptions(); + compact_range_opts = new ROCKSDB_NAMESPACE::CompactRangeOptions(); } else { // NOTE: we do NOT own the pointer! compact_range_opts = - reinterpret_cast(jcompact_range_opts_handle); + reinterpret_cast( + jcompact_range_opts_handle); } - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } - rocksdb::Status s; + ROCKSDB_NAMESPACE::Status s; if (jbegin_len > 0 || jend_len > 0) { - const rocksdb::Slice begin(str_begin); - const rocksdb::Slice end(str_end); + const ROCKSDB_NAMESPACE::Slice begin(str_begin); + const ROCKSDB_NAMESPACE::Slice end(str_end); s = db->CompactRange(*compact_range_opts, cf_handle, &begin, &end); } else { s = db->CompactRange(*compact_range_opts, cf_handle, nullptr, nullptr); @@ -2369,7 +2440,7 @@ void Java_org_rocksdb_RocksDB_compactRange( if (jcompact_range_opts_handle == 0) { delete compact_range_opts; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -2399,9 +2470,8 @@ void Java_org_rocksdb_RocksDB_setOptions( } jboolean has_exception = JNI_FALSE; - std::string s_key = - rocksdb::JniUtil::copyStdString( - env, reinterpret_cast(jobj_key), &has_exception); + std::string s_key = ROCKSDB_NAMESPACE::JniUtil::copyStdString( + env, reinterpret_cast(jobj_key), &has_exception); if (has_exception == JNI_TRUE) { // exception occurred env->DeleteLocalRef(jobj_value); @@ -2409,9 +2479,8 @@ void Java_org_rocksdb_RocksDB_setOptions( return; } - std::string s_value = - rocksdb::JniUtil::copyStdString( - env, reinterpret_cast(jobj_value), &has_exception); + std::string s_value = ROCKSDB_NAMESPACE::JniUtil::copyStdString( + env, reinterpret_cast(jobj_value), &has_exception); if (has_exception == JNI_TRUE) { // exception occurred env->DeleteLocalRef(jobj_value); @@ -2425,11 +2494,12 @@ void Java_org_rocksdb_RocksDB_setOptions( env->DeleteLocalRef(jobj_value); } - auto* db = reinterpret_cast(jdb_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* db = reinterpret_cast(jdb_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); auto s = db->SetOptions(cf_handle, options_map); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2460,9 +2530,8 @@ void Java_org_rocksdb_RocksDB_setDBOptions( } jboolean has_exception = JNI_FALSE; - std::string s_key = - rocksdb::JniUtil::copyStdString( - env, reinterpret_cast(jobj_key), &has_exception); + std::string s_key = ROCKSDB_NAMESPACE::JniUtil::copyStdString( + env, reinterpret_cast(jobj_key), &has_exception); if (has_exception == JNI_TRUE) { // exception occurred env->DeleteLocalRef(jobj_value); @@ -2470,9 +2539,8 @@ void Java_org_rocksdb_RocksDB_setDBOptions( return; } - std::string s_value = - rocksdb::JniUtil::copyStdString( - env, reinterpret_cast(jobj_value), &has_exception); + std::string s_value = ROCKSDB_NAMESPACE::JniUtil::copyStdString( + env, reinterpret_cast(jobj_value), &has_exception); if (has_exception == JNI_TRUE) { // exception occurred env->DeleteLocalRef(jobj_value); @@ -2486,10 +2554,10 @@ void Java_org_rocksdb_RocksDB_setDBOptions( env->DeleteLocalRef(jobj_value); } - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto s = db->SetDBOptions(options_map); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2504,27 +2572,30 @@ jobjectArray Java_org_rocksdb_RocksDB_compactFiles( jint joutput_path_id, jlong jcompaction_job_info_handle) { jboolean has_exception = JNI_FALSE; const std::vector input_file_names = - rocksdb::JniUtil::copyStrings(env, jinput_file_names, &has_exception); + ROCKSDB_NAMESPACE::JniUtil::copyStrings(env, jinput_file_names, + &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return nullptr; } auto* compaction_opts = - reinterpret_cast(jcompaction_opts_handle); - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + reinterpret_cast( + jcompaction_opts_handle); + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } - rocksdb::CompactionJobInfo* compaction_job_info = nullptr; + ROCKSDB_NAMESPACE::CompactionJobInfo* compaction_job_info = nullptr; if (jcompaction_job_info_handle != 0) { compaction_job_info = - reinterpret_cast(jcompaction_job_info_handle); + reinterpret_cast( + jcompaction_job_info_handle); } std::vector output_file_names; @@ -2532,11 +2603,11 @@ jobjectArray Java_org_rocksdb_RocksDB_compactFiles( static_cast(joutput_level), static_cast(joutput_path_id), &output_file_names, compaction_job_info); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } - return rocksdb::JniUtil::toJavaStrings(env, &output_file_names); + return ROCKSDB_NAMESPACE::JniUtil::toJavaStrings(env, &output_file_names); } /* @@ -2546,10 +2617,10 @@ jobjectArray Java_org_rocksdb_RocksDB_compactFiles( */ void Java_org_rocksdb_RocksDB_pauseBackgroundWork( JNIEnv* env, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto s = db->PauseBackgroundWork(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2560,10 +2631,10 @@ void Java_org_rocksdb_RocksDB_pauseBackgroundWork( */ void Java_org_rocksdb_RocksDB_continueBackgroundWork( JNIEnv* env, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto s = db->ContinueBackgroundWork(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2574,10 +2645,12 @@ void Java_org_rocksdb_RocksDB_continueBackgroundWork( */ void Java_org_rocksdb_RocksDB_enableAutoCompaction( JNIEnv* env, jobject, jlong jdb_handle, jlongArray jcf_handles) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); jboolean has_exception = JNI_FALSE; - const std::vector cf_handles = - rocksdb::JniUtil::fromJPointers(env, jcf_handles, &has_exception); + const std::vector cf_handles = + ROCKSDB_NAMESPACE::JniUtil::fromJPointers< + ROCKSDB_NAMESPACE::ColumnFamilyHandle>(env, jcf_handles, + &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return; @@ -2592,13 +2665,13 @@ void Java_org_rocksdb_RocksDB_enableAutoCompaction( */ jint Java_org_rocksdb_RocksDB_numberLevels( JNIEnv*, jobject, jlong jdb_handle, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } return static_cast(db->NumberLevels(cf_handle)); } @@ -2610,13 +2683,13 @@ jint Java_org_rocksdb_RocksDB_numberLevels( */ jint Java_org_rocksdb_RocksDB_maxMemCompactionLevel( JNIEnv*, jobject, jlong jdb_handle, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } return static_cast(db->MaxMemCompactionLevel(cf_handle)); } @@ -2628,13 +2701,13 @@ jint Java_org_rocksdb_RocksDB_maxMemCompactionLevel( */ jint Java_org_rocksdb_RocksDB_level0StopWriteTrigger( JNIEnv*, jobject, jlong jdb_handle, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } return static_cast(db->Level0StopWriteTrigger(cf_handle)); } @@ -2646,9 +2719,9 @@ jint Java_org_rocksdb_RocksDB_level0StopWriteTrigger( */ jstring Java_org_rocksdb_RocksDB_getName( JNIEnv* env, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); std::string name = db->GetName(); - return rocksdb::JniUtil::toJavaString(env, &name, false); + return ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &name, false); } /* @@ -2658,7 +2731,7 @@ jstring Java_org_rocksdb_RocksDB_getName( */ jlong Java_org_rocksdb_RocksDB_getEnv( JNIEnv*, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); return reinterpret_cast(db->GetEnv()); } @@ -2670,17 +2743,17 @@ jlong Java_org_rocksdb_RocksDB_getEnv( void Java_org_rocksdb_RocksDB_flush( JNIEnv* env, jobject, jlong jdb_handle, jlong jflush_opts_handle, jlongArray jcf_handles) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* flush_opts = - reinterpret_cast(jflush_opts_handle); - std::vector cf_handles; + reinterpret_cast(jflush_opts_handle); + std::vector cf_handles; if (jcf_handles == nullptr) { cf_handles.push_back(db->DefaultColumnFamily()); } else { jboolean has_exception = JNI_FALSE; - cf_handles = - rocksdb::JniUtil::fromJPointers( - env, jcf_handles, &has_exception); + cf_handles = ROCKSDB_NAMESPACE::JniUtil::fromJPointers< + ROCKSDB_NAMESPACE::ColumnFamilyHandle>(env, jcf_handles, + &has_exception); if (has_exception) { // exception occurred return; @@ -2688,7 +2761,7 @@ void Java_org_rocksdb_RocksDB_flush( } auto s = db->Flush(*flush_opts, cf_handles); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2699,10 +2772,10 @@ void Java_org_rocksdb_RocksDB_flush( */ void Java_org_rocksdb_RocksDB_flushWal( JNIEnv* env, jobject, jlong jdb_handle, jboolean jsync) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto s = db->FlushWAL(jsync == JNI_TRUE); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2713,10 +2786,10 @@ void Java_org_rocksdb_RocksDB_flushWal( */ void Java_org_rocksdb_RocksDB_syncWal( JNIEnv* env, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto s = db->SyncWAL(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2727,7 +2800,7 @@ void Java_org_rocksdb_RocksDB_syncWal( */ jlong Java_org_rocksdb_RocksDB_getLatestSequenceNumber( JNIEnv*, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); return db->GetLatestSequenceNumber(); } @@ -2738,7 +2811,7 @@ jlong Java_org_rocksdb_RocksDB_getLatestSequenceNumber( */ jboolean JNICALL Java_org_rocksdb_RocksDB_setPreserveDeletesSequenceNumber( JNIEnv*, jobject, jlong jdb_handle, jlong jseq_number) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); if (db->SetPreserveDeletesSequenceNumber( static_cast(jseq_number))) { return JNI_TRUE; @@ -2754,10 +2827,10 @@ jboolean JNICALL Java_org_rocksdb_RocksDB_setPreserveDeletesSequenceNumber( */ void Java_org_rocksdb_RocksDB_disableFileDeletions( JNIEnv* env, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::Status s = db->DisableFileDeletions(); + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::Status s = db->DisableFileDeletions(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2768,10 +2841,10 @@ void Java_org_rocksdb_RocksDB_disableFileDeletions( */ void Java_org_rocksdb_RocksDB_enableFileDeletions( JNIEnv* env, jobject, jlong jdb_handle, jboolean jforce) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::Status s = db->EnableFileDeletions(jforce); + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::Status s = db->EnableFileDeletions(jforce); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2782,13 +2855,13 @@ void Java_org_rocksdb_RocksDB_enableFileDeletions( */ jobjectArray Java_org_rocksdb_RocksDB_getLiveFiles( JNIEnv* env, jobject, jlong jdb_handle, jboolean jflush_memtable) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); std::vector live_files; uint64_t manifest_file_size = 0; auto s = db->GetLiveFiles( live_files, &manifest_file_size, jflush_memtable == JNI_TRUE); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } @@ -2796,7 +2869,7 @@ jobjectArray Java_org_rocksdb_RocksDB_getLiveFiles( // for passing back to java live_files.push_back(std::to_string(manifest_file_size)); - return rocksdb::JniUtil::toJavaStrings(env, &live_files); + return ROCKSDB_NAMESPACE::JniUtil::toJavaStrings(env, &live_files); } /* @@ -2806,18 +2879,18 @@ jobjectArray Java_org_rocksdb_RocksDB_getLiveFiles( */ jobjectArray Java_org_rocksdb_RocksDB_getSortedWalFiles( JNIEnv* env, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); - std::vector> sorted_wal_files; + auto* db = reinterpret_cast(jdb_handle); + std::vector> sorted_wal_files; auto s = db->GetSortedWalFiles(sorted_wal_files); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } // convert to Java type const jsize jlen = static_cast(sorted_wal_files.size()); jobjectArray jsorted_wal_files = env->NewObjectArray( - jlen, rocksdb::LogFileJni::getJClass(env), nullptr); + jlen, ROCKSDB_NAMESPACE::LogFileJni::getJClass(env), nullptr); if(jsorted_wal_files == nullptr) { // exception thrown: OutOfMemoryError return nullptr; @@ -2825,7 +2898,8 @@ jobjectArray Java_org_rocksdb_RocksDB_getSortedWalFiles( jsize i = 0; for (auto it = sorted_wal_files.begin(); it != sorted_wal_files.end(); ++it) { - jobject jlog_file = rocksdb::LogFileJni::fromCppLogFile(env, it->get()); + jobject jlog_file = + ROCKSDB_NAMESPACE::LogFileJni::fromCppLogFile(env, it->get()); if (jlog_file == nullptr) { // exception occurred env->DeleteLocalRef(jsorted_wal_files); @@ -2853,16 +2927,16 @@ jobjectArray Java_org_rocksdb_RocksDB_getSortedWalFiles( */ jlong Java_org_rocksdb_RocksDB_getUpdatesSince( JNIEnv* env, jobject, jlong jdb_handle, jlong jsequence_number) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::SequenceNumber sequence_number = - static_cast(jsequence_number); - std::unique_ptr iter; - rocksdb::Status s = db->GetUpdatesSince(sequence_number, &iter); + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::SequenceNumber sequence_number = + static_cast(jsequence_number); + std::unique_ptr iter; + ROCKSDB_NAMESPACE::Status s = db->GetUpdatesSince(sequence_number, &iter); if (s.ok()) { return reinterpret_cast(iter.release()); } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return 0; } @@ -2873,10 +2947,10 @@ jlong Java_org_rocksdb_RocksDB_getUpdatesSince( */ void Java_org_rocksdb_RocksDB_deleteFile( JNIEnv* env, jobject, jlong jdb_handle, jstring jname) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); jboolean has_exception = JNI_FALSE; std::string name = - rocksdb::JniUtil::copyStdString(env, jname, &has_exception); + ROCKSDB_NAMESPACE::JniUtil::copyStdString(env, jname, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return; @@ -2891,14 +2965,14 @@ void Java_org_rocksdb_RocksDB_deleteFile( */ jobjectArray Java_org_rocksdb_RocksDB_getLiveFilesMetaData( JNIEnv* env, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); - std::vector live_files_meta_data; + auto* db = reinterpret_cast(jdb_handle); + std::vector live_files_meta_data; db->GetLiveFilesMetaData(&live_files_meta_data); // convert to Java type const jsize jlen = static_cast(live_files_meta_data.size()); jobjectArray jlive_files_meta_data = env->NewObjectArray( - jlen, rocksdb::LiveFileMetaDataJni::getJClass(env), nullptr); + jlen, ROCKSDB_NAMESPACE::LiveFileMetaDataJni::getJClass(env), nullptr); if(jlive_files_meta_data == nullptr) { // exception thrown: OutOfMemoryError return nullptr; @@ -2907,7 +2981,8 @@ jobjectArray Java_org_rocksdb_RocksDB_getLiveFilesMetaData( jsize i = 0; for (auto it = live_files_meta_data.begin(); it != live_files_meta_data.end(); ++it) { jobject jlive_file_meta_data = - rocksdb::LiveFileMetaDataJni::fromCppLiveFileMetaData(env, &(*it)); + ROCKSDB_NAMESPACE::LiveFileMetaDataJni::fromCppLiveFileMetaData(env, + &(*it)); if (jlive_file_meta_data == nullptr) { // exception occurred env->DeleteLocalRef(jlive_files_meta_data); @@ -2935,18 +3010,18 @@ jobjectArray Java_org_rocksdb_RocksDB_getLiveFilesMetaData( */ jobject Java_org_rocksdb_RocksDB_getColumnFamilyMetaData( JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } - rocksdb::ColumnFamilyMetaData cf_metadata; + ROCKSDB_NAMESPACE::ColumnFamilyMetaData cf_metadata; db->GetColumnFamilyMetaData(cf_handle, &cf_metadata); - return rocksdb::ColumnFamilyMetaDataJni::fromCppColumnFamilyMetaData( - env, &cf_metadata); + return ROCKSDB_NAMESPACE::ColumnFamilyMetaDataJni:: + fromCppColumnFamilyMetaData(env, &cf_metadata); } /* @@ -2959,22 +3034,23 @@ void Java_org_rocksdb_RocksDB_ingestExternalFile( jobjectArray jfile_path_list, jint jfile_path_list_len, jlong jingest_external_file_options_handle) { jboolean has_exception = JNI_FALSE; - std::vector file_path_list = rocksdb::JniUtil::copyStrings( - env, jfile_path_list, jfile_path_list_len, &has_exception); + std::vector file_path_list = + ROCKSDB_NAMESPACE::JniUtil::copyStrings( + env, jfile_path_list, jfile_path_list_len, &has_exception); if (has_exception == JNI_TRUE) { // exception occurred return; } - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* column_family = - reinterpret_cast(jcf_handle); - auto* ifo = reinterpret_cast( + reinterpret_cast(jcf_handle); + auto* ifo = reinterpret_cast( jingest_external_file_options_handle); - rocksdb::Status s = + ROCKSDB_NAMESPACE::Status s = db->IngestExternalFile(column_family, file_path_list, *ifo); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2985,10 +3061,10 @@ void Java_org_rocksdb_RocksDB_ingestExternalFile( */ void Java_org_rocksdb_RocksDB_verifyChecksum( JNIEnv* env, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto s = db->VerifyChecksum(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -2999,7 +3075,7 @@ void Java_org_rocksdb_RocksDB_verifyChecksum( */ jlong Java_org_rocksdb_RocksDB_getDefaultColumnFamily( JNIEnv*, jobject, jlong jdb_handle) { - auto* db_handle = reinterpret_cast(jdb_handle); + auto* db_handle = reinterpret_cast(jdb_handle); auto* cf_handle = db_handle->DefaultColumnFamily(); return reinterpret_cast(cf_handle); } @@ -3011,48 +3087,63 @@ jlong Java_org_rocksdb_RocksDB_getDefaultColumnFamily( */ jobject Java_org_rocksdb_RocksDB_getPropertiesOfAllTables( JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } - rocksdb::TablePropertiesCollection table_properties_collection; + ROCKSDB_NAMESPACE::TablePropertiesCollection table_properties_collection; auto s = db->GetPropertiesOfAllTables(cf_handle, &table_properties_collection); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } // convert to Java type - jobject jhash_map = rocksdb::HashMapJni::construct( + jobject jhash_map = ROCKSDB_NAMESPACE::HashMapJni::construct( env, static_cast(table_properties_collection.size())); if (jhash_map == nullptr) { // exception occurred return nullptr; } - const rocksdb::HashMapJni::FnMapKV, jobject, jobject> fn_map_kv = - [env](const std::pair>& kv) { - jstring jkey = rocksdb::JniUtil::toJavaString(env, &(kv.first), false); - if (env->ExceptionCheck()) { - // an error occurred - return std::unique_ptr>(nullptr); - } + const ROCKSDB_NAMESPACE::HashMapJni::FnMapKV< + const std::string, + const std::shared_ptr, jobject, + jobject> + fn_map_kv = + [env](const std::pair>& + kv) { + jstring jkey = ROCKSDB_NAMESPACE::JniUtil::toJavaString( + env, &(kv.first), false); + if (env->ExceptionCheck()) { + // an error occurred + return std::unique_ptr>(nullptr); + } - jobject jtable_properties = rocksdb::TablePropertiesJni::fromCppTableProperties(env, *(kv.second.get())); - if (jtable_properties == nullptr) { - // an error occurred - env->DeleteLocalRef(jkey); - return std::unique_ptr>(nullptr); - } + jobject jtable_properties = + ROCKSDB_NAMESPACE::TablePropertiesJni::fromCppTableProperties( + env, *(kv.second.get())); + if (jtable_properties == nullptr) { + // an error occurred + env->DeleteLocalRef(jkey); + return std::unique_ptr>(nullptr); + } - return std::unique_ptr>(new std::pair(static_cast(jkey), static_cast(jtable_properties))); - }; + return std::unique_ptr>( + new std::pair( + static_cast(jkey), + static_cast(jtable_properties))); + }; - if (!rocksdb::HashMapJni::putAll(env, jhash_map, table_properties_collection.begin(), table_properties_collection.end(), fn_map_kv)) { + if (!ROCKSDB_NAMESPACE::HashMapJni::putAll( + env, jhash_map, table_properties_collection.begin(), + table_properties_collection.end(), fn_map_kv)) { // exception occurred return nullptr; } @@ -3068,13 +3159,13 @@ jobject Java_org_rocksdb_RocksDB_getPropertiesOfAllTables( jobject Java_org_rocksdb_RocksDB_getPropertiesOfTablesInRange( JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle, jlongArray jrange_slice_handles) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } const jsize jlen = env->GetArrayLength(jrange_slice_handles); jboolean jrange_slice_handles_is_copy = JNI_FALSE; @@ -3086,22 +3177,23 @@ jobject Java_org_rocksdb_RocksDB_getPropertiesOfTablesInRange( } const size_t ranges_len = static_cast(jlen / 2); - auto ranges = std::unique_ptr(new rocksdb::Range[ranges_len]); + auto ranges = std::unique_ptr( + new ROCKSDB_NAMESPACE::Range[ranges_len]); for (jsize i = 0, j = 0; i < jlen; ++i) { - auto* start = reinterpret_cast( - jrange_slice_handle[i]); - auto* limit = reinterpret_cast( - jrange_slice_handle[++i]); - ranges[j++] = rocksdb::Range(*start, *limit); + auto* start = + reinterpret_cast(jrange_slice_handle[i]); + auto* limit = + reinterpret_cast(jrange_slice_handle[++i]); + ranges[j++] = ROCKSDB_NAMESPACE::Range(*start, *limit); } - rocksdb::TablePropertiesCollection table_properties_collection; + ROCKSDB_NAMESPACE::TablePropertiesCollection table_properties_collection; auto s = db->GetPropertiesOfTablesInRange( cf_handle, ranges.get(), ranges_len, &table_properties_collection); if (!s.ok()) { // error occurred - env->ReleaseLongArrayElements(jrange_slice_handles, jrange_slice_handle, JNI_ABORT); - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + env->ReleaseLongArrayElements(jrange_slice_handles, jrange_slice_handle, JNI_ABORT); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } @@ -3118,22 +3210,22 @@ jobject Java_org_rocksdb_RocksDB_getPropertiesOfTablesInRange( */ jlongArray Java_org_rocksdb_RocksDB_suggestCompactRange( JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } - auto* begin = new rocksdb::Slice(); - auto* end = new rocksdb::Slice(); + auto* begin = new ROCKSDB_NAMESPACE::Slice(); + auto* end = new ROCKSDB_NAMESPACE::Slice(); auto s = db->SuggestCompactRange(cf_handle, begin, end); if (!s.ok()) { // error occurred delete begin; delete end; - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } @@ -3167,13 +3259,13 @@ jlongArray Java_org_rocksdb_RocksDB_suggestCompactRange( */ void Java_org_rocksdb_RocksDB_promoteL0( JNIEnv*, jobject, jlong jdb_handle, jlong jcf_handle, jint jtarget_level) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* cf_handle; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { cf_handle = db->DefaultColumnFamily(); } else { - cf_handle = - reinterpret_cast(jcf_handle); + cf_handle = + reinterpret_cast(jcf_handle); } db->PromoteL0(cf_handle, static_cast(jtarget_level)); } @@ -3186,17 +3278,18 @@ void Java_org_rocksdb_RocksDB_promoteL0( void Java_org_rocksdb_RocksDB_startTrace( JNIEnv* env, jobject, jlong jdb_handle, jlong jmax_trace_file_size, jlong jtrace_writer_jnicallback_handle) { - auto* db = reinterpret_cast(jdb_handle); - rocksdb::TraceOptions trace_options; + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::TraceOptions trace_options; trace_options.max_trace_file_size = static_cast(jmax_trace_file_size); // transfer ownership of trace writer from Java to C++ - auto trace_writer = std::unique_ptr( - reinterpret_cast( - jtrace_writer_jnicallback_handle)); + auto trace_writer = + std::unique_ptr( + reinterpret_cast( + jtrace_writer_jnicallback_handle)); auto s = db->StartTrace(trace_options, std::move(trace_writer)); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -3207,10 +3300,10 @@ void Java_org_rocksdb_RocksDB_startTrace( */ JNIEXPORT void JNICALL Java_org_rocksdb_RocksDB_endTrace( JNIEnv* env, jobject, jlong jdb_handle) { - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto s = db->EndTrace(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -3227,22 +3320,23 @@ void Java_org_rocksdb_RocksDB_destroyDB( return; } - auto* options = reinterpret_cast(joptions_handle); + auto* options = + reinterpret_cast(joptions_handle); if (options == nullptr) { - rocksdb::RocksDBExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Invalid Options.")); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument("Invalid Options.")); } - rocksdb::Status s = rocksdb::DestroyDB(db_path, *options); + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::DestroyDB(db_path, *options); env->ReleaseStringUTFChars(jdb_path, db_path); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } bool get_slice_helper(JNIEnv* env, jobjectArray ranges, jsize index, - std::unique_ptr& slice, + std::unique_ptr& slice, std::vector>& ranges_to_free) { jobject jArray = env->GetObjectArrayElement(ranges, index); if (env->ExceptionCheck()) { @@ -3264,7 +3358,7 @@ bool get_slice_helper(JNIEnv* env, jobjectArray ranges, jsize index, return false; } env->DeleteLocalRef(jArray); - slice.reset(new rocksdb::Slice( + slice.reset(new ROCKSDB_NAMESPACE::Slice( reinterpret_cast(ranges_to_free.back().get()), len_ba)); return true; } @@ -3278,35 +3372,35 @@ JNIEXPORT void JNICALL Java_org_rocksdb_RocksDB_deleteFilesInRanges( jobjectArray ranges, jboolean include_end) { jsize length = env->GetArrayLength(ranges); - std::vector rangesVector; - std::vector> slices; + std::vector rangesVector; + std::vector> slices; std::vector> ranges_to_free; for (jsize i = 0; (i + 1) < length; i += 2) { - slices.push_back(std::unique_ptr()); + slices.push_back(std::unique_ptr()); if (!get_slice_helper(env, ranges, i, slices.back(), ranges_to_free)) { // exception thrown return; } - slices.push_back(std::unique_ptr()); + slices.push_back(std::unique_ptr()); if (!get_slice_helper(env, ranges, i + 1, slices.back(), ranges_to_free)) { // exception thrown return; } - rangesVector.push_back(rocksdb::RangePtr(slices[slices.size() - 2].get(), - slices[slices.size() - 1].get())); + rangesVector.push_back(ROCKSDB_NAMESPACE::RangePtr( + slices[slices.size() - 2].get(), slices[slices.size() - 1].get())); } - auto* db = reinterpret_cast(jdb_handle); + auto* db = reinterpret_cast(jdb_handle); auto* column_family = - reinterpret_cast(jcf_handle); + reinterpret_cast(jcf_handle); - rocksdb::Status s = rocksdb::DeleteFilesInRanges( + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::DeleteFilesInRanges( db, column_family == nullptr ? db->DefaultColumnFamily() : column_family, rangesVector.data(), rangesVector.size(), include_end); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } diff --git a/java/rocksjni/slice.cc b/java/rocksjni/slice.cc index e617cde25a..d9e58992bd 100644 --- a/java/rocksjni/slice.cc +++ b/java/rocksjni/slice.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::Slice. +// ROCKSDB_NAMESPACE::Slice. #include #include @@ -43,7 +43,7 @@ jlong Java_org_rocksdb_AbstractSlice_createNewSliceFromString(JNIEnv* env, buf[len] = 0; env->ReleaseStringUTFChars(jstr, str); - const auto* slice = new rocksdb::Slice(buf); + const auto* slice = new ROCKSDB_NAMESPACE::Slice(buf); return reinterpret_cast(slice); } @@ -54,7 +54,7 @@ jlong Java_org_rocksdb_AbstractSlice_createNewSliceFromString(JNIEnv* env, */ jint Java_org_rocksdb_AbstractSlice_size0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - const auto* slice = reinterpret_cast(handle); + const auto* slice = reinterpret_cast(handle); return static_cast(slice->size()); } @@ -65,7 +65,7 @@ jint Java_org_rocksdb_AbstractSlice_size0(JNIEnv* /*env*/, jobject /*jobj*/, */ jboolean Java_org_rocksdb_AbstractSlice_empty0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - const auto* slice = reinterpret_cast(handle); + const auto* slice = reinterpret_cast(handle); return slice->empty(); } @@ -76,7 +76,7 @@ jboolean Java_org_rocksdb_AbstractSlice_empty0(JNIEnv* /*env*/, */ jstring Java_org_rocksdb_AbstractSlice_toString0(JNIEnv* env, jobject /*jobj*/, jlong handle, jboolean hex) { - const auto* slice = reinterpret_cast(handle); + const auto* slice = reinterpret_cast(handle); const std::string s = slice->ToString(hex); return env->NewStringUTF(s.c_str()); } @@ -88,8 +88,9 @@ jstring Java_org_rocksdb_AbstractSlice_toString0(JNIEnv* env, jobject /*jobj*/, */ jint Java_org_rocksdb_AbstractSlice_compare0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jlong otherHandle) { - const auto* slice = reinterpret_cast(handle); - const auto* otherSlice = reinterpret_cast(otherHandle); + const auto* slice = reinterpret_cast(handle); + const auto* otherSlice = + reinterpret_cast(otherHandle); return slice->compare(*otherSlice); } @@ -102,8 +103,9 @@ jboolean Java_org_rocksdb_AbstractSlice_startsWith0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jlong otherHandle) { - const auto* slice = reinterpret_cast(handle); - const auto* otherSlice = reinterpret_cast(otherHandle); + const auto* slice = reinterpret_cast(handle); + const auto* otherSlice = + reinterpret_cast(otherHandle); return slice->starts_with(*otherSlice); } @@ -115,7 +117,7 @@ jboolean Java_org_rocksdb_AbstractSlice_startsWith0(JNIEnv* /*env*/, void Java_org_rocksdb_AbstractSlice_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - delete reinterpret_cast(handle); + delete reinterpret_cast(handle); } // @@ -141,7 +143,7 @@ jlong Java_org_rocksdb_Slice_createNewSlice0(JNIEnv* env, jclass /*jcls*/, return 0; } - const auto* slice = new rocksdb::Slice((const char*)buf, len); + const auto* slice = new ROCKSDB_NAMESPACE::Slice((const char*)buf, len); return reinterpret_cast(slice); } @@ -165,7 +167,7 @@ jlong Java_org_rocksdb_Slice_createNewSlice1(JNIEnv* env, jclass /*jcls*/, memcpy(buf, ptrData, len - 1); buf[len - 1] = '\0'; - const auto* slice = new rocksdb::Slice(buf, len - 1); + const auto* slice = new ROCKSDB_NAMESPACE::Slice(buf, len - 1); env->ReleaseByteArrayElements(data, ptrData, JNI_ABORT); @@ -179,7 +181,7 @@ jlong Java_org_rocksdb_Slice_createNewSlice1(JNIEnv* env, jclass /*jcls*/, */ jbyteArray Java_org_rocksdb_Slice_data0(JNIEnv* env, jobject /*jobj*/, jlong handle) { - const auto* slice = reinterpret_cast(handle); + const auto* slice = reinterpret_cast(handle); const jsize len = static_cast(slice->size()); const jbyteArray data = env->NewByteArray(len); if (data == nullptr) { @@ -207,7 +209,7 @@ jbyteArray Java_org_rocksdb_Slice_data0(JNIEnv* env, jobject /*jobj*/, void Java_org_rocksdb_Slice_clear0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jboolean shouldRelease, jlong internalBufferOffset) { - auto* slice = reinterpret_cast(handle); + auto* slice = reinterpret_cast(handle); if (shouldRelease == JNI_TRUE) { const char* buf = slice->data_ - internalBufferOffset; delete[] buf; @@ -222,7 +224,7 @@ void Java_org_rocksdb_Slice_clear0(JNIEnv* /*env*/, jobject /*jobj*/, */ void Java_org_rocksdb_Slice_removePrefix0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jint length) { - auto* slice = reinterpret_cast(handle); + auto* slice = reinterpret_cast(handle); slice->remove_prefix(length); } @@ -234,7 +236,7 @@ void Java_org_rocksdb_Slice_removePrefix0(JNIEnv* /*env*/, jobject /*jobj*/, void Java_org_rocksdb_Slice_disposeInternalBuf(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jlong internalBufferOffset) { - const auto* slice = reinterpret_cast(handle); + const auto* slice = reinterpret_cast(handle); const char* buf = slice->data_ - internalBufferOffset; delete[] buf; } @@ -257,13 +259,14 @@ jlong Java_org_rocksdb_DirectSlice_createNewDirectSlice0(JNIEnv* env, if (data_addr == nullptr) { // error: memory region is undefined, given object is not a direct // java.nio.Buffer, or JNI access to direct buffers is not supported by JVM - rocksdb::IllegalArgumentExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Could not access DirectBuffer")); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Could not access DirectBuffer")); return 0; } const auto* ptrData = reinterpret_cast(data_addr); - const auto* slice = new rocksdb::Slice(ptrData, length); + const auto* slice = new ROCKSDB_NAMESPACE::Slice(ptrData, length); return reinterpret_cast(slice); } @@ -279,13 +282,14 @@ jlong Java_org_rocksdb_DirectSlice_createNewDirectSlice1(JNIEnv* env, if (data_addr == nullptr) { // error: memory region is undefined, given object is not a direct // java.nio.Buffer, or JNI access to direct buffers is not supported by JVM - rocksdb::IllegalArgumentExceptionJni::ThrowNew( - env, rocksdb::Status::InvalidArgument("Could not access DirectBuffer")); + ROCKSDB_NAMESPACE::IllegalArgumentExceptionJni::ThrowNew( + env, ROCKSDB_NAMESPACE::Status::InvalidArgument( + "Could not access DirectBuffer")); return 0; } const auto* ptrData = reinterpret_cast(data_addr); - const auto* slice = new rocksdb::Slice(ptrData); + const auto* slice = new ROCKSDB_NAMESPACE::Slice(ptrData); return reinterpret_cast(slice); } @@ -296,7 +300,7 @@ jlong Java_org_rocksdb_DirectSlice_createNewDirectSlice1(JNIEnv* env, */ jobject Java_org_rocksdb_DirectSlice_data0(JNIEnv* env, jobject /*jobj*/, jlong handle) { - const auto* slice = reinterpret_cast(handle); + const auto* slice = reinterpret_cast(handle); return env->NewDirectByteBuffer(const_cast(slice->data()), slice->size()); } @@ -308,7 +312,7 @@ jobject Java_org_rocksdb_DirectSlice_data0(JNIEnv* env, jobject /*jobj*/, */ jbyte Java_org_rocksdb_DirectSlice_get0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jint offset) { - const auto* slice = reinterpret_cast(handle); + const auto* slice = reinterpret_cast(handle); return (*slice)[offset]; } @@ -320,7 +324,7 @@ jbyte Java_org_rocksdb_DirectSlice_get0(JNIEnv* /*env*/, jobject /*jobj*/, void Java_org_rocksdb_DirectSlice_clear0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jboolean shouldRelease, jlong internalBufferOffset) { - auto* slice = reinterpret_cast(handle); + auto* slice = reinterpret_cast(handle); if (shouldRelease == JNI_TRUE) { const char* buf = slice->data_ - internalBufferOffset; delete[] buf; @@ -336,7 +340,7 @@ void Java_org_rocksdb_DirectSlice_clear0(JNIEnv* /*env*/, jobject /*jobj*/, void Java_org_rocksdb_DirectSlice_removePrefix0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jint length) { - auto* slice = reinterpret_cast(handle); + auto* slice = reinterpret_cast(handle); slice->remove_prefix(length); } @@ -348,7 +352,7 @@ void Java_org_rocksdb_DirectSlice_removePrefix0(JNIEnv* /*env*/, void Java_org_rocksdb_DirectSlice_disposeInternalBuf( JNIEnv* /*env*/, jobject /*jobj*/, jlong handle, jlong internalBufferOffset) { - const auto* slice = reinterpret_cast(handle); + const auto* slice = reinterpret_cast(handle); const char* buf = slice->data_ - internalBufferOffset; delete[] buf; } diff --git a/java/rocksjni/snapshot.cc b/java/rocksjni/snapshot.cc index 679271db87..2a1265a58a 100644 --- a/java/rocksjni/snapshot.cc +++ b/java/rocksjni/snapshot.cc @@ -21,6 +21,7 @@ jlong Java_org_rocksdb_Snapshot_getSequenceNumber(JNIEnv* /*env*/, jobject /*jobj*/, jlong jsnapshot_handle) { - auto* snapshot = reinterpret_cast(jsnapshot_handle); + auto* snapshot = + reinterpret_cast(jsnapshot_handle); return snapshot->GetSequenceNumber(); } diff --git a/java/rocksjni/sst_file_manager.cc b/java/rocksjni/sst_file_manager.cc index 3df3c9966c..e7445d80f0 100644 --- a/java/rocksjni/sst_file_manager.cc +++ b/java/rocksjni/sst_file_manager.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling C++ rocksdb::SstFileManager methods +// calling C++ ROCKSDB_NAMESPACE::SstFileManager methods // from Java side. #include @@ -23,30 +23,31 @@ jlong Java_org_rocksdb_SstFileManager_newSstFileManager( JNIEnv* jnienv, jclass /*jcls*/, jlong jenv_handle, jlong jlogger_handle, jlong jrate_bytes, jdouble jmax_trash_db_ratio, jlong jmax_delete_chunk_bytes) { - auto* env = reinterpret_cast(jenv_handle); - rocksdb::Status s; - rocksdb::SstFileManager* sst_file_manager = nullptr; + auto* env = reinterpret_cast(jenv_handle); + ROCKSDB_NAMESPACE::Status s; + ROCKSDB_NAMESPACE::SstFileManager* sst_file_manager = nullptr; if (jlogger_handle != 0) { auto* sptr_logger = - reinterpret_cast*>(jlogger_handle); - sst_file_manager = rocksdb::NewSstFileManager( + reinterpret_cast*>( + jlogger_handle); + sst_file_manager = ROCKSDB_NAMESPACE::NewSstFileManager( env, *sptr_logger, "", jrate_bytes, true, &s, jmax_trash_db_ratio, jmax_delete_chunk_bytes); } else { - sst_file_manager = rocksdb::NewSstFileManager(env, nullptr, "", jrate_bytes, - true, &s, jmax_trash_db_ratio, - jmax_delete_chunk_bytes); + sst_file_manager = ROCKSDB_NAMESPACE::NewSstFileManager( + env, nullptr, "", jrate_bytes, true, &s, jmax_trash_db_ratio, + jmax_delete_chunk_bytes); } if (!s.ok()) { if (sst_file_manager != nullptr) { delete sst_file_manager; } - rocksdb::RocksDBExceptionJni::ThrowNew(jnienv, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(jnienv, s); } auto* sptr_sst_file_manager = - new std::shared_ptr(sst_file_manager); + new std::shared_ptr(sst_file_manager); return reinterpret_cast(sptr_sst_file_manager); } @@ -60,7 +61,8 @@ void Java_org_rocksdb_SstFileManager_setMaxAllowedSpaceUsage( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jmax_allowed_space) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); sptr_sst_file_manager->get()->SetMaxAllowedSpaceUsage(jmax_allowed_space); } @@ -73,7 +75,8 @@ void Java_org_rocksdb_SstFileManager_setCompactionBufferSize( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jcompaction_buffer_size) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); sptr_sst_file_manager->get()->SetCompactionBufferSize( jcompaction_buffer_size); } @@ -86,7 +89,8 @@ void Java_org_rocksdb_SstFileManager_setCompactionBufferSize( jboolean Java_org_rocksdb_SstFileManager_isMaxAllowedSpaceReached( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); return sptr_sst_file_manager->get()->IsMaxAllowedSpaceReached(); } @@ -99,7 +103,8 @@ jboolean Java_org_rocksdb_SstFileManager_isMaxAllowedSpaceReachedIncludingCompactions( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); return sptr_sst_file_manager->get() ->IsMaxAllowedSpaceReachedIncludingCompactions(); } @@ -113,7 +118,8 @@ jlong Java_org_rocksdb_SstFileManager_getTotalSize(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); return sptr_sst_file_manager->get()->GetTotalSize(); } @@ -126,19 +132,22 @@ jobject Java_org_rocksdb_SstFileManager_getTrackedFiles(JNIEnv* env, jobject /*jobj*/, jlong jhandle) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); auto tracked_files = sptr_sst_file_manager->get()->GetTrackedFiles(); - //TODO(AR) could refactor to share code with rocksdb::HashMapJni::fromCppMap(env, tracked_files); + // TODO(AR) could refactor to share code with + // ROCKSDB_NAMESPACE::HashMapJni::fromCppMap(env, tracked_files); - const jobject jtracked_files = rocksdb::HashMapJni::construct( + const jobject jtracked_files = ROCKSDB_NAMESPACE::HashMapJni::construct( env, static_cast(tracked_files.size())); if (jtracked_files == nullptr) { // exception occurred return nullptr; } - const rocksdb::HashMapJni::FnMapKV + const ROCKSDB_NAMESPACE::HashMapJni::FnMapKV fn_map_kv = [env](const std::pair& pair) { const jstring jtracked_file_path = @@ -148,7 +157,7 @@ jobject Java_org_rocksdb_SstFileManager_getTrackedFiles(JNIEnv* env, return std::unique_ptr>(nullptr); } const jobject jtracked_file_size = - rocksdb::LongJni::valueOf(env, pair.second); + ROCKSDB_NAMESPACE::LongJni::valueOf(env, pair.second); if (jtracked_file_size == nullptr) { // an error occurred return std::unique_ptr>(nullptr); @@ -158,8 +167,9 @@ jobject Java_org_rocksdb_SstFileManager_getTrackedFiles(JNIEnv* env, jtracked_file_size)); }; - if (!rocksdb::HashMapJni::putAll(env, jtracked_files, tracked_files.begin(), - tracked_files.end(), fn_map_kv)) { + if (!ROCKSDB_NAMESPACE::HashMapJni::putAll(env, jtracked_files, + tracked_files.begin(), + tracked_files.end(), fn_map_kv)) { // exception occcurred return nullptr; } @@ -175,7 +185,8 @@ jobject Java_org_rocksdb_SstFileManager_getTrackedFiles(JNIEnv* env, jlong Java_org_rocksdb_SstFileManager_getDeleteRateBytesPerSecond( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); return sptr_sst_file_manager->get()->GetDeleteRateBytesPerSecond(); } @@ -187,7 +198,8 @@ jlong Java_org_rocksdb_SstFileManager_getDeleteRateBytesPerSecond( void Java_org_rocksdb_SstFileManager_setDeleteRateBytesPerSecond( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jdelete_rate) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); sptr_sst_file_manager->get()->SetDeleteRateBytesPerSecond(jdelete_rate); } @@ -200,7 +212,8 @@ jdouble Java_org_rocksdb_SstFileManager_getMaxTrashDBRatio(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); return sptr_sst_file_manager->get()->GetMaxTrashDBRatio(); } @@ -214,7 +227,8 @@ void Java_org_rocksdb_SstFileManager_setMaxTrashDBRatio(JNIEnv* /*env*/, jlong jhandle, jdouble jratio) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); sptr_sst_file_manager->get()->SetMaxTrashDBRatio(jratio); } @@ -227,6 +241,7 @@ void Java_org_rocksdb_SstFileManager_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* sptr_sst_file_manager = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); delete sptr_sst_file_manager; } diff --git a/java/rocksjni/sst_file_reader_iterator.cc b/java/rocksjni/sst_file_reader_iterator.cc index 97ee89b99f..29cf2c5daa 100644 --- a/java/rocksjni/sst_file_reader_iterator.cc +++ b/java/rocksjni/sst_file_reader_iterator.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::Iterator methods from Java side. +// calling c++ ROCKSDB_NAMESPACE::Iterator methods from Java side. #include #include @@ -22,7 +22,7 @@ void Java_org_rocksdb_SstFileReaderIterator_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); + auto* it = reinterpret_cast(handle); assert(it != nullptr); delete it; } @@ -35,7 +35,7 @@ void Java_org_rocksdb_SstFileReaderIterator_disposeInternal(JNIEnv* /*env*/, jboolean Java_org_rocksdb_SstFileReaderIterator_isValid0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - return reinterpret_cast(handle)->Valid(); + return reinterpret_cast(handle)->Valid(); } /* @@ -46,7 +46,7 @@ jboolean Java_org_rocksdb_SstFileReaderIterator_isValid0(JNIEnv* /*env*/, void Java_org_rocksdb_SstFileReaderIterator_seekToFirst0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->SeekToFirst(); + reinterpret_cast(handle)->SeekToFirst(); } /* @@ -57,7 +57,7 @@ void Java_org_rocksdb_SstFileReaderIterator_seekToFirst0(JNIEnv* /*env*/, void Java_org_rocksdb_SstFileReaderIterator_seekToLast0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->SeekToLast(); + reinterpret_cast(handle)->SeekToLast(); } /* @@ -68,7 +68,7 @@ void Java_org_rocksdb_SstFileReaderIterator_seekToLast0(JNIEnv* /*env*/, void Java_org_rocksdb_SstFileReaderIterator_next0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->Next(); + reinterpret_cast(handle)->Next(); } /* @@ -79,7 +79,7 @@ void Java_org_rocksdb_SstFileReaderIterator_next0(JNIEnv* /*env*/, void Java_org_rocksdb_SstFileReaderIterator_prev0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->Prev(); + reinterpret_cast(handle)->Prev(); } /* @@ -97,9 +97,10 @@ void Java_org_rocksdb_SstFileReaderIterator_seek0(JNIEnv* env, jobject /*jobj*/, return; } - rocksdb::Slice target_slice(reinterpret_cast(target), jtarget_len); + ROCKSDB_NAMESPACE::Slice target_slice(reinterpret_cast(target), + jtarget_len); - auto* it = reinterpret_cast(handle); + auto* it = reinterpret_cast(handle); it->Seek(target_slice); env->ReleaseByteArrayElements(jtarget, target, JNI_ABORT); @@ -121,9 +122,10 @@ void Java_org_rocksdb_SstFileReaderIterator_seekForPrev0(JNIEnv* env, return; } - rocksdb::Slice target_slice(reinterpret_cast(target), jtarget_len); + ROCKSDB_NAMESPACE::Slice target_slice(reinterpret_cast(target), + jtarget_len); - auto* it = reinterpret_cast(handle); + auto* it = reinterpret_cast(handle); it->SeekForPrev(target_slice); env->ReleaseByteArrayElements(jtarget, target, JNI_ABORT); @@ -137,14 +139,14 @@ void Java_org_rocksdb_SstFileReaderIterator_seekForPrev0(JNIEnv* env, void Java_org_rocksdb_SstFileReaderIterator_status0(JNIEnv* env, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); - rocksdb::Status s = it->status(); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Status s = it->status(); if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -155,8 +157,8 @@ void Java_org_rocksdb_SstFileReaderIterator_status0(JNIEnv* env, jbyteArray Java_org_rocksdb_SstFileReaderIterator_key0(JNIEnv* env, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); - rocksdb::Slice key_slice = it->key(); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Slice key_slice = it->key(); jbyteArray jkey = env->NewByteArray(static_cast(key_slice.size())); if (jkey == nullptr) { @@ -176,14 +178,14 @@ jbyteArray Java_org_rocksdb_SstFileReaderIterator_key0(JNIEnv* env, */ jbyteArray Java_org_rocksdb_SstFileReaderIterator_value0(JNIEnv* env, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); - rocksdb::Slice value_slice = it->value(); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Slice value_slice = it->value(); - jbyteArray jkeyValue = - env->NewByteArray(static_cast(value_slice.size())); - if(jkeyValue == nullptr) { - // exception thrown: OutOfMemoryError - return nullptr; + jbyteArray jkeyValue = + env->NewByteArray(static_cast(value_slice.size())); + if (jkeyValue == nullptr) { + // exception thrown: OutOfMemoryError + return nullptr; } env->SetByteArrayRegion(jkeyValue, 0, static_cast(value_slice.size()), const_cast(reinterpret_cast(value_slice.data()))); @@ -198,10 +200,10 @@ jbyteArray Java_org_rocksdb_SstFileReaderIterator_value0(JNIEnv* env, jobject /* jint Java_org_rocksdb_SstFileReaderIterator_keyDirect0( JNIEnv* env, jobject /*jobj*/, jlong handle, jobject jtarget, jint jtarget_off, jint jtarget_len) { - auto* it = reinterpret_cast(handle); - rocksdb::Slice key_slice = it->key(); - return rocksdb::JniUtil::copyToDirect(env, key_slice, jtarget, jtarget_off, - jtarget_len); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Slice key_slice = it->key(); + return ROCKSDB_NAMESPACE::JniUtil::copyToDirect(env, key_slice, jtarget, + jtarget_off, jtarget_len); } /* @@ -212,10 +214,10 @@ jint Java_org_rocksdb_SstFileReaderIterator_keyDirect0( jint Java_org_rocksdb_SstFileReaderIterator_valueDirect0( JNIEnv* env, jobject /*jobj*/, jlong handle, jobject jtarget, jint jtarget_off, jint jtarget_len) { - auto* it = reinterpret_cast(handle); - rocksdb::Slice value_slice = it->value(); - return rocksdb::JniUtil::copyToDirect(env, value_slice, jtarget, jtarget_off, - jtarget_len); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Slice value_slice = it->value(); + return ROCKSDB_NAMESPACE::JniUtil::copyToDirect(env, value_slice, jtarget, + jtarget_off, jtarget_len); } /* @@ -226,9 +228,12 @@ jint Java_org_rocksdb_SstFileReaderIterator_valueDirect0( void Java_org_rocksdb_SstFileReaderIterator_seekDirect0( JNIEnv* env, jobject /*jobj*/, jlong handle, jobject jtarget, jint jtarget_off, jint jtarget_len) { - auto* it = reinterpret_cast(handle); - auto seek = [&it](rocksdb::Slice& target_slice) { it->Seek(target_slice); }; - rocksdb::JniUtil::k_op_direct(seek, env, jtarget, jtarget_off, jtarget_len); + auto* it = reinterpret_cast(handle); + auto seek = [&it](ROCKSDB_NAMESPACE::Slice& target_slice) { + it->Seek(target_slice); + }; + ROCKSDB_NAMESPACE::JniUtil::k_op_direct(seek, env, jtarget, jtarget_off, + jtarget_len); } /* @@ -239,10 +244,10 @@ void Java_org_rocksdb_SstFileReaderIterator_seekDirect0( void Java_org_rocksdb_SstFileReaderIterator_seekForPrevDirect0( JNIEnv* env, jobject /*jobj*/, jlong handle, jobject jtarget, jint jtarget_off, jint jtarget_len) { - auto* it = reinterpret_cast(handle); - auto seekPrev = [&it](rocksdb::Slice& target_slice) { + auto* it = reinterpret_cast(handle); + auto seekPrev = [&it](ROCKSDB_NAMESPACE::Slice& target_slice) { it->SeekForPrev(target_slice); }; - rocksdb::JniUtil::k_op_direct(seekPrev, env, jtarget, jtarget_off, - jtarget_len); + ROCKSDB_NAMESPACE::JniUtil::k_op_direct(seekPrev, env, jtarget, jtarget_off, + jtarget_len); } diff --git a/java/rocksjni/sst_file_readerjni.cc b/java/rocksjni/sst_file_readerjni.cc index c8348c2e25..d79a2c09a3 100644 --- a/java/rocksjni/sst_file_readerjni.cc +++ b/java/rocksjni/sst_file_readerjni.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling C++ rocksdb::SstFileReader methods +// calling C++ ROCKSDB_NAMESPACE::SstFileReader methods // from Java side. #include @@ -25,9 +25,10 @@ jlong Java_org_rocksdb_SstFileReader_newSstFileReader(JNIEnv * /*env*/, jclass /*jcls*/, jlong joptions) { - auto *options = reinterpret_cast(joptions); - rocksdb::SstFileReader *sst_file_reader = - new rocksdb::SstFileReader(*options); + auto *options = + reinterpret_cast(joptions); + ROCKSDB_NAMESPACE::SstFileReader *sst_file_reader = + new ROCKSDB_NAMESPACE::SstFileReader(*options); return reinterpret_cast(sst_file_reader); } @@ -43,12 +44,13 @@ void Java_org_rocksdb_SstFileReader_open(JNIEnv *env, jobject /*jobj*/, // exception thrown: OutOfMemoryError return; } - rocksdb::Status s = - reinterpret_cast(jhandle)->Open(file_path); + ROCKSDB_NAMESPACE::Status s = + reinterpret_cast(jhandle)->Open( + file_path); env->ReleaseStringUTFChars(jfile_path, file_path); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -61,9 +63,10 @@ jlong Java_org_rocksdb_SstFileReader_newIterator(JNIEnv * /*env*/, jobject /*jobj*/, jlong jhandle, jlong jread_options_handle) { - auto *sst_file_reader = reinterpret_cast(jhandle); + auto *sst_file_reader = + reinterpret_cast(jhandle); auto *read_options = - reinterpret_cast(jread_options_handle); + reinterpret_cast(jread_options_handle); return reinterpret_cast(sst_file_reader->NewIterator(*read_options)); } @@ -75,7 +78,7 @@ jlong Java_org_rocksdb_SstFileReader_newIterator(JNIEnv * /*env*/, void Java_org_rocksdb_SstFileReader_disposeInternal(JNIEnv * /*env*/, jobject /*jobj*/, jlong jhandle) { - delete reinterpret_cast(jhandle); + delete reinterpret_cast(jhandle); } /* @@ -86,10 +89,11 @@ void Java_org_rocksdb_SstFileReader_disposeInternal(JNIEnv * /*env*/, void Java_org_rocksdb_SstFileReader_verifyChecksum(JNIEnv *env, jobject /*jobj*/, jlong jhandle) { - auto *sst_file_reader = reinterpret_cast(jhandle); + auto *sst_file_reader = + reinterpret_cast(jhandle); auto s = sst_file_reader->VerifyChecksum(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -101,10 +105,12 @@ void Java_org_rocksdb_SstFileReader_verifyChecksum(JNIEnv *env, jobject Java_org_rocksdb_SstFileReader_getTableProperties(JNIEnv *env, jobject /*jobj*/, jlong jhandle) { - auto *sst_file_reader = reinterpret_cast(jhandle); - std::shared_ptr tp = + auto *sst_file_reader = + reinterpret_cast(jhandle); + std::shared_ptr tp = sst_file_reader->GetTableProperties(); jobject jtable_properties = - rocksdb::TablePropertiesJni::fromCppTableProperties(env, *(tp.get())); + ROCKSDB_NAMESPACE::TablePropertiesJni::fromCppTableProperties( + env, *(tp.get())); return jtable_properties; } diff --git a/java/rocksjni/sst_file_writerjni.cc b/java/rocksjni/sst_file_writerjni.cc index 9f7afad04d..5ca8c5309a 100644 --- a/java/rocksjni/sst_file_writerjni.cc +++ b/java/rocksjni/sst_file_writerjni.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling C++ rocksdb::SstFileWriter methods +// calling C++ ROCKSDB_NAMESPACE::SstFileWriter methods // from Java side. #include @@ -25,24 +25,26 @@ jlong Java_org_rocksdb_SstFileWriter_newSstFileWriter__JJJB( JNIEnv * /*env*/, jclass /*jcls*/, jlong jenvoptions, jlong joptions, jlong jcomparator_handle, jbyte jcomparator_type) { - rocksdb::Comparator *comparator = nullptr; + ROCKSDB_NAMESPACE::Comparator *comparator = nullptr; switch (jcomparator_type) { // JAVA_COMPARATOR case 0x0: - comparator = reinterpret_cast( + comparator = reinterpret_cast( jcomparator_handle); break; // JAVA_NATIVE_COMPARATOR_WRAPPER case 0x1: - comparator = reinterpret_cast(jcomparator_handle); + comparator = + reinterpret_cast(jcomparator_handle); break; } auto *env_options = - reinterpret_cast(jenvoptions); - auto *options = reinterpret_cast(joptions); - rocksdb::SstFileWriter *sst_file_writer = - new rocksdb::SstFileWriter(*env_options, *options, comparator); + reinterpret_cast(jenvoptions); + auto *options = + reinterpret_cast(joptions); + ROCKSDB_NAMESPACE::SstFileWriter *sst_file_writer = + new ROCKSDB_NAMESPACE::SstFileWriter(*env_options, *options, comparator); return reinterpret_cast(sst_file_writer); } @@ -56,10 +58,11 @@ jlong Java_org_rocksdb_SstFileWriter_newSstFileWriter__JJ(JNIEnv * /*env*/, jlong jenvoptions, jlong joptions) { auto *env_options = - reinterpret_cast(jenvoptions); - auto *options = reinterpret_cast(joptions); - rocksdb::SstFileWriter *sst_file_writer = - new rocksdb::SstFileWriter(*env_options, *options); + reinterpret_cast(jenvoptions); + auto *options = + reinterpret_cast(joptions); + ROCKSDB_NAMESPACE::SstFileWriter *sst_file_writer = + new ROCKSDB_NAMESPACE::SstFileWriter(*env_options, *options); return reinterpret_cast(sst_file_writer); } @@ -75,12 +78,13 @@ void Java_org_rocksdb_SstFileWriter_open(JNIEnv *env, jobject /*jobj*/, // exception thrown: OutOfMemoryError return; } - rocksdb::Status s = - reinterpret_cast(jhandle)->Open(file_path); + ROCKSDB_NAMESPACE::Status s = + reinterpret_cast(jhandle)->Open( + file_path); env->ReleaseStringUTFChars(jfile_path, file_path); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -92,12 +96,14 @@ void Java_org_rocksdb_SstFileWriter_open(JNIEnv *env, jobject /*jobj*/, void Java_org_rocksdb_SstFileWriter_put__JJJ(JNIEnv *env, jobject /*jobj*/, jlong jhandle, jlong jkey_handle, jlong jvalue_handle) { - auto *key_slice = reinterpret_cast(jkey_handle); - auto *value_slice = reinterpret_cast(jvalue_handle); - rocksdb::Status s = reinterpret_cast(jhandle)->Put( - *key_slice, *value_slice); + auto *key_slice = reinterpret_cast(jkey_handle); + auto *value_slice = + reinterpret_cast(jvalue_handle); + ROCKSDB_NAMESPACE::Status s = + reinterpret_cast(jhandle)->Put( + *key_slice, *value_slice); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -114,8 +120,8 @@ void Java_org_rocksdb_SstFileWriter_put__J_3B_3B(JNIEnv *env, jobject /*jobj*/, // exception thrown: OutOfMemoryError return; } - rocksdb::Slice key_slice(reinterpret_cast(key), - env->GetArrayLength(jkey)); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + env->GetArrayLength(jkey)); jbyte *value = env->GetByteArrayElements(jval, nullptr); if (value == nullptr) { @@ -123,17 +129,18 @@ void Java_org_rocksdb_SstFileWriter_put__J_3B_3B(JNIEnv *env, jobject /*jobj*/, env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); return; } - rocksdb::Slice value_slice(reinterpret_cast(value), - env->GetArrayLength(jval)); + ROCKSDB_NAMESPACE::Slice value_slice(reinterpret_cast(value), + env->GetArrayLength(jval)); - rocksdb::Status s = reinterpret_cast(jhandle)->Put( - key_slice, value_slice); + ROCKSDB_NAMESPACE::Status s = + reinterpret_cast(jhandle)->Put( + key_slice, value_slice); env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); env->ReleaseByteArrayElements(jval, value, JNI_ABORT); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -147,16 +154,18 @@ void Java_org_rocksdb_SstFileWriter_putDirect(JNIEnv *env, jobject /*jdb*/, jint jkey_off, jint jkey_len, jobject jval, jint jval_off, jint jval_len) { - auto *writer = reinterpret_cast(jdb_handle); - auto put = [&env, &writer](rocksdb::Slice &key, rocksdb::Slice &value) { - rocksdb::Status s = writer->Put(key, value); + auto *writer = + reinterpret_cast(jdb_handle); + auto put = [&env, &writer](ROCKSDB_NAMESPACE::Slice &key, + ROCKSDB_NAMESPACE::Slice &value) { + ROCKSDB_NAMESPACE::Status s = writer->Put(key, value); if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); }; - rocksdb::JniUtil::kv_op_direct(put, env, jkey, jkey_off, jkey_len, jval, - jval_off, jval_len); + ROCKSDB_NAMESPACE::JniUtil::kv_op_direct(put, env, jkey, jkey_off, jkey_len, + jval, jval_off, jval_len); } /* @@ -166,7 +175,8 @@ void Java_org_rocksdb_SstFileWriter_putDirect(JNIEnv *env, jobject /*jdb*/, */ jlong Java_org_rocksdb_SstFileWriter_fileSize(JNIEnv * /*env*/, jobject /*jdb*/, jlong jdb_handle) { - auto *writer = reinterpret_cast(jdb_handle); + auto *writer = + reinterpret_cast(jdb_handle); return static_cast(writer->FileSize()); } @@ -178,13 +188,14 @@ jlong Java_org_rocksdb_SstFileWriter_fileSize(JNIEnv * /*env*/, jobject /*jdb*/, void Java_org_rocksdb_SstFileWriter_merge__JJJ(JNIEnv *env, jobject /*jobj*/, jlong jhandle, jlong jkey_handle, jlong jvalue_handle) { - auto *key_slice = reinterpret_cast(jkey_handle); - auto *value_slice = reinterpret_cast(jvalue_handle); - rocksdb::Status s = - reinterpret_cast(jhandle)->Merge(*key_slice, - *value_slice); + auto *key_slice = reinterpret_cast(jkey_handle); + auto *value_slice = + reinterpret_cast(jvalue_handle); + ROCKSDB_NAMESPACE::Status s = + reinterpret_cast(jhandle)->Merge( + *key_slice, *value_slice); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -203,8 +214,8 @@ void Java_org_rocksdb_SstFileWriter_merge__J_3B_3B(JNIEnv *env, // exception thrown: OutOfMemoryError return; } - rocksdb::Slice key_slice(reinterpret_cast(key), - env->GetArrayLength(jkey)); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + env->GetArrayLength(jkey)); jbyte *value = env->GetByteArrayElements(jval, nullptr); if (value == nullptr) { @@ -212,18 +223,18 @@ void Java_org_rocksdb_SstFileWriter_merge__J_3B_3B(JNIEnv *env, env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); return; } - rocksdb::Slice value_slice(reinterpret_cast(value), - env->GetArrayLength(jval)); + ROCKSDB_NAMESPACE::Slice value_slice(reinterpret_cast(value), + env->GetArrayLength(jval)); - rocksdb::Status s = - reinterpret_cast(jhandle)->Merge(key_slice, - value_slice); + ROCKSDB_NAMESPACE::Status s = + reinterpret_cast(jhandle)->Merge( + key_slice, value_slice); env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); env->ReleaseByteArrayElements(jval, value, JNI_ABORT); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -240,16 +251,17 @@ void Java_org_rocksdb_SstFileWriter_delete__J_3B(JNIEnv *env, jobject /*jobj*/, // exception thrown: OutOfMemoryError return; } - rocksdb::Slice key_slice(reinterpret_cast(key), - env->GetArrayLength(jkey)); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + env->GetArrayLength(jkey)); - rocksdb::Status s = - reinterpret_cast(jhandle)->Delete(key_slice); + ROCKSDB_NAMESPACE::Status s = + reinterpret_cast(jhandle)->Delete( + key_slice); env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -261,11 +273,12 @@ void Java_org_rocksdb_SstFileWriter_delete__J_3B(JNIEnv *env, jobject /*jobj*/, void Java_org_rocksdb_SstFileWriter_delete__JJ(JNIEnv *env, jobject /*jobj*/, jlong jhandle, jlong jkey_handle) { - auto *key_slice = reinterpret_cast(jkey_handle); - rocksdb::Status s = - reinterpret_cast(jhandle)->Delete(*key_slice); + auto *key_slice = reinterpret_cast(jkey_handle); + ROCKSDB_NAMESPACE::Status s = + reinterpret_cast(jhandle)->Delete( + *key_slice); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -276,10 +289,10 @@ void Java_org_rocksdb_SstFileWriter_delete__JJ(JNIEnv *env, jobject /*jobj*/, */ void Java_org_rocksdb_SstFileWriter_finish(JNIEnv *env, jobject /*jobj*/, jlong jhandle) { - rocksdb::Status s = - reinterpret_cast(jhandle)->Finish(); + ROCKSDB_NAMESPACE::Status s = + reinterpret_cast(jhandle)->Finish(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -291,5 +304,5 @@ void Java_org_rocksdb_SstFileWriter_finish(JNIEnv *env, jobject /*jobj*/, void Java_org_rocksdb_SstFileWriter_disposeInternal(JNIEnv * /*env*/, jobject /*jobj*/, jlong jhandle) { - delete reinterpret_cast(jhandle); + delete reinterpret_cast(jhandle); } diff --git a/java/rocksjni/statistics.cc b/java/rocksjni/statistics.cc index ae7ad53529..f59e79e6ce 100644 --- a/java/rocksjni/statistics.cc +++ b/java/rocksjni/statistics.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::Statistics methods from Java side. +// calling c++ ROCKSDB_NAMESPACE::Statistics methods from Java side. #include #include @@ -55,10 +55,11 @@ jlong Java_org_rocksdb_Statistics_newStatistics___3B( */ jlong Java_org_rocksdb_Statistics_newStatistics___3BJ( JNIEnv* env, jclass, jbyteArray jhistograms, jlong jother_statistics_handle) { - std::shared_ptr* pSptr_other_statistics = nullptr; + std::shared_ptr* pSptr_other_statistics = + nullptr; if (jother_statistics_handle > 0) { pSptr_other_statistics = - reinterpret_cast*>( + reinterpret_cast*>( jother_statistics_handle); } @@ -73,8 +74,8 @@ jlong Java_org_rocksdb_Statistics_newStatistics___3BJ( } for (jsize i = 0; i < len; i++) { - const rocksdb::Histograms histogram = - rocksdb::HistogramTypeJni::toCppHistograms(jhistogram[i]); + const ROCKSDB_NAMESPACE::Histograms histogram = + ROCKSDB_NAMESPACE::HistogramTypeJni::toCppHistograms(jhistogram[i]); histograms.emplace(histogram); } @@ -82,13 +83,16 @@ jlong Java_org_rocksdb_Statistics_newStatistics___3BJ( } } - std::shared_ptr sptr_other_statistics = nullptr; + std::shared_ptr sptr_other_statistics = + nullptr; if (pSptr_other_statistics != nullptr) { sptr_other_statistics = *pSptr_other_statistics; } - auto* pSptr_statistics = new std::shared_ptr( - new rocksdb::StatisticsJni(sptr_other_statistics, histograms)); + auto* pSptr_statistics = + new std::shared_ptr( + new ROCKSDB_NAMESPACE::StatisticsJni(sptr_other_statistics, + histograms)); return reinterpret_cast(pSptr_statistics); } @@ -102,7 +106,8 @@ void Java_org_rocksdb_Statistics_disposeInternal( JNIEnv*, jobject, jlong jhandle) { if (jhandle > 0) { auto* pSptr_statistics = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); delete pSptr_statistics; } } @@ -115,9 +120,10 @@ void Java_org_rocksdb_Statistics_disposeInternal( jbyte Java_org_rocksdb_Statistics_statsLevel( JNIEnv*, jobject, jlong jhandle) { auto* pSptr_statistics = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); assert(pSptr_statistics != nullptr); - return rocksdb::StatsLevelJni::toJavaStatsLevel( + return ROCKSDB_NAMESPACE::StatsLevelJni::toJavaStatsLevel( pSptr_statistics->get()->get_stats_level()); } @@ -129,9 +135,11 @@ jbyte Java_org_rocksdb_Statistics_statsLevel( void Java_org_rocksdb_Statistics_setStatsLevel( JNIEnv*, jobject, jlong jhandle, jbyte jstats_level) { auto* pSptr_statistics = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); assert(pSptr_statistics != nullptr); - auto stats_level = rocksdb::StatsLevelJni::toCppStatsLevel(jstats_level); + auto stats_level = + ROCKSDB_NAMESPACE::StatsLevelJni::toCppStatsLevel(jstats_level); pSptr_statistics->get()->set_stats_level(stats_level); } @@ -143,9 +151,10 @@ void Java_org_rocksdb_Statistics_setStatsLevel( jlong Java_org_rocksdb_Statistics_getTickerCount( JNIEnv*, jobject, jlong jhandle, jbyte jticker_type) { auto* pSptr_statistics = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); assert(pSptr_statistics != nullptr); - auto ticker = rocksdb::TickerTypeJni::toCppTickers(jticker_type); + auto ticker = ROCKSDB_NAMESPACE::TickerTypeJni::toCppTickers(jticker_type); uint64_t count = pSptr_statistics->get()->getTickerCount(ticker); return static_cast(count); } @@ -158,9 +167,10 @@ jlong Java_org_rocksdb_Statistics_getTickerCount( jlong Java_org_rocksdb_Statistics_getAndResetTickerCount( JNIEnv*, jobject, jlong jhandle, jbyte jticker_type) { auto* pSptr_statistics = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); assert(pSptr_statistics != nullptr); - auto ticker = rocksdb::TickerTypeJni::toCppTickers(jticker_type); + auto ticker = ROCKSDB_NAMESPACE::TickerTypeJni::toCppTickers(jticker_type); return pSptr_statistics->get()->getAndResetTickerCount(ticker); } @@ -172,24 +182,27 @@ jlong Java_org_rocksdb_Statistics_getAndResetTickerCount( jobject Java_org_rocksdb_Statistics_getHistogramData( JNIEnv* env, jobject, jlong jhandle, jbyte jhistogram_type) { auto* pSptr_statistics = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); assert(pSptr_statistics != nullptr); // TODO(AR) perhaps better to construct a Java Object Wrapper that // uses ptr to C++ `new HistogramData` - rocksdb::HistogramData data; + ROCKSDB_NAMESPACE::HistogramData data; - auto histogram = rocksdb::HistogramTypeJni::toCppHistograms(jhistogram_type); + auto histogram = + ROCKSDB_NAMESPACE::HistogramTypeJni::toCppHistograms(jhistogram_type); pSptr_statistics->get()->histogramData( - static_cast(histogram), &data); + static_cast(histogram), &data); - jclass jclazz = rocksdb::HistogramDataJni::getJClass(env); + jclass jclazz = ROCKSDB_NAMESPACE::HistogramDataJni::getJClass(env); if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - jmethodID mid = rocksdb::HistogramDataJni::getConstructorMethodId(env); + jmethodID mid = + ROCKSDB_NAMESPACE::HistogramDataJni::getConstructorMethodId(env); if (mid == nullptr) { // exception occurred accessing method return nullptr; @@ -209,9 +222,11 @@ jobject Java_org_rocksdb_Statistics_getHistogramData( jstring Java_org_rocksdb_Statistics_getHistogramString( JNIEnv* env, jobject, jlong jhandle, jbyte jhistogram_type) { auto* pSptr_statistics = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); assert(pSptr_statistics != nullptr); - auto histogram = rocksdb::HistogramTypeJni::toCppHistograms(jhistogram_type); + auto histogram = + ROCKSDB_NAMESPACE::HistogramTypeJni::toCppHistograms(jhistogram_type); auto str = pSptr_statistics->get()->getHistogramString(histogram); return env->NewStringUTF(str.c_str()); } @@ -224,11 +239,12 @@ jstring Java_org_rocksdb_Statistics_getHistogramString( void Java_org_rocksdb_Statistics_reset( JNIEnv* env, jobject, jlong jhandle) { auto* pSptr_statistics = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); assert(pSptr_statistics != nullptr); - rocksdb::Status s = pSptr_statistics->get()->Reset(); + ROCKSDB_NAMESPACE::Status s = pSptr_statistics->get()->Reset(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -240,7 +256,8 @@ void Java_org_rocksdb_Statistics_reset( jstring Java_org_rocksdb_Statistics_toString( JNIEnv* env, jobject, jlong jhandle) { auto* pSptr_statistics = - reinterpret_cast*>(jhandle); + reinterpret_cast*>( + jhandle); assert(pSptr_statistics != nullptr); auto str = pSptr_statistics->get()->ToString(); return env->NewStringUTF(str.c_str()); diff --git a/java/rocksjni/statisticsjni.cc b/java/rocksjni/statisticsjni.cc index f59ace4dfc..afb9d6cfff 100644 --- a/java/rocksjni/statisticsjni.cc +++ b/java/rocksjni/statisticsjni.cc @@ -4,11 +4,11 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::Statistics +// ROCKSDB_NAMESPACE::Statistics #include "rocksjni/statisticsjni.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { StatisticsJni::StatisticsJni(std::shared_ptr stats) : StatisticsImpl(stats), m_ignore_histograms() {} @@ -29,4 +29,4 @@ bool StatisticsJni::HistEnabledForType(uint32_t type) const { return true; } // @lint-ignore TXT4 T25377293 Grandfathered in -}; \ No newline at end of file +}; // namespace ROCKSDB_NAMESPACE \ No newline at end of file diff --git a/java/rocksjni/statisticsjni.h b/java/rocksjni/statisticsjni.h index 56186789a9..51e2791433 100644 --- a/java/rocksjni/statisticsjni.h +++ b/java/rocksjni/statisticsjni.h @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::Statistics +// ROCKSDB_NAMESPACE::Statistics #ifndef JAVA_ROCKSJNI_STATISTICSJNI_H_ #define JAVA_ROCKSJNI_STATISTICSJNI_H_ @@ -15,20 +15,20 @@ #include "rocksdb/statistics.h" #include "monitoring/statistics.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { - class StatisticsJni : public StatisticsImpl { - public: - StatisticsJni(std::shared_ptr stats); - StatisticsJni(std::shared_ptr stats, - const std::set ignore_histograms); - virtual bool HistEnabledForType(uint32_t type) const override; +class StatisticsJni : public StatisticsImpl { + public: + StatisticsJni(std::shared_ptr stats); + StatisticsJni(std::shared_ptr stats, + const std::set ignore_histograms); + virtual bool HistEnabledForType(uint32_t type) const override; - private: - const std::set m_ignore_histograms; + private: + const std::set m_ignore_histograms; }; -} // namespace rocksdb + } // namespace ROCKSDB_NAMESPACE // @lint-ignore TXT4 T25377293 Grandfathered in #endif // JAVA_ROCKSJNI_STATISTICSJNI_H_ \ No newline at end of file diff --git a/java/rocksjni/table.cc b/java/rocksjni/table.cc index a4504d917a..9e3f4b6637 100644 --- a/java/rocksjni/table.cc +++ b/java/rocksjni/table.cc @@ -3,7 +3,8 @@ // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). // -// This file implements the "bridge" between Java and C++ for rocksdb::Options. +// This file implements the "bridge" between Java and C++ for +// ROCKSDB_NAMESPACE::Options. #include "rocksdb/table.h" #include @@ -23,16 +24,19 @@ jlong Java_org_rocksdb_PlainTableConfig_newTableFactoryHandle( jint jbloom_bits_per_key, jdouble jhash_table_ratio, jint jindex_sparseness, jint jhuge_page_tlb_size, jbyte jencoding_type, jboolean jfull_scan_mode, jboolean jstore_index_in_file) { - rocksdb::PlainTableOptions options = rocksdb::PlainTableOptions(); + ROCKSDB_NAMESPACE::PlainTableOptions options = + ROCKSDB_NAMESPACE::PlainTableOptions(); options.user_key_len = jkey_size; options.bloom_bits_per_key = jbloom_bits_per_key; options.hash_table_ratio = jhash_table_ratio; options.index_sparseness = jindex_sparseness; options.huge_page_tlb_size = jhuge_page_tlb_size; - options.encoding_type = static_cast(jencoding_type); + options.encoding_type = + static_cast(jencoding_type); options.full_scan_mode = jfull_scan_mode; options.store_index_in_file = jstore_index_in_file; - return reinterpret_cast(rocksdb::NewPlainTableFactory(options)); + return reinterpret_cast( + ROCKSDB_NAMESPACE::NewPlainTableFactory(options)); } /* @@ -59,7 +63,7 @@ jlong Java_org_rocksdb_BlockBasedTableConfig_newTableFactoryHandle( jboolean jblock_align, jlong jblock_cache_size, jint jblock_cache_num_shard_bits, jlong jblock_cache_compressed_size, jint jblock_cache_compressed_num_shard_bits) { - rocksdb::BlockBasedTableOptions options; + ROCKSDB_NAMESPACE::BlockBasedTableOptions options; options.cache_index_and_filter_blocks = static_cast(jcache_index_and_filter_blocks); options.cache_index_and_filter_blocks_with_high_priority = @@ -69,29 +73,30 @@ jlong Java_org_rocksdb_BlockBasedTableConfig_newTableFactoryHandle( options.pin_top_level_index_and_filter = static_cast(jpin_top_level_index_and_filter); options.index_type = - rocksdb::IndexTypeJni::toCppIndexType(jindex_type_value); + ROCKSDB_NAMESPACE::IndexTypeJni::toCppIndexType(jindex_type_value); options.data_block_index_type = - rocksdb::DataBlockIndexTypeJni::toCppDataBlockIndexType( + ROCKSDB_NAMESPACE::DataBlockIndexTypeJni::toCppDataBlockIndexType( jdata_block_index_type_value); options.data_block_hash_table_util_ratio = static_cast(jdata_block_hash_table_util_ratio); - options.checksum = - rocksdb::ChecksumTypeJni::toCppChecksumType(jchecksum_type_value); + options.checksum = ROCKSDB_NAMESPACE::ChecksumTypeJni::toCppChecksumType( + jchecksum_type_value); options.no_block_cache = static_cast(jno_block_cache); if (options.no_block_cache) { options.block_cache = nullptr; } else { if (jblock_cache_handle > 0) { - std::shared_ptr *pCache = - reinterpret_cast *>(jblock_cache_handle); + std::shared_ptr *pCache = + reinterpret_cast *>( + jblock_cache_handle); options.block_cache = *pCache; } else if (jblock_cache_size >= 0) { if (jblock_cache_num_shard_bits > 0) { - options.block_cache = rocksdb::NewLRUCache( + options.block_cache = ROCKSDB_NAMESPACE::NewLRUCache( static_cast(jblock_cache_size), static_cast(jblock_cache_num_shard_bits)); } else { - options.block_cache = rocksdb::NewLRUCache( + options.block_cache = ROCKSDB_NAMESPACE::NewLRUCache( static_cast(jblock_cache_size)); } } else { @@ -100,21 +105,23 @@ jlong Java_org_rocksdb_BlockBasedTableConfig_newTableFactoryHandle( } } if (jpersistent_cache_handle > 0) { - std::shared_ptr *pCache = - reinterpret_cast *>(jpersistent_cache_handle); - options.persistent_cache = *pCache; + std::shared_ptr *pCache = + reinterpret_cast *>( + jpersistent_cache_handle); + options.persistent_cache = *pCache; } if (jblock_cache_compressed_handle > 0) { - std::shared_ptr *pCache = - reinterpret_cast *>(jblock_cache_compressed_handle); - options.block_cache_compressed = *pCache; + std::shared_ptr *pCache = + reinterpret_cast *>( + jblock_cache_compressed_handle); + options.block_cache_compressed = *pCache; } else if (jblock_cache_compressed_size > 0) { if (jblock_cache_compressed_num_shard_bits > 0) { - options.block_cache_compressed = rocksdb::NewLRUCache( + options.block_cache_compressed = ROCKSDB_NAMESPACE::NewLRUCache( static_cast(jblock_cache_compressed_size), static_cast(jblock_cache_compressed_num_shard_bits)); } else { - options.block_cache_compressed = rocksdb::NewLRUCache( + options.block_cache_compressed = ROCKSDB_NAMESPACE::NewLRUCache( static_cast(jblock_cache_compressed_size)); } } @@ -126,8 +133,8 @@ jlong Java_org_rocksdb_BlockBasedTableConfig_newTableFactoryHandle( options.partition_filters = static_cast(jpartition_filters); options.use_delta_encoding = static_cast(juse_delta_encoding); if (jfilter_policy_handle > 0) { - std::shared_ptr *pFilterPolicy = - reinterpret_cast *>( + std::shared_ptr *pFilterPolicy = + reinterpret_cast *>( jfilter_policy_handle); options.filter_policy = *pFilterPolicy; } @@ -138,5 +145,6 @@ jlong Java_org_rocksdb_BlockBasedTableConfig_newTableFactoryHandle( options.enable_index_compression = static_cast(jenable_index_compression); options.block_align = static_cast(jblock_align); - return reinterpret_cast(rocksdb::NewBlockBasedTableFactory(options)); + return reinterpret_cast( + ROCKSDB_NAMESPACE::NewBlockBasedTableFactory(options)); } diff --git a/java/rocksjni/table_filter.cc b/java/rocksjni/table_filter.cc index e5b3556213..a9024ce88f 100644 --- a/java/rocksjni/table_filter.cc +++ b/java/rocksjni/table_filter.cc @@ -20,6 +20,6 @@ jlong Java_org_rocksdb_AbstractTableFilter_createNewTableFilter( JNIEnv* env, jobject jtable_filter) { auto* table_filter_jnicallback = - new rocksdb::TableFilterJniCallback(env, jtable_filter); + new ROCKSDB_NAMESPACE::TableFilterJniCallback(env, jtable_filter); return reinterpret_cast(table_filter_jnicallback); -} \ No newline at end of file +} diff --git a/java/rocksjni/table_filter_jnicallback.cc b/java/rocksjni/table_filter_jnicallback.cc index 680c014459..d1699548d0 100644 --- a/java/rocksjni/table_filter_jnicallback.cc +++ b/java/rocksjni/table_filter_jnicallback.cc @@ -4,12 +4,12 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::TableFilter. +// ROCKSDB_NAMESPACE::TableFilter. #include "rocksjni/table_filter_jnicallback.h" #include "rocksjni/portal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { TableFilterJniCallback::TableFilterJniCallback( JNIEnv* env, jobject jtable_filter) : JniCallback(env, jtable_filter) { @@ -26,37 +26,41 @@ TableFilterJniCallback::TableFilterJniCallback( on each call to the function itself as it may be called from multiple threads */ - m_table_filter_function = [this](const rocksdb::TableProperties& table_properties) { - jboolean attached_thread = JNI_FALSE; - JNIEnv* thread_env = getJniEnv(&attached_thread); - assert(thread_env != nullptr); + m_table_filter_function = + [this](const ROCKSDB_NAMESPACE::TableProperties& table_properties) { + jboolean attached_thread = JNI_FALSE; + JNIEnv* thread_env = getJniEnv(&attached_thread); + assert(thread_env != nullptr); - // create a Java TableProperties object - jobject jtable_properties = TablePropertiesJni::fromCppTableProperties(thread_env, table_properties); - if (jtable_properties == nullptr) { - // exception thrown from fromCppTableProperties - thread_env->ExceptionDescribe(); // print out exception to stderr - releaseJniEnv(attached_thread); - return false; - } + // create a Java TableProperties object + jobject jtable_properties = TablePropertiesJni::fromCppTableProperties( + thread_env, table_properties); + if (jtable_properties == nullptr) { + // exception thrown from fromCppTableProperties + thread_env->ExceptionDescribe(); // print out exception to stderr + releaseJniEnv(attached_thread); + return false; + } - jboolean result = thread_env->CallBooleanMethod(m_jcallback_obj, m_jfilter_methodid, jtable_properties); - if (thread_env->ExceptionCheck()) { - // exception thrown from CallBooleanMethod - thread_env->DeleteLocalRef(jtable_properties); - thread_env->ExceptionDescribe(); // print out exception to stderr - releaseJniEnv(attached_thread); - return false; - } + jboolean result = thread_env->CallBooleanMethod( + m_jcallback_obj, m_jfilter_methodid, jtable_properties); + if (thread_env->ExceptionCheck()) { + // exception thrown from CallBooleanMethod + thread_env->DeleteLocalRef(jtable_properties); + thread_env->ExceptionDescribe(); // print out exception to stderr + releaseJniEnv(attached_thread); + return false; + } - // ok... cleanup and then return - releaseJniEnv(attached_thread); - return static_cast(result); - }; + // ok... cleanup and then return + releaseJniEnv(attached_thread); + return static_cast(result); + }; } -std::function TableFilterJniCallback::GetTableFilterFunction() { +std::function +TableFilterJniCallback::GetTableFilterFunction() { return m_table_filter_function; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/table_filter_jnicallback.h b/java/rocksjni/table_filter_jnicallback.h index 39a0c90e0e..b5804737ae 100644 --- a/java/rocksjni/table_filter_jnicallback.h +++ b/java/rocksjni/table_filter_jnicallback.h @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::TableFilter. +// ROCKSDB_NAMESPACE::TableFilter. #ifndef JAVA_ROCKSJNI_TABLE_FILTER_JNICALLBACK_H_ #define JAVA_ROCKSJNI_TABLE_FILTER_JNICALLBACK_H_ @@ -16,19 +16,21 @@ #include "rocksdb/table_properties.h" #include "rocksjni/jnicallback.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TableFilterJniCallback : public JniCallback { public: TableFilterJniCallback( JNIEnv* env, jobject jtable_filter); - std::function GetTableFilterFunction(); + std::function + GetTableFilterFunction(); - private: + private: jmethodID m_jfilter_methodid; - std::function m_table_filter_function; + std::function + m_table_filter_function; }; -} //namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_TABLE_FILTER_JNICALLBACK_H_ diff --git a/java/rocksjni/thread_status.cc b/java/rocksjni/thread_status.cc index f70d515a5b..a5811ec177 100644 --- a/java/rocksjni/thread_status.cc +++ b/java/rocksjni/thread_status.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::ThreadStatus methods from Java side. +// calling c++ ROCKSDB_NAMESPACE::ThreadStatus methods from Java side. #include @@ -19,9 +19,9 @@ */ jstring Java_org_rocksdb_ThreadStatus_getThreadTypeName( JNIEnv* env, jclass, jbyte jthread_type_value) { - auto name = rocksdb::ThreadStatus::GetThreadTypeName( - rocksdb::ThreadTypeJni::toCppThreadType(jthread_type_value)); - return rocksdb::JniUtil::toJavaString(env, &name, true); + auto name = ROCKSDB_NAMESPACE::ThreadStatus::GetThreadTypeName( + ROCKSDB_NAMESPACE::ThreadTypeJni::toCppThreadType(jthread_type_value)); + return ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &name, true); } /* @@ -31,9 +31,10 @@ jstring Java_org_rocksdb_ThreadStatus_getThreadTypeName( */ jstring Java_org_rocksdb_ThreadStatus_getOperationName( JNIEnv* env, jclass, jbyte joperation_type_value) { - auto name = rocksdb::ThreadStatus::GetOperationName( - rocksdb::OperationTypeJni::toCppOperationType(joperation_type_value)); - return rocksdb::JniUtil::toJavaString(env, &name, true); + auto name = ROCKSDB_NAMESPACE::ThreadStatus::GetOperationName( + ROCKSDB_NAMESPACE::OperationTypeJni::toCppOperationType( + joperation_type_value)); + return ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &name, true); } /* @@ -43,9 +44,9 @@ jstring Java_org_rocksdb_ThreadStatus_getOperationName( */ jstring Java_org_rocksdb_ThreadStatus_microsToStringNative( JNIEnv* env, jclass, jlong jmicros) { - auto str = - rocksdb::ThreadStatus::MicrosToString(static_cast(jmicros)); - return rocksdb::JniUtil::toJavaString(env, &str, true); + auto str = ROCKSDB_NAMESPACE::ThreadStatus::MicrosToString( + static_cast(jmicros)); + return ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &str, true); } /* @@ -55,9 +56,10 @@ jstring Java_org_rocksdb_ThreadStatus_microsToStringNative( */ jstring Java_org_rocksdb_ThreadStatus_getOperationStageName( JNIEnv* env, jclass, jbyte joperation_stage_value) { - auto name = rocksdb::ThreadStatus::GetOperationStageName( - rocksdb::OperationStageJni::toCppOperationStage(joperation_stage_value)); - return rocksdb::JniUtil::toJavaString(env, &name, true); + auto name = ROCKSDB_NAMESPACE::ThreadStatus::GetOperationStageName( + ROCKSDB_NAMESPACE::OperationStageJni::toCppOperationStage( + joperation_stage_value)); + return ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &name, true); } /* @@ -67,10 +69,11 @@ jstring Java_org_rocksdb_ThreadStatus_getOperationStageName( */ jstring Java_org_rocksdb_ThreadStatus_getOperationPropertyName( JNIEnv* env, jclass, jbyte joperation_type_value, jint jindex) { - auto name = rocksdb::ThreadStatus::GetOperationPropertyName( - rocksdb::OperationTypeJni::toCppOperationType(joperation_type_value), + auto name = ROCKSDB_NAMESPACE::ThreadStatus::GetOperationPropertyName( + ROCKSDB_NAMESPACE::OperationTypeJni::toCppOperationType( + joperation_type_value), static_cast(jindex)); - return rocksdb::JniUtil::toJavaString(env, &name, true); + return ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &name, true); } /* @@ -96,10 +99,11 @@ jobject Java_org_rocksdb_ThreadStatus_interpretOperationProperties( env->ReleaseLongArrayElements(joperation_properties, jop, JNI_ABORT); // call the function - auto result = rocksdb::ThreadStatus::InterpretOperationProperties( - rocksdb::OperationTypeJni::toCppOperationType(joperation_type_value), + auto result = ROCKSDB_NAMESPACE::ThreadStatus::InterpretOperationProperties( + ROCKSDB_NAMESPACE::OperationTypeJni::toCppOperationType( + joperation_type_value), op_properties.get()); - jobject jresult = rocksdb::HashMapJni::fromCppMap(env, &result); + jobject jresult = ROCKSDB_NAMESPACE::HashMapJni::fromCppMap(env, &result); if (env->ExceptionCheck()) { // exception occurred return nullptr; @@ -115,7 +119,7 @@ jobject Java_org_rocksdb_ThreadStatus_interpretOperationProperties( */ jstring Java_org_rocksdb_ThreadStatus_getStateName( JNIEnv* env, jclass, jbyte jstate_type_value) { - auto name = rocksdb::ThreadStatus::GetStateName( - rocksdb::StateTypeJni::toCppStateType(jstate_type_value)); - return rocksdb::JniUtil::toJavaString(env, &name, true); -} \ No newline at end of file + auto name = ROCKSDB_NAMESPACE::ThreadStatus::GetStateName( + ROCKSDB_NAMESPACE::StateTypeJni::toCppStateType(jstate_type_value)); + return ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &name, true); +} diff --git a/java/rocksjni/trace_writer.cc b/java/rocksjni/trace_writer.cc index 5d47cfcb3a..3beafd45e0 100644 --- a/java/rocksjni/trace_writer.cc +++ b/java/rocksjni/trace_writer.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::CompactionFilterFactory. +// ROCKSDB_NAMESPACE::CompactionFilterFactory. #include @@ -18,6 +18,6 @@ */ jlong Java_org_rocksdb_AbstractTraceWriter_createNewTraceWriter( JNIEnv* env, jobject jobj) { - auto* trace_writer = new rocksdb::TraceWriterJniCallback(env, jobj); + auto* trace_writer = new ROCKSDB_NAMESPACE::TraceWriterJniCallback(env, jobj); return reinterpret_cast(trace_writer); } diff --git a/java/rocksjni/trace_writer_jnicallback.cc b/java/rocksjni/trace_writer_jnicallback.cc index d547fb3f87..b6566d335b 100644 --- a/java/rocksjni/trace_writer_jnicallback.cc +++ b/java/rocksjni/trace_writer_jnicallback.cc @@ -4,12 +4,12 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::TraceWriter. +// ROCKSDB_NAMESPACE::TraceWriter. #include "rocksjni/trace_writer_jnicallback.h" #include "rocksjni/portal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { TraceWriterJniCallback::TraceWriterJniCallback( JNIEnv* env, jobject jtrace_writer) : JniCallback(env, jtrace_writer) { @@ -112,4 +112,4 @@ uint64_t TraceWriterJniCallback::GetFileSize() { return static_cast(jfile_size); } -} // namespace rocksdb \ No newline at end of file +} // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/trace_writer_jnicallback.h b/java/rocksjni/trace_writer_jnicallback.h index 610b6c465f..eb2a8b0f80 100644 --- a/java/rocksjni/trace_writer_jnicallback.h +++ b/java/rocksjni/trace_writer_jnicallback.h @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::TraceWriter. +// ROCKSDB_NAMESPACE::TraceWriter. #ifndef JAVA_ROCKSJNI_TRACE_WRITER_JNICALLBACK_H_ #define JAVA_ROCKSJNI_TRACE_WRITER_JNICALLBACK_H_ @@ -15,7 +15,7 @@ #include "rocksdb/trace_reader_writer.h" #include "rocksjni/jnicallback.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TraceWriterJniCallback : public JniCallback, public TraceWriter { public: @@ -31,6 +31,6 @@ class TraceWriterJniCallback : public JniCallback, public TraceWriter { jmethodID m_jget_file_size_methodid; }; -} //namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_TRACE_WRITER_JNICALLBACK_H_ diff --git a/java/rocksjni/transaction.cc b/java/rocksjni/transaction.cc index 04eb654df7..ae98b868c3 100644 --- a/java/rocksjni/transaction.cc +++ b/java/rocksjni/transaction.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ -// for rocksdb::Transaction. +// for ROCKSDB_NAMESPACE::Transaction. #include #include @@ -29,7 +29,7 @@ using namespace std::placeholders; */ void Java_org_rocksdb_Transaction_setSnapshot(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); txn->SetSnapshot(); } @@ -40,7 +40,7 @@ void Java_org_rocksdb_Transaction_setSnapshot(JNIEnv* /*env*/, jobject /*jobj*/, */ void Java_org_rocksdb_Transaction_setSnapshotOnNextOperation__J( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); txn->SetSnapshotOnNextOperation(nullptr); } @@ -52,10 +52,10 @@ void Java_org_rocksdb_Transaction_setSnapshotOnNextOperation__J( void Java_org_rocksdb_Transaction_setSnapshotOnNextOperation__JJ( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jtxn_notifier_handle) { - auto* txn = reinterpret_cast(jhandle); - auto* txn_notifier = - reinterpret_cast*>( - jtxn_notifier_handle); + auto* txn = reinterpret_cast(jhandle); + auto* txn_notifier = reinterpret_cast< + std::shared_ptr*>( + jtxn_notifier_handle); txn->SetSnapshotOnNextOperation(*txn_notifier); } @@ -67,8 +67,8 @@ void Java_org_rocksdb_Transaction_setSnapshotOnNextOperation__JJ( jlong Java_org_rocksdb_Transaction_getSnapshot(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); - const rocksdb::Snapshot* snapshot = txn->GetSnapshot(); + auto* txn = reinterpret_cast(jhandle); + const ROCKSDB_NAMESPACE::Snapshot* snapshot = txn->GetSnapshot(); return reinterpret_cast(snapshot); } @@ -80,7 +80,7 @@ jlong Java_org_rocksdb_Transaction_getSnapshot(JNIEnv* /*env*/, void Java_org_rocksdb_Transaction_clearSnapshot(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); txn->ClearSnapshot(); } @@ -91,10 +91,10 @@ void Java_org_rocksdb_Transaction_clearSnapshot(JNIEnv* /*env*/, */ void Java_org_rocksdb_Transaction_prepare(JNIEnv* env, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); - rocksdb::Status s = txn->Prepare(); + auto* txn = reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::Status s = txn->Prepare(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -105,10 +105,10 @@ void Java_org_rocksdb_Transaction_prepare(JNIEnv* env, jobject /*jobj*/, */ void Java_org_rocksdb_Transaction_commit(JNIEnv* env, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); - rocksdb::Status s = txn->Commit(); + auto* txn = reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::Status s = txn->Commit(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -119,10 +119,10 @@ void Java_org_rocksdb_Transaction_commit(JNIEnv* env, jobject /*jobj*/, */ void Java_org_rocksdb_Transaction_rollback(JNIEnv* env, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); - rocksdb::Status s = txn->Rollback(); + auto* txn = reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::Status s = txn->Rollback(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -134,7 +134,7 @@ void Java_org_rocksdb_Transaction_rollback(JNIEnv* env, jobject /*jobj*/, void Java_org_rocksdb_Transaction_setSavePoint(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); txn->SetSavePoint(); } @@ -146,15 +146,16 @@ void Java_org_rocksdb_Transaction_setSavePoint(JNIEnv* /*env*/, void Java_org_rocksdb_Transaction_rollbackToSavePoint(JNIEnv* env, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); - rocksdb::Status s = txn->RollbackToSavePoint(); + auto* txn = reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::Status s = txn->RollbackToSavePoint(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } -typedef std::function +typedef std::function FnGet; // TODO(AR) consider refactoring to share this between here and rocksjni.cc @@ -166,12 +167,13 @@ jbyteArray txn_get_helper(JNIEnv* env, const FnGet& fn_get, // exception thrown: OutOfMemoryError return nullptr; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_part_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + jkey_part_len); auto* read_options = - reinterpret_cast(jread_options_handle); + reinterpret_cast(jread_options_handle); std::string value; - rocksdb::Status s = fn_get(*read_options, key_slice, &value); + ROCKSDB_NAMESPACE::Status s = fn_get(*read_options, key_slice, &value); // trigger java unref on key. // by passing JNI_ABORT, it will simply release the reference without @@ -197,7 +199,7 @@ jbyteArray txn_get_helper(JNIEnv* env, const FnGet& fn_get, return jret_value; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } @@ -209,13 +211,17 @@ jbyteArray txn_get_helper(JNIEnv* env, const FnGet& fn_get, jbyteArray Java_org_rocksdb_Transaction_get__JJ_3BIJ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jlong jread_options_handle, jbyteArray jkey, jint jkey_part_len, jlong jcolumn_family_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); - FnGet fn_get = std::bind(&rocksdb::Transaction::Get, txn, _1, - column_family_handle, _2, _3); + reinterpret_cast( + jcolumn_family_handle); + FnGet fn_get = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::Get, txn, _1, column_family_handle, + _2, _3); return txn_get_helper(env, fn_get, jread_options_handle, jkey, jkey_part_len); } @@ -227,36 +233,38 @@ jbyteArray Java_org_rocksdb_Transaction_get__JJ_3BIJ( jbyteArray Java_org_rocksdb_Transaction_get__JJ_3BI( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jlong jread_options_handle, jbyteArray jkey, jint jkey_part_len) { - auto* txn = reinterpret_cast(jhandle); - FnGet fn_get = std::bind( - &rocksdb::Transaction::Get, txn, _1, _2, _3); + auto* txn = reinterpret_cast(jhandle); + FnGet fn_get = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::Get, txn, _1, _2, _3); return txn_get_helper(env, fn_get, jread_options_handle, jkey, jkey_part_len); } // TODO(AR) consider refactoring to share this between here and rocksjni.cc // used by txn_multi_get_helper below -std::vector txn_column_families_helper( +std::vector txn_column_families_helper( JNIEnv* env, jlongArray jcolumn_family_handles, bool* has_exception) { - std::vector cf_handles; + std::vector cf_handles; if (jcolumn_family_handles != nullptr) { const jsize len_cols = env->GetArrayLength(jcolumn_family_handles); if (len_cols > 0) { if (env->EnsureLocalCapacity(len_cols) != 0) { // out of memory *has_exception = JNI_TRUE; - return std::vector(); + return std::vector(); } jlong* jcfh = env->GetLongArrayElements(jcolumn_family_handles, nullptr); if (jcfh == nullptr) { // exception thrown: OutOfMemoryError *has_exception = JNI_TRUE; - return std::vector(); + return std::vector(); } for (int i = 0; i < len_cols; i++) { auto* cf_handle = - reinterpret_cast(jcfh[i]); + reinterpret_cast(jcfh[i]); cf_handles.push_back(cf_handle); } env->ReleaseLongArrayElements(jcolumn_family_handles, jcfh, JNI_ABORT); @@ -265,9 +273,9 @@ std::vector txn_column_families_helper( return cf_handles; } -typedef std::function( - const rocksdb::ReadOptions&, const std::vector&, - std::vector*)> +typedef std::function( + const ROCKSDB_NAMESPACE::ReadOptions&, + const std::vector&, std::vector*)> FnMultiGet; void free_parts( @@ -294,7 +302,7 @@ jobjectArray txn_multi_get_helper(JNIEnv* env, const FnMultiGet& fn_multi_get, return nullptr; } - std::vector key_parts; + std::vector key_parts; std::vector> key_parts_to_free; for (int i = 0; i < len_key_parts; i++) { const jobject jk = env->GetObjectArrayElement(jkey_parts, i); @@ -319,16 +327,17 @@ jobjectArray txn_multi_get_helper(JNIEnv* env, const FnMultiGet& fn_multi_get, return nullptr; } - rocksdb::Slice key_slice(reinterpret_cast(jk_val), len_key); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(jk_val), + len_key); key_parts.push_back(key_slice); key_parts_to_free.push_back(std::make_tuple(jk_ba, jk_val, jk)); } auto* read_options = - reinterpret_cast(jread_options_handle); + reinterpret_cast(jread_options_handle); std::vector value_parts; - std::vector s = + std::vector s = fn_multi_get(*read_options, key_parts, &value_parts); // free up allocated byte arrays @@ -344,7 +353,8 @@ jobjectArray txn_multi_get_helper(JNIEnv* env, const FnMultiGet& fn_multi_get, } // add to the jresults - for (std::vector::size_type i = 0; i != s.size(); i++) { + for (std::vector::size_type i = 0; i != s.size(); + i++) { if (s[i].ok()) { jbyteArray jentry_value = env->NewByteArray(static_cast(value_parts[i].size())); @@ -379,20 +389,21 @@ jobjectArray Java_org_rocksdb_Transaction_multiGet__JJ_3_3B_3J( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jlong jread_options_handle, jobjectArray jkey_parts, jlongArray jcolumn_family_handles) { bool has_exception = false; - const std::vector column_family_handles = - txn_column_families_helper(env, jcolumn_family_handles, &has_exception); + const std::vector + column_family_handles = txn_column_families_helper( + env, jcolumn_family_handles, &has_exception); if (has_exception) { // exception thrown: OutOfMemoryError return nullptr; } - auto* txn = reinterpret_cast(jhandle); - FnMultiGet fn_multi_get = - std::bind (rocksdb::Transaction::*)( - const rocksdb::ReadOptions&, - const std::vector&, - const std::vector&, std::vector*)>( - &rocksdb::Transaction::MultiGet, txn, _1, column_family_handles, _2, - _3); + auto* txn = reinterpret_cast(jhandle); + FnMultiGet fn_multi_get = std::bind ( + ROCKSDB_NAMESPACE::Transaction::*)( + const ROCKSDB_NAMESPACE::ReadOptions&, + const std::vector&, + const std::vector&, std::vector*)>( + &ROCKSDB_NAMESPACE::Transaction::MultiGet, txn, _1, column_family_handles, + _2, _3); return txn_multi_get_helper(env, fn_multi_get, jread_options_handle, jkey_parts); } @@ -405,12 +416,12 @@ jobjectArray Java_org_rocksdb_Transaction_multiGet__JJ_3_3B_3J( jobjectArray Java_org_rocksdb_Transaction_multiGet__JJ_3_3B( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jlong jread_options_handle, jobjectArray jkey_parts) { - auto* txn = reinterpret_cast(jhandle); - FnMultiGet fn_multi_get = - std::bind (rocksdb::Transaction::*)( - const rocksdb::ReadOptions&, const std::vector&, - std::vector*)>(&rocksdb::Transaction::MultiGet, txn, _1, - _2, _3); + auto* txn = reinterpret_cast(jhandle); + FnMultiGet fn_multi_get = std::bind ( + ROCKSDB_NAMESPACE::Transaction::*)( + const ROCKSDB_NAMESPACE::ReadOptions&, + const std::vector&, std::vector*)>( + &ROCKSDB_NAMESPACE::Transaction::MultiGet, txn, _1, _2, _3); return txn_multi_get_helper(env, fn_multi_get, jread_options_handle, jkey_parts); } @@ -425,13 +436,16 @@ jbyteArray Java_org_rocksdb_Transaction_getForUpdate__JJ_3BIJZZ( jbyteArray jkey, jint jkey_part_len, jlong jcolumn_family_handle, jboolean jexclusive, jboolean jdo_validate) { auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); - auto* txn = reinterpret_cast(jhandle); - FnGet fn_get_for_update = std::bind( - &rocksdb::Transaction::GetForUpdate, txn, _1, column_family_handle, _2, - _3, jexclusive, jdo_validate); + reinterpret_cast( + jcolumn_family_handle); + auto* txn = reinterpret_cast(jhandle); + FnGet fn_get_for_update = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::GetForUpdate, txn, _1, + column_family_handle, _2, _3, jexclusive, jdo_validate); return txn_get_helper(env, fn_get_for_update, jread_options_handle, jkey, jkey_part_len); } @@ -445,11 +459,13 @@ jbyteArray Java_org_rocksdb_Transaction_getForUpdate__JJ_3BIZZ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jlong jread_options_handle, jbyteArray jkey, jint jkey_part_len, jboolean jexclusive, jboolean jdo_validate) { - auto* txn = reinterpret_cast(jhandle); - FnGet fn_get_for_update = std::bind(&rocksdb::Transaction::GetForUpdate, txn, _1, _2, _3, jexclusive, - jdo_validate); + auto* txn = reinterpret_cast(jhandle); + FnGet fn_get_for_update = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::GetForUpdate, txn, _1, _2, _3, + jexclusive, jdo_validate); return txn_get_helper(env, fn_get_for_update, jread_options_handle, jkey, jkey_part_len); } @@ -463,20 +479,21 @@ jobjectArray Java_org_rocksdb_Transaction_multiGetForUpdate__JJ_3_3B_3J( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jlong jread_options_handle, jobjectArray jkey_parts, jlongArray jcolumn_family_handles) { bool has_exception = false; - const std::vector column_family_handles = - txn_column_families_helper(env, jcolumn_family_handles, &has_exception); + const std::vector + column_family_handles = txn_column_families_helper( + env, jcolumn_family_handles, &has_exception); if (has_exception) { // exception thrown: OutOfMemoryError return nullptr; } - auto* txn = reinterpret_cast(jhandle); - FnMultiGet fn_multi_get_for_update = - std::bind (rocksdb::Transaction::*)( - const rocksdb::ReadOptions&, - const std::vector&, - const std::vector&, std::vector*)>( - &rocksdb::Transaction::MultiGetForUpdate, txn, _1, - column_family_handles, _2, _3); + auto* txn = reinterpret_cast(jhandle); + FnMultiGet fn_multi_get_for_update = std::bind (ROCKSDB_NAMESPACE::Transaction::*)( + const ROCKSDB_NAMESPACE::ReadOptions&, + const std::vector&, + const std::vector&, std::vector*)>( + &ROCKSDB_NAMESPACE::Transaction::MultiGetForUpdate, txn, _1, + column_family_handles, _2, _3); return txn_multi_get_helper(env, fn_multi_get_for_update, jread_options_handle, jkey_parts); } @@ -489,12 +506,12 @@ jobjectArray Java_org_rocksdb_Transaction_multiGetForUpdate__JJ_3_3B_3J( jobjectArray Java_org_rocksdb_Transaction_multiGetForUpdate__JJ_3_3B( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jlong jread_options_handle, jobjectArray jkey_parts) { - auto* txn = reinterpret_cast(jhandle); - FnMultiGet fn_multi_get_for_update = - std::bind (rocksdb::Transaction::*)( - const rocksdb::ReadOptions&, const std::vector&, - std::vector*)>(&rocksdb::Transaction::MultiGetForUpdate, - txn, _1, _2, _3); + auto* txn = reinterpret_cast(jhandle); + FnMultiGet fn_multi_get_for_update = std::bind (ROCKSDB_NAMESPACE::Transaction::*)( + const ROCKSDB_NAMESPACE::ReadOptions&, + const std::vector&, std::vector*)>( + &ROCKSDB_NAMESPACE::Transaction::MultiGetForUpdate, txn, _1, _2, _3); return txn_multi_get_helper(env, fn_multi_get_for_update, jread_options_handle, jkey_parts); } @@ -508,9 +525,9 @@ jlong Java_org_rocksdb_Transaction_getIterator__JJ(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jread_options_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* read_options = - reinterpret_cast(jread_options_handle); + reinterpret_cast(jread_options_handle); return reinterpret_cast(txn->GetIterator(*read_options)); } @@ -522,17 +539,18 @@ jlong Java_org_rocksdb_Transaction_getIterator__JJ(JNIEnv* /*env*/, jlong Java_org_rocksdb_Transaction_getIterator__JJJ( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jread_options_handle, jlong jcolumn_family_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* read_options = - reinterpret_cast(jread_options_handle); + reinterpret_cast(jread_options_handle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); + reinterpret_cast( + jcolumn_family_handle); return reinterpret_cast( txn->GetIterator(*read_options, column_family_handle)); } -typedef std::function +typedef std::function FnWriteKV; // TODO(AR) consider refactoring to share this between here and rocksjni.cc @@ -550,10 +568,12 @@ void txn_write_kv_helper(JNIEnv* env, const FnWriteKV& fn_write_kv, env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); return; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_part_len); - rocksdb::Slice value_slice(reinterpret_cast(value), jval_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + jkey_part_len); + ROCKSDB_NAMESPACE::Slice value_slice(reinterpret_cast(value), + jval_len); - rocksdb::Status s = fn_write_kv(key_slice, value_slice); + ROCKSDB_NAMESPACE::Status s = fn_write_kv(key_slice, value_slice); // trigger java unref on key. // by passing JNI_ABORT, it will simply release the reference without @@ -564,7 +584,7 @@ void txn_write_kv_helper(JNIEnv* env, const FnWriteKV& fn_write_kv, if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -576,14 +596,16 @@ void Java_org_rocksdb_Transaction_put__J_3BI_3BIJZ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jbyteArray jval, jint jval_len, jlong jcolumn_family_handle, jboolean jassume_tracked) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); - FnWriteKV fn_put = std::bind(&rocksdb::Transaction::Put, txn, - column_family_handle, _1, _2, - jassume_tracked); + reinterpret_cast( + jcolumn_family_handle); + FnWriteKV fn_put = + std::bind(&ROCKSDB_NAMESPACE::Transaction::Put, txn, + column_family_handle, _1, _2, jassume_tracked); txn_write_kv_helper(env, fn_put, jkey, jkey_part_len, jval, jval_len); } @@ -597,15 +619,16 @@ void Java_org_rocksdb_Transaction_put__J_3BI_3BI(JNIEnv* env, jobject /*jobj*/, jint jkey_part_len, jbyteArray jval, jint jval_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteKV fn_put = std::bind(&rocksdb::Transaction::Put, - txn, _1, _2); + auto* txn = reinterpret_cast(jhandle); + FnWriteKV fn_put = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::Put, txn, _1, _2); txn_write_kv_helper(env, fn_put, jkey, jkey_part_len, jval, jval_len); } -typedef std::function +typedef std::function FnWriteKVParts; // TODO(AR) consider refactoring to share this between here and rocksjni.cc @@ -621,8 +644,8 @@ void txn_write_kv_parts_helper(JNIEnv* env, assert(jkey_parts_len == jvalue_parts_len); #endif - auto key_parts = std::vector(); - auto value_parts = std::vector(); + auto key_parts = std::vector(); + auto value_parts = std::vector(); auto jparts_to_free = std::vector>(); // convert java key_parts/value_parts byte[][] to Slice(s) @@ -684,16 +707,17 @@ void txn_write_kv_parts_helper(JNIEnv* env, jparts_to_free.push_back( std::make_tuple(jba_value_part, jvalue_part, jobj_value_part)); - key_parts.push_back( - rocksdb::Slice(reinterpret_cast(jkey_part), jkey_part_len)); - value_parts.push_back( - rocksdb::Slice(reinterpret_cast(jvalue_part), jvalue_part_len)); + key_parts.push_back(ROCKSDB_NAMESPACE::Slice( + reinterpret_cast(jkey_part), jkey_part_len)); + value_parts.push_back(ROCKSDB_NAMESPACE::Slice( + reinterpret_cast(jvalue_part), jvalue_part_len)); } // call the write_multi function - rocksdb::Status s = fn_write_kv_parts( - rocksdb::SliceParts(key_parts.data(), (int)key_parts.size()), - rocksdb::SliceParts(value_parts.data(), (int)value_parts.size())); + ROCKSDB_NAMESPACE::Status s = fn_write_kv_parts( + ROCKSDB_NAMESPACE::SliceParts(key_parts.data(), (int)key_parts.size()), + ROCKSDB_NAMESPACE::SliceParts(value_parts.data(), + (int)value_parts.size())); // cleanup temporary memory free_parts(env, jparts_to_free); @@ -703,7 +727,7 @@ void txn_write_kv_parts_helper(JNIEnv* env, return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -715,15 +739,17 @@ void Java_org_rocksdb_Transaction_put__J_3_3BI_3_3BIJZ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jobjectArray jkey_parts, jint jkey_parts_len, jobjectArray jvalue_parts, jint jvalue_parts_len, jlong jcolumn_family_handle, jboolean jassume_tracked) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); + reinterpret_cast( + jcolumn_family_handle); FnWriteKVParts fn_put_parts = - std::bind(&rocksdb::Transaction::Put, txn, - column_family_handle, _1, _2, - jassume_tracked); + std::bind( + &ROCKSDB_NAMESPACE::Transaction::Put, txn, column_family_handle, _1, + _2, jassume_tracked); txn_write_kv_parts_helper(env, fn_put_parts, jkey_parts, jkey_parts_len, jvalue_parts, jvalue_parts_len); } @@ -736,11 +762,11 @@ void Java_org_rocksdb_Transaction_put__J_3_3BI_3_3BIJZ( void Java_org_rocksdb_Transaction_put__J_3_3BI_3_3BI( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jobjectArray jkey_parts, jint jkey_parts_len, jobjectArray jvalue_parts, jint jvalue_parts_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteKVParts fn_put_parts = - std::bind( - &rocksdb::Transaction::Put, txn, _1, _2); + auto* txn = reinterpret_cast(jhandle); + FnWriteKVParts fn_put_parts = std::bind( + &ROCKSDB_NAMESPACE::Transaction::Put, txn, _1, _2); txn_write_kv_parts_helper(env, fn_put_parts, jkey_parts, jkey_parts_len, jvalue_parts, jvalue_parts_len); } @@ -754,14 +780,16 @@ void Java_org_rocksdb_Transaction_merge__J_3BI_3BIJZ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jbyteArray jval, jint jval_len, jlong jcolumn_family_handle, jboolean jassume_tracked) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); - FnWriteKV fn_merge = std::bind(&rocksdb::Transaction::Merge, txn, - column_family_handle, _1, _2, - jassume_tracked); + reinterpret_cast( + jcolumn_family_handle); + FnWriteKV fn_merge = + std::bind(&ROCKSDB_NAMESPACE::Transaction::Merge, txn, + column_family_handle, _1, _2, jassume_tracked); txn_write_kv_helper(env, fn_merge, jkey, jkey_part_len, jval, jval_len); } @@ -773,14 +801,17 @@ void Java_org_rocksdb_Transaction_merge__J_3BI_3BIJZ( void Java_org_rocksdb_Transaction_merge__J_3BI_3BI( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jbyteArray jval, jint jval_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteKV fn_merge = std::bind( - &rocksdb::Transaction::Merge, txn, _1, _2); + auto* txn = reinterpret_cast(jhandle); + FnWriteKV fn_merge = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::Merge, txn, _1, _2); txn_write_kv_helper(env, fn_merge, jkey, jkey_part_len, jval, jval_len); } -typedef std::function FnWriteK; +typedef std::function + FnWriteK; // TODO(AR) consider refactoring to share this between here and rocksjni.cc void txn_write_k_helper(JNIEnv* env, const FnWriteK& fn_write_k, @@ -790,9 +821,10 @@ void txn_write_k_helper(JNIEnv* env, const FnWriteK& fn_write_k, // exception thrown: OutOfMemoryError return; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_part_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + jkey_part_len); - rocksdb::Status s = fn_write_k(key_slice); + ROCKSDB_NAMESPACE::Status s = fn_write_k(key_slice); // trigger java unref on key. // by passing JNI_ABORT, it will simply release the reference without @@ -802,7 +834,7 @@ void txn_write_k_helper(JNIEnv* env, const FnWriteK& fn_write_k, if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -813,13 +845,16 @@ void txn_write_k_helper(JNIEnv* env, const FnWriteK& fn_write_k, void Java_org_rocksdb_Transaction_delete__J_3BIJZ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jlong jcolumn_family_handle, jboolean jassume_tracked) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); - FnWriteK fn_delete = std::bind( - &rocksdb::Transaction::Delete, txn, column_family_handle, _1, - jassume_tracked); + reinterpret_cast( + jcolumn_family_handle); + FnWriteK fn_delete = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::Delete, txn, column_family_handle, + _1, jassume_tracked); txn_write_k_helper(env, fn_delete, jkey, jkey_part_len); } @@ -831,13 +866,15 @@ void Java_org_rocksdb_Transaction_delete__J_3BIJZ( void Java_org_rocksdb_Transaction_delete__J_3BI(JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteK fn_delete = std::bind(&rocksdb::Transaction::Delete, txn, _1); + auto* txn = reinterpret_cast(jhandle); + FnWriteK fn_delete = std::bind( + &ROCKSDB_NAMESPACE::Transaction::Delete, txn, _1); txn_write_k_helper(env, fn_delete, jkey, jkey_part_len); } -typedef std::function +typedef std::function FnWriteKParts; // TODO(AR) consider refactoring to share this between here and rocksjni.cc @@ -845,7 +882,7 @@ void txn_write_k_parts_helper(JNIEnv* env, const FnWriteKParts& fn_write_k_parts, const jobjectArray& jkey_parts, const jint& jkey_parts_len) { - std::vector key_parts; + std::vector key_parts; std::vector> jkey_parts_to_free; // convert java key_parts byte[][] to Slice(s) @@ -876,13 +913,13 @@ void txn_write_k_parts_helper(JNIEnv* env, jkey_parts_to_free.push_back(std::tuple( jba_key_part, jkey_part, jobj_key_part)); - key_parts.push_back( - rocksdb::Slice(reinterpret_cast(jkey_part), jkey_part_len)); + key_parts.push_back(ROCKSDB_NAMESPACE::Slice( + reinterpret_cast(jkey_part), jkey_part_len)); } // call the write_multi function - rocksdb::Status s = fn_write_k_parts( - rocksdb::SliceParts(key_parts.data(), (int)key_parts.size())); + ROCKSDB_NAMESPACE::Status s = fn_write_k_parts( + ROCKSDB_NAMESPACE::SliceParts(key_parts.data(), (int)key_parts.size())); // cleanup temporary memory free_parts(env, jkey_parts_to_free); @@ -891,7 +928,7 @@ void txn_write_k_parts_helper(JNIEnv* env, if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -903,14 +940,16 @@ void Java_org_rocksdb_Transaction_delete__J_3_3BIJZ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jobjectArray jkey_parts, jint jkey_parts_len, jlong jcolumn_family_handle, jboolean jassume_tracked) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); + reinterpret_cast( + jcolumn_family_handle); FnWriteKParts fn_delete_parts = - std::bind( - &rocksdb::Transaction::Delete, txn, column_family_handle, _1, - jassume_tracked); + std::bind( + &ROCKSDB_NAMESPACE::Transaction::Delete, txn, column_family_handle, + _1, jassume_tracked); txn_write_k_parts_helper(env, fn_delete_parts, jkey_parts, jkey_parts_len); } @@ -923,10 +962,10 @@ void Java_org_rocksdb_Transaction_delete__J_3_3BI(JNIEnv* env, jobject /*jobj*/, jlong jhandle, jobjectArray jkey_parts, jint jkey_parts_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteKParts fn_delete_parts = - std::bind(&rocksdb::Transaction::Delete, txn, _1); + auto* txn = reinterpret_cast(jhandle); + FnWriteKParts fn_delete_parts = std::bind( + &ROCKSDB_NAMESPACE::Transaction::Delete, txn, _1); txn_write_k_parts_helper(env, fn_delete_parts, jkey_parts, jkey_parts_len); } @@ -938,14 +977,16 @@ void Java_org_rocksdb_Transaction_delete__J_3_3BI(JNIEnv* env, jobject /*jobj*/, void Java_org_rocksdb_Transaction_singleDelete__J_3BIJZ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jlong jcolumn_family_handle, jboolean jassume_tracked) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); + reinterpret_cast( + jcolumn_family_handle); FnWriteK fn_single_delete = - std::bind( - &rocksdb::Transaction::SingleDelete, txn, column_family_handle, _1, - jassume_tracked); + std::bind( + &ROCKSDB_NAMESPACE::Transaction::SingleDelete, txn, + column_family_handle, _1, jassume_tracked); txn_write_k_helper(env, fn_single_delete, jkey, jkey_part_len); } @@ -959,10 +1000,10 @@ void Java_org_rocksdb_Transaction_singleDelete__J_3BI(JNIEnv* env, jlong jhandle, jbyteArray jkey, jint jkey_part_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteK fn_single_delete = - std::bind(&rocksdb::Transaction::SingleDelete, txn, _1); + auto* txn = reinterpret_cast(jhandle); + FnWriteK fn_single_delete = std::bind( + &ROCKSDB_NAMESPACE::Transaction::SingleDelete, txn, _1); txn_write_k_helper(env, fn_single_delete, jkey, jkey_part_len); } @@ -975,14 +1016,16 @@ void Java_org_rocksdb_Transaction_singleDelete__J_3_3BIJZ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jobjectArray jkey_parts, jint jkey_parts_len, jlong jcolumn_family_handle, jboolean jassume_tracked) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); + reinterpret_cast( + jcolumn_family_handle); FnWriteKParts fn_single_delete_parts = - std::bind( - &rocksdb::Transaction::SingleDelete, txn, column_family_handle, _1, - jassume_tracked); + std::bind( + &ROCKSDB_NAMESPACE::Transaction::SingleDelete, txn, + column_family_handle, _1, jassume_tracked); txn_write_k_parts_helper(env, fn_single_delete_parts, jkey_parts, jkey_parts_len); } @@ -997,10 +1040,10 @@ void Java_org_rocksdb_Transaction_singleDelete__J_3_3BI(JNIEnv* env, jlong jhandle, jobjectArray jkey_parts, jint jkey_parts_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteKParts fn_single_delete_parts = std::bind( - &rocksdb::Transaction::SingleDelete, txn, _1); + auto* txn = reinterpret_cast(jhandle); + FnWriteKParts fn_single_delete_parts = std::bind( + &ROCKSDB_NAMESPACE::Transaction::SingleDelete, txn, _1); txn_write_k_parts_helper(env, fn_single_delete_parts, jkey_parts, jkey_parts_len); } @@ -1014,13 +1057,16 @@ void Java_org_rocksdb_Transaction_putUntracked__J_3BI_3BIJ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jbyteArray jval, jint jval_len, jlong jcolumn_family_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); - FnWriteKV fn_put_untracked = std::bind( - &rocksdb::Transaction::PutUntracked, txn, column_family_handle, _1, _2); + reinterpret_cast( + jcolumn_family_handle); + FnWriteKV fn_put_untracked = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::PutUntracked, txn, + column_family_handle, _1, _2); txn_write_kv_helper(env, fn_put_untracked, jkey, jkey_part_len, jval, jval_len); } @@ -1033,10 +1079,11 @@ void Java_org_rocksdb_Transaction_putUntracked__J_3BI_3BIJ( void Java_org_rocksdb_Transaction_putUntracked__J_3BI_3BI( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jbyteArray jval, jint jval_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteKV fn_put_untracked = std::bind( - &rocksdb::Transaction::PutUntracked, txn, _1, _2); + auto* txn = reinterpret_cast(jhandle); + FnWriteKV fn_put_untracked = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::PutUntracked, txn, _1, _2); txn_write_kv_helper(env, fn_put_untracked, jkey, jkey_part_len, jval, jval_len); } @@ -1050,14 +1097,16 @@ void Java_org_rocksdb_Transaction_putUntracked__J_3_3BI_3_3BIJ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jobjectArray jkey_parts, jint jkey_parts_len, jobjectArray jvalue_parts, jint jvalue_parts_len, jlong jcolumn_family_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); - FnWriteKVParts fn_put_parts_untracked = - std::bind(&rocksdb::Transaction::PutUntracked, txn, - column_family_handle, _1, _2); + reinterpret_cast( + jcolumn_family_handle); + FnWriteKVParts fn_put_parts_untracked = std::bind( + &ROCKSDB_NAMESPACE::Transaction::PutUntracked, txn, column_family_handle, + _1, _2); txn_write_kv_parts_helper(env, fn_put_parts_untracked, jkey_parts, jkey_parts_len, jvalue_parts, jvalue_parts_len); } @@ -1070,11 +1119,11 @@ void Java_org_rocksdb_Transaction_putUntracked__J_3_3BI_3_3BIJ( void Java_org_rocksdb_Transaction_putUntracked__J_3_3BI_3_3BI( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jobjectArray jkey_parts, jint jkey_parts_len, jobjectArray jvalue_parts, jint jvalue_parts_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteKVParts fn_put_parts_untracked = - std::bind( - &rocksdb::Transaction::PutUntracked, txn, _1, _2); + auto* txn = reinterpret_cast(jhandle); + FnWriteKVParts fn_put_parts_untracked = std::bind( + &ROCKSDB_NAMESPACE::Transaction::PutUntracked, txn, _1, _2); txn_write_kv_parts_helper(env, fn_put_parts_untracked, jkey_parts, jkey_parts_len, jvalue_parts, jvalue_parts_len); } @@ -1088,13 +1137,16 @@ void Java_org_rocksdb_Transaction_mergeUntracked__J_3BI_3BIJ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jbyteArray jval, jint jval_len, jlong jcolumn_family_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); - FnWriteKV fn_merge_untracked = std::bind( - &rocksdb::Transaction::MergeUntracked, txn, column_family_handle, _1, _2); + reinterpret_cast( + jcolumn_family_handle); + FnWriteKV fn_merge_untracked = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::MergeUntracked, txn, + column_family_handle, _1, _2); txn_write_kv_helper(env, fn_merge_untracked, jkey, jkey_part_len, jval, jval_len); } @@ -1107,10 +1159,11 @@ void Java_org_rocksdb_Transaction_mergeUntracked__J_3BI_3BIJ( void Java_org_rocksdb_Transaction_mergeUntracked__J_3BI_3BI( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jbyteArray jval, jint jval_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteKV fn_merge_untracked = std::bind( - &rocksdb::Transaction::MergeUntracked, txn, _1, _2); + auto* txn = reinterpret_cast(jhandle); + FnWriteKV fn_merge_untracked = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::MergeUntracked, txn, _1, _2); txn_write_kv_helper(env, fn_merge_untracked, jkey, jkey_part_len, jval, jval_len); } @@ -1123,14 +1176,15 @@ void Java_org_rocksdb_Transaction_mergeUntracked__J_3BI_3BI( void Java_org_rocksdb_Transaction_deleteUntracked__J_3BIJ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jlong jcolumn_family_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); - FnWriteK fn_delete_untracked = - std::bind( - &rocksdb::Transaction::DeleteUntracked, txn, column_family_handle, - _1); + reinterpret_cast( + jcolumn_family_handle); + FnWriteK fn_delete_untracked = std::bind( + &ROCKSDB_NAMESPACE::Transaction::DeleteUntracked, txn, + column_family_handle, _1); txn_write_k_helper(env, fn_delete_untracked, jkey, jkey_part_len); } @@ -1144,10 +1198,10 @@ void Java_org_rocksdb_Transaction_deleteUntracked__J_3BI(JNIEnv* env, jlong jhandle, jbyteArray jkey, jint jkey_part_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteK fn_delete_untracked = std::bind( - &rocksdb::Transaction::DeleteUntracked, txn, _1); + auto* txn = reinterpret_cast(jhandle); + FnWriteK fn_delete_untracked = std::bind( + &ROCKSDB_NAMESPACE::Transaction::DeleteUntracked, txn, _1); txn_write_k_helper(env, fn_delete_untracked, jkey, jkey_part_len); } @@ -1159,14 +1213,16 @@ void Java_org_rocksdb_Transaction_deleteUntracked__J_3BI(JNIEnv* env, void Java_org_rocksdb_Transaction_deleteUntracked__J_3_3BIJ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jobjectArray jkey_parts, jint jkey_parts_len, jlong jcolumn_family_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); + reinterpret_cast( + jcolumn_family_handle); FnWriteKParts fn_delete_untracked_parts = - std::bind( - &rocksdb::Transaction::DeleteUntracked, txn, column_family_handle, - _1); + std::bind( + &ROCKSDB_NAMESPACE::Transaction::DeleteUntracked, txn, + column_family_handle, _1); txn_write_k_parts_helper(env, fn_delete_untracked_parts, jkey_parts, jkey_parts_len); } @@ -1179,10 +1235,11 @@ void Java_org_rocksdb_Transaction_deleteUntracked__J_3_3BIJ( void Java_org_rocksdb_Transaction_deleteUntracked__J_3_3BI( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jobjectArray jkey_parts, jint jkey_parts_len) { - auto* txn = reinterpret_cast(jhandle); - FnWriteKParts fn_delete_untracked_parts = std::bind( - &rocksdb::Transaction::DeleteUntracked, txn, _1); + auto* txn = reinterpret_cast(jhandle); + FnWriteKParts fn_delete_untracked_parts = + std::bind( + &ROCKSDB_NAMESPACE::Transaction::DeleteUntracked, txn, _1); txn_write_k_parts_helper(env, fn_delete_untracked_parts, jkey_parts, jkey_parts_len); } @@ -1195,7 +1252,7 @@ void Java_org_rocksdb_Transaction_deleteUntracked__J_3_3BI( void Java_org_rocksdb_Transaction_putLogData(JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); jbyte* key = env->GetByteArrayElements(jkey, nullptr); if (key == nullptr) { @@ -1203,7 +1260,8 @@ void Java_org_rocksdb_Transaction_putLogData(JNIEnv* env, jobject /*jobj*/, return; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_part_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + jkey_part_len); txn->PutLogData(key_slice); // trigger java unref on key. @@ -1220,7 +1278,7 @@ void Java_org_rocksdb_Transaction_putLogData(JNIEnv* env, jobject /*jobj*/, void Java_org_rocksdb_Transaction_disableIndexing(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); txn->DisableIndexing(); } @@ -1232,7 +1290,7 @@ void Java_org_rocksdb_Transaction_disableIndexing(JNIEnv* /*env*/, void Java_org_rocksdb_Transaction_enableIndexing(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); txn->EnableIndexing(); } @@ -1243,7 +1301,7 @@ void Java_org_rocksdb_Transaction_enableIndexing(JNIEnv* /*env*/, */ jlong Java_org_rocksdb_Transaction_getNumKeys(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); return txn->GetNumKeys(); } @@ -1254,7 +1312,7 @@ jlong Java_org_rocksdb_Transaction_getNumKeys(JNIEnv* /*env*/, jobject /*jobj*/, */ jlong Java_org_rocksdb_Transaction_getNumPuts(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); return txn->GetNumPuts(); } @@ -1266,7 +1324,7 @@ jlong Java_org_rocksdb_Transaction_getNumPuts(JNIEnv* /*env*/, jobject /*jobj*/, jlong Java_org_rocksdb_Transaction_getNumDeletes(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); return txn->GetNumDeletes(); } @@ -1278,7 +1336,7 @@ jlong Java_org_rocksdb_Transaction_getNumDeletes(JNIEnv* /*env*/, jlong Java_org_rocksdb_Transaction_getNumMerges(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); return txn->GetNumMerges(); } @@ -1290,7 +1348,7 @@ jlong Java_org_rocksdb_Transaction_getNumMerges(JNIEnv* /*env*/, jlong Java_org_rocksdb_Transaction_getElapsedTime(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); return txn->GetElapsedTime(); } @@ -1302,7 +1360,7 @@ jlong Java_org_rocksdb_Transaction_getElapsedTime(JNIEnv* /*env*/, jlong Java_org_rocksdb_Transaction_getWriteBatch(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); return reinterpret_cast(txn->GetWriteBatch()); } @@ -1315,7 +1373,7 @@ void Java_org_rocksdb_Transaction_setLockTimeout(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jlock_timeout) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); txn->SetLockTimeout(jlock_timeout); } @@ -1327,7 +1385,7 @@ void Java_org_rocksdb_Transaction_setLockTimeout(JNIEnv* /*env*/, jlong Java_org_rocksdb_Transaction_getWriteOptions(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); return reinterpret_cast(txn->GetWriteOptions()); } @@ -1340,9 +1398,9 @@ void Java_org_rocksdb_Transaction_setWriteOptions(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jwrite_options_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* write_options = - reinterpret_cast(jwrite_options_handle); + reinterpret_cast(jwrite_options_handle); txn->SetWriteOptions(*write_options); } @@ -1354,16 +1412,18 @@ void Java_org_rocksdb_Transaction_setWriteOptions(JNIEnv* /*env*/, void Java_org_rocksdb_Transaction_undoGetForUpdate__J_3BIJ( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jbyteArray jkey, jint jkey_part_len, jlong jcolumn_family_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* column_family_handle = - reinterpret_cast(jcolumn_family_handle); + reinterpret_cast( + jcolumn_family_handle); jbyte* key = env->GetByteArrayElements(jkey, nullptr); if (key == nullptr) { // exception thrown: OutOfMemoryError return; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_part_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + jkey_part_len); txn->UndoGetForUpdate(column_family_handle, key_slice); env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); @@ -1379,14 +1439,15 @@ void Java_org_rocksdb_Transaction_undoGetForUpdate__J_3BI(JNIEnv* env, jlong jhandle, jbyteArray jkey, jint jkey_part_len) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); jbyte* key = env->GetByteArrayElements(jkey, nullptr); if (key == nullptr) { // exception thrown: OutOfMemoryError return; } - rocksdb::Slice key_slice(reinterpret_cast(key), jkey_part_len); + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), + jkey_part_len); txn->UndoGetForUpdate(key_slice); env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); @@ -1399,12 +1460,12 @@ void Java_org_rocksdb_Transaction_undoGetForUpdate__J_3BI(JNIEnv* env, */ void Java_org_rocksdb_Transaction_rebuildFromWriteBatch( JNIEnv* env, jobject /*jobj*/, jlong jhandle, jlong jwrite_batch_handle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); auto* write_batch = - reinterpret_cast(jwrite_batch_handle); - rocksdb::Status s = txn->RebuildFromWriteBatch(write_batch); + reinterpret_cast(jwrite_batch_handle); + ROCKSDB_NAMESPACE::Status s = txn->RebuildFromWriteBatch(write_batch); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -1416,7 +1477,7 @@ void Java_org_rocksdb_Transaction_rebuildFromWriteBatch( jlong Java_org_rocksdb_Transaction_getCommitTimeWriteBatch(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); return reinterpret_cast(txn->GetCommitTimeWriteBatch()); } @@ -1428,7 +1489,7 @@ jlong Java_org_rocksdb_Transaction_getCommitTimeWriteBatch(JNIEnv* /*env*/, void Java_org_rocksdb_Transaction_setLogNumber(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jlog_number) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); txn->SetLogNumber(jlog_number); } @@ -1440,7 +1501,7 @@ void Java_org_rocksdb_Transaction_setLogNumber(JNIEnv* /*env*/, jlong Java_org_rocksdb_Transaction_getLogNumber(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); return txn->GetLogNumber(); } @@ -1451,19 +1512,19 @@ jlong Java_org_rocksdb_Transaction_getLogNumber(JNIEnv* /*env*/, */ void Java_org_rocksdb_Transaction_setName(JNIEnv* env, jobject /*jobj*/, jlong jhandle, jstring jname) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); const char* name = env->GetStringUTFChars(jname, nullptr); if (name == nullptr) { // exception thrown: OutOfMemoryError return; } - rocksdb::Status s = txn->SetName(name); + ROCKSDB_NAMESPACE::Status s = txn->SetName(name); env->ReleaseStringUTFChars(jname, name); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -1474,8 +1535,8 @@ void Java_org_rocksdb_Transaction_setName(JNIEnv* env, jobject /*jobj*/, */ jstring Java_org_rocksdb_Transaction_getName(JNIEnv* env, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); - rocksdb::TransactionName name = txn->GetName(); + auto* txn = reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::TransactionName name = txn->GetName(); return env->NewStringUTF(name.data()); } @@ -1486,8 +1547,8 @@ jstring Java_org_rocksdb_Transaction_getName(JNIEnv* env, jobject /*jobj*/, */ jlong Java_org_rocksdb_Transaction_getID(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); - rocksdb::TransactionID id = txn->GetID(); + auto* txn = reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::TransactionID id = txn->GetID(); return static_cast(id); } @@ -1499,7 +1560,7 @@ jlong Java_org_rocksdb_Transaction_getID(JNIEnv* /*env*/, jobject /*jobj*/, jboolean Java_org_rocksdb_Transaction_isDeadlockDetect(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); return static_cast(txn->IsDeadlockDetect()); } @@ -1511,13 +1572,14 @@ jboolean Java_org_rocksdb_Transaction_isDeadlockDetect(JNIEnv* /*env*/, jobject Java_org_rocksdb_Transaction_getWaitingTxns(JNIEnv* env, jobject jtransaction_obj, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); uint32_t column_family_id; std::string key; - std::vector waiting_txns = + std::vector waiting_txns = txn->GetWaitingTxns(&column_family_id, &key); - jobject jwaiting_txns = rocksdb::TransactionJni::newWaitingTransactions( - env, jtransaction_obj, column_family_id, key, waiting_txns); + jobject jwaiting_txns = + ROCKSDB_NAMESPACE::TransactionJni::newWaitingTransactions( + env, jtransaction_obj, column_family_id, key, waiting_txns); return jwaiting_txns; } @@ -1528,31 +1590,31 @@ jobject Java_org_rocksdb_Transaction_getWaitingTxns(JNIEnv* env, */ jbyte Java_org_rocksdb_Transaction_getState(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); - rocksdb::Transaction::TransactionState txn_status = txn->GetState(); + auto* txn = reinterpret_cast(jhandle); + ROCKSDB_NAMESPACE::Transaction::TransactionState txn_status = txn->GetState(); switch (txn_status) { - case rocksdb::Transaction::TransactionState::STARTED: + case ROCKSDB_NAMESPACE::Transaction::TransactionState::STARTED: return 0x0; - case rocksdb::Transaction::TransactionState::AWAITING_PREPARE: + case ROCKSDB_NAMESPACE::Transaction::TransactionState::AWAITING_PREPARE: return 0x1; - case rocksdb::Transaction::TransactionState::PREPARED: + case ROCKSDB_NAMESPACE::Transaction::TransactionState::PREPARED: return 0x2; - case rocksdb::Transaction::TransactionState::AWAITING_COMMIT: + case ROCKSDB_NAMESPACE::Transaction::TransactionState::AWAITING_COMMIT: return 0x3; - case rocksdb::Transaction::TransactionState::COMMITED: + case ROCKSDB_NAMESPACE::Transaction::TransactionState::COMMITED: return 0x4; - case rocksdb::Transaction::TransactionState::AWAITING_ROLLBACK: + case ROCKSDB_NAMESPACE::Transaction::TransactionState::AWAITING_ROLLBACK: return 0x5; - case rocksdb::Transaction::TransactionState::ROLLEDBACK: + case ROCKSDB_NAMESPACE::Transaction::TransactionState::ROLLEDBACK: return 0x6; - case rocksdb::Transaction::TransactionState::LOCKS_STOLEN: + case ROCKSDB_NAMESPACE::Transaction::TransactionState::LOCKS_STOLEN: return 0x7; } @@ -1567,7 +1629,7 @@ jbyte Java_org_rocksdb_Transaction_getState(JNIEnv* /*env*/, jobject /*jobj*/, */ jlong Java_org_rocksdb_Transaction_getId(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* txn = reinterpret_cast(jhandle); + auto* txn = reinterpret_cast(jhandle); uint64_t id = txn->GetId(); return static_cast(id); } @@ -1580,5 +1642,5 @@ jlong Java_org_rocksdb_Transaction_getId(JNIEnv* /*env*/, jobject /*jobj*/, void Java_org_rocksdb_Transaction_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - delete reinterpret_cast(jhandle); + delete reinterpret_cast(jhandle); } diff --git a/java/rocksjni/transaction_db.cc b/java/rocksjni/transaction_db.cc index c2c40bf10e..c6ec646403 100644 --- a/java/rocksjni/transaction_db.cc +++ b/java/rocksjni/transaction_db.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ -// for rocksdb::TransactionDB. +// for ROCKSDB_NAMESPACE::TransactionDB. #include #include @@ -27,23 +27,25 @@ jlong Java_org_rocksdb_TransactionDB_open__JJLjava_lang_String_2( JNIEnv* env, jclass, jlong joptions_handle, jlong jtxn_db_options_handle, jstring jdb_path) { - auto* options = reinterpret_cast(joptions_handle); + auto* options = + reinterpret_cast(joptions_handle); auto* txn_db_options = - reinterpret_cast(jtxn_db_options_handle); - rocksdb::TransactionDB* tdb = nullptr; + reinterpret_cast( + jtxn_db_options_handle); + ROCKSDB_NAMESPACE::TransactionDB* tdb = nullptr; const char* db_path = env->GetStringUTFChars(jdb_path, nullptr); if (db_path == nullptr) { // exception thrown: OutOfMemoryError return 0; } - rocksdb::Status s = - rocksdb::TransactionDB::Open(*options, *txn_db_options, db_path, &tdb); + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::TransactionDB::Open( + *options, *txn_db_options, db_path, &tdb); env->ReleaseStringUTFChars(jdb_path, db_path); if (s.ok()) { return reinterpret_cast(tdb); } else { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return 0; } } @@ -76,7 +78,7 @@ jlongArray Java_org_rocksdb_TransactionDB_open__JJLjava_lang_String_2_3_3B_3J( env->ReleaseStringUTFChars(jdb_path, db_path); return nullptr; } - std::vector column_families; + std::vector column_families; for (int i = 0; i < len_cols; i++) { const jobject jcn = env->GetObjectArrayElement(jcolumn_names, i); if (env->ExceptionCheck()) { @@ -105,22 +107,24 @@ jlongArray Java_org_rocksdb_TransactionDB_open__JJLjava_lang_String_2_3_3B_3J( return nullptr; } const std::string cf_name(reinterpret_cast(jcf_name), jcf_name_len); - const rocksdb::ColumnFamilyOptions* cf_options = - reinterpret_cast(jco[i]); + const ROCKSDB_NAMESPACE::ColumnFamilyOptions* cf_options = + reinterpret_cast(jco[i]); column_families.push_back( - rocksdb::ColumnFamilyDescriptor(cf_name, *cf_options)); + ROCKSDB_NAMESPACE::ColumnFamilyDescriptor(cf_name, *cf_options)); env->ReleaseByteArrayElements(jcn_ba, jcf_name, JNI_ABORT); env->DeleteLocalRef(jcn); } env->ReleaseLongArrayElements(jcolumn_options_handles, jco, JNI_ABORT); - auto* db_options = reinterpret_cast(jdb_options_handle); + auto* db_options = + reinterpret_cast(jdb_options_handle); auto* txn_db_options = - reinterpret_cast(jtxn_db_options_handle); - std::vector handles; - rocksdb::TransactionDB* tdb = nullptr; - const rocksdb::Status s = rocksdb::TransactionDB::Open( + reinterpret_cast( + jtxn_db_options_handle); + std::vector handles; + ROCKSDB_NAMESPACE::TransactionDB* tdb = nullptr; + const ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::TransactionDB::Open( *db_options, *txn_db_options, db_path, column_families, &handles, &tdb); // check if open operation was successful @@ -146,7 +150,7 @@ jlongArray Java_org_rocksdb_TransactionDB_open__JJLjava_lang_String_2_3_3B_3J( } return jresults; } else { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } } @@ -158,7 +162,7 @@ jlongArray Java_org_rocksdb_TransactionDB_open__JJLjava_lang_String_2_3_3B_3J( */ void Java_org_rocksdb_TransactionDB_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto* txn_db = reinterpret_cast(jhandle); + auto* txn_db = reinterpret_cast(jhandle); assert(txn_db != nullptr); delete txn_db; } @@ -170,10 +174,10 @@ void Java_org_rocksdb_TransactionDB_disposeInternal( */ void Java_org_rocksdb_TransactionDB_closeDatabase( JNIEnv* env, jclass, jlong jhandle) { - auto* txn_db = reinterpret_cast(jhandle); + auto* txn_db = reinterpret_cast(jhandle); assert(txn_db != nullptr); - rocksdb::Status s = txn_db->Close(); - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::Status s = txn_db->Close(); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -183,10 +187,11 @@ void Java_org_rocksdb_TransactionDB_closeDatabase( */ jlong Java_org_rocksdb_TransactionDB_beginTransaction__JJ( JNIEnv*, jobject, jlong jhandle, jlong jwrite_options_handle) { - auto* txn_db = reinterpret_cast(jhandle); + auto* txn_db = reinterpret_cast(jhandle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - rocksdb::Transaction* txn = txn_db->BeginTransaction(*write_options); + reinterpret_cast(jwrite_options_handle); + ROCKSDB_NAMESPACE::Transaction* txn = + txn_db->BeginTransaction(*write_options); return reinterpret_cast(txn); } @@ -198,12 +203,12 @@ jlong Java_org_rocksdb_TransactionDB_beginTransaction__JJ( jlong Java_org_rocksdb_TransactionDB_beginTransaction__JJJ( JNIEnv*, jobject, jlong jhandle, jlong jwrite_options_handle, jlong jtxn_options_handle) { - auto* txn_db = reinterpret_cast(jhandle); + auto* txn_db = reinterpret_cast(jhandle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - auto* txn_options = - reinterpret_cast(jtxn_options_handle); - rocksdb::Transaction* txn = + reinterpret_cast(jwrite_options_handle); + auto* txn_options = reinterpret_cast( + jtxn_options_handle); + ROCKSDB_NAMESPACE::Transaction* txn = txn_db->BeginTransaction(*write_options, *txn_options); return reinterpret_cast(txn); } @@ -216,12 +221,13 @@ jlong Java_org_rocksdb_TransactionDB_beginTransaction__JJJ( jlong Java_org_rocksdb_TransactionDB_beginTransaction_1withOld__JJJ( JNIEnv*, jobject, jlong jhandle, jlong jwrite_options_handle, jlong jold_txn_handle) { - auto* txn_db = reinterpret_cast(jhandle); + auto* txn_db = reinterpret_cast(jhandle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - auto* old_txn = reinterpret_cast(jold_txn_handle); - rocksdb::TransactionOptions txn_options; - rocksdb::Transaction* txn = + reinterpret_cast(jwrite_options_handle); + auto* old_txn = + reinterpret_cast(jold_txn_handle); + ROCKSDB_NAMESPACE::TransactionOptions txn_options; + ROCKSDB_NAMESPACE::Transaction* txn = txn_db->BeginTransaction(*write_options, txn_options, old_txn); // RocksJava relies on the assumption that @@ -240,13 +246,14 @@ jlong Java_org_rocksdb_TransactionDB_beginTransaction_1withOld__JJJ( jlong Java_org_rocksdb_TransactionDB_beginTransaction_1withOld__JJJJ( JNIEnv*, jobject, jlong jhandle, jlong jwrite_options_handle, jlong jtxn_options_handle, jlong jold_txn_handle) { - auto* txn_db = reinterpret_cast(jhandle); + auto* txn_db = reinterpret_cast(jhandle); auto* write_options = - reinterpret_cast(jwrite_options_handle); - auto* txn_options = - reinterpret_cast(jtxn_options_handle); - auto* old_txn = reinterpret_cast(jold_txn_handle); - rocksdb::Transaction* txn = + reinterpret_cast(jwrite_options_handle); + auto* txn_options = reinterpret_cast( + jtxn_options_handle); + auto* old_txn = + reinterpret_cast(jold_txn_handle); + ROCKSDB_NAMESPACE::Transaction* txn = txn_db->BeginTransaction(*write_options, *txn_options, old_txn); // RocksJava relies on the assumption that @@ -264,13 +271,13 @@ jlong Java_org_rocksdb_TransactionDB_beginTransaction_1withOld__JJJJ( */ jlong Java_org_rocksdb_TransactionDB_getTransactionByName( JNIEnv* env, jobject, jlong jhandle, jstring jname) { - auto* txn_db = reinterpret_cast(jhandle); + auto* txn_db = reinterpret_cast(jhandle); const char* name = env->GetStringUTFChars(jname, nullptr); if (name == nullptr) { // exception thrown: OutOfMemoryError return 0; } - rocksdb::Transaction* txn = txn_db->GetTransactionByName(name); + ROCKSDB_NAMESPACE::Transaction* txn = txn_db->GetTransactionByName(name); env->ReleaseStringUTFChars(jname, name); return reinterpret_cast(txn); } @@ -282,8 +289,8 @@ jlong Java_org_rocksdb_TransactionDB_getTransactionByName( */ jlongArray Java_org_rocksdb_TransactionDB_getAllPreparedTransactions( JNIEnv* env, jobject, jlong jhandle) { - auto* txn_db = reinterpret_cast(jhandle); - std::vector txns; + auto* txn_db = reinterpret_cast(jhandle); + std::vector txns; txn_db->GetAllPreparedTransactions(&txns); const size_t size = txns.size(); @@ -317,29 +324,29 @@ jlongArray Java_org_rocksdb_TransactionDB_getAllPreparedTransactions( */ jobject Java_org_rocksdb_TransactionDB_getLockStatusData( JNIEnv* env, jobject, jlong jhandle) { - auto* txn_db = reinterpret_cast(jhandle); - const std::unordered_multimap + auto* txn_db = reinterpret_cast(jhandle); + const std::unordered_multimap lock_status_data = txn_db->GetLockStatusData(); - const jobject jlock_status_data = rocksdb::HashMapJni::construct( + const jobject jlock_status_data = ROCKSDB_NAMESPACE::HashMapJni::construct( env, static_cast(lock_status_data.size())); if (jlock_status_data == nullptr) { // exception occurred return nullptr; } - const rocksdb::HashMapJni::FnMapKV + const ROCKSDB_NAMESPACE::HashMapJni::FnMapKV< + const int32_t, const ROCKSDB_NAMESPACE::KeyLockInfo, jobject, jobject> fn_map_kv = - [env]( - const std::pair& - pair) { + [env](const std::pair& pair) { const jobject jlong_column_family_id = - rocksdb::LongJni::valueOf(env, pair.first); + ROCKSDB_NAMESPACE::LongJni::valueOf(env, pair.first); if (jlong_column_family_id == nullptr) { // an error occurred return std::unique_ptr>(nullptr); } const jobject jkey_lock_info = - rocksdb::KeyLockInfoJni::construct(env, pair.second); + ROCKSDB_NAMESPACE::KeyLockInfoJni::construct(env, pair.second); if (jkey_lock_info == nullptr) { // an error occurred return std::unique_ptr>(nullptr); @@ -349,9 +356,9 @@ jobject Java_org_rocksdb_TransactionDB_getLockStatusData( jkey_lock_info)); }; - if (!rocksdb::HashMapJni::putAll(env, jlock_status_data, - lock_status_data.begin(), - lock_status_data.end(), fn_map_kv)) { + if (!ROCKSDB_NAMESPACE::HashMapJni::putAll( + env, jlock_status_data, lock_status_data.begin(), + lock_status_data.end(), fn_map_kv)) { // exception occcurred return nullptr; } @@ -366,15 +373,15 @@ jobject Java_org_rocksdb_TransactionDB_getLockStatusData( */ jobjectArray Java_org_rocksdb_TransactionDB_getDeadlockInfoBuffer( JNIEnv* env, jobject jobj, jlong jhandle) { - auto* txn_db = reinterpret_cast(jhandle); - const std::vector deadlock_info_buffer = + auto* txn_db = reinterpret_cast(jhandle); + const std::vector deadlock_info_buffer = txn_db->GetDeadlockInfoBuffer(); const jsize deadlock_info_buffer_len = static_cast(deadlock_info_buffer.size()); - jobjectArray jdeadlock_info_buffer = - env->NewObjectArray(deadlock_info_buffer_len, - rocksdb::DeadlockPathJni::getJClass(env), nullptr); + jobjectArray jdeadlock_info_buffer = env->NewObjectArray( + deadlock_info_buffer_len, + ROCKSDB_NAMESPACE::DeadlockPathJni::getJClass(env), nullptr); if (jdeadlock_info_buffer == nullptr) { // exception thrown: OutOfMemoryError return nullptr; @@ -384,13 +391,14 @@ jobjectArray Java_org_rocksdb_TransactionDB_getDeadlockInfoBuffer( auto buf_end = deadlock_info_buffer.end(); for (auto buf_it = deadlock_info_buffer.begin(); buf_it != buf_end; ++buf_it) { - const rocksdb::DeadlockPath deadlock_path = *buf_it; - const std::vector deadlock_infos = + const ROCKSDB_NAMESPACE::DeadlockPath deadlock_path = *buf_it; + const std::vector deadlock_infos = deadlock_path.path; const jsize deadlock_infos_len = static_cast(deadlock_info_buffer.size()); jobjectArray jdeadlock_infos = env->NewObjectArray( - deadlock_infos_len, rocksdb::DeadlockInfoJni::getJClass(env), nullptr); + deadlock_infos_len, ROCKSDB_NAMESPACE::DeadlockInfoJni::getJClass(env), + nullptr); if (jdeadlock_infos == nullptr) { // exception thrown: OutOfMemoryError env->DeleteLocalRef(jdeadlock_info_buffer); @@ -401,10 +409,11 @@ jobjectArray Java_org_rocksdb_TransactionDB_getDeadlockInfoBuffer( auto infos_end = deadlock_infos.end(); for (auto infos_it = deadlock_infos.begin(); infos_it != infos_end; ++infos_it) { - const rocksdb::DeadlockInfo deadlock_info = *infos_it; - const jobject jdeadlock_info = rocksdb::TransactionDBJni::newDeadlockInfo( - env, jobj, deadlock_info.m_txn_id, deadlock_info.m_cf_id, - deadlock_info.m_waiting_key, deadlock_info.m_exclusive); + const ROCKSDB_NAMESPACE::DeadlockInfo deadlock_info = *infos_it; + const jobject jdeadlock_info = + ROCKSDB_NAMESPACE::TransactionDBJni::newDeadlockInfo( + env, jobj, deadlock_info.m_txn_id, deadlock_info.m_cf_id, + deadlock_info.m_waiting_key, deadlock_info.m_exclusive); if (jdeadlock_info == nullptr) { // exception occcurred env->DeleteLocalRef(jdeadlock_info_buffer); @@ -421,8 +430,9 @@ jobjectArray Java_org_rocksdb_TransactionDB_getDeadlockInfoBuffer( } } - const jobject jdeadlock_path = rocksdb::DeadlockPathJni::construct( - env, jdeadlock_infos, deadlock_path.limit_exceeded); + const jobject jdeadlock_path = + ROCKSDB_NAMESPACE::DeadlockPathJni::construct( + env, jdeadlock_infos, deadlock_path.limit_exceeded); if (jdeadlock_path == nullptr) { // exception occcurred env->DeleteLocalRef(jdeadlock_info_buffer); @@ -448,6 +458,6 @@ jobjectArray Java_org_rocksdb_TransactionDB_getDeadlockInfoBuffer( */ void Java_org_rocksdb_TransactionDB_setDeadlockInfoBufferSize( JNIEnv*, jobject, jlong jhandle, jint jdeadlock_info_buffer_size) { - auto* txn_db = reinterpret_cast(jhandle); + auto* txn_db = reinterpret_cast(jhandle); txn_db->SetDeadlockInfoBufferSize(jdeadlock_info_buffer_size); } diff --git a/java/rocksjni/transaction_db_options.cc b/java/rocksjni/transaction_db_options.cc index 391accc375..c64ff94562 100644 --- a/java/rocksjni/transaction_db_options.cc +++ b/java/rocksjni/transaction_db_options.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ -// for rocksdb::TransactionDBOptions. +// for ROCKSDB_NAMESPACE::TransactionDBOptions. #include @@ -21,7 +21,8 @@ */ jlong Java_org_rocksdb_TransactionDBOptions_newTransactionDBOptions( JNIEnv* /*env*/, jclass /*jcls*/) { - rocksdb::TransactionDBOptions* opts = new rocksdb::TransactionDBOptions(); + ROCKSDB_NAMESPACE::TransactionDBOptions* opts = + new ROCKSDB_NAMESPACE::TransactionDBOptions(); return reinterpret_cast(opts); } @@ -33,7 +34,8 @@ jlong Java_org_rocksdb_TransactionDBOptions_newTransactionDBOptions( jlong Java_org_rocksdb_TransactionDBOptions_getMaxNumLocks(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); return opts->max_num_locks; } @@ -44,7 +46,8 @@ jlong Java_org_rocksdb_TransactionDBOptions_getMaxNumLocks(JNIEnv* /*env*/, */ void Java_org_rocksdb_TransactionDBOptions_setMaxNumLocks( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jmax_num_locks) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->max_num_locks = jmax_num_locks; } @@ -56,7 +59,8 @@ void Java_org_rocksdb_TransactionDBOptions_setMaxNumLocks( jlong Java_org_rocksdb_TransactionDBOptions_getNumStripes(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); return opts->num_stripes; } @@ -69,7 +73,8 @@ void Java_org_rocksdb_TransactionDBOptions_setNumStripes(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jnum_stripes) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->num_stripes = jnum_stripes; } @@ -80,7 +85,8 @@ void Java_org_rocksdb_TransactionDBOptions_setNumStripes(JNIEnv* /*env*/, */ jlong Java_org_rocksdb_TransactionDBOptions_getTransactionLockTimeout( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); return opts->transaction_lock_timeout; } @@ -92,7 +98,8 @@ jlong Java_org_rocksdb_TransactionDBOptions_getTransactionLockTimeout( void Java_org_rocksdb_TransactionDBOptions_setTransactionLockTimeout( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jtransaction_lock_timeout) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->transaction_lock_timeout = jtransaction_lock_timeout; } @@ -103,7 +110,8 @@ void Java_org_rocksdb_TransactionDBOptions_setTransactionLockTimeout( */ jlong Java_org_rocksdb_TransactionDBOptions_getDefaultLockTimeout( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); return opts->default_lock_timeout; } @@ -115,7 +123,8 @@ jlong Java_org_rocksdb_TransactionDBOptions_getDefaultLockTimeout( void Java_org_rocksdb_TransactionDBOptions_setDefaultLockTimeout( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jdefault_lock_timeout) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->default_lock_timeout = jdefault_lock_timeout; } @@ -127,8 +136,9 @@ void Java_org_rocksdb_TransactionDBOptions_setDefaultLockTimeout( jbyte Java_org_rocksdb_TransactionDBOptions_getWritePolicy(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); - return rocksdb::TxnDBWritePolicyJni::toJavaTxnDBWritePolicy( + auto* opts = + reinterpret_cast(jhandle); + return ROCKSDB_NAMESPACE::TxnDBWritePolicyJni::toJavaTxnDBWritePolicy( opts->write_policy); } @@ -141,9 +151,11 @@ void Java_org_rocksdb_TransactionDBOptions_setWritePolicy(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jbyte jwrite_policy) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->write_policy = - rocksdb::TxnDBWritePolicyJni::toCppTxnDBWritePolicy(jwrite_policy); + ROCKSDB_NAMESPACE::TxnDBWritePolicyJni::toCppTxnDBWritePolicy( + jwrite_policy); } /* @@ -154,5 +166,5 @@ void Java_org_rocksdb_TransactionDBOptions_setWritePolicy(JNIEnv* /*env*/, void Java_org_rocksdb_TransactionDBOptions_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - delete reinterpret_cast(jhandle); + delete reinterpret_cast(jhandle); } diff --git a/java/rocksjni/transaction_log.cc b/java/rocksjni/transaction_log.cc index 8186a846bd..aa57211eb6 100644 --- a/java/rocksjni/transaction_log.cc +++ b/java/rocksjni/transaction_log.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::Iterator methods from Java side. +// calling c++ ROCKSDB_NAMESPACE::Iterator methods from Java side. #include #include @@ -22,7 +22,7 @@ void Java_org_rocksdb_TransactionLogIterator_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - delete reinterpret_cast(handle); + delete reinterpret_cast(handle); } /* @@ -33,7 +33,8 @@ void Java_org_rocksdb_TransactionLogIterator_disposeInternal(JNIEnv* /*env*/, jboolean Java_org_rocksdb_TransactionLogIterator_isValid(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - return reinterpret_cast(handle)->Valid(); + return reinterpret_cast(handle) + ->Valid(); } /* @@ -44,7 +45,7 @@ jboolean Java_org_rocksdb_TransactionLogIterator_isValid(JNIEnv* /*env*/, void Java_org_rocksdb_TransactionLogIterator_next(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->Next(); + reinterpret_cast(handle)->Next(); } /* @@ -55,10 +56,11 @@ void Java_org_rocksdb_TransactionLogIterator_next(JNIEnv* /*env*/, void Java_org_rocksdb_TransactionLogIterator_status(JNIEnv* env, jobject /*jobj*/, jlong handle) { - rocksdb::Status s = - reinterpret_cast(handle)->status(); + ROCKSDB_NAMESPACE::Status s = + reinterpret_cast(handle) + ->status(); if (!s.ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } } @@ -70,7 +72,8 @@ void Java_org_rocksdb_TransactionLogIterator_status(JNIEnv* env, jobject Java_org_rocksdb_TransactionLogIterator_getBatch(JNIEnv* env, jobject /*jobj*/, jlong handle) { - rocksdb::BatchResult batch_result = - reinterpret_cast(handle)->GetBatch(); - return rocksdb::BatchResultJni::construct(env, batch_result); + ROCKSDB_NAMESPACE::BatchResult batch_result = + reinterpret_cast(handle) + ->GetBatch(); + return ROCKSDB_NAMESPACE::BatchResultJni::construct(env, batch_result); } diff --git a/java/rocksjni/transaction_notifier.cc b/java/rocksjni/transaction_notifier.cc index b60076e100..4e42af359d 100644 --- a/java/rocksjni/transaction_notifier.cc +++ b/java/rocksjni/transaction_notifier.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ -// for rocksdb::TransactionNotifier. +// for ROCKSDB_NAMESPACE::TransactionNotifier. #include @@ -19,9 +19,9 @@ jlong Java_org_rocksdb_AbstractTransactionNotifier_createNewTransactionNotifier( JNIEnv* env, jobject jobj) { auto* transaction_notifier = - new rocksdb::TransactionNotifierJniCallback(env, jobj); + new ROCKSDB_NAMESPACE::TransactionNotifierJniCallback(env, jobj); auto* sptr_transaction_notifier = - new std::shared_ptr( + new std::shared_ptr( transaction_notifier); return reinterpret_cast(sptr_transaction_notifier); } @@ -35,8 +35,9 @@ void Java_org_rocksdb_AbstractTransactionNotifier_disposeInternal( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { // TODO(AR) refactor to use JniCallback::JniCallback // when https://github.com/facebook/rocksdb/pull/1241/ is merged - std::shared_ptr* handle = + std::shared_ptr* handle = reinterpret_cast< - std::shared_ptr*>(jhandle); + std::shared_ptr*>( + jhandle); delete handle; } diff --git a/java/rocksjni/transaction_notifier_jnicallback.cc b/java/rocksjni/transaction_notifier_jnicallback.cc index 85f2a194be..06b62ad6df 100644 --- a/java/rocksjni/transaction_notifier_jnicallback.cc +++ b/java/rocksjni/transaction_notifier_jnicallback.cc @@ -4,12 +4,12 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::TransactionNotifier. +// ROCKSDB_NAMESPACE::TransactionNotifier. #include "rocksjni/transaction_notifier_jnicallback.h" #include "rocksjni/portal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { TransactionNotifierJniCallback::TransactionNotifierJniCallback(JNIEnv* env, jobject jtransaction_notifier) : JniCallback(env, jtransaction_notifier) { @@ -36,4 +36,4 @@ void TransactionNotifierJniCallback::SnapshotCreated( releaseJniEnv(attached_thread); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/transaction_notifier_jnicallback.h b/java/rocksjni/transaction_notifier_jnicallback.h index 8f67cdb8bc..b3155b5a33 100644 --- a/java/rocksjni/transaction_notifier_jnicallback.h +++ b/java/rocksjni/transaction_notifier_jnicallback.h @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::TransactionNotifier. +// ROCKSDB_NAMESPACE::TransactionNotifier. #ifndef JAVA_ROCKSJNI_TRANSACTION_NOTIFIER_JNICALLBACK_H_ #define JAVA_ROCKSJNI_TRANSACTION_NOTIFIER_JNICALLBACK_H_ @@ -14,7 +14,7 @@ #include "rocksdb/utilities/transaction.h" #include "rocksjni/jnicallback.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { /** * This class acts as a bridge between C++ @@ -37,6 +37,6 @@ class TransactionNotifierJniCallback: public JniCallback, private: jmethodID m_jsnapshot_created_methodID; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_TRANSACTION_NOTIFIER_JNICALLBACK_H_ diff --git a/java/rocksjni/transaction_options.cc b/java/rocksjni/transaction_options.cc index d18a5294af..0544f255ec 100644 --- a/java/rocksjni/transaction_options.cc +++ b/java/rocksjni/transaction_options.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ -// for rocksdb::TransactionOptions. +// for ROCKSDB_NAMESPACE::TransactionOptions. #include @@ -19,7 +19,7 @@ */ jlong Java_org_rocksdb_TransactionOptions_newTransactionOptions( JNIEnv* /*env*/, jclass /*jcls*/) { - auto* opts = new rocksdb::TransactionOptions(); + auto* opts = new ROCKSDB_NAMESPACE::TransactionOptions(); return reinterpret_cast(opts); } @@ -31,7 +31,8 @@ jlong Java_org_rocksdb_TransactionOptions_newTransactionOptions( jboolean Java_org_rocksdb_TransactionOptions_isSetSnapshot(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); return opts->set_snapshot; } @@ -42,7 +43,8 @@ jboolean Java_org_rocksdb_TransactionOptions_isSetSnapshot(JNIEnv* /*env*/, */ void Java_org_rocksdb_TransactionOptions_setSetSnapshot( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean jset_snapshot) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->set_snapshot = jset_snapshot; } @@ -54,7 +56,8 @@ void Java_org_rocksdb_TransactionOptions_setSetSnapshot( jboolean Java_org_rocksdb_TransactionOptions_isDeadlockDetect(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); return opts->deadlock_detect; } @@ -66,7 +69,8 @@ jboolean Java_org_rocksdb_TransactionOptions_isDeadlockDetect(JNIEnv* /*env*/, void Java_org_rocksdb_TransactionOptions_setDeadlockDetect( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean jdeadlock_detect) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->deadlock_detect = jdeadlock_detect; } @@ -78,7 +82,8 @@ void Java_org_rocksdb_TransactionOptions_setDeadlockDetect( jlong Java_org_rocksdb_TransactionOptions_getLockTimeout(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); return opts->lock_timeout; } @@ -91,7 +96,8 @@ void Java_org_rocksdb_TransactionOptions_setLockTimeout(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jlock_timeout) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->lock_timeout = jlock_timeout; } @@ -103,7 +109,8 @@ void Java_org_rocksdb_TransactionOptions_setLockTimeout(JNIEnv* /*env*/, jlong Java_org_rocksdb_TransactionOptions_getExpiration(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); return opts->expiration; } @@ -116,7 +123,8 @@ void Java_org_rocksdb_TransactionOptions_setExpiration(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jexpiration) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->expiration = jexpiration; } @@ -127,7 +135,8 @@ void Java_org_rocksdb_TransactionOptions_setExpiration(JNIEnv* /*env*/, */ jlong Java_org_rocksdb_TransactionOptions_getDeadlockDetectDepth( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); return opts->deadlock_detect_depth; } @@ -139,7 +148,8 @@ jlong Java_org_rocksdb_TransactionOptions_getDeadlockDetectDepth( void Java_org_rocksdb_TransactionOptions_setDeadlockDetectDepth( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jdeadlock_detect_depth) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->deadlock_detect_depth = jdeadlock_detect_depth; } @@ -151,7 +161,8 @@ void Java_org_rocksdb_TransactionOptions_setDeadlockDetectDepth( jlong Java_org_rocksdb_TransactionOptions_getMaxWriteBatchSize(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); return opts->max_write_batch_size; } @@ -163,7 +174,8 @@ jlong Java_org_rocksdb_TransactionOptions_getMaxWriteBatchSize(JNIEnv* /*env*/, void Java_org_rocksdb_TransactionOptions_setMaxWriteBatchSize( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jlong jmax_write_batch_size) { - auto* opts = reinterpret_cast(jhandle); + auto* opts = + reinterpret_cast(jhandle); opts->max_write_batch_size = jmax_write_batch_size; } @@ -175,5 +187,5 @@ void Java_org_rocksdb_TransactionOptions_setMaxWriteBatchSize( void Java_org_rocksdb_TransactionOptions_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - delete reinterpret_cast(jhandle); + delete reinterpret_cast(jhandle); } diff --git a/java/rocksjni/ttl.cc b/java/rocksjni/ttl.cc index 4b071e7b33..77d17c82a3 100644 --- a/java/rocksjni/ttl.cc +++ b/java/rocksjni/ttl.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::TtlDB methods. +// calling c++ ROCKSDB_NAMESPACE::TtlDB methods. // from Java side. #include @@ -32,10 +32,10 @@ jlong Java_org_rocksdb_TtlDB_open( return 0; } - auto* opt = reinterpret_cast(joptions_handle); - rocksdb::DBWithTTL* db = nullptr; - rocksdb::Status s = - rocksdb::DBWithTTL::Open(*opt, db_path, &db, jttl, jread_only); + auto* opt = reinterpret_cast(joptions_handle); + ROCKSDB_NAMESPACE::DBWithTTL* db = nullptr; + ROCKSDB_NAMESPACE::Status s = + ROCKSDB_NAMESPACE::DBWithTTL::Open(*opt, db_path, &db, jttl, jread_only); env->ReleaseStringUTFChars(jdb_path, db_path); // as TTLDB extends RocksDB on the java side, we can reuse @@ -43,7 +43,7 @@ jlong Java_org_rocksdb_TtlDB_open( if (s.ok()) { return reinterpret_cast(db); } else { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return 0; } } @@ -71,18 +71,18 @@ jlongArray Java_org_rocksdb_TtlDB_openCF( return nullptr; } - std::vector column_families; + std::vector column_families; jboolean has_exception = JNI_FALSE; - rocksdb::JniUtil::byteStrings( + ROCKSDB_NAMESPACE::JniUtil::byteStrings( env, jcolumn_names, [](const char* str_data, const size_t str_len) { return std::string(str_data, str_len); }, [&jco, &column_families](size_t idx, std::string cf_name) { - rocksdb::ColumnFamilyOptions* cf_options = - reinterpret_cast(jco[idx]); + ROCKSDB_NAMESPACE::ColumnFamilyOptions* cf_options = + reinterpret_cast(jco[idx]); column_families.push_back( - rocksdb::ColumnFamilyDescriptor(cf_name, *cf_options)); + ROCKSDB_NAMESPACE::ColumnFamilyDescriptor(cf_name, *cf_options)); }, &has_exception); @@ -107,10 +107,10 @@ jlongArray Java_org_rocksdb_TtlDB_openCF( } env->ReleaseIntArrayElements(jttls, jttlv, JNI_ABORT); - auto* opt = reinterpret_cast(jopt_handle); - std::vector handles; - rocksdb::DBWithTTL* db = nullptr; - rocksdb::Status s = rocksdb::DBWithTTL::Open( + auto* opt = reinterpret_cast(jopt_handle); + std::vector handles; + ROCKSDB_NAMESPACE::DBWithTTL* db = nullptr; + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::DBWithTTL::Open( *opt, db_path, column_families, &handles, &db, ttl_values, jread_only); // we have now finished with db_path @@ -141,7 +141,7 @@ jlongArray Java_org_rocksdb_TtlDB_openCF( return jresults; } else { - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return NULL; } } @@ -153,7 +153,7 @@ jlongArray Java_org_rocksdb_TtlDB_openCF( */ void Java_org_rocksdb_TtlDB_disposeInternal( JNIEnv*, jobject, jlong jhandle) { - auto* ttl_db = reinterpret_cast(jhandle); + auto* ttl_db = reinterpret_cast(jhandle); assert(ttl_db != nullptr); delete ttl_db; } @@ -165,10 +165,10 @@ void Java_org_rocksdb_TtlDB_disposeInternal( */ void Java_org_rocksdb_TtlDB_closeDatabase( JNIEnv* /* env */, jclass, jlong /* jhandle */) { - //auto* ttl_db = reinterpret_cast(jhandle); - //assert(ttl_db != nullptr); - //rocksdb::Status s = ttl_db->Close(); - //rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + // auto* ttl_db = reinterpret_cast(jhandle); + // assert(ttl_db != nullptr); + // ROCKSDB_NAMESPACE::Status s = ttl_db->Close(); + // ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); //TODO(AR) this is disabled until https://github.com/facebook/rocksdb/issues/4818 is resolved! } @@ -188,12 +188,12 @@ jlong Java_org_rocksdb_TtlDB_createColumnFamilyWithTtl( } const jsize len = env->GetArrayLength(jcolumn_name); - auto* cfOptions = - reinterpret_cast(jcolumn_options); + auto* cfOptions = reinterpret_cast( + jcolumn_options); - auto* db_handle = reinterpret_cast(jdb_handle); - rocksdb::ColumnFamilyHandle* handle; - rocksdb::Status s = db_handle->CreateColumnFamilyWithTtl( + auto* db_handle = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::ColumnFamilyHandle* handle; + ROCKSDB_NAMESPACE::Status s = db_handle->CreateColumnFamilyWithTtl( *cfOptions, std::string(reinterpret_cast(cfname), len), &handle, jttl); @@ -202,6 +202,6 @@ jlong Java_org_rocksdb_TtlDB_createColumnFamilyWithTtl( if (s.ok()) { return reinterpret_cast(handle); } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return 0; } diff --git a/java/rocksjni/wal_filter.cc b/java/rocksjni/wal_filter.cc index c74e54252e..e4040b1f82 100644 --- a/java/rocksjni/wal_filter.cc +++ b/java/rocksjni/wal_filter.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ for -// rocksdb::WalFilter. +// ROCKSDB_NAMESPACE::WalFilter. #include @@ -18,6 +18,6 @@ */ jlong Java_org_rocksdb_AbstractWalFilter_createNewWalFilter( JNIEnv* env, jobject jobj) { - auto* wal_filter = new rocksdb::WalFilterJniCallback(env, jobj); + auto* wal_filter = new ROCKSDB_NAMESPACE::WalFilterJniCallback(env, jobj); return reinterpret_cast(wal_filter); -} \ No newline at end of file +} diff --git a/java/rocksjni/wal_filter_jnicallback.cc b/java/rocksjni/wal_filter_jnicallback.cc index 8fd909258f..48fe2d5059 100644 --- a/java/rocksjni/wal_filter_jnicallback.cc +++ b/java/rocksjni/wal_filter_jnicallback.cc @@ -4,12 +4,12 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::WalFilter. +// ROCKSDB_NAMESPACE::WalFilter. #include "rocksjni/wal_filter_jnicallback.h" #include "rocksjni/portal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { WalFilterJniCallback::WalFilterJniCallback( JNIEnv* env, jobject jwal_filter) : JniCallback(env, jwal_filter) { @@ -58,7 +58,7 @@ void WalFilterJniCallback::ColumnFamilyLogNumberMap( } jobject jcf_lognumber_map = - rocksdb::HashMapJni::fromCppMap(env, &cf_lognumber_map); + ROCKSDB_NAMESPACE::HashMapJni::fromCppMap(env, &cf_lognumber_map); if (jcf_lognumber_map == nullptr) { // exception occurred env->ExceptionDescribe(); // print out exception to stderr @@ -67,7 +67,7 @@ void WalFilterJniCallback::ColumnFamilyLogNumberMap( } jobject jcf_name_id_map = - rocksdb::HashMapJni::fromCppMap(env, &cf_name_id_map); + ROCKSDB_NAMESPACE::HashMapJni::fromCppMap(env, &cf_name_id_map); if (jcf_name_id_map == nullptr) { // exception occurred env->ExceptionDescribe(); // print out exception to stderr @@ -141,4 +141,4 @@ const char* WalFilterJniCallback::Name() const { return m_name.get(); } -} // namespace rocksdb \ No newline at end of file +} // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/wal_filter_jnicallback.h b/java/rocksjni/wal_filter_jnicallback.h index df6394cef2..b575ddc62f 100644 --- a/java/rocksjni/wal_filter_jnicallback.h +++ b/java/rocksjni/wal_filter_jnicallback.h @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::WalFilter. +// ROCKSDB_NAMESPACE::WalFilter. #ifndef JAVA_ROCKSJNI_WAL_FILTER_JNICALLBACK_H_ #define JAVA_ROCKSJNI_WAL_FILTER_JNICALLBACK_H_ @@ -17,7 +17,7 @@ #include "rocksdb/wal_filter.h" #include "rocksjni/jnicallback.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WalFilterJniCallback : public JniCallback, public WalFilter { public: @@ -37,6 +37,6 @@ class WalFilterJniCallback : public JniCallback, public WalFilter { jmethodID m_log_record_found_proxy_mid; }; -} //namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_WAL_FILTER_JNICALLBACK_H_ diff --git a/java/rocksjni/write_batch.cc b/java/rocksjni/write_batch.cc index a9b6981d53..4ef8035c4a 100644 --- a/java/rocksjni/write_batch.cc +++ b/java/rocksjni/write_batch.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::WriteBatch methods from Java side. +// calling c++ ROCKSDB_NAMESPACE::WriteBatch methods from Java side. #include #include "db/memtable.h" @@ -30,7 +30,8 @@ jlong Java_org_rocksdb_WriteBatch_newWriteBatch__I(JNIEnv* /*env*/, jclass /*jcls*/, jint jreserved_bytes) { - auto* wb = new rocksdb::WriteBatch(static_cast(jreserved_bytes)); + auto* wb = + new ROCKSDB_NAMESPACE::WriteBatch(static_cast(jreserved_bytes)); return reinterpret_cast(wb); } @@ -44,7 +45,7 @@ jlong Java_org_rocksdb_WriteBatch_newWriteBatch___3BI(JNIEnv* env, jbyteArray jserialized, jint jserialized_length) { jboolean has_exception = JNI_FALSE; - std::string serialized = rocksdb::JniUtil::byteString( + std::string serialized = ROCKSDB_NAMESPACE::JniUtil::byteString( env, jserialized, jserialized_length, [](const char* str, const size_t len) { return std::string(str, len); }, &has_exception); @@ -53,7 +54,7 @@ jlong Java_org_rocksdb_WriteBatch_newWriteBatch___3BI(JNIEnv* env, return 0; } - auto* wb = new rocksdb::WriteBatch(serialized); + auto* wb = new ROCKSDB_NAMESPACE::WriteBatch(serialized); return reinterpret_cast(wb); } @@ -64,7 +65,7 @@ jlong Java_org_rocksdb_WriteBatch_newWriteBatch___3BI(JNIEnv* env, */ jint Java_org_rocksdb_WriteBatch_count0(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); return static_cast(wb->Count()); @@ -77,7 +78,7 @@ jint Java_org_rocksdb_WriteBatch_count0(JNIEnv* /*env*/, jobject /*jobj*/, */ void Java_org_rocksdb_WriteBatch_clear0(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); wb->Clear(); @@ -91,7 +92,7 @@ void Java_org_rocksdb_WriteBatch_clear0(JNIEnv* /*env*/, jobject /*jobj*/, void Java_org_rocksdb_WriteBatch_setSavePoint0(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); wb->SetSavePoint(); @@ -105,7 +106,7 @@ void Java_org_rocksdb_WriteBatch_setSavePoint0(JNIEnv* /*env*/, void Java_org_rocksdb_WriteBatch_rollbackToSavePoint0(JNIEnv* env, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); auto s = wb->RollbackToSavePoint(); @@ -113,7 +114,7 @@ void Java_org_rocksdb_WriteBatch_rollbackToSavePoint0(JNIEnv* env, if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -123,7 +124,7 @@ void Java_org_rocksdb_WriteBatch_rollbackToSavePoint0(JNIEnv* env, */ void Java_org_rocksdb_WriteBatch_popSavePoint(JNIEnv* env, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); auto s = wb->PopSavePoint(); @@ -131,7 +132,7 @@ void Java_org_rocksdb_WriteBatch_popSavePoint(JNIEnv* env, jobject /*jobj*/, if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -142,7 +143,7 @@ void Java_org_rocksdb_WriteBatch_popSavePoint(JNIEnv* env, jobject /*jobj*/, void Java_org_rocksdb_WriteBatch_setMaxBytes(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle, jlong jmax_bytes) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); wb->SetMaxBytes(static_cast(jmax_bytes)); @@ -158,15 +159,17 @@ void Java_org_rocksdb_WriteBatch_put__J_3BI_3BI(JNIEnv* env, jobject jobj, jbyteArray jkey, jint jkey_len, jbyteArray jentry_value, jint jentry_value_len) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto put = [&wb](rocksdb::Slice key, rocksdb::Slice value) { + auto put = [&wb](ROCKSDB_NAMESPACE::Slice key, + ROCKSDB_NAMESPACE::Slice value) { return wb->Put(key, value); }; - std::unique_ptr status = rocksdb::JniUtil::kv_op( - put, env, jobj, jkey, jkey_len, jentry_value, jentry_value_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(put, env, jobj, jkey, jkey_len, + jentry_value, jentry_value_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -178,17 +181,20 @@ void Java_org_rocksdb_WriteBatch_put__J_3BI_3BI(JNIEnv* env, jobject jobj, void Java_org_rocksdb_WriteBatch_put__J_3BI_3BIJ( JNIEnv* env, jobject jobj, jlong jwb_handle, jbyteArray jkey, jint jkey_len, jbyteArray jentry_value, jint jentry_value_len, jlong jcf_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); assert(cf_handle != nullptr); - auto put = [&wb, &cf_handle](rocksdb::Slice key, rocksdb::Slice value) { + auto put = [&wb, &cf_handle](ROCKSDB_NAMESPACE::Slice key, + ROCKSDB_NAMESPACE::Slice value) { return wb->Put(cf_handle, key, value); }; - std::unique_ptr status = rocksdb::JniUtil::kv_op( - put, env, jobj, jkey, jkey_len, jentry_value, jentry_value_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(put, env, jobj, jkey, jkey_len, + jentry_value, jentry_value_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -202,18 +208,20 @@ void Java_org_rocksdb_WriteBatch_putDirect(JNIEnv* env, jobject /*jobj*/, jint jkey_offset, jint jkey_len, jobject jval, jint jval_offset, jint jval_len, jlong jcf_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); - auto put = [&wb, &cf_handle](rocksdb::Slice& key, rocksdb::Slice& value) { + auto* cf_handle = + reinterpret_cast(jcf_handle); + auto put = [&wb, &cf_handle](ROCKSDB_NAMESPACE::Slice& key, + ROCKSDB_NAMESPACE::Slice& value) { if (cf_handle == nullptr) { wb->Put(key, value); } else { wb->Put(cf_handle, key, value); } }; - rocksdb::JniUtil::kv_op_direct(put, env, jkey, jkey_offset, jkey_len, jval, - jval_offset, jval_len); + ROCKSDB_NAMESPACE::JniUtil::kv_op_direct( + put, env, jkey, jkey_offset, jkey_len, jval, jval_offset, jval_len); } /* @@ -224,15 +232,17 @@ void Java_org_rocksdb_WriteBatch_putDirect(JNIEnv* env, jobject /*jobj*/, void Java_org_rocksdb_WriteBatch_merge__J_3BI_3BI( JNIEnv* env, jobject jobj, jlong jwb_handle, jbyteArray jkey, jint jkey_len, jbyteArray jentry_value, jint jentry_value_len) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto merge = [&wb](rocksdb::Slice key, rocksdb::Slice value) { + auto merge = [&wb](ROCKSDB_NAMESPACE::Slice key, + ROCKSDB_NAMESPACE::Slice value) { return wb->Merge(key, value); }; - std::unique_ptr status = rocksdb::JniUtil::kv_op( - merge, env, jobj, jkey, jkey_len, jentry_value, jentry_value_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(merge, env, jobj, jkey, jkey_len, + jentry_value, jentry_value_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -244,17 +254,20 @@ void Java_org_rocksdb_WriteBatch_merge__J_3BI_3BI( void Java_org_rocksdb_WriteBatch_merge__J_3BI_3BIJ( JNIEnv* env, jobject jobj, jlong jwb_handle, jbyteArray jkey, jint jkey_len, jbyteArray jentry_value, jint jentry_value_len, jlong jcf_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); assert(cf_handle != nullptr); - auto merge = [&wb, &cf_handle](rocksdb::Slice key, rocksdb::Slice value) { + auto merge = [&wb, &cf_handle](ROCKSDB_NAMESPACE::Slice key, + ROCKSDB_NAMESPACE::Slice value) { return wb->Merge(cf_handle, key, value); }; - std::unique_ptr status = rocksdb::JniUtil::kv_op( - merge, env, jobj, jkey, jkey_len, jentry_value, jentry_value_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(merge, env, jobj, jkey, jkey_len, + jentry_value, jentry_value_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -266,13 +279,13 @@ void Java_org_rocksdb_WriteBatch_merge__J_3BI_3BIJ( void Java_org_rocksdb_WriteBatch_delete__J_3BI(JNIEnv* env, jobject jobj, jlong jwb_handle, jbyteArray jkey, jint jkey_len) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto remove = [&wb](rocksdb::Slice key) { return wb->Delete(key); }; - std::unique_ptr status = - rocksdb::JniUtil::k_op(remove, env, jobj, jkey, jkey_len); + auto remove = [&wb](ROCKSDB_NAMESPACE::Slice key) { return wb->Delete(key); }; + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::k_op(remove, env, jobj, jkey, jkey_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -285,17 +298,18 @@ void Java_org_rocksdb_WriteBatch_delete__J_3BIJ(JNIEnv* env, jobject jobj, jlong jwb_handle, jbyteArray jkey, jint jkey_len, jlong jcf_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); assert(cf_handle != nullptr); - auto remove = [&wb, &cf_handle](rocksdb::Slice key) { + auto remove = [&wb, &cf_handle](ROCKSDB_NAMESPACE::Slice key) { return wb->Delete(cf_handle, key); }; - std::unique_ptr status = - rocksdb::JniUtil::k_op(remove, env, jobj, jkey, jkey_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::k_op(remove, env, jobj, jkey, jkey_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -308,15 +322,16 @@ void Java_org_rocksdb_WriteBatch_singleDelete__J_3BI(JNIEnv* env, jobject jobj, jlong jwb_handle, jbyteArray jkey, jint jkey_len) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto single_delete = [&wb](rocksdb::Slice key) { + auto single_delete = [&wb](ROCKSDB_NAMESPACE::Slice key) { return wb->SingleDelete(key); }; - std::unique_ptr status = - rocksdb::JniUtil::k_op(single_delete, env, jobj, jkey, jkey_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::k_op(single_delete, env, jobj, jkey, + jkey_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -330,17 +345,19 @@ void Java_org_rocksdb_WriteBatch_singleDelete__J_3BIJ(JNIEnv* env, jobject jobj, jbyteArray jkey, jint jkey_len, jlong jcf_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); assert(cf_handle != nullptr); - auto single_delete = [&wb, &cf_handle](rocksdb::Slice key) { + auto single_delete = [&wb, &cf_handle](ROCKSDB_NAMESPACE::Slice key) { return wb->SingleDelete(cf_handle, key); }; - std::unique_ptr status = - rocksdb::JniUtil::k_op(single_delete, env, jobj, jkey, jkey_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::k_op(single_delete, env, jobj, jkey, + jkey_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -353,17 +370,19 @@ void Java_org_rocksdb_WriteBatch_removeDirect(JNIEnv* env, jobject /*jobj*/, jlong jwb_handle, jobject jkey, jint jkey_offset, jint jkey_len, jlong jcf_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); - auto remove = [&wb, &cf_handle](rocksdb::Slice& key) { + auto* cf_handle = + reinterpret_cast(jcf_handle); + auto remove = [&wb, &cf_handle](ROCKSDB_NAMESPACE::Slice& key) { if (cf_handle == nullptr) { wb->Delete(key); } else { wb->Delete(cf_handle, key); } }; - rocksdb::JniUtil::k_op_direct(remove, env, jkey, jkey_offset, jkey_len); + ROCKSDB_NAMESPACE::JniUtil::k_op_direct(remove, env, jkey, jkey_offset, + jkey_len); } /* @@ -374,16 +393,17 @@ void Java_org_rocksdb_WriteBatch_removeDirect(JNIEnv* env, jobject /*jobj*/, void Java_org_rocksdb_WriteBatch_deleteRange__J_3BI_3BI( JNIEnv* env, jobject jobj, jlong jwb_handle, jbyteArray jbegin_key, jint jbegin_key_len, jbyteArray jend_key, jint jend_key_len) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto deleteRange = [&wb](rocksdb::Slice beginKey, rocksdb::Slice endKey) { + auto deleteRange = [&wb](ROCKSDB_NAMESPACE::Slice beginKey, + ROCKSDB_NAMESPACE::Slice endKey) { return wb->DeleteRange(beginKey, endKey); }; - std::unique_ptr status = - rocksdb::JniUtil::kv_op(deleteRange, env, jobj, jbegin_key, - jbegin_key_len, jend_key, jend_key_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(deleteRange, env, jobj, jbegin_key, + jbegin_key_len, jend_key, jend_key_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -396,19 +416,20 @@ void Java_org_rocksdb_WriteBatch_deleteRange__J_3BI_3BIJ( JNIEnv* env, jobject jobj, jlong jwb_handle, jbyteArray jbegin_key, jint jbegin_key_len, jbyteArray jend_key, jint jend_key_len, jlong jcf_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); assert(cf_handle != nullptr); - auto deleteRange = [&wb, &cf_handle](rocksdb::Slice beginKey, - rocksdb::Slice endKey) { + auto deleteRange = [&wb, &cf_handle](ROCKSDB_NAMESPACE::Slice beginKey, + ROCKSDB_NAMESPACE::Slice endKey) { return wb->DeleteRange(cf_handle, beginKey, endKey); }; - std::unique_ptr status = - rocksdb::JniUtil::kv_op(deleteRange, env, jobj, jbegin_key, - jbegin_key_len, jend_key, jend_key_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(deleteRange, env, jobj, jbegin_key, + jbegin_key_len, jend_key, jend_key_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -420,13 +441,15 @@ void Java_org_rocksdb_WriteBatch_deleteRange__J_3BI_3BIJ( void Java_org_rocksdb_WriteBatch_putLogData(JNIEnv* env, jobject jobj, jlong jwb_handle, jbyteArray jblob, jint jblob_len) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto putLogData = [&wb](rocksdb::Slice blob) { return wb->PutLogData(blob); }; - std::unique_ptr status = - rocksdb::JniUtil::k_op(putLogData, env, jobj, jblob, jblob_len); + auto putLogData = [&wb](ROCKSDB_NAMESPACE::Slice blob) { + return wb->PutLogData(blob); + }; + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::k_op(putLogData, env, jobj, jblob, jblob_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -438,16 +461,17 @@ void Java_org_rocksdb_WriteBatch_putLogData(JNIEnv* env, jobject jobj, void Java_org_rocksdb_WriteBatch_iterate(JNIEnv* env, jobject /*jobj*/, jlong jwb_handle, jlong handlerHandle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - rocksdb::Status s = wb->Iterate( - reinterpret_cast(handlerHandle)); + ROCKSDB_NAMESPACE::Status s = wb->Iterate( + reinterpret_cast( + handlerHandle)); if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -457,11 +481,11 @@ void Java_org_rocksdb_WriteBatch_iterate(JNIEnv* env, jobject /*jobj*/, */ jbyteArray Java_org_rocksdb_WriteBatch_data(JNIEnv* env, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); auto data = wb->Data(); - return rocksdb::JniUtil::copyBytes(env, data); + return ROCKSDB_NAMESPACE::JniUtil::copyBytes(env, data); } /* @@ -471,7 +495,7 @@ jbyteArray Java_org_rocksdb_WriteBatch_data(JNIEnv* env, jobject /*jobj*/, */ jlong Java_org_rocksdb_WriteBatch_getDataSize(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); auto data_size = wb->GetDataSize(); @@ -485,7 +509,7 @@ jlong Java_org_rocksdb_WriteBatch_getDataSize(JNIEnv* /*env*/, jobject /*jobj*/, */ jboolean Java_org_rocksdb_WriteBatch_hasPut(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); return wb->HasPut(); @@ -499,7 +523,7 @@ jboolean Java_org_rocksdb_WriteBatch_hasPut(JNIEnv* /*env*/, jobject /*jobj*/, jboolean Java_org_rocksdb_WriteBatch_hasDelete(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); return wb->HasDelete(); @@ -512,7 +536,7 @@ jboolean Java_org_rocksdb_WriteBatch_hasDelete(JNIEnv* /*env*/, */ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasSingleDelete( JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); return wb->HasSingleDelete(); @@ -525,7 +549,7 @@ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasSingleDelete( */ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasDeleteRange( JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); return wb->HasDeleteRange(); @@ -538,7 +562,7 @@ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasDeleteRange( */ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasMerge( JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); return wb->HasMerge(); @@ -551,7 +575,7 @@ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasMerge( */ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasBeginPrepare( JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); return wb->HasBeginPrepare(); @@ -564,7 +588,7 @@ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasBeginPrepare( */ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasEndPrepare( JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); return wb->HasEndPrepare(); @@ -577,7 +601,7 @@ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasEndPrepare( */ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasCommit( JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); return wb->HasCommit(); @@ -590,7 +614,7 @@ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasCommit( */ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasRollback( JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); return wb->HasRollback(); @@ -604,7 +628,7 @@ JNIEXPORT jboolean JNICALL Java_org_rocksdb_WriteBatch_hasRollback( void Java_org_rocksdb_WriteBatch_markWalTerminationPoint(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); wb->MarkWalTerminationPoint(); @@ -618,11 +642,11 @@ void Java_org_rocksdb_WriteBatch_markWalTerminationPoint(JNIEnv* /*env*/, jobject Java_org_rocksdb_WriteBatch_getWalTerminationPoint(JNIEnv* env, jobject /*jobj*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); auto save_point = wb->GetWalTerminationPoint(); - return rocksdb::WriteBatchSavePointJni::construct(env, save_point); + return ROCKSDB_NAMESPACE::WriteBatchSavePointJni::construct(env, save_point); } /* @@ -633,7 +657,7 @@ jobject Java_org_rocksdb_WriteBatch_getWalTerminationPoint(JNIEnv* env, void Java_org_rocksdb_WriteBatch_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - auto* wb = reinterpret_cast(handle); + auto* wb = reinterpret_cast(handle); assert(wb != nullptr); delete wb; } @@ -645,6 +669,6 @@ void Java_org_rocksdb_WriteBatch_disposeInternal(JNIEnv* /*env*/, */ jlong Java_org_rocksdb_WriteBatch_00024Handler_createNewHandler0(JNIEnv* env, jobject jobj) { - auto* wbjnic = new rocksdb::WriteBatchHandlerJniCallback(env, jobj); + auto* wbjnic = new ROCKSDB_NAMESPACE::WriteBatchHandlerJniCallback(env, jobj); return reinterpret_cast(wbjnic); } diff --git a/java/rocksjni/write_batch_test.cc b/java/rocksjni/write_batch_test.cc index 4b51b12781..114eac42cd 100644 --- a/java/rocksjni/write_batch_test.cc +++ b/java/rocksjni/write_batch_test.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::WriteBatch methods testing from Java side. +// calling c++ ROCKSDB_NAMESPACE::WriteBatch methods testing from Java side. #include #include "db/memtable.h" @@ -33,40 +33,42 @@ jbyteArray Java_org_rocksdb_WriteBatchTest_getContents(JNIEnv* env, jclass /*jclazz*/, jlong jwb_handle) { - auto* b = reinterpret_cast(jwb_handle); + auto* b = reinterpret_cast(jwb_handle); assert(b != nullptr); // todo: Currently the following code is directly copied from // db/write_bench_test.cc. It could be implemented in java once // all the necessary components can be accessed via jni api. - rocksdb::InternalKeyComparator cmp(rocksdb::BytewiseComparator()); - auto factory = std::make_shared(); - rocksdb::Options options; - rocksdb::WriteBufferManager wb(options.db_write_buffer_size); + ROCKSDB_NAMESPACE::InternalKeyComparator cmp( + ROCKSDB_NAMESPACE::BytewiseComparator()); + auto factory = std::make_shared(); + ROCKSDB_NAMESPACE::Options options; + ROCKSDB_NAMESPACE::WriteBufferManager wb(options.db_write_buffer_size); options.memtable_factory = factory; - rocksdb::MemTable* mem = new rocksdb::MemTable( - cmp, rocksdb::ImmutableCFOptions(options), - rocksdb::MutableCFOptions(options), &wb, rocksdb::kMaxSequenceNumber, - 0 /* column_family_id */); + ROCKSDB_NAMESPACE::MemTable* mem = new ROCKSDB_NAMESPACE::MemTable( + cmp, ROCKSDB_NAMESPACE::ImmutableCFOptions(options), + ROCKSDB_NAMESPACE::MutableCFOptions(options), &wb, + ROCKSDB_NAMESPACE::kMaxSequenceNumber, 0 /* column_family_id */); mem->Ref(); std::string state; - rocksdb::ColumnFamilyMemTablesDefault cf_mems_default(mem); - rocksdb::Status s = rocksdb::WriteBatchInternal::InsertInto( - b, &cf_mems_default, nullptr, nullptr); + ROCKSDB_NAMESPACE::ColumnFamilyMemTablesDefault cf_mems_default(mem); + ROCKSDB_NAMESPACE::Status s = + ROCKSDB_NAMESPACE::WriteBatchInternal::InsertInto(b, &cf_mems_default, + nullptr, nullptr); unsigned int count = 0; - rocksdb::Arena arena; - rocksdb::ScopedArenaIterator iter( - mem->NewIterator(rocksdb::ReadOptions(), &arena)); + ROCKSDB_NAMESPACE::Arena arena; + ROCKSDB_NAMESPACE::ScopedArenaIterator iter( + mem->NewIterator(ROCKSDB_NAMESPACE::ReadOptions(), &arena)); for (iter->SeekToFirst(); iter->Valid(); iter->Next()) { - rocksdb::ParsedInternalKey ikey; + ROCKSDB_NAMESPACE::ParsedInternalKey ikey; ikey.clear(); - bool parsed = rocksdb::ParseInternalKey(iter->key(), &ikey); + bool parsed = ROCKSDB_NAMESPACE::ParseInternalKey(iter->key(), &ikey); if (!parsed) { assert(parsed); } switch (ikey.type) { - case rocksdb::kTypeValue: + case ROCKSDB_NAMESPACE::kTypeValue: state.append("Put("); state.append(ikey.user_key.ToString()); state.append(", "); @@ -74,7 +76,7 @@ jbyteArray Java_org_rocksdb_WriteBatchTest_getContents(JNIEnv* env, state.append(")"); count++; break; - case rocksdb::kTypeMerge: + case ROCKSDB_NAMESPACE::kTypeMerge: state.append("Merge("); state.append(ikey.user_key.ToString()); state.append(", "); @@ -82,19 +84,19 @@ jbyteArray Java_org_rocksdb_WriteBatchTest_getContents(JNIEnv* env, state.append(")"); count++; break; - case rocksdb::kTypeDeletion: + case ROCKSDB_NAMESPACE::kTypeDeletion: state.append("Delete("); state.append(ikey.user_key.ToString()); state.append(")"); count++; break; - case rocksdb::kTypeSingleDeletion: + case ROCKSDB_NAMESPACE::kTypeSingleDeletion: state.append("SingleDelete("); state.append(ikey.user_key.ToString()); state.append(")"); count++; break; - case rocksdb::kTypeRangeDeletion: + case ROCKSDB_NAMESPACE::kTypeRangeDeletion: state.append("DeleteRange("); state.append(ikey.user_key.ToString()); state.append(", "); @@ -102,7 +104,7 @@ jbyteArray Java_org_rocksdb_WriteBatchTest_getContents(JNIEnv* env, state.append(")"); count++; break; - case rocksdb::kTypeLogData: + case ROCKSDB_NAMESPACE::kTypeLogData: state.append("LogData("); state.append(ikey.user_key.ToString()); state.append(")"); @@ -117,13 +119,14 @@ jbyteArray Java_org_rocksdb_WriteBatchTest_getContents(JNIEnv* env, break; } state.append("@"); - state.append(rocksdb::NumberToString(ikey.sequence)); + state.append(ROCKSDB_NAMESPACE::NumberToString(ikey.sequence)); } if (!s.ok()) { state.append(s.ToString()); - } else if (rocksdb::WriteBatchInternal::Count(b) != count) { + } else if (ROCKSDB_NAMESPACE::WriteBatchInternal::Count(b) != count) { state.append("Err:CountMismatch(expected="); - state.append(std::to_string(rocksdb::WriteBatchInternal::Count(b))); + state.append( + std::to_string(ROCKSDB_NAMESPACE::WriteBatchInternal::Count(b))); state.append(", actual="); state.append(std::to_string(count)); state.append(")"); @@ -155,11 +158,11 @@ jbyteArray Java_org_rocksdb_WriteBatchTest_getContents(JNIEnv* env, */ void Java_org_rocksdb_WriteBatchTestInternalHelper_setSequence( JNIEnv* /*env*/, jclass /*jclazz*/, jlong jwb_handle, jlong jsn) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - rocksdb::WriteBatchInternal::SetSequence( - wb, static_cast(jsn)); + ROCKSDB_NAMESPACE::WriteBatchInternal::SetSequence( + wb, static_cast(jsn)); } /* @@ -170,10 +173,11 @@ void Java_org_rocksdb_WriteBatchTestInternalHelper_setSequence( jlong Java_org_rocksdb_WriteBatchTestInternalHelper_sequence(JNIEnv* /*env*/, jclass /*jclazz*/, jlong jwb_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - return static_cast(rocksdb::WriteBatchInternal::Sequence(wb)); + return static_cast( + ROCKSDB_NAMESPACE::WriteBatchInternal::Sequence(wb)); } /* @@ -185,10 +189,10 @@ void Java_org_rocksdb_WriteBatchTestInternalHelper_append(JNIEnv* /*env*/, jclass /*jclazz*/, jlong jwb_handle_1, jlong jwb_handle_2) { - auto* wb1 = reinterpret_cast(jwb_handle_1); + auto* wb1 = reinterpret_cast(jwb_handle_1); assert(wb1 != nullptr); - auto* wb2 = reinterpret_cast(jwb_handle_2); + auto* wb2 = reinterpret_cast(jwb_handle_2); assert(wb2 != nullptr); - rocksdb::WriteBatchInternal::Append(wb1, wb2); + ROCKSDB_NAMESPACE::WriteBatchInternal::Append(wb1, wb2); } diff --git a/java/rocksjni/write_batch_with_index.cc b/java/rocksjni/write_batch_with_index.cc index e5361da30d..da8264525f 100644 --- a/java/rocksjni/write_batch_with_index.cc +++ b/java/rocksjni/write_batch_with_index.cc @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the "bridge" between Java and C++ and enables -// calling c++ rocksdb::WriteBatchWithIndex methods from Java side. +// calling c++ ROCKSDB_NAMESPACE::WriteBatchWithIndex methods from Java side. #include "rocksdb/utilities/write_batch_with_index.h" #include "include/org_rocksdb_WBWIRocksIterator.h" @@ -19,7 +19,7 @@ */ jlong Java_org_rocksdb_WriteBatchWithIndex_newWriteBatchWithIndex__( JNIEnv* /*env*/, jclass /*jcls*/) { - auto* wbwi = new rocksdb::WriteBatchWithIndex(); + auto* wbwi = new ROCKSDB_NAMESPACE::WriteBatchWithIndex(); return reinterpret_cast(wbwi); } @@ -30,8 +30,9 @@ jlong Java_org_rocksdb_WriteBatchWithIndex_newWriteBatchWithIndex__( */ jlong Java_org_rocksdb_WriteBatchWithIndex_newWriteBatchWithIndex__Z( JNIEnv* /*env*/, jclass /*jcls*/, jboolean joverwrite_key) { - auto* wbwi = new rocksdb::WriteBatchWithIndex( - rocksdb::BytewiseComparator(), 0, static_cast(joverwrite_key)); + auto* wbwi = new ROCKSDB_NAMESPACE::WriteBatchWithIndex( + ROCKSDB_NAMESPACE::BytewiseComparator(), 0, + static_cast(joverwrite_key)); return reinterpret_cast(wbwi); } @@ -43,21 +44,22 @@ jlong Java_org_rocksdb_WriteBatchWithIndex_newWriteBatchWithIndex__Z( jlong Java_org_rocksdb_WriteBatchWithIndex_newWriteBatchWithIndex__JBIZ( JNIEnv* /*env*/, jclass /*jcls*/, jlong jfallback_index_comparator_handle, jbyte jcomparator_type, jint jreserved_bytes, jboolean joverwrite_key) { - rocksdb::Comparator* fallback_comparator = nullptr; + ROCKSDB_NAMESPACE::Comparator* fallback_comparator = nullptr; switch (jcomparator_type) { // JAVA_COMPARATOR case 0x0: - fallback_comparator = reinterpret_cast( - jfallback_index_comparator_handle); + fallback_comparator = + reinterpret_cast( + jfallback_index_comparator_handle); break; // JAVA_NATIVE_COMPARATOR_WRAPPER case 0x1: - fallback_comparator = reinterpret_cast( + fallback_comparator = reinterpret_cast( jfallback_index_comparator_handle); break; } - auto* wbwi = new rocksdb::WriteBatchWithIndex( + auto* wbwi = new ROCKSDB_NAMESPACE::WriteBatchWithIndex( fallback_comparator, static_cast(jreserved_bytes), static_cast(joverwrite_key)); return reinterpret_cast(wbwi); @@ -71,7 +73,8 @@ jlong Java_org_rocksdb_WriteBatchWithIndex_newWriteBatchWithIndex__JBIZ( jint Java_org_rocksdb_WriteBatchWithIndex_count0(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwbwi_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); return static_cast(wbwi->GetWriteBatch()->Count()); @@ -85,15 +88,18 @@ jint Java_org_rocksdb_WriteBatchWithIndex_count0(JNIEnv* /*env*/, void Java_org_rocksdb_WriteBatchWithIndex_put__J_3BI_3BI( JNIEnv* env, jobject jobj, jlong jwbwi_handle, jbyteArray jkey, jint jkey_len, jbyteArray jentry_value, jint jentry_value_len) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto put = [&wbwi](rocksdb::Slice key, rocksdb::Slice value) { + auto put = [&wbwi](ROCKSDB_NAMESPACE::Slice key, + ROCKSDB_NAMESPACE::Slice value) { return wbwi->Put(key, value); }; - std::unique_ptr status = rocksdb::JniUtil::kv_op( - put, env, jobj, jkey, jkey_len, jentry_value, jentry_value_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(put, env, jobj, jkey, jkey_len, + jentry_value, jentry_value_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -106,17 +112,21 @@ void Java_org_rocksdb_WriteBatchWithIndex_put__J_3BI_3BIJ( JNIEnv* env, jobject jobj, jlong jwbwi_handle, jbyteArray jkey, jint jkey_len, jbyteArray jentry_value, jint jentry_value_len, jlong jcf_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); assert(cf_handle != nullptr); - auto put = [&wbwi, &cf_handle](rocksdb::Slice key, rocksdb::Slice value) { + auto put = [&wbwi, &cf_handle](ROCKSDB_NAMESPACE::Slice key, + ROCKSDB_NAMESPACE::Slice value) { return wbwi->Put(cf_handle, key, value); }; - std::unique_ptr status = rocksdb::JniUtil::kv_op( - put, env, jobj, jkey, jkey_len, jentry_value, jentry_value_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(put, env, jobj, jkey, jkey_len, + jentry_value, jentry_value_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -129,18 +139,20 @@ void Java_org_rocksdb_WriteBatchWithIndex_putDirect( JNIEnv* env, jobject /*jobj*/, jlong jwb_handle, jobject jkey, jint jkey_offset, jint jkey_len, jobject jval, jint jval_offset, jint jval_len, jlong jcf_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); - auto put = [&wb, &cf_handle](rocksdb::Slice& key, rocksdb::Slice& value) { + auto* cf_handle = + reinterpret_cast(jcf_handle); + auto put = [&wb, &cf_handle](ROCKSDB_NAMESPACE::Slice& key, + ROCKSDB_NAMESPACE::Slice& value) { if (cf_handle == nullptr) { wb->Put(key, value); } else { wb->Put(cf_handle, key, value); } }; - rocksdb::JniUtil::kv_op_direct(put, env, jkey, jkey_offset, jkey_len, jval, - jval_offset, jval_len); + ROCKSDB_NAMESPACE::JniUtil::kv_op_direct( + put, env, jkey, jkey_offset, jkey_len, jval, jval_offset, jval_len); } /* @@ -151,15 +163,18 @@ void Java_org_rocksdb_WriteBatchWithIndex_putDirect( void Java_org_rocksdb_WriteBatchWithIndex_merge__J_3BI_3BI( JNIEnv* env, jobject jobj, jlong jwbwi_handle, jbyteArray jkey, jint jkey_len, jbyteArray jentry_value, jint jentry_value_len) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto merge = [&wbwi](rocksdb::Slice key, rocksdb::Slice value) { + auto merge = [&wbwi](ROCKSDB_NAMESPACE::Slice key, + ROCKSDB_NAMESPACE::Slice value) { return wbwi->Merge(key, value); }; - std::unique_ptr status = rocksdb::JniUtil::kv_op( - merge, env, jobj, jkey, jkey_len, jentry_value, jentry_value_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(merge, env, jobj, jkey, jkey_len, + jentry_value, jentry_value_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -172,17 +187,21 @@ void Java_org_rocksdb_WriteBatchWithIndex_merge__J_3BI_3BIJ( JNIEnv* env, jobject jobj, jlong jwbwi_handle, jbyteArray jkey, jint jkey_len, jbyteArray jentry_value, jint jentry_value_len, jlong jcf_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); assert(cf_handle != nullptr); - auto merge = [&wbwi, &cf_handle](rocksdb::Slice key, rocksdb::Slice value) { + auto merge = [&wbwi, &cf_handle](ROCKSDB_NAMESPACE::Slice key, + ROCKSDB_NAMESPACE::Slice value) { return wbwi->Merge(cf_handle, key, value); }; - std::unique_ptr status = rocksdb::JniUtil::kv_op( - merge, env, jobj, jkey, jkey_len, jentry_value, jentry_value_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(merge, env, jobj, jkey, jkey_len, + jentry_value, jentry_value_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -196,13 +215,16 @@ void Java_org_rocksdb_WriteBatchWithIndex_delete__J_3BI(JNIEnv* env, jlong jwbwi_handle, jbyteArray jkey, jint jkey_len) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto remove = [&wbwi](rocksdb::Slice key) { return wbwi->Delete(key); }; - std::unique_ptr status = - rocksdb::JniUtil::k_op(remove, env, jobj, jkey, jkey_len); + auto remove = [&wbwi](ROCKSDB_NAMESPACE::Slice key) { + return wbwi->Delete(key); + }; + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::k_op(remove, env, jobj, jkey, jkey_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -214,17 +236,19 @@ void Java_org_rocksdb_WriteBatchWithIndex_delete__J_3BI(JNIEnv* env, void Java_org_rocksdb_WriteBatchWithIndex_delete__J_3BIJ( JNIEnv* env, jobject jobj, jlong jwbwi_handle, jbyteArray jkey, jint jkey_len, jlong jcf_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); assert(cf_handle != nullptr); - auto remove = [&wbwi, &cf_handle](rocksdb::Slice key) { + auto remove = [&wbwi, &cf_handle](ROCKSDB_NAMESPACE::Slice key) { return wbwi->Delete(cf_handle, key); }; - std::unique_ptr status = - rocksdb::JniUtil::k_op(remove, env, jobj, jkey, jkey_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::k_op(remove, env, jobj, jkey, jkey_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -236,15 +260,17 @@ void Java_org_rocksdb_WriteBatchWithIndex_delete__J_3BIJ( void Java_org_rocksdb_WriteBatchWithIndex_singleDelete__J_3BI( JNIEnv* env, jobject jobj, jlong jwbwi_handle, jbyteArray jkey, jint jkey_len) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto single_delete = [&wbwi](rocksdb::Slice key) { + auto single_delete = [&wbwi](ROCKSDB_NAMESPACE::Slice key) { return wbwi->SingleDelete(key); }; - std::unique_ptr status = - rocksdb::JniUtil::k_op(single_delete, env, jobj, jkey, jkey_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::k_op(single_delete, env, jobj, jkey, + jkey_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -256,17 +282,20 @@ void Java_org_rocksdb_WriteBatchWithIndex_singleDelete__J_3BI( void Java_org_rocksdb_WriteBatchWithIndex_singleDelete__J_3BIJ( JNIEnv* env, jobject jobj, jlong jwbwi_handle, jbyteArray jkey, jint jkey_len, jlong jcf_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); assert(cf_handle != nullptr); - auto single_delete = [&wbwi, &cf_handle](rocksdb::Slice key) { + auto single_delete = [&wbwi, &cf_handle](ROCKSDB_NAMESPACE::Slice key) { return wbwi->SingleDelete(cf_handle, key); }; - std::unique_ptr status = - rocksdb::JniUtil::k_op(single_delete, env, jobj, jkey, jkey_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::k_op(single_delete, env, jobj, jkey, + jkey_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -278,17 +307,19 @@ void Java_org_rocksdb_WriteBatchWithIndex_singleDelete__J_3BIJ( void Java_org_rocksdb_WriteBatchWithIndex_removeDirect( JNIEnv* env, jobject /*jobj*/, jlong jwb_handle, jobject jkey, jint jkey_offset, jint jkey_len, jlong jcf_handle) { - auto* wb = reinterpret_cast(jwb_handle); + auto* wb = reinterpret_cast(jwb_handle); assert(wb != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); - auto remove = [&wb, &cf_handle](rocksdb::Slice& key) { + auto* cf_handle = + reinterpret_cast(jcf_handle); + auto remove = [&wb, &cf_handle](ROCKSDB_NAMESPACE::Slice& key) { if (cf_handle == nullptr) { wb->Delete(key); } else { wb->Delete(cf_handle, key); } }; - rocksdb::JniUtil::k_op_direct(remove, env, jkey, jkey_offset, jkey_len); + ROCKSDB_NAMESPACE::JniUtil::k_op_direct(remove, env, jkey, jkey_offset, + jkey_len); } /* @@ -299,16 +330,18 @@ void Java_org_rocksdb_WriteBatchWithIndex_removeDirect( void Java_org_rocksdb_WriteBatchWithIndex_deleteRange__J_3BI_3BI( JNIEnv* env, jobject jobj, jlong jwbwi_handle, jbyteArray jbegin_key, jint jbegin_key_len, jbyteArray jend_key, jint jend_key_len) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto deleteRange = [&wbwi](rocksdb::Slice beginKey, rocksdb::Slice endKey) { + auto deleteRange = [&wbwi](ROCKSDB_NAMESPACE::Slice beginKey, + ROCKSDB_NAMESPACE::Slice endKey) { return wbwi->DeleteRange(beginKey, endKey); }; - std::unique_ptr status = - rocksdb::JniUtil::kv_op(deleteRange, env, jobj, jbegin_key, - jbegin_key_len, jend_key, jend_key_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(deleteRange, env, jobj, jbegin_key, + jbegin_key_len, jend_key, jend_key_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -321,19 +354,21 @@ void Java_org_rocksdb_WriteBatchWithIndex_deleteRange__J_3BI_3BIJ( JNIEnv* env, jobject jobj, jlong jwbwi_handle, jbyteArray jbegin_key, jint jbegin_key_len, jbyteArray jend_key, jint jend_key_len, jlong jcf_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); assert(cf_handle != nullptr); - auto deleteRange = [&wbwi, &cf_handle](rocksdb::Slice beginKey, - rocksdb::Slice endKey) { + auto deleteRange = [&wbwi, &cf_handle](ROCKSDB_NAMESPACE::Slice beginKey, + ROCKSDB_NAMESPACE::Slice endKey) { return wbwi->DeleteRange(cf_handle, beginKey, endKey); }; - std::unique_ptr status = - rocksdb::JniUtil::kv_op(deleteRange, env, jobj, jbegin_key, - jbegin_key_len, jend_key, jend_key_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::kv_op(deleteRange, env, jobj, jbegin_key, + jbegin_key_len, jend_key, jend_key_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -346,15 +381,16 @@ void Java_org_rocksdb_WriteBatchWithIndex_putLogData(JNIEnv* env, jobject jobj, jlong jwbwi_handle, jbyteArray jblob, jint jblob_len) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); - auto putLogData = [&wbwi](rocksdb::Slice blob) { + auto putLogData = [&wbwi](ROCKSDB_NAMESPACE::Slice blob) { return wbwi->PutLogData(blob); }; - std::unique_ptr status = - rocksdb::JniUtil::k_op(putLogData, env, jobj, jblob, jblob_len); + std::unique_ptr status = + ROCKSDB_NAMESPACE::JniUtil::k_op(putLogData, env, jobj, jblob, jblob_len); if (status != nullptr && !status->ok()) { - rocksdb::RocksDBExceptionJni::ThrowNew(env, status); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, status); } } @@ -366,7 +402,8 @@ void Java_org_rocksdb_WriteBatchWithIndex_putLogData(JNIEnv* env, jobject jobj, void Java_org_rocksdb_WriteBatchWithIndex_clear0(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwbwi_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); wbwi->Clear(); @@ -380,7 +417,8 @@ void Java_org_rocksdb_WriteBatchWithIndex_clear0(JNIEnv* /*env*/, void Java_org_rocksdb_WriteBatchWithIndex_setSavePoint0(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwbwi_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); wbwi->SetSavePoint(); @@ -393,7 +431,8 @@ void Java_org_rocksdb_WriteBatchWithIndex_setSavePoint0(JNIEnv* /*env*/, */ void Java_org_rocksdb_WriteBatchWithIndex_rollbackToSavePoint0( JNIEnv* env, jobject /*jobj*/, jlong jwbwi_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); auto s = wbwi->RollbackToSavePoint(); @@ -402,7 +441,7 @@ void Java_org_rocksdb_WriteBatchWithIndex_rollbackToSavePoint0( return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -413,7 +452,8 @@ void Java_org_rocksdb_WriteBatchWithIndex_rollbackToSavePoint0( void Java_org_rocksdb_WriteBatchWithIndex_popSavePoint(JNIEnv* env, jobject /*jobj*/, jlong jwbwi_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); auto s = wbwi->PopSavePoint(); @@ -422,7 +462,7 @@ void Java_org_rocksdb_WriteBatchWithIndex_popSavePoint(JNIEnv* env, return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -434,7 +474,8 @@ void Java_org_rocksdb_WriteBatchWithIndex_setMaxBytes(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwbwi_handle, jlong jmax_bytes) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); wbwi->SetMaxBytes(static_cast(jmax_bytes)); @@ -448,13 +489,14 @@ void Java_org_rocksdb_WriteBatchWithIndex_setMaxBytes(JNIEnv* /*env*/, jobject Java_org_rocksdb_WriteBatchWithIndex_getWriteBatch(JNIEnv* env, jobject /*jobj*/, jlong jwbwi_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); assert(wbwi != nullptr); auto* wb = wbwi->GetWriteBatch(); // TODO(AR) is the `wb` object owned by us? - return rocksdb::WriteBatchJni::construct(env, wb); + return ROCKSDB_NAMESPACE::WriteBatchJni::construct(env, wb); } /* @@ -465,7 +507,8 @@ jobject Java_org_rocksdb_WriteBatchWithIndex_getWriteBatch(JNIEnv* env, jlong Java_org_rocksdb_WriteBatchWithIndex_iterator0(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwbwi_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); auto* wbwi_iterator = wbwi->NewIterator(); return reinterpret_cast(wbwi_iterator); } @@ -479,8 +522,10 @@ jlong Java_org_rocksdb_WriteBatchWithIndex_iterator1(JNIEnv* /*env*/, jobject /*jobj*/, jlong jwbwi_handle, jlong jcf_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); auto* wbwi_iterator = wbwi->NewIterator(cf_handle); return reinterpret_cast(wbwi_iterator); } @@ -495,9 +540,12 @@ jlong Java_org_rocksdb_WriteBatchWithIndex_iteratorWithBase(JNIEnv* /*env*/, jlong jwbwi_handle, jlong jcf_handle, jlong jbi_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); - auto* base_iterator = reinterpret_cast(jbi_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); + auto* base_iterator = + reinterpret_cast(jbi_handle); auto* iterator = wbwi->NewIteratorWithBase(cf_handle, base_iterator); return reinterpret_cast(iterator); } @@ -510,14 +558,16 @@ jlong Java_org_rocksdb_WriteBatchWithIndex_iteratorWithBase(JNIEnv* /*env*/, jbyteArray JNICALL Java_org_rocksdb_WriteBatchWithIndex_getFromBatch__JJ_3BI( JNIEnv* env, jobject /*jobj*/, jlong jwbwi_handle, jlong jdbopt_handle, jbyteArray jkey, jint jkey_len) { - auto* wbwi = reinterpret_cast(jwbwi_handle); - auto* dbopt = reinterpret_cast(jdbopt_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); + auto* dbopt = reinterpret_cast(jdbopt_handle); - auto getter = [&wbwi, &dbopt](const rocksdb::Slice& key, std::string* value) { + auto getter = [&wbwi, &dbopt](const ROCKSDB_NAMESPACE::Slice& key, + std::string* value) { return wbwi->GetFromBatch(*dbopt, key, value); }; - return rocksdb::JniUtil::v_op(getter, env, jkey, jkey_len); + return ROCKSDB_NAMESPACE::JniUtil::v_op(getter, env, jkey, jkey_len); } /* @@ -528,16 +578,18 @@ jbyteArray JNICALL Java_org_rocksdb_WriteBatchWithIndex_getFromBatch__JJ_3BI( jbyteArray Java_org_rocksdb_WriteBatchWithIndex_getFromBatch__JJ_3BIJ( JNIEnv* env, jobject /*jobj*/, jlong jwbwi_handle, jlong jdbopt_handle, jbyteArray jkey, jint jkey_len, jlong jcf_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); - auto* dbopt = reinterpret_cast(jdbopt_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); + auto* dbopt = reinterpret_cast(jdbopt_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); - auto getter = [&wbwi, &cf_handle, &dbopt](const rocksdb::Slice& key, + auto getter = [&wbwi, &cf_handle, &dbopt](const ROCKSDB_NAMESPACE::Slice& key, std::string* value) { return wbwi->GetFromBatch(cf_handle, *dbopt, key, value); }; - return rocksdb::JniUtil::v_op(getter, env, jkey, jkey_len); + return ROCKSDB_NAMESPACE::JniUtil::v_op(getter, env, jkey, jkey_len); } /* @@ -548,16 +600,18 @@ jbyteArray Java_org_rocksdb_WriteBatchWithIndex_getFromBatch__JJ_3BIJ( jbyteArray Java_org_rocksdb_WriteBatchWithIndex_getFromBatchAndDB__JJJ_3BI( JNIEnv* env, jobject /*jobj*/, jlong jwbwi_handle, jlong jdb_handle, jlong jreadopt_handle, jbyteArray jkey, jint jkey_len) { - auto* wbwi = reinterpret_cast(jwbwi_handle); - auto* db = reinterpret_cast(jdb_handle); - auto* readopt = reinterpret_cast(jreadopt_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); + auto* db = reinterpret_cast(jdb_handle); + auto* readopt = + reinterpret_cast(jreadopt_handle); - auto getter = [&wbwi, &db, &readopt](const rocksdb::Slice& key, + auto getter = [&wbwi, &db, &readopt](const ROCKSDB_NAMESPACE::Slice& key, std::string* value) { return wbwi->GetFromBatchAndDB(db, *readopt, key, value); }; - return rocksdb::JniUtil::v_op(getter, env, jkey, jkey_len); + return ROCKSDB_NAMESPACE::JniUtil::v_op(getter, env, jkey, jkey_len); } /* @@ -568,17 +622,20 @@ jbyteArray Java_org_rocksdb_WriteBatchWithIndex_getFromBatchAndDB__JJJ_3BI( jbyteArray Java_org_rocksdb_WriteBatchWithIndex_getFromBatchAndDB__JJJ_3BIJ( JNIEnv* env, jobject /*jobj*/, jlong jwbwi_handle, jlong jdb_handle, jlong jreadopt_handle, jbyteArray jkey, jint jkey_len, jlong jcf_handle) { - auto* wbwi = reinterpret_cast(jwbwi_handle); - auto* db = reinterpret_cast(jdb_handle); - auto* readopt = reinterpret_cast(jreadopt_handle); - auto* cf_handle = reinterpret_cast(jcf_handle); + auto* wbwi = + reinterpret_cast(jwbwi_handle); + auto* db = reinterpret_cast(jdb_handle); + auto* readopt = + reinterpret_cast(jreadopt_handle); + auto* cf_handle = + reinterpret_cast(jcf_handle); - auto getter = [&wbwi, &db, &cf_handle, &readopt](const rocksdb::Slice& key, - std::string* value) { + auto getter = [&wbwi, &db, &cf_handle, &readopt]( + const ROCKSDB_NAMESPACE::Slice& key, std::string* value) { return wbwi->GetFromBatchAndDB(db, *readopt, cf_handle, key, value); }; - return rocksdb::JniUtil::v_op(getter, env, jkey, jkey_len); + return ROCKSDB_NAMESPACE::JniUtil::v_op(getter, env, jkey, jkey_len); } /* @@ -589,7 +646,8 @@ jbyteArray Java_org_rocksdb_WriteBatchWithIndex_getFromBatchAndDB__JJJ_3BIJ( void Java_org_rocksdb_WriteBatchWithIndex_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - auto* wbwi = reinterpret_cast(handle); + auto* wbwi = + reinterpret_cast(handle); assert(wbwi != nullptr); delete wbwi; } @@ -604,7 +662,7 @@ void Java_org_rocksdb_WriteBatchWithIndex_disposeInternal(JNIEnv* /*env*/, void Java_org_rocksdb_WBWIRocksIterator_disposeInternal(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); + auto* it = reinterpret_cast(handle); assert(it != nullptr); delete it; } @@ -617,7 +675,7 @@ void Java_org_rocksdb_WBWIRocksIterator_disposeInternal(JNIEnv* /*env*/, jboolean Java_org_rocksdb_WBWIRocksIterator_isValid0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - return reinterpret_cast(handle)->Valid(); + return reinterpret_cast(handle)->Valid(); } /* @@ -628,7 +686,7 @@ jboolean Java_org_rocksdb_WBWIRocksIterator_isValid0(JNIEnv* /*env*/, void Java_org_rocksdb_WBWIRocksIterator_seekToFirst0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->SeekToFirst(); + reinterpret_cast(handle)->SeekToFirst(); } /* @@ -639,7 +697,7 @@ void Java_org_rocksdb_WBWIRocksIterator_seekToFirst0(JNIEnv* /*env*/, void Java_org_rocksdb_WBWIRocksIterator_seekToLast0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->SeekToLast(); + reinterpret_cast(handle)->SeekToLast(); } /* @@ -649,7 +707,7 @@ void Java_org_rocksdb_WBWIRocksIterator_seekToLast0(JNIEnv* /*env*/, */ void Java_org_rocksdb_WBWIRocksIterator_next0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->Next(); + reinterpret_cast(handle)->Next(); } /* @@ -659,7 +717,7 @@ void Java_org_rocksdb_WBWIRocksIterator_next0(JNIEnv* /*env*/, jobject /*jobj*/, */ void Java_org_rocksdb_WBWIRocksIterator_prev0(JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { - reinterpret_cast(handle)->Prev(); + reinterpret_cast(handle)->Prev(); } /* @@ -670,14 +728,15 @@ void Java_org_rocksdb_WBWIRocksIterator_prev0(JNIEnv* /*env*/, jobject /*jobj*/, void Java_org_rocksdb_WBWIRocksIterator_seek0(JNIEnv* env, jobject /*jobj*/, jlong handle, jbyteArray jtarget, jint jtarget_len) { - auto* it = reinterpret_cast(handle); + auto* it = reinterpret_cast(handle); jbyte* target = env->GetByteArrayElements(jtarget, nullptr); if (target == nullptr) { // exception thrown: OutOfMemoryError return; } - rocksdb::Slice target_slice(reinterpret_cast(target), jtarget_len); + ROCKSDB_NAMESPACE::Slice target_slice(reinterpret_cast(target), + jtarget_len); it->Seek(target_slice); @@ -692,9 +751,12 @@ void Java_org_rocksdb_WBWIRocksIterator_seek0(JNIEnv* env, jobject /*jobj*/, void Java_org_rocksdb_WBWIRocksIterator_seekDirect0( JNIEnv* env, jobject /*jobj*/, jlong handle, jobject jtarget, jint jtarget_off, jint jtarget_len) { - auto* it = reinterpret_cast(handle); - auto seek = [&it](rocksdb::Slice& target_slice) { it->Seek(target_slice); }; - rocksdb::JniUtil::k_op_direct(seek, env, jtarget, jtarget_off, jtarget_len); + auto* it = reinterpret_cast(handle); + auto seek = [&it](ROCKSDB_NAMESPACE::Slice& target_slice) { + it->Seek(target_slice); + }; + ROCKSDB_NAMESPACE::JniUtil::k_op_direct(seek, env, jtarget, jtarget_off, + jtarget_len); } /* @@ -707,14 +769,15 @@ void Java_org_rocksdb_WBWIRocksIterator_seekForPrev0(JNIEnv* env, jlong handle, jbyteArray jtarget, jint jtarget_len) { - auto* it = reinterpret_cast(handle); + auto* it = reinterpret_cast(handle); jbyte* target = env->GetByteArrayElements(jtarget, nullptr); if (target == nullptr) { // exception thrown: OutOfMemoryError return; } - rocksdb::Slice target_slice(reinterpret_cast(target), jtarget_len); + ROCKSDB_NAMESPACE::Slice target_slice(reinterpret_cast(target), + jtarget_len); it->SeekForPrev(target_slice); @@ -728,14 +791,14 @@ void Java_org_rocksdb_WBWIRocksIterator_seekForPrev0(JNIEnv* env, */ void Java_org_rocksdb_WBWIRocksIterator_status0(JNIEnv* env, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); - rocksdb::Status s = it->status(); + auto* it = reinterpret_cast(handle); + ROCKSDB_NAMESPACE::Status s = it->status(); if (s.ok()) { return; } - rocksdb::RocksDBExceptionJni::ThrowNew(env, s); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } /* @@ -746,26 +809,27 @@ void Java_org_rocksdb_WBWIRocksIterator_status0(JNIEnv* env, jobject /*jobj*/, jlongArray Java_org_rocksdb_WBWIRocksIterator_entry1(JNIEnv* env, jobject /*jobj*/, jlong handle) { - auto* it = reinterpret_cast(handle); - const rocksdb::WriteEntry& we = it->Entry(); + auto* it = reinterpret_cast(handle); + const ROCKSDB_NAMESPACE::WriteEntry& we = it->Entry(); jlong results[3]; // set the type of the write entry - results[0] = rocksdb::WriteTypeJni::toJavaWriteType(we.type); + results[0] = ROCKSDB_NAMESPACE::WriteTypeJni::toJavaWriteType(we.type); // NOTE: key_slice and value_slice will be freed by // org.rocksdb.DirectSlice#close - auto* key_slice = new rocksdb::Slice(we.key.data(), we.key.size()); + auto* key_slice = new ROCKSDB_NAMESPACE::Slice(we.key.data(), we.key.size()); results[1] = reinterpret_cast(key_slice); - if (we.type == rocksdb::kDeleteRecord || - we.type == rocksdb::kSingleDeleteRecord || - we.type == rocksdb::kLogDataRecord) { + if (we.type == ROCKSDB_NAMESPACE::kDeleteRecord || + we.type == ROCKSDB_NAMESPACE::kSingleDeleteRecord || + we.type == ROCKSDB_NAMESPACE::kLogDataRecord) { // set native handle of value slice to null if no value available results[2] = 0; } else { - auto* value_slice = new rocksdb::Slice(we.value.data(), we.value.size()); + auto* value_slice = + new ROCKSDB_NAMESPACE::Slice(we.value.data(), we.value.size()); results[2] = reinterpret_cast(value_slice); } @@ -773,7 +837,8 @@ jlongArray Java_org_rocksdb_WBWIRocksIterator_entry1(JNIEnv* env, if (jresults == nullptr) { // exception thrown: OutOfMemoryError if (results[2] != 0) { - auto* value_slice = reinterpret_cast(results[2]); + auto* value_slice = + reinterpret_cast(results[2]); delete value_slice; } delete key_slice; @@ -785,7 +850,8 @@ jlongArray Java_org_rocksdb_WBWIRocksIterator_entry1(JNIEnv* env, // exception thrown: ArrayIndexOutOfBoundsException env->DeleteLocalRef(jresults); if (results[2] != 0) { - auto* value_slice = reinterpret_cast(results[2]); + auto* value_slice = + reinterpret_cast(results[2]); delete value_slice; } delete key_slice; diff --git a/java/rocksjni/write_buffer_manager.cc b/java/rocksjni/write_buffer_manager.cc index 043f69031c..a52daed7d1 100644 --- a/java/rocksjni/write_buffer_manager.cc +++ b/java/rocksjni/write_buffer_manager.cc @@ -17,11 +17,14 @@ */ jlong Java_org_rocksdb_WriteBufferManager_newWriteBufferManager( JNIEnv* /*env*/, jclass /*jclazz*/, jlong jbuffer_size, jlong jcache_handle) { - auto* cache_ptr = - reinterpret_cast *>(jcache_handle); - auto* write_buffer_manager = new std::shared_ptr( - std::make_shared(jbuffer_size, *cache_ptr)); - return reinterpret_cast(write_buffer_manager); + auto* cache_ptr = + reinterpret_cast*>( + jcache_handle); + auto* write_buffer_manager = + new std::shared_ptr( + std::make_shared(jbuffer_size, + *cache_ptr)); + return reinterpret_cast(write_buffer_manager); } /* @@ -31,8 +34,9 @@ jlong Java_org_rocksdb_WriteBufferManager_newWriteBufferManager( */ void Java_org_rocksdb_WriteBufferManager_disposeInternal( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { - auto* write_buffer_manager = - reinterpret_cast *>(jhandle); - assert(write_buffer_manager != nullptr); - delete write_buffer_manager; + auto* write_buffer_manager = + reinterpret_cast*>( + jhandle); + assert(write_buffer_manager != nullptr); + delete write_buffer_manager; } diff --git a/java/rocksjni/writebatchhandlerjnicallback.cc b/java/rocksjni/writebatchhandlerjnicallback.cc index bf9001110a..4ecb6b2d13 100644 --- a/java/rocksjni/writebatchhandlerjnicallback.cc +++ b/java/rocksjni/writebatchhandlerjnicallback.cc @@ -4,12 +4,12 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::Comparator. +// ROCKSDB_NAMESPACE::Comparator. #include "rocksjni/writebatchhandlerjnicallback.h" #include "rocksjni/portal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { WriteBatchHandlerJniCallback::WriteBatchHandlerJniCallback( JNIEnv* env, jobject jWriteBatchHandler) : JniCallback(env, jWriteBatchHandler), m_env(env) { @@ -128,8 +128,8 @@ WriteBatchHandlerJniCallback::WriteBatchHandlerJniCallback( } } -rocksdb::Status WriteBatchHandlerJniCallback::PutCF(uint32_t column_family_id, - const Slice& key, const Slice& value) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::PutCF( + uint32_t column_family_id, const Slice& key, const Slice& value) { auto put = [this, column_family_id] ( jbyteArray j_key, jbyteArray j_value) { m_env->CallVoidMethod( @@ -141,9 +141,11 @@ rocksdb::Status WriteBatchHandlerJniCallback::PutCF(uint32_t column_family_id, }; auto status = WriteBatchHandlerJniCallback::kv_op(key, value, put); if(status == nullptr) { - return rocksdb::Status::OK(); // TODO(AR) what to do if there is an Exception but we don't know the rocksdb::Status? + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is + // an Exception but we don't know + // the ROCKSDB_NAMESPACE::Status? } else { - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } @@ -159,8 +161,8 @@ void WriteBatchHandlerJniCallback::Put(const Slice& key, const Slice& value) { WriteBatchHandlerJniCallback::kv_op(key, value, put); } -rocksdb::Status WriteBatchHandlerJniCallback::MergeCF(uint32_t column_family_id, - const Slice& key, const Slice& value) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MergeCF( + uint32_t column_family_id, const Slice& key, const Slice& value) { auto merge = [this, column_family_id] ( jbyteArray j_key, jbyteArray j_value) { m_env->CallVoidMethod( @@ -172,9 +174,11 @@ rocksdb::Status WriteBatchHandlerJniCallback::MergeCF(uint32_t column_family_id, }; auto status = WriteBatchHandlerJniCallback::kv_op(key, value, merge); if(status == nullptr) { - return rocksdb::Status::OK(); // TODO(AR) what to do if there is an Exception but we don't know the rocksdb::Status? + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is + // an Exception but we don't know + // the ROCKSDB_NAMESPACE::Status? } else { - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } @@ -190,8 +194,8 @@ void WriteBatchHandlerJniCallback::Merge(const Slice& key, const Slice& value) { WriteBatchHandlerJniCallback::kv_op(key, value, merge); } -rocksdb::Status WriteBatchHandlerJniCallback::DeleteCF(uint32_t column_family_id, - const Slice& key) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::DeleteCF( + uint32_t column_family_id, const Slice& key) { auto remove = [this, column_family_id] (jbyteArray j_key) { m_env->CallVoidMethod( m_jcallback_obj, @@ -201,9 +205,11 @@ rocksdb::Status WriteBatchHandlerJniCallback::DeleteCF(uint32_t column_family_id }; auto status = WriteBatchHandlerJniCallback::k_op(key, remove); if(status == nullptr) { - return rocksdb::Status::OK(); // TODO(AR) what to do if there is an Exception but we don't know the rocksdb::Status? + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is + // an Exception but we don't know + // the ROCKSDB_NAMESPACE::Status? } else { - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } @@ -217,8 +223,8 @@ void WriteBatchHandlerJniCallback::Delete(const Slice& key) { WriteBatchHandlerJniCallback::k_op(key, remove); } -rocksdb::Status WriteBatchHandlerJniCallback::SingleDeleteCF(uint32_t column_family_id, - const Slice& key) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::SingleDeleteCF( + uint32_t column_family_id, const Slice& key) { auto singleDelete = [this, column_family_id] (jbyteArray j_key) { m_env->CallVoidMethod( m_jcallback_obj, @@ -228,9 +234,11 @@ rocksdb::Status WriteBatchHandlerJniCallback::SingleDeleteCF(uint32_t column_fam }; auto status = WriteBatchHandlerJniCallback::k_op(key, singleDelete); if(status == nullptr) { - return rocksdb::Status::OK(); // TODO(AR) what to do if there is an Exception but we don't know the rocksdb::Status? + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is + // an Exception but we don't know + // the ROCKSDB_NAMESPACE::Status? } else { - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } @@ -244,8 +252,8 @@ void WriteBatchHandlerJniCallback::SingleDelete(const Slice& key) { WriteBatchHandlerJniCallback::k_op(key, singleDelete); } -rocksdb::Status WriteBatchHandlerJniCallback::DeleteRangeCF(uint32_t column_family_id, - const Slice& beginKey, const Slice& endKey) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::DeleteRangeCF( + uint32_t column_family_id, const Slice& beginKey, const Slice& endKey) { auto deleteRange = [this, column_family_id] ( jbyteArray j_beginKey, jbyteArray j_endKey) { m_env->CallVoidMethod( @@ -257,9 +265,11 @@ rocksdb::Status WriteBatchHandlerJniCallback::DeleteRangeCF(uint32_t column_fami }; auto status = WriteBatchHandlerJniCallback::kv_op(beginKey, endKey, deleteRange); if(status == nullptr) { - return rocksdb::Status::OK(); // TODO(AR) what to do if there is an Exception but we don't know the rocksdb::Status? + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is + // an Exception but we don't know + // the ROCKSDB_NAMESPACE::Status? } else { - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } @@ -286,8 +296,8 @@ void WriteBatchHandlerJniCallback::LogData(const Slice& blob) { WriteBatchHandlerJniCallback::k_op(blob, logData); } -rocksdb::Status WriteBatchHandlerJniCallback::PutBlobIndexCF(uint32_t column_family_id, - const Slice& key, const Slice& value) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::PutBlobIndexCF( + uint32_t column_family_id, const Slice& key, const Slice& value) { auto putBlobIndex = [this, column_family_id] ( jbyteArray j_key, jbyteArray j_value) { m_env->CallVoidMethod( @@ -299,13 +309,16 @@ rocksdb::Status WriteBatchHandlerJniCallback::PutBlobIndexCF(uint32_t column_fam }; auto status = WriteBatchHandlerJniCallback::kv_op(key, value, putBlobIndex); if(status == nullptr) { - return rocksdb::Status::OK(); // TODO(AR) what to do if there is an Exception but we don't know the rocksdb::Status? + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is + // an Exception but we don't know + // the ROCKSDB_NAMESPACE::Status? } else { - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } -rocksdb::Status WriteBatchHandlerJniCallback::MarkBeginPrepare(bool unprepare) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkBeginPrepare( + bool unprepare) { #ifndef DEBUG (void) unprepare; #else @@ -317,22 +330,25 @@ rocksdb::Status WriteBatchHandlerJniCallback::MarkBeginPrepare(bool unprepare) { if (m_env->ExceptionCheck()) { // exception thrown jthrowable exception = m_env->ExceptionOccurred(); - std::unique_ptr status = rocksdb::RocksDBExceptionJni::toCppStatus(m_env, exception); + std::unique_ptr status = + ROCKSDB_NAMESPACE::RocksDBExceptionJni::toCppStatus(m_env, exception); if (status == nullptr) { // unkown status or exception occurred extracting status m_env->ExceptionDescribe(); - return rocksdb::Status::OK(); // TODO(AR) probably need a better error code here + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) probably need a + // better error code here } else { m_env->ExceptionClear(); // clear the exception, as we have extracted the status - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } - return rocksdb::Status::OK(); + return ROCKSDB_NAMESPACE::Status::OK(); } -rocksdb::Status WriteBatchHandlerJniCallback::MarkEndPrepare(const Slice& xid) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkEndPrepare( + const Slice& xid) { auto markEndPrepare = [this] ( jbyteArray j_xid) { m_env->CallVoidMethod( @@ -342,35 +358,41 @@ rocksdb::Status WriteBatchHandlerJniCallback::MarkEndPrepare(const Slice& xid) { }; auto status = WriteBatchHandlerJniCallback::k_op(xid, markEndPrepare); if(status == nullptr) { - return rocksdb::Status::OK(); // TODO(AR) what to do if there is an Exception but we don't know the rocksdb::Status? + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is + // an Exception but we don't know + // the ROCKSDB_NAMESPACE::Status? } else { - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } -rocksdb::Status WriteBatchHandlerJniCallback::MarkNoop(bool empty_batch) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkNoop( + bool empty_batch) { m_env->CallVoidMethod(m_jcallback_obj, m_jMarkNoopMethodId, static_cast(empty_batch)); // check for Exception, in-particular RocksDBException if (m_env->ExceptionCheck()) { // exception thrown jthrowable exception = m_env->ExceptionOccurred(); - std::unique_ptr status = rocksdb::RocksDBExceptionJni::toCppStatus(m_env, exception); + std::unique_ptr status = + ROCKSDB_NAMESPACE::RocksDBExceptionJni::toCppStatus(m_env, exception); if (status == nullptr) { // unkown status or exception occurred extracting status m_env->ExceptionDescribe(); - return rocksdb::Status::OK(); // TODO(AR) probably need a better error code here + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) probably need a + // better error code here } else { m_env->ExceptionClear(); // clear the exception, as we have extracted the status - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } - return rocksdb::Status::OK(); + return ROCKSDB_NAMESPACE::Status::OK(); } -rocksdb::Status WriteBatchHandlerJniCallback::MarkRollback(const Slice& xid) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkRollback( + const Slice& xid) { auto markRollback = [this] ( jbyteArray j_xid) { m_env->CallVoidMethod( @@ -380,13 +402,16 @@ rocksdb::Status WriteBatchHandlerJniCallback::MarkRollback(const Slice& xid) { }; auto status = WriteBatchHandlerJniCallback::k_op(xid, markRollback); if(status == nullptr) { - return rocksdb::Status::OK(); // TODO(AR) what to do if there is an Exception but we don't know the rocksdb::Status? + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is + // an Exception but we don't know + // the ROCKSDB_NAMESPACE::Status? } else { - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } -rocksdb::Status WriteBatchHandlerJniCallback::MarkCommit(const Slice& xid) { +ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkCommit( + const Slice& xid) { auto markCommit = [this] ( jbyteArray j_xid) { m_env->CallVoidMethod( @@ -396,9 +421,11 @@ rocksdb::Status WriteBatchHandlerJniCallback::MarkCommit(const Slice& xid) { }; auto status = WriteBatchHandlerJniCallback::k_op(xid, markCommit); if(status == nullptr) { - return rocksdb::Status::OK(); // TODO(AR) what to do if there is an Exception but we don't know the rocksdb::Status? + return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is + // an Exception but we don't know + // the ROCKSDB_NAMESPACE::Status? } else { - return rocksdb::Status(*status); + return ROCKSDB_NAMESPACE::Status(*status); } } @@ -414,8 +441,10 @@ bool WriteBatchHandlerJniCallback::Continue() { return static_cast(jContinue == JNI_TRUE); } -std::unique_ptr WriteBatchHandlerJniCallback::kv_op(const Slice& key, const Slice& value, std::function kvFn) { - const jbyteArray j_key = JniUtil::copyBytes(m_env, key); +std::unique_ptr WriteBatchHandlerJniCallback::kv_op( + const Slice& key, const Slice& value, + std::function kvFn) { + const jbyteArray j_key = JniUtil::copyBytes(m_env, key); if (j_key == nullptr) { // exception thrown if (m_env->ExceptionCheck()) { @@ -449,7 +478,8 @@ std::unique_ptr WriteBatchHandlerJniCallback::kv_op(const Slice // exception thrown jthrowable exception = m_env->ExceptionOccurred(); - std::unique_ptr status = rocksdb::RocksDBExceptionJni::toCppStatus(m_env, exception); + std::unique_ptr status = + ROCKSDB_NAMESPACE::RocksDBExceptionJni::toCppStatus(m_env, exception); if (status == nullptr) { // unkown status or exception occurred extracting status m_env->ExceptionDescribe(); @@ -469,11 +499,13 @@ std::unique_ptr WriteBatchHandlerJniCallback::kv_op(const Slice } // all OK - return std::unique_ptr(new rocksdb::Status(rocksdb::Status::OK())); + return std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::OK())); } -std::unique_ptr WriteBatchHandlerJniCallback::k_op(const Slice& key, std::function kFn) { - const jbyteArray j_key = JniUtil::copyBytes(m_env, key); +std::unique_ptr WriteBatchHandlerJniCallback::k_op( + const Slice& key, std::function kFn) { + const jbyteArray j_key = JniUtil::copyBytes(m_env, key); if (j_key == nullptr) { // exception thrown if (m_env->ExceptionCheck()) { @@ -492,7 +524,8 @@ std::unique_ptr WriteBatchHandlerJniCallback::k_op(const Slice& // exception thrown jthrowable exception = m_env->ExceptionOccurred(); - std::unique_ptr status = rocksdb::RocksDBExceptionJni::toCppStatus(m_env, exception); + std::unique_ptr status = + ROCKSDB_NAMESPACE::RocksDBExceptionJni::toCppStatus(m_env, exception); if (status == nullptr) { // unkown status or exception occurred extracting status m_env->ExceptionDescribe(); @@ -509,6 +542,7 @@ std::unique_ptr WriteBatchHandlerJniCallback::k_op(const Slice& } // all OK - return std::unique_ptr(new rocksdb::Status(rocksdb::Status::OK())); + return std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::OK())); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/writebatchhandlerjnicallback.h b/java/rocksjni/writebatchhandlerjnicallback.h index 720f1693cb..a4c61f8bdf 100644 --- a/java/rocksjni/writebatchhandlerjnicallback.h +++ b/java/rocksjni/writebatchhandlerjnicallback.h @@ -4,7 +4,7 @@ // (found in the LICENSE.Apache file in the root directory). // // This file implements the callback "bridge" between Java and C++ for -// rocksdb::WriteBatch::Handler. +// ROCKSDB_NAMESPACE::WriteBatch::Handler. #ifndef JAVA_ROCKSJNI_WRITEBATCHHANDLERJNICALLBACK_H_ #define JAVA_ROCKSJNI_WRITEBATCHHANDLERJNICALLBACK_H_ @@ -15,7 +15,7 @@ #include "rocksjni/jnicallback.h" #include "rocksdb/write_batch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { /** * This class acts as a bridge between C++ * and Java. The methods in this class will be @@ -71,14 +71,19 @@ class WriteBatchHandlerJniCallback : public JniCallback, public WriteBatch::Hand jmethodID m_jMarkCommitMethodId; jmethodID m_jContinueMethodId; /** - * @return A pointer to a rocksdb::Status or nullptr if an unexpected exception occurred + * @return A pointer to a ROCKSDB_NAMESPACE::Status or nullptr if an + * unexpected exception occurred */ - std::unique_ptr kv_op(const Slice& key, const Slice& value, std::function kvFn); + std::unique_ptr kv_op( + const Slice& key, const Slice& value, + std::function kvFn); /** - * @return A pointer to a rocksdb::Status or nullptr if an unexpected exception occurred + * @return A pointer to a ROCKSDB_NAMESPACE::Status or nullptr if an + * unexpected exception occurred */ - std::unique_ptr k_op(const Slice& key, std::function kFn); + std::unique_ptr k_op( + const Slice& key, std::function kFn); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_WRITEBATCHHANDLERJNICALLBACK_H_ diff --git a/logging/auto_roll_logger.cc b/logging/auto_roll_logger.cc index 5a474207c5..fc498521b9 100644 --- a/logging/auto_roll_logger.cc +++ b/logging/auto_roll_logger.cc @@ -10,7 +10,7 @@ #include "logging/logging.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE // -- AutoRollLogger @@ -289,4 +289,4 @@ Status CreateLoggerFromOptions(const std::string& dbname, return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/logging/auto_roll_logger.h b/logging/auto_roll_logger.h index 87b4311387..5d8c414138 100644 --- a/logging/auto_roll_logger.h +++ b/logging/auto_roll_logger.h @@ -17,7 +17,7 @@ #include "test_util/sync_point.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE // Rolls the log file by size and/or time @@ -161,4 +161,4 @@ Status CreateLoggerFromOptions(const std::string& dbname, const DBOptions& options, std::shared_ptr* logger); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/logging/auto_roll_logger_test.cc b/logging/auto_roll_logger_test.cc index 791fd60819..6e72fb90ba 100644 --- a/logging/auto_roll_logger_test.cc +++ b/logging/auto_roll_logger_test.cc @@ -24,7 +24,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { class NoSleepEnv : public EnvWrapper { public: @@ -445,7 +445,7 @@ TEST_F(AutoRollLoggerTest, LogFlushWhileRolling) { AutoRollLogger* auto_roll_logger = dynamic_cast(logger.get()); ASSERT_TRUE(auto_roll_logger); - rocksdb::port::Thread flush_thread; + ROCKSDB_NAMESPACE::port::Thread flush_thread; // Notes: // (1) Need to pin the old logger before beginning the roll, as rolling grabs @@ -456,7 +456,7 @@ TEST_F(AutoRollLoggerTest, LogFlushWhileRolling) { // logger after auto-roll logger has cut over to a new logger. // (3) PosixLogger::Flush() happens in both threads but its SyncPoints only // are enabled in flush_thread (the one pinning the old logger). - rocksdb::SyncPoint::GetInstance()->LoadDependencyAndMarkers( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependencyAndMarkers( {{"AutoRollLogger::Flush:PinnedLogger", "AutoRollLoggerTest::LogFlushWhileRolling:PreRollAndPostThreadInit"}, {"PosixLogger::Flush:Begin1", @@ -465,7 +465,7 @@ TEST_F(AutoRollLoggerTest, LogFlushWhileRolling) { "PosixLogger::Flush:Begin2"}}, {{"AutoRollLogger::Flush:PinnedLogger", "PosixLogger::Flush:Begin1"}, {"AutoRollLogger::Flush:PinnedLogger", "PosixLogger::Flush:Begin2"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); flush_thread = port::Thread([&]() { auto_roll_logger->Flush(); }); TEST_SYNC_POINT( @@ -473,7 +473,7 @@ TEST_F(AutoRollLoggerTest, LogFlushWhileRolling) { RollLogFileBySizeTest(auto_roll_logger, options.max_log_file_size, kSampleMessage + ":LogFlushWhileRolling"); flush_thread.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } #endif // OS_WIN @@ -637,8 +637,8 @@ TEST_F(AutoRollLoggerTest, LogHeaderTest) { } TEST_F(AutoRollLoggerTest, LogFileExistence) { - rocksdb::DB* db; - rocksdb::Options options; + ROCKSDB_NAMESPACE::DB* db; + ROCKSDB_NAMESPACE::Options options; #ifdef OS_WIN // Replace all slashes in the path so windows CompSpec does not // become confused @@ -652,7 +652,7 @@ TEST_F(AutoRollLoggerTest, LogFileExistence) { ASSERT_EQ(system(deleteCmd.c_str()), 0); options.max_log_file_size = 100 * 1024 * 1024; options.create_if_missing = true; - ASSERT_OK(rocksdb::DB::Open(options, kTestDir, &db)); + ASSERT_OK(ROCKSDB_NAMESPACE::DB::Open(options, kTestDir, &db)); ASSERT_OK(default_env->FileExists(kLogFile)); delete db; } @@ -666,7 +666,7 @@ TEST_F(AutoRollLoggerTest, FileCreateFailure) { ASSERT_NOK(CreateLoggerFromOptions("", options, &logger)); ASSERT_TRUE(!logger); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/logging/env_logger.h b/logging/env_logger.h index 5aeb1d07c3..9fecb50cf9 100644 --- a/logging/env_logger.h +++ b/logging/env_logger.h @@ -23,7 +23,7 @@ #include "test_util/sync_point.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class EnvLogger : public Logger { public: @@ -162,4 +162,4 @@ class EnvLogger : public Logger { std::atomic flush_pending_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/logging/env_logger_test.cc b/logging/env_logger_test.cc index 6e1af2d559..375e2cf5ba 100644 --- a/logging/env_logger_test.cc +++ b/logging/env_logger_test.cc @@ -9,7 +9,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { // In this test we only want to Log some simple log message with @@ -154,7 +154,7 @@ TEST_F(EnvLoggerTest, ConcurrentLogging) { DeleteLogFile(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/logging/event_logger.cc b/logging/event_logger.cc index 5e07fd96f2..f1747ad253 100644 --- a/logging/event_logger.cc +++ b/logging/event_logger.cc @@ -13,7 +13,7 @@ #include "logging/logging.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { EventLoggerStream::EventLoggerStream(Logger* logger) : logger_(logger), @@ -53,7 +53,7 @@ void EventLogger::Log(Logger* logger, const JSONWriter& jwriter) { #ifdef ROCKSDB_PRINT_EVENTS_TO_STDOUT printf("%s\n", jwriter.Get().c_str()); #else - rocksdb::Log(logger, "%s %s", Prefix(), jwriter.Get().c_str()); + ROCKSDB_NAMESPACE::Log(logger, "%s %s", Prefix(), jwriter.Get().c_str()); #endif } @@ -63,9 +63,9 @@ void EventLogger::LogToBuffer(LogBuffer* log_buffer, const JSONWriter& jwriter, printf("%s\n", jwriter.Get().c_str()); #else assert(log_buffer); - rocksdb::LogToBuffer(log_buffer, max_log_size, "%s %s", Prefix(), - jwriter.Get().c_str()); + ROCKSDB_NAMESPACE::LogToBuffer(log_buffer, max_log_size, "%s %s", Prefix(), + jwriter.Get().c_str()); #endif } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/logging/event_logger.h b/logging/event_logger.h index 6206993c87..596eb0f517 100644 --- a/logging/event_logger.h +++ b/logging/event_logger.h @@ -13,7 +13,7 @@ #include "logging/log_buffer.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class JSONWriter { public: @@ -200,4 +200,4 @@ class EventLogger { Logger* logger_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/logging/event_logger_test.cc b/logging/event_logger_test.cc index cc635d42fb..656d73c87b 100644 --- a/logging/event_logger_test.cc +++ b/logging/event_logger_test.cc @@ -8,7 +8,7 @@ #include "logging/event_logger.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class EventLoggerTest : public testing::Test {}; @@ -35,7 +35,7 @@ TEST_F(EventLoggerTest, SimpleTest) { ASSERT_TRUE(output.find("\"time_micros\"") != std::string::npos); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/logging/log_buffer.cc b/logging/log_buffer.cc index 5327c1814c..242d280b32 100644 --- a/logging/log_buffer.cc +++ b/logging/log_buffer.cc @@ -8,7 +8,7 @@ #include "port/sys_time.h" #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { LogBuffer::LogBuffer(const InfoLogLevel log_level, Logger*info_log) @@ -89,4 +89,4 @@ void LogToBuffer(LogBuffer* log_buffer, const char* format, ...) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/logging/log_buffer.h b/logging/log_buffer.h index b54bf4d49e..285256e209 100644 --- a/logging/log_buffer.h +++ b/logging/log_buffer.h @@ -11,7 +11,7 @@ #include "rocksdb/env.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Logger; @@ -53,4 +53,4 @@ extern void LogToBuffer(LogBuffer* log_buffer, size_t max_log_size, // Same as previous function, but with default max log size. extern void LogToBuffer(LogBuffer* log_buffer, const char* format, ...); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/logging/logging.h b/logging/logging.h index cad90a309f..178addcc3b 100644 --- a/logging/logging.h +++ b/logging/logging.h @@ -25,36 +25,43 @@ inline const char* RocksLogShorterFileName(const char* file) } // Don't inclide file/line info in HEADER level -#define ROCKS_LOG_HEADER(LGR, FMT, ...) \ - rocksdb::Log(InfoLogLevel::HEADER_LEVEL, LGR, FMT, ##__VA_ARGS__) +#define ROCKS_LOG_HEADER(LGR, FMT, ...) \ + ROCKSDB_NAMESPACE::Log(InfoLogLevel::HEADER_LEVEL, LGR, FMT, ##__VA_ARGS__) -#define ROCKS_LOG_DEBUG(LGR, FMT, ...) \ - rocksdb::Log(InfoLogLevel::DEBUG_LEVEL, LGR, ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ - RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) +#define ROCKS_LOG_DEBUG(LGR, FMT, ...) \ + ROCKSDB_NAMESPACE::Log(InfoLogLevel::DEBUG_LEVEL, LGR, \ + ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ + RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) -#define ROCKS_LOG_INFO(LGR, FMT, ...) \ - rocksdb::Log(InfoLogLevel::INFO_LEVEL, LGR, ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ - RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) +#define ROCKS_LOG_INFO(LGR, FMT, ...) \ + ROCKSDB_NAMESPACE::Log(InfoLogLevel::INFO_LEVEL, LGR, \ + ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ + RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) -#define ROCKS_LOG_WARN(LGR, FMT, ...) \ - rocksdb::Log(InfoLogLevel::WARN_LEVEL, LGR, ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ - RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) +#define ROCKS_LOG_WARN(LGR, FMT, ...) \ + ROCKSDB_NAMESPACE::Log(InfoLogLevel::WARN_LEVEL, LGR, \ + ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ + RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) -#define ROCKS_LOG_ERROR(LGR, FMT, ...) \ - rocksdb::Log(InfoLogLevel::ERROR_LEVEL, LGR, ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ - RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) +#define ROCKS_LOG_ERROR(LGR, FMT, ...) \ + ROCKSDB_NAMESPACE::Log(InfoLogLevel::ERROR_LEVEL, LGR, \ + ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ + RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) -#define ROCKS_LOG_FATAL(LGR, FMT, ...) \ - rocksdb::Log(InfoLogLevel::FATAL_LEVEL, LGR, ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ - RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) +#define ROCKS_LOG_FATAL(LGR, FMT, ...) \ + ROCKSDB_NAMESPACE::Log(InfoLogLevel::FATAL_LEVEL, LGR, \ + ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ + RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) -#define ROCKS_LOG_BUFFER(LOG_BUF, FMT, ...) \ - rocksdb::LogToBuffer(LOG_BUF, ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ - RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) +#define ROCKS_LOG_BUFFER(LOG_BUF, FMT, ...) \ + ROCKSDB_NAMESPACE::LogToBuffer(LOG_BUF, ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ + RocksLogShorterFileName(__FILE__), \ + ##__VA_ARGS__) -#define ROCKS_LOG_BUFFER_MAX_SZ(LOG_BUF, MAX_LOG_SIZE, FMT, ...) \ - rocksdb::LogToBuffer(LOG_BUF, MAX_LOG_SIZE, ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ - RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) +#define ROCKS_LOG_BUFFER_MAX_SZ(LOG_BUF, MAX_LOG_SIZE, FMT, ...) \ + ROCKSDB_NAMESPACE::LogToBuffer( \ + LOG_BUF, MAX_LOG_SIZE, ROCKS_LOG_PREPEND_FILE_LINE(FMT), \ + RocksLogShorterFileName(__FILE__), ##__VA_ARGS__) #define ROCKS_LOG_DETAILS(LGR, FMT, ...) \ ; // due to overhead by default skip such lines diff --git a/logging/posix_logger.h b/logging/posix_logger.h index 8406a6d8ac..fbd297c68b 100644 --- a/logging/posix_logger.h +++ b/logging/posix_logger.h @@ -29,7 +29,7 @@ #include "rocksdb/env.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class PosixLogger : public Logger { private: @@ -182,4 +182,4 @@ class PosixLogger : public Logger { size_t GetLogFileSize() const override { return log_size_; } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memory/allocator.h b/memory/allocator.h index 619cd66a5f..002ad5f1d8 100644 --- a/memory/allocator.h +++ b/memory/allocator.h @@ -15,7 +15,7 @@ #include #include "rocksdb/write_buffer_manager.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Logger; @@ -54,4 +54,4 @@ class AllocTracker { bool freed_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memory/arena.cc b/memory/arena.cc index 70c8039015..ed46459d9c 100644 --- a/memory/arena.cc +++ b/memory/arena.cc @@ -18,7 +18,7 @@ #include "rocksdb/env.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // MSVC complains that it is already defined since it is static in the header. #ifndef _MSC_VER @@ -230,4 +230,4 @@ char* Arena::AllocateNewBlock(size_t block_bytes) { return block; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memory/arena.h b/memory/arena.h index fd97f57e1e..a7ee4c6ab0 100644 --- a/memory/arena.h +++ b/memory/arena.h @@ -23,7 +23,7 @@ #include "memory/allocator.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Arena : public Allocator { public: @@ -138,4 +138,4 @@ inline char* Arena::Allocate(size_t bytes) { // 2. the multiple of align unit. extern size_t OptimizeBlockSize(size_t block_size); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memory/arena_test.cc b/memory/arena_test.cc index 18296d307d..3fa6483fc5 100644 --- a/memory/arena_test.cc +++ b/memory/arena_test.cc @@ -11,7 +11,7 @@ #include "test_util/testharness.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { const size_t kHugePageSize = 2 * 1024 * 1024; @@ -196,7 +196,7 @@ TEST_F(ArenaTest, Simple) { SimpleTest(0); SimpleTest(kHugePageSize); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/memory/concurrent_arena.cc b/memory/concurrent_arena.cc index 722eb3b60b..3333f94db8 100644 --- a/memory/concurrent_arena.cc +++ b/memory/concurrent_arena.cc @@ -12,7 +12,7 @@ #include "port/port.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_SUPPORT_THREAD_LOCAL __thread size_t ConcurrentArena::tls_cpuid = 0; @@ -44,4 +44,4 @@ ConcurrentArena::Shard* ConcurrentArena::Repick() { return shard_and_index.first; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memory/concurrent_arena.h b/memory/concurrent_arena.h index 6b41ab0247..dad27a3079 100644 --- a/memory/concurrent_arena.h +++ b/memory/concurrent_arena.h @@ -26,7 +26,7 @@ #define ROCKSDB_FIELD_UNUSED #endif // __clang__ -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Logger; @@ -212,4 +212,4 @@ class ConcurrentArena : public Allocator { ConcurrentArena& operator=(const ConcurrentArena&) = delete; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memory/jemalloc_nodump_allocator.cc b/memory/jemalloc_nodump_allocator.cc index 1f58351bef..980b08b955 100644 --- a/memory/jemalloc_nodump_allocator.cc +++ b/memory/jemalloc_nodump_allocator.cc @@ -12,7 +12,7 @@ #include "port/port.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_JEMALLOC_NODUMP_ALLOCATOR @@ -203,4 +203,4 @@ Status NewJemallocNodumpAllocator( #endif // ROCKSDB_JEMALLOC_NODUMP_ALLOCATOR } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memory/jemalloc_nodump_allocator.h b/memory/jemalloc_nodump_allocator.h index f997a3b812..7bc255508e 100644 --- a/memory/jemalloc_nodump_allocator.h +++ b/memory/jemalloc_nodump_allocator.h @@ -20,7 +20,7 @@ #if (JEMALLOC_VERSION_MAJOR >= 5) && defined(MADV_DONTDUMP) #define ROCKSDB_JEMALLOC_NODUMP_ALLOCATOR -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class JemallocNodumpAllocator : public MemoryAllocator { public: @@ -73,6 +73,6 @@ class JemallocNodumpAllocator : public MemoryAllocator { ThreadLocalPtr tcache_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // (JEMALLOC_VERSION_MAJOR >= 5) && MADV_DONTDUMP #endif // ROCKSDB_JEMALLOC && ROCKSDB_PLATFORM_POSIX diff --git a/memory/memory_allocator.h b/memory/memory_allocator.h index 99a7241d0a..f1a548659b 100644 --- a/memory/memory_allocator.h +++ b/memory/memory_allocator.h @@ -8,7 +8,7 @@ #include "rocksdb/memory_allocator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct CustomDeleter { CustomDeleter(MemoryAllocator* a = nullptr) : allocator(a) {} @@ -35,4 +35,4 @@ inline CacheAllocationPtr AllocateBlock(size_t size, return CacheAllocationPtr(new char[size]); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memory/memory_usage.h b/memory/memory_usage.h index 0d8854453a..15e8b87cde 100644 --- a/memory/memory_usage.h +++ b/memory/memory_usage.h @@ -7,7 +7,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Helper methods to estimate memroy usage by std containers. @@ -22,4 +22,4 @@ size_t ApproximateMemoryUsage( umap.bucket_count() * sizeof(void*); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memtable/alloc_tracker.cc b/memtable/alloc_tracker.cc index ddd40aa059..fe21343471 100644 --- a/memtable/alloc_tracker.cc +++ b/memtable/alloc_tracker.cc @@ -12,7 +12,7 @@ #include "memory/arena.h" #include "rocksdb/write_buffer_manager.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { AllocTracker::AllocTracker(WriteBufferManager* write_buffer_manager) : write_buffer_manager_(write_buffer_manager), @@ -59,4 +59,4 @@ void AllocTracker::FreeMem() { freed_ = true; } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memtable/hash_linklist_rep.cc b/memtable/hash_linklist_rep.cc index 5c906165e0..3698812c5c 100644 --- a/memtable/hash_linklist_rep.cc +++ b/memtable/hash_linklist_rep.cc @@ -19,7 +19,7 @@ #include "rocksdb/slice_transform.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { typedef const char* Key; @@ -840,5 +840,5 @@ MemTableRepFactory* NewHashLinkListRepFactory( bucket_entries_logging_threshold, if_log_bucket_dist_when_flash); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/memtable/hash_linklist_rep.h b/memtable/hash_linklist_rep.h index a6da3eedd5..7e7195526b 100644 --- a/memtable/hash_linklist_rep.h +++ b/memtable/hash_linklist_rep.h @@ -11,7 +11,7 @@ #include "rocksdb/slice_transform.h" #include "rocksdb/memtablerep.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class HashLinkListRepFactory : public MemTableRepFactory { public: @@ -45,5 +45,5 @@ class HashLinkListRepFactory : public MemTableRepFactory { bool if_log_bucket_dist_when_flash_; }; -} +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/memtable/hash_skiplist_rep.cc b/memtable/hash_skiplist_rep.cc index 5c74657cd3..67a2a6c83c 100644 --- a/memtable/hash_skiplist_rep.cc +++ b/memtable/hash_skiplist_rep.cc @@ -18,7 +18,7 @@ #include "rocksdb/slice_transform.h" #include "util/murmurhash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { class HashSkipListRep : public MemTableRep { @@ -345,5 +345,5 @@ MemTableRepFactory* NewHashSkipListRepFactory( skiplist_branching_factor); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/memtable/hash_skiplist_rep.h b/memtable/hash_skiplist_rep.h index 5d1e04f34d..6da5a4e943 100644 --- a/memtable/hash_skiplist_rep.h +++ b/memtable/hash_skiplist_rep.h @@ -11,7 +11,7 @@ #include "rocksdb/slice_transform.h" #include "rocksdb/memtablerep.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class HashSkipListRepFactory : public MemTableRepFactory { public: @@ -40,5 +40,5 @@ class HashSkipListRepFactory : public MemTableRepFactory { const int32_t skiplist_branching_factor_; }; -} +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/memtable/inlineskiplist.h b/memtable/inlineskiplist.h index 91ab3d7546..1782288f08 100644 --- a/memtable/inlineskiplist.h +++ b/memtable/inlineskiplist.h @@ -53,7 +53,7 @@ #include "util/coding.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { template class InlineSkipList { @@ -994,4 +994,4 @@ void InlineSkipList::TEST_Validate() const { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memtable/inlineskiplist_test.cc b/memtable/inlineskiplist_test.cc index a3ae414987..f0a7053196 100644 --- a/memtable/inlineskiplist_test.cc +++ b/memtable/inlineskiplist_test.cc @@ -16,7 +16,7 @@ #include "util/hash.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Our test skip list stores 8-byte unsigned integers typedef uint64_t Key; @@ -655,7 +655,7 @@ TEST_F(InlineSkipTest, ConcurrentInsertWithHint3) { } #endif // ROCKSDB_VALGRIND_RUN -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/memtable/memtablerep_bench.cc b/memtable/memtablerep_bench.cc index 1e2b5bdd1e..06074a3a4a 100644 --- a/memtable/memtablerep_bench.cc +++ b/memtable/memtablerep_bench.cc @@ -120,7 +120,7 @@ DEFINE_int64(seed, 0, "Seed base for random number generators. " "When 0 it is deterministic."); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { struct CallbackVerifyArgs { @@ -552,7 +552,7 @@ class ReadWriteBenchmark : public Benchmark { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE void PrintWarnings() { #if defined(__GNUC__) && !defined(__OPTIMIZE__) @@ -566,45 +566,45 @@ void PrintWarnings() { } int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); SetUsageMessage(std::string("\nUSAGE:\n") + std::string(argv[0]) + " [OPTIONS]..."); ParseCommandLineFlags(&argc, &argv, true); PrintWarnings(); - rocksdb::Options options; + ROCKSDB_NAMESPACE::Options options; - std::unique_ptr factory; + std::unique_ptr factory; if (FLAGS_memtablerep == "skiplist") { - factory.reset(new rocksdb::SkipListFactory); + factory.reset(new ROCKSDB_NAMESPACE::SkipListFactory); #ifndef ROCKSDB_LITE } else if (FLAGS_memtablerep == "vector") { - factory.reset(new rocksdb::VectorRepFactory); + factory.reset(new ROCKSDB_NAMESPACE::VectorRepFactory); } else if (FLAGS_memtablerep == "hashskiplist") { - factory.reset(rocksdb::NewHashSkipListRepFactory( + factory.reset(ROCKSDB_NAMESPACE::NewHashSkipListRepFactory( FLAGS_bucket_count, FLAGS_hashskiplist_height, FLAGS_hashskiplist_branching_factor)); options.prefix_extractor.reset( - rocksdb::NewFixedPrefixTransform(FLAGS_prefix_length)); + ROCKSDB_NAMESPACE::NewFixedPrefixTransform(FLAGS_prefix_length)); } else if (FLAGS_memtablerep == "hashlinklist") { - factory.reset(rocksdb::NewHashLinkListRepFactory( + factory.reset(ROCKSDB_NAMESPACE::NewHashLinkListRepFactory( FLAGS_bucket_count, FLAGS_huge_page_tlb_size, FLAGS_bucket_entries_logging_threshold, FLAGS_if_log_bucket_dist_when_flash, FLAGS_threshold_use_skiplist)); options.prefix_extractor.reset( - rocksdb::NewFixedPrefixTransform(FLAGS_prefix_length)); + ROCKSDB_NAMESPACE::NewFixedPrefixTransform(FLAGS_prefix_length)); #endif // ROCKSDB_LITE } else { fprintf(stdout, "Unknown memtablerep: %s\n", FLAGS_memtablerep.c_str()); exit(1); } - rocksdb::InternalKeyComparator internal_key_comp( - rocksdb::BytewiseComparator()); - rocksdb::MemTable::KeyComparator key_comp(internal_key_comp); - rocksdb::Arena arena; - rocksdb::WriteBufferManager wb(FLAGS_write_buffer_size); + ROCKSDB_NAMESPACE::InternalKeyComparator internal_key_comp( + ROCKSDB_NAMESPACE::BytewiseComparator()); + ROCKSDB_NAMESPACE::MemTable::KeyComparator key_comp(internal_key_comp); + ROCKSDB_NAMESPACE::Arena arena; + ROCKSDB_NAMESPACE::WriteBufferManager wb(FLAGS_write_buffer_size); uint64_t sequence; auto createMemtableRep = [&] { sequence = 0; @@ -612,57 +612,57 @@ int main(int argc, char** argv) { options.prefix_extractor.get(), options.info_log.get()); }; - std::unique_ptr memtablerep; - rocksdb::Random64 rng(FLAGS_seed); + std::unique_ptr memtablerep; + ROCKSDB_NAMESPACE::Random64 rng(FLAGS_seed); const char* benchmarks = FLAGS_benchmarks.c_str(); while (benchmarks != nullptr) { - std::unique_ptr key_gen; + std::unique_ptr key_gen; const char* sep = strchr(benchmarks, ','); - rocksdb::Slice name; + ROCKSDB_NAMESPACE::Slice name; if (sep == nullptr) { name = benchmarks; benchmarks = nullptr; } else { - name = rocksdb::Slice(benchmarks, sep - benchmarks); + name = ROCKSDB_NAMESPACE::Slice(benchmarks, sep - benchmarks); benchmarks = sep + 1; } - std::unique_ptr benchmark; - if (name == rocksdb::Slice("fillseq")) { + std::unique_ptr benchmark; + if (name == ROCKSDB_NAMESPACE::Slice("fillseq")) { memtablerep.reset(createMemtableRep()); - key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::SEQUENTIAL, - FLAGS_num_operations)); - benchmark.reset(new rocksdb::FillBenchmark(memtablerep.get(), - key_gen.get(), &sequence)); - } else if (name == rocksdb::Slice("fillrandom")) { + key_gen.reset(new ROCKSDB_NAMESPACE::KeyGenerator( + &rng, ROCKSDB_NAMESPACE::SEQUENTIAL, FLAGS_num_operations)); + benchmark.reset(new ROCKSDB_NAMESPACE::FillBenchmark( + memtablerep.get(), key_gen.get(), &sequence)); + } else if (name == ROCKSDB_NAMESPACE::Slice("fillrandom")) { memtablerep.reset(createMemtableRep()); - key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::UNIQUE_RANDOM, - FLAGS_num_operations)); - benchmark.reset(new rocksdb::FillBenchmark(memtablerep.get(), - key_gen.get(), &sequence)); - } else if (name == rocksdb::Slice("readrandom")) { - key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::RANDOM, - FLAGS_num_operations)); - benchmark.reset(new rocksdb::ReadBenchmark(memtablerep.get(), - key_gen.get(), &sequence)); - } else if (name == rocksdb::Slice("readseq")) { - key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::SEQUENTIAL, - FLAGS_num_operations)); - benchmark.reset( - new rocksdb::SeqReadBenchmark(memtablerep.get(), &sequence)); - } else if (name == rocksdb::Slice("readwrite")) { + key_gen.reset(new ROCKSDB_NAMESPACE::KeyGenerator( + &rng, ROCKSDB_NAMESPACE::UNIQUE_RANDOM, FLAGS_num_operations)); + benchmark.reset(new ROCKSDB_NAMESPACE::FillBenchmark( + memtablerep.get(), key_gen.get(), &sequence)); + } else if (name == ROCKSDB_NAMESPACE::Slice("readrandom")) { + key_gen.reset(new ROCKSDB_NAMESPACE::KeyGenerator( + &rng, ROCKSDB_NAMESPACE::RANDOM, FLAGS_num_operations)); + benchmark.reset(new ROCKSDB_NAMESPACE::ReadBenchmark( + memtablerep.get(), key_gen.get(), &sequence)); + } else if (name == ROCKSDB_NAMESPACE::Slice("readseq")) { + key_gen.reset(new ROCKSDB_NAMESPACE::KeyGenerator( + &rng, ROCKSDB_NAMESPACE::SEQUENTIAL, FLAGS_num_operations)); + benchmark.reset(new ROCKSDB_NAMESPACE::SeqReadBenchmark(memtablerep.get(), + &sequence)); + } else if (name == ROCKSDB_NAMESPACE::Slice("readwrite")) { memtablerep.reset(createMemtableRep()); - key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::RANDOM, - FLAGS_num_operations)); - benchmark.reset(new rocksdb::ReadWriteBenchmark< - rocksdb::ConcurrentReadBenchmarkThread>(memtablerep.get(), - key_gen.get(), &sequence)); - } else if (name == rocksdb::Slice("seqreadwrite")) { + key_gen.reset(new ROCKSDB_NAMESPACE::KeyGenerator( + &rng, ROCKSDB_NAMESPACE::RANDOM, FLAGS_num_operations)); + benchmark.reset(new ROCKSDB_NAMESPACE::ReadWriteBenchmark< + ROCKSDB_NAMESPACE::ConcurrentReadBenchmarkThread>( + memtablerep.get(), key_gen.get(), &sequence)); + } else if (name == ROCKSDB_NAMESPACE::Slice("seqreadwrite")) { memtablerep.reset(createMemtableRep()); - key_gen.reset(new rocksdb::KeyGenerator(&rng, rocksdb::RANDOM, - FLAGS_num_operations)); - benchmark.reset(new rocksdb::ReadWriteBenchmark< - rocksdb::SeqConcurrentReadBenchmarkThread>(memtablerep.get(), - key_gen.get(), &sequence)); + key_gen.reset(new ROCKSDB_NAMESPACE::KeyGenerator( + &rng, ROCKSDB_NAMESPACE::RANDOM, FLAGS_num_operations)); + benchmark.reset(new ROCKSDB_NAMESPACE::ReadWriteBenchmark< + ROCKSDB_NAMESPACE::SeqConcurrentReadBenchmarkThread>( + memtablerep.get(), key_gen.get(), &sequence)); } else { std::cout << "WARNING: skipping unknown benchmark '" << name.ToString() << std::endl; diff --git a/memtable/skiplist.h b/memtable/skiplist.h index 5edfc10b7c..52818e3020 100644 --- a/memtable/skiplist.h +++ b/memtable/skiplist.h @@ -38,7 +38,7 @@ #include "port/port.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { template class SkipList { @@ -493,4 +493,4 @@ bool SkipList::Contains(const Key& key) const { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memtable/skiplist_test.cc b/memtable/skiplist_test.cc index 33cc19b2d3..18990eab5c 100644 --- a/memtable/skiplist_test.cc +++ b/memtable/skiplist_test.cc @@ -15,7 +15,7 @@ #include "util/hash.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { typedef uint64_t Key; @@ -380,7 +380,7 @@ TEST_F(SkipTest, Concurrent3) { RunConcurrent(3); } TEST_F(SkipTest, Concurrent4) { RunConcurrent(4); } TEST_F(SkipTest, Concurrent5) { RunConcurrent(5); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/memtable/skiplistrep.cc b/memtable/skiplistrep.cc index 55d3cd7a65..eec15626c0 100644 --- a/memtable/skiplistrep.cc +++ b/memtable/skiplistrep.cc @@ -8,7 +8,7 @@ #include "memtable/inlineskiplist.h" #include "rocksdb/memtablerep.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { class SkipListRep : public MemTableRep { InlineSkipList skip_list_; @@ -277,4 +277,4 @@ MemTableRep* SkipListFactory::CreateMemTableRep( return new SkipListRep(compare, allocator, transform, lookahead_); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memtable/stl_wrappers.h b/memtable/stl_wrappers.h index 0287f4f8fe..e9f8f214ce 100644 --- a/memtable/stl_wrappers.h +++ b/memtable/stl_wrappers.h @@ -12,7 +12,7 @@ #include "rocksdb/slice.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace stl_wrappers { class Base { @@ -30,4 +30,4 @@ struct Compare : private Base { }; } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/memtable/vectorrep.cc b/memtable/vectorrep.cc index e7acc94ad6..3797e46c45 100644 --- a/memtable/vectorrep.cc +++ b/memtable/vectorrep.cc @@ -18,7 +18,7 @@ #include "port/port.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { using namespace stl_wrappers; @@ -297,5 +297,5 @@ MemTableRep* VectorRepFactory::CreateMemTableRep( const SliceTransform*, Logger* /*logger*/) { return new VectorRep(compare, allocator, count_); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/memtable/write_buffer_manager.cc b/memtable/write_buffer_manager.cc index cf7f537642..8a2dc3b8b9 100644 --- a/memtable/write_buffer_manager.cc +++ b/memtable/write_buffer_manager.cc @@ -11,7 +11,7 @@ #include #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE namespace { const size_t kSizeDummyEntry = 256 * 1024; @@ -127,4 +127,4 @@ void WriteBufferManager::FreeMemWithCache(size_t mem) { (void)mem; #endif // ROCKSDB_LITE } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/memtable/write_buffer_manager_test.cc b/memtable/write_buffer_manager_test.cc index 23de06a623..4ea52348f1 100644 --- a/memtable/write_buffer_manager_test.cc +++ b/memtable/write_buffer_manager_test.cc @@ -10,7 +10,7 @@ #include "rocksdb/write_buffer_manager.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WriteBufferManagerTest : public testing::Test {}; @@ -147,7 +147,7 @@ TEST_F(WriteBufferManagerTest, NoCapCacheCost) { ASSERT_LT(cache->GetPinnedUsage(), 1024 * 1024 + 10000); } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/monitoring/file_read_sample.h b/monitoring/file_read_sample.h index 9ad7d2f56e..82a933e0a1 100644 --- a/monitoring/file_read_sample.h +++ b/monitoring/file_read_sample.h @@ -7,7 +7,7 @@ #include "db/version_edit.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const uint32_t kFileReadSampleRate = 1024; extern bool should_sample_file_read(); extern void sample_file_read_inc(FileMetaData*); @@ -20,4 +20,4 @@ inline void sample_file_read_inc(FileMetaData* meta) { meta->stats.num_reads_sampled.fetch_add(kFileReadSampleRate, std::memory_order_relaxed); } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/histogram.cc b/monitoring/histogram.cc index 3fb30e0d7e..55339f8880 100644 --- a/monitoring/histogram.cc +++ b/monitoring/histogram.cc @@ -17,7 +17,7 @@ #include "port/port.h" #include "util/cast_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { HistogramBucketMapper::HistogramBucketMapper() { // If you change this, you also need to change @@ -285,4 +285,4 @@ void HistogramImpl::Data(HistogramData * const data) const { stats_.Data(data); } -} // namespace levedb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/histogram.h b/monitoring/histogram.h index 6bf2e9e93f..a6b93e8fd1 100644 --- a/monitoring/histogram.h +++ b/monitoring/histogram.h @@ -16,7 +16,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class HistogramBucketMapper { public: @@ -146,4 +146,4 @@ class HistogramImpl : public Histogram { std::mutex mutex_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/histogram_test.cc b/monitoring/histogram_test.cc index ed9a7bd32f..36a7d71542 100644 --- a/monitoring/histogram_test.cc +++ b/monitoring/histogram_test.cc @@ -9,7 +9,7 @@ #include "monitoring/histogram_windowing.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class HistogramTest : public testing::Test {}; @@ -213,7 +213,7 @@ TEST_F(HistogramTest, HistogramWindowingMerge) { ASSERT_EQ(histogramWindowing.max(), 5); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/monitoring/histogram_windowing.cc b/monitoring/histogram_windowing.cc index ecd6f090a5..2535127784 100644 --- a/monitoring/histogram_windowing.cc +++ b/monitoring/histogram_windowing.cc @@ -13,7 +13,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { HistogramWindowingImpl::HistogramWindowingImpl() { env_ = Env::Default(); @@ -199,4 +199,4 @@ void HistogramWindowingImpl::SwapHistoryBucket() { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/histogram_windowing.h b/monitoring/histogram_windowing.h index 6532aa248e..72545b07f3 100644 --- a/monitoring/histogram_windowing.h +++ b/monitoring/histogram_windowing.h @@ -12,7 +12,7 @@ #include "monitoring/histogram.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class HistogramWindowingImpl : public Histogram { @@ -77,4 +77,4 @@ private: uint64_t min_num_per_window_ = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/in_memory_stats_history.cc b/monitoring/in_memory_stats_history.cc index 22ecde0ab6..dba791e2b8 100644 --- a/monitoring/in_memory_stats_history.cc +++ b/monitoring/in_memory_stats_history.cc @@ -9,7 +9,7 @@ #include "monitoring/in_memory_stats_history.h" #include "db/db_impl/db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { InMemoryStatsHistoryIterator::~InMemoryStatsHistoryIterator() {} @@ -46,4 +46,4 @@ void InMemoryStatsHistoryIterator::AdvanceIteratorByTime(uint64_t start_time, } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/in_memory_stats_history.h b/monitoring/in_memory_stats_history.h index 37b50ca06d..3be864fe26 100644 --- a/monitoring/in_memory_stats_history.h +++ b/monitoring/in_memory_stats_history.h @@ -10,7 +10,7 @@ #include "rocksdb/stats_history.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // InMemoryStatsHistoryIterator can be used to access stats history that was // stored by an in-memory two level std::map(DBImpl::stats_history_). It keeps @@ -71,4 +71,4 @@ class InMemoryStatsHistoryIterator final : public StatsHistoryIterator { DBImpl* db_impl_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/instrumented_mutex.cc b/monitoring/instrumented_mutex.cc index 796bb26dd4..8b06c60ff8 100644 --- a/monitoring/instrumented_mutex.cc +++ b/monitoring/instrumented_mutex.cc @@ -8,7 +8,7 @@ #include "monitoring/thread_status_util.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { Statistics* stats_for_report(Env* env, Statistics* stats) { if (env != nullptr && stats != nullptr && @@ -66,4 +66,4 @@ bool InstrumentedCondVar::TimedWaitInternal(uint64_t abs_time_us) { return cond_.TimedWait(abs_time_us); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/instrumented_mutex.h b/monitoring/instrumented_mutex.h index 83d7523ef3..50c1f29c8a 100644 --- a/monitoring/instrumented_mutex.h +++ b/monitoring/instrumented_mutex.h @@ -12,7 +12,7 @@ #include "rocksdb/thread_status.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class InstrumentedCondVar; // A wrapper class for port::Mutex that provides additional layer @@ -95,4 +95,4 @@ class InstrumentedCondVar { int stats_code_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/iostats_context.cc b/monitoring/iostats_context.cc index 20e0467ab8..2960f05e8c 100644 --- a/monitoring/iostats_context.cc +++ b/monitoring/iostats_context.cc @@ -7,7 +7,7 @@ #include "monitoring/iostats_context_imp.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_SUPPORT_THREAD_LOCAL __thread IOStatsContext iostats_context; @@ -59,4 +59,4 @@ std::string IOStatsContext::ToString(bool exclude_zero_counters) const { return str; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/iostats_context_imp.h b/monitoring/iostats_context_imp.h index 19e34209b1..a7f095d6ef 100644 --- a/monitoring/iostats_context_imp.h +++ b/monitoring/iostats_context_imp.h @@ -8,9 +8,9 @@ #include "rocksdb/iostats_context.h" #ifdef ROCKSDB_SUPPORT_THREAD_LOCAL -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern __thread IOStatsContext iostats_context; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE // increment a specific counter by the specified value #define IOSTATS_ADD(metric, value) (iostats_context.metric += value) diff --git a/monitoring/iostats_context_test.cc b/monitoring/iostats_context_test.cc index 28d305d021..49f6fc0585 100644 --- a/monitoring/iostats_context_test.cc +++ b/monitoring/iostats_context_test.cc @@ -6,7 +6,7 @@ #include "rocksdb/iostats_context.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { TEST(IOStatsContextTest, ToString) { get_iostats_context()->Reset(); @@ -21,7 +21,7 @@ TEST(IOStatsContextTest, ToString) { ASSERT_NE(std::string::npos, zero_excluded.find("= 12345")); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/monitoring/perf_context.cc b/monitoring/perf_context.cc index 5e0d5ac254..446a9b7663 100644 --- a/monitoring/perf_context.cc +++ b/monitoring/perf_context.cc @@ -7,7 +7,7 @@ #include #include "monitoring/perf_context_imp.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #if defined(NPERF_CONTEXT) || !defined(ROCKSDB_SUPPORT_THREAD_LOCAL) PerfContext perf_context; @@ -556,4 +556,4 @@ void PerfContext::ClearPerLevelPerfContext(){ per_level_perf_context_enabled = false; } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/perf_context_imp.h b/monitoring/perf_context_imp.h index 7bf6206055..cdca27621e 100644 --- a/monitoring/perf_context_imp.h +++ b/monitoring/perf_context_imp.h @@ -8,7 +8,7 @@ #include "rocksdb/perf_context.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #if defined(NPERF_CONTEXT) || !defined(ROCKSDB_SUPPORT_THREAD_LOCAL) extern PerfContext perf_context; #else @@ -94,4 +94,4 @@ extern thread_local PerfContext perf_context; #endif -} +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/perf_level.cc b/monitoring/perf_level.cc index 79c718cce7..27bff0d281 100644 --- a/monitoring/perf_level.cc +++ b/monitoring/perf_level.cc @@ -7,7 +7,7 @@ #include #include "monitoring/perf_level_imp.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_SUPPORT_THREAD_LOCAL __thread PerfLevel perf_level = kEnableCount; @@ -25,4 +25,4 @@ PerfLevel GetPerfLevel() { return perf_level; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/perf_level_imp.h b/monitoring/perf_level_imp.h index 2a3add19ce..01277af576 100644 --- a/monitoring/perf_level_imp.h +++ b/monitoring/perf_level_imp.h @@ -7,7 +7,7 @@ #include "rocksdb/perf_level.h" #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_SUPPORT_THREAD_LOCAL extern __thread PerfLevel perf_level; @@ -15,4 +15,4 @@ extern __thread PerfLevel perf_level; extern PerfLevel perf_level; #endif -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/perf_step_timer.h b/monitoring/perf_step_timer.h index 6501bd54ab..f2d35d9d62 100644 --- a/monitoring/perf_step_timer.h +++ b/monitoring/perf_step_timer.h @@ -8,7 +8,7 @@ #include "rocksdb/env.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class PerfStepTimer { public: @@ -76,4 +76,4 @@ class PerfStepTimer { uint32_t ticker_type_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/persistent_stats_history.cc b/monitoring/persistent_stats_history.cc index 74f7303648..7cc869cf21 100644 --- a/monitoring/persistent_stats_history.cc +++ b/monitoring/persistent_stats_history.cc @@ -15,7 +15,7 @@ #include "port/likely.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // 10 digit seconds timestamp => [Sep 9, 2001 ~ Nov 20, 2286] const int kNowSecondsStringLength = 10; const std::string kFormatVersionKeyString = @@ -167,4 +167,4 @@ void PersistentStatsHistoryIterator::AdvanceIteratorByTime(uint64_t start_time, } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/persistent_stats_history.h b/monitoring/persistent_stats_history.h index 9a6885987f..7c711fe4ef 100644 --- a/monitoring/persistent_stats_history.h +++ b/monitoring/persistent_stats_history.h @@ -11,7 +11,7 @@ #include "db/db_impl/db_impl.h" #include "rocksdb/stats_history.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern const std::string kFormatVersionKeyString; extern const std::string kCompatibleVersionKeyString; @@ -80,4 +80,4 @@ class PersistentStatsHistoryIterator final : public StatsHistoryIterator { DBImpl* db_impl_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/statistics.cc b/monitoring/statistics.cc index 6942fc579f..ff610c8a14 100644 --- a/monitoring/statistics.cc +++ b/monitoring/statistics.cc @@ -11,7 +11,7 @@ #include "port/likely.h" #include "rocksdb/statistics.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // The order of items listed in Tickers should be the same as // the order listed in TickersNameMap @@ -403,4 +403,4 @@ bool StatisticsImpl::HistEnabledForType(uint32_t type) const { return type < HISTOGRAM_ENUM_MAX; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/statistics.h b/monitoring/statistics.h index 952bf8cb41..f633aa4efb 100644 --- a/monitoring/statistics.h +++ b/monitoring/statistics.h @@ -28,7 +28,7 @@ #define TOSTRING(x) STRINGIFY(x) #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { enum TickersInternal : uint32_t { INTERNAL_TICKER_ENUM_START = TICKER_ENUM_MAX, @@ -135,4 +135,4 @@ inline void SetTickerCount(Statistics* statistics, uint32_t ticker_type, } } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/statistics_test.cc b/monitoring/statistics_test.cc index 162afb264b..e497afcbe0 100644 --- a/monitoring/statistics_test.cc +++ b/monitoring/statistics_test.cc @@ -10,7 +10,7 @@ #include "rocksdb/statistics.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class StatisticsTest : public testing::Test {}; @@ -38,10 +38,10 @@ TEST_F(StatisticsTest, SanityHistograms) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/monitoring/stats_history_test.cc b/monitoring/stats_history_test.cc index f1ec339113..56b8dc4f5c 100644 --- a/monitoring/stats_history_test.cc +++ b/monitoring/stats_history_test.cc @@ -24,7 +24,7 @@ #include "test_util/testutil.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class StatsHistoryTest : public DBTestBase { public: @@ -36,15 +36,15 @@ TEST_F(StatsHistoryTest, RunStatsDumpPeriodSec) { Options options; options.create_if_missing = true; options.stats_dump_period_sec = 5; - std::unique_ptr mock_env; - mock_env.reset(new rocksdb::MockTimeEnv(env_)); + std::unique_ptr mock_env; + mock_env.reset(new ROCKSDB_NAMESPACE::MockTimeEnv(env_)); mock_env->set_current_time(0); // in seconds options.env = mock_env.get(); int counter = 0; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); #if defined(OS_MACOSX) && !defined(NDEBUG) - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "InstrumentedCondVar::TimedWaitInternal", [&](void* arg) { uint64_t time_us = *reinterpret_cast(arg); if (time_us < mock_env->RealNowMicros()) { @@ -52,9 +52,9 @@ TEST_F(StatsHistoryTest, RunStatsDumpPeriodSec) { } }); #endif // OS_MACOSX && !NDEBUG - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::DumpStats:1", [&](void* /*arg*/) { counter++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Reopen(options); ASSERT_EQ(5u, dbfull()->GetDBOptions().stats_dump_period_sec); dbfull()->TEST_WaitForDumpStatsRun([&] { mock_env->set_current_time(5); }); @@ -75,14 +75,14 @@ TEST_F(StatsHistoryTest, StatsPersistScheduling) { Options options; options.create_if_missing = true; options.stats_persist_period_sec = 5; - std::unique_ptr mock_env; - mock_env.reset(new rocksdb::MockTimeEnv(env_)); + std::unique_ptr mock_env; + mock_env.reset(new ROCKSDB_NAMESPACE::MockTimeEnv(env_)); mock_env->set_current_time(0); // in seconds options.env = mock_env.get(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); #if defined(OS_MACOSX) && !defined(NDEBUG) - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "InstrumentedCondVar::TimedWaitInternal", [&](void* arg) { uint64_t time_us = *reinterpret_cast(arg); if (time_us < mock_env->RealNowMicros()) { @@ -91,9 +91,9 @@ TEST_F(StatsHistoryTest, StatsPersistScheduling) { }); #endif // OS_MACOSX && !NDEBUG int counter = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::PersistStats:Entry", [&](void* /*arg*/) { counter++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Reopen(options); ASSERT_EQ(5u, dbfull()->GetDBOptions().stats_persist_period_sec); dbfull()->TEST_WaitForPersistStatsRun([&] { mock_env->set_current_time(5); }); @@ -111,14 +111,14 @@ TEST_F(StatsHistoryTest, PersistentStatsFreshInstall) { Options options; options.create_if_missing = true; options.stats_persist_period_sec = 0; - std::unique_ptr mock_env; - mock_env.reset(new rocksdb::MockTimeEnv(env_)); + std::unique_ptr mock_env; + mock_env.reset(new ROCKSDB_NAMESPACE::MockTimeEnv(env_)); mock_env->set_current_time(0); // in seconds options.env = mock_env.get(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); #if defined(OS_MACOSX) && !defined(NDEBUG) - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "InstrumentedCondVar::TimedWaitInternal", [&](void* arg) { uint64_t time_us = *reinterpret_cast(arg); if (time_us < mock_env->RealNowMicros()) { @@ -127,9 +127,9 @@ TEST_F(StatsHistoryTest, PersistentStatsFreshInstall) { }); #endif // OS_MACOSX && !NDEBUG int counter = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::PersistStats:Entry", [&](void* /*arg*/) { counter++; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Reopen(options); ASSERT_OK(dbfull()->SetDBOptions({{"stats_persist_period_sec", "5"}})); ASSERT_EQ(5u, dbfull()->GetDBOptions().stats_persist_period_sec); @@ -143,22 +143,22 @@ TEST_F(StatsHistoryTest, GetStatsHistoryInMemory) { Options options; options.create_if_missing = true; options.stats_persist_period_sec = 5; - options.statistics = rocksdb::CreateDBStatistics(); - std::unique_ptr mock_env; - mock_env.reset(new rocksdb::MockTimeEnv(env_)); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); + std::unique_ptr mock_env; + mock_env.reset(new ROCKSDB_NAMESPACE::MockTimeEnv(env_)); mock_env->set_current_time(0); // in seconds options.env = mock_env.get(); #if defined(OS_MACOSX) && !defined(NDEBUG) - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "InstrumentedCondVar::TimedWaitInternal", [&](void* arg) { uint64_t time_us = *reinterpret_cast(arg); if (time_us < mock_env->RealNowMicros()) { *reinterpret_cast(arg) = mock_env->RealNowMicros() + 1000; } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); #endif // OS_MACOSX && !NDEBUG CreateColumnFamilies({"pikachu"}, options); @@ -198,23 +198,23 @@ TEST_F(StatsHistoryTest, GetStatsHistoryInMemory) { TEST_F(StatsHistoryTest, InMemoryStatsHistoryPurging) { Options options; options.create_if_missing = true; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.stats_persist_period_sec = 1; - std::unique_ptr mock_env; - mock_env.reset(new rocksdb::MockTimeEnv(env_)); + std::unique_ptr mock_env; + mock_env.reset(new ROCKSDB_NAMESPACE::MockTimeEnv(env_)); mock_env->set_current_time(0); // in seconds options.env = mock_env.get(); #if defined(OS_MACOSX) && !defined(NDEBUG) - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "InstrumentedCondVar::TimedWaitInternal", [&](void* arg) { uint64_t time_us = *reinterpret_cast(arg); if (time_us < mock_env->RealNowMicros()) { *reinterpret_cast(arg) = mock_env->RealNowMicros() + 1000; } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); #endif // OS_MACOSX && !NDEBUG CreateColumnFamilies({"pikachu"}, options); @@ -312,10 +312,10 @@ TEST_F(StatsHistoryTest, GetStatsHistoryFromDisk) { Options options; options.create_if_missing = true; options.stats_persist_period_sec = 5; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.persist_stats_to_disk = true; - std::unique_ptr mock_env; - mock_env.reset(new rocksdb::MockTimeEnv(env_)); + std::unique_ptr mock_env; + mock_env.reset(new ROCKSDB_NAMESPACE::MockTimeEnv(env_)); mock_env->set_current_time(0); // in seconds options.env = mock_env.get(); CreateColumnFamilies({"pikachu"}, options); @@ -393,10 +393,10 @@ TEST_F(StatsHistoryTest, PersitentStatsVerifyValue) { Options options; options.create_if_missing = true; options.stats_persist_period_sec = 5; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.persist_stats_to_disk = true; - std::unique_ptr mock_env; - mock_env.reset(new rocksdb::MockTimeEnv(env_)); + std::unique_ptr mock_env; + mock_env.reset(new ROCKSDB_NAMESPACE::MockTimeEnv(env_)); std::map stats_map_before; ASSERT_TRUE(options.statistics->getTickerMap(&stats_map_before)); mock_env->set_current_time(0); // in seconds @@ -472,10 +472,10 @@ TEST_F(StatsHistoryTest, PersistentStatsCreateColumnFamilies) { Options options; options.create_if_missing = true; options.stats_persist_period_sec = 5; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.persist_stats_to_disk = true; - std::unique_ptr mock_env; - mock_env.reset(new rocksdb::MockTimeEnv(env_)); + std::unique_ptr mock_env; + mock_env.reset(new ROCKSDB_NAMESPACE::MockTimeEnv(env_)); mock_env->set_current_time(0); // in seconds options.env = mock_env.get(); ASSERT_OK(TryReopen(options)); @@ -573,10 +573,10 @@ TEST_F(StatsHistoryTest, ForceManualFlushStatsCF) { options.create_if_missing = true; options.write_buffer_size = 1024 * 1024 * 10; // 10 Mb options.stats_persist_period_sec = 5; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.persist_stats_to_disk = true; - std::unique_ptr mock_env; - mock_env.reset(new rocksdb::MockTimeEnv(env_)); + std::unique_ptr mock_env; + mock_env.reset(new ROCKSDB_NAMESPACE::MockTimeEnv(env_)); mock_env->set_current_time(0); // in seconds options.env = mock_env.get(); CreateColumnFamilies({"pikachu"}, options); @@ -644,10 +644,10 @@ TEST_F(StatsHistoryTest, ForceManualFlushStatsCF) { } #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/monitoring/thread_status_impl.cc b/monitoring/thread_status_impl.cc index f4531ce75c..9619dfd81e 100644 --- a/monitoring/thread_status_impl.cc +++ b/monitoring/thread_status_impl.cc @@ -11,7 +11,7 @@ #include "util/string_util.h" #include "util/thread_operation.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_USING_THREAD_STATUS std::string ThreadStatus::GetThreadTypeName( @@ -160,4 +160,4 @@ std::map ThreadStatus::InterpretOperationProperties( } #endif // ROCKSDB_USING_THREAD_STATUS -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/thread_status_updater.cc b/monitoring/thread_status_updater.cc index cde44928b6..7e4b299a8c 100644 --- a/monitoring/thread_status_updater.cc +++ b/monitoring/thread_status_updater.cc @@ -9,7 +9,7 @@ #include "rocksdb/env.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_USING_THREAD_STATUS @@ -311,4 +311,4 @@ void ThreadStatusUpdater::IncreaseThreadOperationProperty(int /*i*/, uint64_t /*delta*/) {} #endif // ROCKSDB_USING_THREAD_STATUS -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/thread_status_updater.h b/monitoring/thread_status_updater.h index 6706d159df..ac8c0f35da 100644 --- a/monitoring/thread_status_updater.h +++ b/monitoring/thread_status_updater.h @@ -41,7 +41,7 @@ #include "port/port.h" #include "util/thread_operation.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ColumnFamilyHandle; @@ -230,4 +230,4 @@ class ThreadStatusUpdater { #endif // ROCKSDB_USING_THREAD_STATUS }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/thread_status_updater_debug.cc b/monitoring/thread_status_updater_debug.cc index 8dc0fe6fd9..5937d91faa 100644 --- a/monitoring/thread_status_updater_debug.cc +++ b/monitoring/thread_status_updater_debug.cc @@ -8,7 +8,7 @@ #include "db/column_family.h" #include "monitoring/thread_status_updater.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef NDEBUG #ifdef ROCKSDB_USING_THREAD_STATUS @@ -39,4 +39,4 @@ void ThreadStatusUpdater::TEST_VerifyColumnFamilyInfoMap( #endif // ROCKSDB_USING_THREAD_STATUS #endif // !NDEBUG -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/thread_status_util.cc b/monitoring/thread_status_util.cc index c2af0a5745..13a79163c3 100644 --- a/monitoring/thread_status_util.cc +++ b/monitoring/thread_status_util.cc @@ -8,7 +8,7 @@ #include "monitoring/thread_status_updater.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_USING_THREAD_STATUS __thread ThreadStatusUpdater* ThreadStatusUtil::thread_updater_local_cache_ = @@ -203,4 +203,4 @@ AutoThreadOperationStageUpdater::~AutoThreadOperationStageUpdater() {} #endif // ROCKSDB_USING_THREAD_STATUS -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/thread_status_util.h b/monitoring/thread_status_util.h index a403435c3d..b4d97b0b63 100644 --- a/monitoring/thread_status_util.h +++ b/monitoring/thread_status_util.h @@ -12,7 +12,7 @@ #include "rocksdb/env.h" #include "rocksdb/thread_status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ColumnFamilyData; @@ -131,4 +131,4 @@ class AutoThreadOperationStageUpdater { #endif }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/monitoring/thread_status_util_debug.cc b/monitoring/thread_status_util_debug.cc index b4fa584747..375fe8c0ae 100644 --- a/monitoring/thread_status_util_debug.cc +++ b/monitoring/thread_status_util_debug.cc @@ -9,7 +9,7 @@ #include "monitoring/thread_status_util.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef NDEBUG // the delay for debugging purpose. @@ -29,4 +29,4 @@ void ThreadStatusUtil::TEST_StateDelay(const ThreadStatus::StateType state) { #endif // !NDEBUG -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/options/cf_options.cc b/options/cf_options.cc index 1063ebed04..bc9e301e69 100644 --- a/options/cf_options.cc +++ b/options/cf_options.cc @@ -16,7 +16,7 @@ #include "rocksdb/file_system.h" #include "rocksdb/options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { ImmutableCFOptions::ImmutableCFOptions(const Options& options) : ImmutableCFOptions(ImmutableDBOptions(options), options) {} @@ -228,4 +228,4 @@ void MutableCFOptions::Dump(Logger* log) const { MutableCFOptions::MutableCFOptions(const Options& options) : MutableCFOptions(ColumnFamilyOptions(options)) {} -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/options/cf_options.h b/options/cf_options.h index 88cfb24d9a..b53ed840f4 100644 --- a/options/cf_options.h +++ b/options/cf_options.h @@ -13,7 +13,7 @@ #include "rocksdb/options.h" #include "util/compression.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // ImmutableCFOptions is a data struct used by RocksDB internal. It contains a // subset of Options that should not be changed during the entire lifetime @@ -266,4 +266,4 @@ uint64_t MultiplyCheckOverflow(uint64_t op1, double op2); uint64_t MaxFileSizeForLevel(const MutableCFOptions& cf_options, int level, CompactionStyle compaction_style, int base_level = 1, bool level_compaction_dynamic_level_bytes = false); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/options/db_options.cc b/options/db_options.cc index 0ede4daaba..0dcc8ef79f 100644 --- a/options/db_options.cc +++ b/options/db_options.cc @@ -16,7 +16,7 @@ #include "rocksdb/sst_file_manager.h" #include "rocksdb/wal_filter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { ImmutableDBOptions::ImmutableDBOptions() : ImmutableDBOptions(Options()) {} @@ -330,4 +330,4 @@ void MutableDBOptions::Dump(Logger* log) const { compaction_readahead_size); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/options/db_options.h b/options/db_options.h index 9af9c7ca0a..cba298a21f 100644 --- a/options/db_options.h +++ b/options/db_options.h @@ -10,7 +10,7 @@ #include "rocksdb/options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct ImmutableDBOptions { ImmutableDBOptions(); @@ -115,4 +115,4 @@ struct MutableDBOptions { size_t compaction_readahead_size; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/options/options.cc b/options/options.cc index ffa0afe89e..fe676597ed 100644 --- a/options/options.cc +++ b/options/options.cc @@ -30,7 +30,7 @@ #include "table/block_based/block_based_table_factory.h" #include "util/compression.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { AdvancedColumnFamilyOptions::AdvancedColumnFamilyOptions() { assert(memtable_factory.get() != nullptr); @@ -478,8 +478,8 @@ DBOptions* DBOptions::OptimizeForSmallDb(std::shared_ptr* cache) { max_open_files = 5000; // Cost memtable to block cache too. - std::shared_ptr wbm = - std::make_shared( + std::shared_ptr wbm = + std::make_shared( 0, (cache != nullptr) ? *cache : std::shared_ptr()); write_buffer_manager = wbm; @@ -620,4 +620,4 @@ ReadOptions::ReadOptions(bool cksum, bool cache) iter_start_seqnum(0), timestamp(nullptr) {} -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/options/options_helper.cc b/options/options_helper.cc index dc9fe5a460..bc36dbcfe7 100644 --- a/options/options_helper.cc +++ b/options/options_helper.cc @@ -26,7 +26,7 @@ #include "util/cast_util.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options, const MutableDBOptions& mutable_db_options) { @@ -2121,4 +2121,4 @@ std::unordered_map #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/options/options_helper.h b/options/options_helper.h index c5463999ba..c75fdb1ceb 100644 --- a/options/options_helper.h +++ b/options/options_helper.h @@ -17,7 +17,7 @@ #include "rocksdb/table.h" #include "rocksdb/universal_compaction.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options, const MutableDBOptions& mutable_db_options); @@ -230,4 +230,4 @@ static auto& info_log_level_string_map = OptionsHelper::info_log_level_string_map; #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/options/options_parser.cc b/options/options_parser.cc index f61bfd7005..e10f932c96 100644 --- a/options/options_parser.cc +++ b/options/options_parser.cc @@ -24,7 +24,7 @@ #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const std::string option_file_header = "# This is a RocksDB option file.\n" @@ -834,6 +834,6 @@ Status RocksDBOptionsParser::VerifyTableFactory( } return Status::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/options/options_parser.h b/options/options_parser.h index 13601d9676..a88b806f8f 100644 --- a/options/options_parser.h +++ b/options/options_parser.h @@ -14,7 +14,7 @@ #include "rocksdb/options.h" #include "table/block_based/block_based_table_factory.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE @@ -144,4 +144,4 @@ class RocksDBOptionsParser { #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/options/options_sanity_check.cc b/options/options_sanity_check.cc index d3afcc060e..47cff31cf3 100644 --- a/options/options_sanity_check.cc +++ b/options/options_sanity_check.cc @@ -7,7 +7,7 @@ #include "options/options_sanity_check.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { OptionsSanityCheckLevel SanityCheckLevelHelper( @@ -33,6 +33,6 @@ OptionsSanityCheckLevel BBTOptionSanityCheckLevel( return SanityCheckLevelHelper(sanity_level_bbt_options, option_name); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/options/options_sanity_check.h b/options/options_sanity_check.h index 118fdd208b..ab8ec6d4d3 100644 --- a/options/options_sanity_check.h +++ b/options/options_sanity_check.h @@ -8,8 +8,10 @@ #include #include +#include "rocksdb/rocksdb_namespace.h" + #ifndef ROCKSDB_LITE -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This enum defines the RocksDB options sanity level. enum OptionsSanityCheckLevel : unsigned char { // Performs no sanity check at all. @@ -43,6 +45,6 @@ OptionsSanityCheckLevel CFOptionSanityCheckLevel( OptionsSanityCheckLevel BBTOptionSanityCheckLevel( const std::string& options_name); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/options/options_settable_test.cc b/options/options_settable_test.cc index 9e1fd301a2..c5fee7b3e5 100644 --- a/options/options_settable_test.cc +++ b/options/options_settable_test.cc @@ -21,7 +21,7 @@ using GFLAGS_NAMESPACE::ParseCommandLineFlags; DEFINE_bool(enable_print, false, "Print options generated to console."); #endif // GFLAGS -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Verify options are settable from options strings. // We take the approach that depends on compiler behavior that copy constructor @@ -481,7 +481,7 @@ TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) { #endif // OS_LINUX || OS_WIN #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/options/options_test.cc b/options/options_test.cc index 5078afd3cd..9ff99532cd 100644 --- a/options/options_test.cc +++ b/options/options_test.cc @@ -39,7 +39,7 @@ using GFLAGS_NAMESPACE::ParseCommandLineFlags; DEFINE_bool(enable_print, false, "Print options generated to console."); #endif // GFLAGS -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class OptionsTest : public testing::Test {}; @@ -1993,7 +1993,7 @@ TEST_F(OptionsParserTest, EscapeOptionString) { "Escape \\# and"); } #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/port/port_dirent.h b/port/port_dirent.h index cb1adbe129..192abec4d6 100644 --- a/port/port_dirent.h +++ b/port/port_dirent.h @@ -16,7 +16,7 @@ #include #elif defined(OS_WIN) -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { struct dirent { @@ -39,6 +39,6 @@ using port::opendir; using port::readdir; using port::closedir; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // OS_WIN diff --git a/port/port_example.h b/port/port_example.h index a94dc93c26..b906bbec7a 100644 --- a/port/port_example.h +++ b/port/port_example.h @@ -14,7 +14,7 @@ #pragma once -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { // TODO(jorlow): Many of these belong more in the environment class rather than @@ -98,4 +98,4 @@ extern bool Snappy_Uncompress(const char* input_data, size_t input_length, char* output); } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/port_posix.cc b/port/port_posix.cc index 167159d83c..f5001411cc 100644 --- a/port/port_posix.cc +++ b/port/port_posix.cc @@ -24,7 +24,7 @@ #include #include "logging/logging.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // We want to give users opportunity to default all the mutexes to adaptive if // not specified otherwise. This enables a quick way to conduct various @@ -219,4 +219,4 @@ void cacheline_aligned_free(void *memblock) { } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/port_posix.h b/port/port_posix.h index 892089831f..f08a4ee220 100644 --- a/port/port_posix.h +++ b/port/port_posix.h @@ -12,6 +12,9 @@ #pragma once #include + +#include "rocksdb/rocksdb_namespace.h" + // size_t printf formatting named in the manner of C99 standard formatting // strings such as PRIu64 // in fact, we could use that one @@ -81,7 +84,7 @@ #define fdatasync fsync #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern const bool kDefaultToAdaptiveMutex; @@ -210,4 +213,4 @@ extern void Crash(const std::string& srcfile, int srcline); extern int GetMaxOpenFiles(); } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/stack_trace.cc b/port/stack_trace.cc index 8f8135a446..32eb45bfbb 100644 --- a/port/stack_trace.cc +++ b/port/stack_trace.cc @@ -10,12 +10,12 @@ // noop -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { void InstallStackTraceHandler() {} void PrintStack(int /*first_frames_to_skip*/) {} } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #else @@ -27,7 +27,7 @@ void PrintStack(int /*first_frames_to_skip*/) {} #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { namespace { @@ -133,6 +133,6 @@ void InstallStackTraceHandler() { } } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/port/stack_trace.h b/port/stack_trace.h index f1d4f1febf..4924f5b1bf 100644 --- a/port/stack_trace.h +++ b/port/stack_trace.h @@ -4,7 +4,10 @@ // (found in the LICENSE.Apache file in the root directory). // #pragma once -namespace rocksdb { + +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { namespace port { // Install a signal handler to print callstack on the following signals: @@ -16,4 +19,4 @@ void InstallStackTraceHandler(); void PrintStack(int first_frames_to_skip = 0); } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/sys_time.h b/port/sys_time.h index 2f83da8b3e..1c7d206a79 100644 --- a/port/sys_time.h +++ b/port/sys_time.h @@ -16,7 +16,9 @@ #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { namespace port { @@ -37,7 +39,7 @@ inline struct tm* localtime_r(const time_t* timep, struct tm* result) { using port::timeval; using port::gettimeofday; using port::localtime_r; -} +} // namespace ROCKSDB_NAMESPACE #else #include diff --git a/port/win/env_default.cc b/port/win/env_default.cc index 584a524cf8..663779ddec 100644 --- a/port/win/env_default.cc +++ b/port/win/env_default.cc @@ -15,7 +15,7 @@ #include "util/compression_context_cache.h" #include "util/thread_local.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { // We choose not to destroy the env because joining the threads from the @@ -38,4 +38,4 @@ Env* Env::Default() { return envptr; } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/port/win/env_win.cc b/port/win/env_win.cc index b5ab1283b8..295bb2b7e9 100644 --- a/port/win/env_win.cc +++ b/port/win/env_win.cc @@ -40,7 +40,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { ThreadStatusUpdater* CreateThreadStatusUpdater() { return new ThreadStatusUpdater(); @@ -122,7 +122,7 @@ Status WinEnvIO::DeleteFile(const std::string& fname) { Status WinEnvIO::Truncate(const std::string& fname, size_t size) { Status s; - int result = rocksdb::port::Truncate(fname, size); + int result = ROCKSDB_NAMESPACE::port::Truncate(fname, size); if (result != 0) { s = IOError("Failed to truncate: " + fname, errno); } @@ -1243,8 +1243,7 @@ void WinEnvThreads::StartThread(void(*function)(void* arg), void* arg) { state->user_function = function; state->arg = arg; try { - - rocksdb::port::WindowsThread th(&StartThreadWrapper, state.get()); + ROCKSDB_NAMESPACE::port::WindowsThread th(&StartThreadWrapper, state.get()); state.release(); std::lock_guard lg(mu_); @@ -1538,4 +1537,4 @@ std::string Env::GenerateUniqueId() { return result; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/win/env_win.h b/port/win/env_win.h index 49e1c4cb1b..5dfca58bd7 100644 --- a/port/win/env_win.h +++ b/port/win/env_win.h @@ -32,7 +32,7 @@ #undef DeleteFile #undef GetTickCount -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { // Currently not designed for inheritance but rather a replacement @@ -344,4 +344,4 @@ private: }; } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/win/io_win.cc b/port/win/io_win.cc index c433e5e522..e6c6890ef8 100644 --- a/port/win/io_win.cc +++ b/port/win/io_win.cc @@ -14,7 +14,7 @@ #include "util/aligned_buffer.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { /* @@ -1066,4 +1066,4 @@ WinFileLock::~WinFileLock() { } } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/port/win/io_win.h b/port/win/io_win.h index 1c9d803b13..4fc2ba499b 100644 --- a/port/win/io_win.h +++ b/port/win/io_win.h @@ -18,8 +18,7 @@ #include - -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { std::string GetWindowsErrSz(DWORD err); @@ -454,4 +453,4 @@ class WinFileLock : public FileLock { HANDLE hFile_; }; } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/port/win/port_win.cc b/port/win/port_win.cc index 31e65e78cd..5a19c33a87 100644 --- a/port/win/port_win.cc +++ b/port/win/port_win.cc @@ -35,7 +35,7 @@ #include "logging/logging.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern const bool kDefaultToAdaptiveMutex = false; @@ -211,7 +211,7 @@ int truncate(const char* path, int64_t length) { errno = EFAULT; return -1; } - return rocksdb::port::Truncate(path, length); + return ROCKSDB_NAMESPACE::port::Truncate(path, length); } int Truncate(std::string path, int64_t len) { @@ -263,4 +263,4 @@ void Crash(const std::string& srcfile, int srcline) { int GetMaxOpenFiles() { return -1; } } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/win/port_win.h b/port/win/port_win.h index 6f16b9c237..80f68bcdee 100644 --- a/port/win/port_win.h +++ b/port/win/port_win.h @@ -74,7 +74,7 @@ typedef SSIZE_T ssize_t; #define PLATFORM_IS_LITTLE_ENDIAN (__BYTE_ORDER == __LITTLE_ENDIAN) #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #define PREFETCH(addr, rw, locality) @@ -345,8 +345,8 @@ std::wstring utf8_to_utf16(const std::string& utf8); #ifdef ROCKSDB_WINDOWS_UTF8_FILENAMES #define RX_FILESTRING std::wstring -#define RX_FN(a) rocksdb::port::utf8_to_utf16(a) -#define FN_TO_RX(a) rocksdb::port::utf16_to_utf8(a) +#define RX_FN(a) ROCKSDB_NAMESPACE::port::utf8_to_utf16(a) +#define FN_TO_RX(a) ROCKSDB_NAMESPACE::port::utf16_to_utf8(a) #define RX_FNLEN(a) ::wcslen(a) #define RX_DeleteFile DeleteFileW @@ -398,4 +398,4 @@ using port::pthread_setspecific; using port::pthread_getspecific; using port::truncate; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/win/win_jemalloc.cc b/port/win/win_jemalloc.cc index b207793880..a29232f8a2 100644 --- a/port/win/win_jemalloc.cc +++ b/port/win/win_jemalloc.cc @@ -18,7 +18,7 @@ #if defined(ZSTD) && defined(ZSTD_STATIC_LINKING_ONLY) #include #if (ZSTD_VERSION_NUMBER >= 500) -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { void* JemallocAllocateForZSTD(void* /* opaque */, size_t size) { return je_malloc(size); @@ -30,21 +30,21 @@ ZSTD_customMem GetJeZstdAllocationOverrides() { return {JemallocAllocateForZSTD, JemallocDeallocateForZSTD, nullptr}; } } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // (ZSTD_VERSION_NUMBER >= 500) #endif // defined(ZSTD) defined(ZSTD_STATIC_LINKING_ONLY) // Global operators to be replaced by a linker when this file is // a part of the build -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { void* jemalloc_aligned_alloc(size_t size, size_t alignment) ROCKSDB_NOEXCEPT { return je_aligned_alloc(alignment, size); } void jemalloc_aligned_free(void* p) ROCKSDB_NOEXCEPT { je_free(p); } } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE void* operator new(size_t size) { void* p = je_malloc(size); diff --git a/port/win/win_logger.cc b/port/win/win_logger.cc index af722d9054..d429a3f4a5 100644 --- a/port/win/win_logger.cc +++ b/port/win/win_logger.cc @@ -24,7 +24,7 @@ #include "monitoring/iostats_context_imp.h" #include "port/sys_time.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { @@ -189,4 +189,4 @@ size_t WinLogger::GetLogFileSize() const { return log_size_; } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/win/win_logger.h b/port/win/win_logger.h index 0982f142f6..116e7898db 100644 --- a/port/win/win_logger.h +++ b/port/win/win_logger.h @@ -19,13 +19,13 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Env; namespace port { -class WinLogger : public rocksdb::Logger { +class WinLogger : public ROCKSDB_NAMESPACE::Logger { public: WinLogger(uint64_t (*gettid)(), Env* env, HANDLE file, const InfoLogLevel log_level = InfoLogLevel::ERROR_LEVEL); @@ -38,7 +38,7 @@ class WinLogger : public rocksdb::Logger { void Flush() override; - using rocksdb::Logger::Logv; + using ROCKSDB_NAMESPACE::Logger::Logv; void Logv(const char* format, va_list ap) override; size_t GetLogFileSize() const override; @@ -61,7 +61,6 @@ protected: const static uint64_t flush_every_seconds_ = 5; }; - } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/win/win_thread.cc b/port/win/win_thread.cc index 34e54f3017..74c667b544 100644 --- a/port/win/win_thread.cc +++ b/port/win/win_thread.cc @@ -17,7 +17,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { struct WindowsThread::Data { @@ -176,4 +176,4 @@ unsigned int __stdcall WindowsThread::Data::ThreadProc(void* arg) { return 0; } } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/port/win/win_thread.h b/port/win/win_thread.h index 1d5b225e6c..472b299552 100644 --- a/port/win/win_thread.h +++ b/port/win/win_thread.h @@ -13,7 +13,9 @@ #include #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { namespace port { // This class is a replacement for std::thread @@ -109,13 +111,12 @@ public: void swap(WindowsThread&); }; } // namespace port -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE namespace std { - inline - void swap(rocksdb::port::WindowsThread& th1, - rocksdb::port::WindowsThread& th2) { - th1.swap(th2); - } +inline void swap(ROCKSDB_NAMESPACE::port::WindowsThread& th1, + ROCKSDB_NAMESPACE::port::WindowsThread& th2) { + th1.swap(th2); +} } // namespace std diff --git a/port/win/xpress_win.cc b/port/win/xpress_win.cc index 9ab23c534d..bcc106534d 100644 --- a/port/win/xpress_win.cc +++ b/port/win/xpress_win.cc @@ -21,7 +21,7 @@ // can still build #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace port { namespace xpress { @@ -221,6 +221,6 @@ char* Decompress(const char* input_data, size_t input_length, } } } -} +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/port/win/xpress_win.h b/port/win/xpress_win.h index 5b11e7da9c..1214bb7b99 100644 --- a/port/win/xpress_win.h +++ b/port/win/xpress_win.h @@ -11,7 +11,9 @@ #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { namespace port { namespace xpress { @@ -22,5 +24,4 @@ char* Decompress(const char* input_data, size_t input_length, } } -} - +} // namespace ROCKSDB_NAMESPACE diff --git a/table/adaptive/adaptive_table_factory.cc b/table/adaptive/adaptive_table_factory.cc index 0086368a9b..fa94e7bcd0 100644 --- a/table/adaptive/adaptive_table_factory.cc +++ b/table/adaptive/adaptive_table_factory.cc @@ -10,7 +10,7 @@ #include "table/format.h" #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { AdaptiveTableFactory::AdaptiveTableFactory( std::shared_ptr table_factory_to_write, @@ -120,5 +120,5 @@ extern TableFactory* NewAdaptiveTableFactory( block_based_table_factory, plain_table_factory, cuckoo_table_factory); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/adaptive/adaptive_table_factory.h b/table/adaptive/adaptive_table_factory.h index 9d606362e1..fcc4c682ca 100644 --- a/table/adaptive/adaptive_table_factory.h +++ b/table/adaptive/adaptive_table_factory.h @@ -11,7 +11,7 @@ #include "rocksdb/options.h" #include "rocksdb/table.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct EnvOptions; @@ -59,5 +59,5 @@ class AdaptiveTableFactory : public TableFactory { std::shared_ptr cuckoo_table_factory_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/block_based/block.cc b/table/block_based/block.cc index 1aa5bfe547..d3a57632e4 100644 --- a/table/block_based/block.cc +++ b/table/block_based/block.cc @@ -25,7 +25,7 @@ #include "table/format.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Helper routine: decode the next block entry starting at "p", // storing the number of shared key bytes, non_shared key bytes, @@ -1010,4 +1010,4 @@ size_t Block::ApproximateMemoryUsage() const { return usage; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block.h b/table/block_based/block.h index c8580e9760..95f2fac908 100644 --- a/table/block_based/block.h +++ b/table/block_based/block.h @@ -27,7 +27,7 @@ #include "test_util/sync_point.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct BlockContents; class Comparator; @@ -37,9 +37,10 @@ class DataBlockIter; class IndexBlockIter; class BlockPrefixIndex; -// BlockReadAmpBitmap is a bitmap that map the rocksdb::Block data bytes to -// a bitmap with ratio bytes_per_bit. Whenever we access a range of bytes in -// the Block we update the bitmap and increment READ_AMP_ESTIMATE_USEFUL_BYTES. +// BlockReadAmpBitmap is a bitmap that map the ROCKSDB_NAMESPACE::Block data +// bytes to a bitmap with ratio bytes_per_bit. Whenever we access a range of +// bytes in the Block we update the bitmap and increment +// READ_AMP_ESTIMATE_USEFUL_BYTES. class BlockReadAmpBitmap { public: explicit BlockReadAmpBitmap(size_t block_size, size_t bytes_per_bit, @@ -629,4 +630,4 @@ class IndexBlockIter final : public BlockIter { inline void DecodeCurrentValue(uint32_t shared); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_based_filter_block.cc b/table/block_based/block_based_filter_block.cc index 319c5bf6d8..de3f5cb132 100644 --- a/table/block_based/block_based_filter_block.cc +++ b/table/block_based/block_based_filter_block.cc @@ -17,7 +17,7 @@ #include "util/coding.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -49,7 +49,7 @@ void AppendItem(std::string* props, const std::string& key, template void AppendItem(std::string* props, const TKey& key, const std::string& value) { - std::string key_str = rocksdb::ToString(key); + std::string key_str = ROCKSDB_NAMESPACE::ToString(key); AppendItem(props, key_str, value); } } // namespace @@ -327,7 +327,7 @@ std::string BlockBasedFilterBlockReader::ToString() const { result.reserve(1024); std::string s_bo("Block offset"), s_hd("Hex dump"), s_fb("# filter blocks"); - AppendItem(&result, s_fb, rocksdb::ToString(num)); + AppendItem(&result, s_fb, ROCKSDB_NAMESPACE::ToString(num)); AppendItem(&result, s_bo, s_hd); for (size_t index = 0; index < num; index++) { @@ -335,7 +335,8 @@ std::string BlockBasedFilterBlockReader::ToString() const { uint32_t limit = DecodeFixed32(offset + index * 4 + 4); if (start != limit) { - result.append(" filter block # " + rocksdb::ToString(index + 1) + "\n"); + result.append(" filter block # " + + ROCKSDB_NAMESPACE::ToString(index + 1) + "\n"); Slice filter = Slice(data + start, limit - start); AppendItem(&result, start, filter.ToString(true)); } @@ -343,4 +344,4 @@ std::string BlockBasedFilterBlockReader::ToString() const { return result; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_based_filter_block.h b/table/block_based/block_based_filter_block.h index ed409e041e..01c98a70be 100644 --- a/table/block_based/block_based_filter_block.h +++ b/table/block_based/block_based_filter_block.h @@ -26,7 +26,7 @@ #include "table/format.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A BlockBasedFilterBlockBuilder is used to construct all of the filters for a // particular Table. It generates a single string which is stored as @@ -116,4 +116,4 @@ class BlockBasedFilterBlockReader BlockCacheLookupContext* lookup_context) const; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_based_filter_block_test.cc b/table/block_based/block_based_filter_block_test.cc index 677203ae24..283d6a9a2e 100644 --- a/table/block_based/block_based_filter_block_test.cc +++ b/table/block_based/block_based_filter_block_test.cc @@ -17,7 +17,7 @@ #include "util/hash.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // For testing: emit an array with one hash value per key class TestHashFilter : public FilterPolicy { @@ -426,7 +426,7 @@ TEST_F(BlockBasedFilterBlockTest, BlockBasedMultiChunk) { delete reader; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/table/block_based/block_based_table_builder.cc b/table/block_based/block_based_table_builder.cc index 9f10691c1d..2003008fe1 100644 --- a/table/block_based/block_based_table_builder.cc +++ b/table/block_based/block_based_table_builder.cc @@ -48,7 +48,7 @@ #include "util/string_util.h" #include "util/xxhash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern const std::string kHashIndexPrefixesBlock; extern const std::string kHashIndexPrefixesMetadataBlock; @@ -1214,4 +1214,4 @@ const std::string BlockBasedTable::kFilterBlockPrefix = "filter."; const std::string BlockBasedTable::kFullFilterBlockPrefix = "fullfilter."; const std::string BlockBasedTable::kPartitionedFilterBlockPrefix = "partitionedfilter."; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_based_table_builder.h b/table/block_based/block_based_table_builder.h index 691fe17a42..97c9bc65a7 100644 --- a/table/block_based/block_based_table_builder.h +++ b/table/block_based/block_based_table_builder.h @@ -23,7 +23,7 @@ #include "table/table_builder.h" #include "util/compression.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class BlockBuilder; class BlockHandle; @@ -154,4 +154,4 @@ Slice CompressBlock(const Slice& raw, const CompressionInfo& info, std::string* sampled_output_fast, std::string* sampled_output_slow); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_based_table_factory.cc b/table/block_based/block_based_table_factory.cc index cdd1211486..70a6f38d5d 100644 --- a/table/block_based/block_based_table_factory.cc +++ b/table/block_based/block_based_table_factory.cc @@ -25,7 +25,7 @@ #include "util/mutexlock.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void TailPrefetchStats::RecordEffectiveSize(size_t len) { MutexLock l(&mutex_); @@ -646,4 +646,4 @@ const std::string kHashIndexPrefixesMetadataBlock = const std::string kPropTrue = "1"; const std::string kPropFalse = "0"; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_based_table_factory.h b/table/block_based/block_based_table_factory.h index 83676e9b9c..7c8633c07f 100644 --- a/table/block_based/block_based_table_factory.h +++ b/table/block_based/block_based_table_factory.h @@ -19,7 +19,7 @@ #include "rocksdb/flush_block_policy.h" #include "rocksdb/table.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct EnvOptions; @@ -192,4 +192,4 @@ static std::unordered_map pin_top_level_index_and_filter), OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}}}; #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_based_table_reader.cc b/table/block_based/block_based_table_reader.cc index 0a6424b733..ffa4c68926 100644 --- a/table/block_based/block_based_table_reader.cc +++ b/table/block_based/block_based_table_reader.cc @@ -56,7 +56,7 @@ #include "util/string_util.h" #include "util/xxhash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern const uint64_t kBlockBasedTableMagicNumber; extern const std::string kHashIndexPrefixesBlock; @@ -1349,8 +1349,8 @@ Status BlockBasedTable::TryReadPropertiesWithGlobalSeqno( tmp_buf.get() + global_seqno_offset - props_block_handle.offset(), 0); } uint32_t value = DecodeFixed32(tmp_buf.get() + block_size + 1); - s = rocksdb::VerifyChecksum(rep_->footer.checksum(), tmp_buf.get(), - block_size + 1, value); + s = ROCKSDB_NAMESPACE::VerifyChecksum(rep_->footer.checksum(), + tmp_buf.get(), block_size + 1, value); } return s; } @@ -2455,9 +2455,9 @@ void BlockBasedTable::RetrieveMultipleBlocks( // begin address of each read request, we need to add the offset // in each read request. Checksum is stored in the block trailer, // which is handle.size() + 1. - s = rocksdb::VerifyChecksum(footer.checksum(), - req.result.data() + req_offset, - handle.size() + 1, expected); + s = ROCKSDB_NAMESPACE::VerifyChecksum(footer.checksum(), + req.result.data() + req_offset, + handle.size() + 1, expected); TEST_SYNC_POINT_CALLBACK("RetrieveMultipleBlocks:VerifyChecksum", &s); } } @@ -4251,11 +4251,12 @@ Status BlockBasedTable::DumpTable(WritableFile* out_file) { if (!s.ok()) { return s; } - if (metaindex_iter->key() == rocksdb::kPropertiesBlock) { + if (metaindex_iter->key() == ROCKSDB_NAMESPACE::kPropertiesBlock) { out_file->Append(" Properties block handle: "); out_file->Append(metaindex_iter->value().ToString(true).c_str()); out_file->Append("\n"); - } else if (metaindex_iter->key() == rocksdb::kCompressionDictBlock) { + } else if (metaindex_iter->key() == + ROCKSDB_NAMESPACE::kCompressionDictBlock) { out_file->Append(" Compression dictionary block handle: "); out_file->Append(metaindex_iter->value().ToString(true).c_str()); out_file->Append("\n"); @@ -4264,7 +4265,7 @@ Status BlockBasedTable::DumpTable(WritableFile* out_file) { out_file->Append(" Filter block handle: "); out_file->Append(metaindex_iter->value().ToString(true).c_str()); out_file->Append("\n"); - } else if (metaindex_iter->key() == rocksdb::kRangeDelBlock) { + } else if (metaindex_iter->key() == ROCKSDB_NAMESPACE::kRangeDelBlock) { out_file->Append(" Range deletion block handle: "); out_file->Append(metaindex_iter->value().ToString(true).c_str()); out_file->Append("\n"); @@ -4276,7 +4277,7 @@ Status BlockBasedTable::DumpTable(WritableFile* out_file) { } // Output TableProperties - const rocksdb::TableProperties* table_properties; + const ROCKSDB_NAMESPACE::TableProperties* table_properties; table_properties = rep_->table_properties.get(); if (table_properties != nullptr) { @@ -4321,7 +4322,7 @@ Status BlockBasedTable::DumpTable(WritableFile* out_file) { "Compression Dictionary:\n" "--------------------------------------\n"); out_file->Append(" size (bytes): "); - out_file->Append(rocksdb::ToString(raw_dict.size())); + out_file->Append(ROCKSDB_NAMESPACE::ToString(raw_dict.size())); out_file->Append("\n\n"); out_file->Append(" HEX "); out_file->Append(raw_dict.ToString(true).c_str()); @@ -4435,7 +4436,7 @@ Status BlockBasedTable::DumpDataBlocks(WritableFile* out_file) { datablock_size_sum += datablock_size; out_file->Append("Data Block # "); - out_file->Append(rocksdb::ToString(block_id)); + out_file->Append(ROCKSDB_NAMESPACE::ToString(block_id)); out_file->Append(" @ "); out_file->Append(blockhandles_iter->value().handle.ToString(true).c_str()); out_file->Append("\n"); @@ -4473,13 +4474,13 @@ Status BlockBasedTable::DumpDataBlocks(WritableFile* out_file) { out_file->Append("Data Block Summary:\n"); out_file->Append("--------------------------------------"); out_file->Append("\n # data blocks: "); - out_file->Append(rocksdb::ToString(num_datablocks)); + out_file->Append(ROCKSDB_NAMESPACE::ToString(num_datablocks)); out_file->Append("\n min data block size: "); - out_file->Append(rocksdb::ToString(datablock_size_min)); + out_file->Append(ROCKSDB_NAMESPACE::ToString(datablock_size_min)); out_file->Append("\n max data block size: "); - out_file->Append(rocksdb::ToString(datablock_size_max)); + out_file->Append(ROCKSDB_NAMESPACE::ToString(datablock_size_max)); out_file->Append("\n avg data block size: "); - out_file->Append(rocksdb::ToString(datablock_size_avg)); + out_file->Append(ROCKSDB_NAMESPACE::ToString(datablock_size_avg)); out_file->Append("\n"); } @@ -4525,4 +4526,4 @@ void BlockBasedTable::DumpKeyValue(const Slice& key, const Slice& value, out_file->Append("\n ------\n"); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_based_table_reader.h b/table/block_based/block_based_table_reader.h index 998a5b5795..28a378988b 100644 --- a/table/block_based/block_based_table_reader.h +++ b/table/block_based/block_based_table_reader.h @@ -42,7 +42,7 @@ #include "util/coding.h" #include "util/user_comparator_wrapper.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Cache; class FilterBlockReader; @@ -590,9 +590,10 @@ struct BlockBasedTable::Rep { } uint64_t cf_id_for_tracing() const { - return table_properties ? table_properties->column_family_id - : rocksdb::TablePropertiesCollectorFactory:: - Context::kUnknownColumnFamily; + return table_properties + ? table_properties->column_family_id + : ROCKSDB_NAMESPACE::TablePropertiesCollectorFactory::Context:: + kUnknownColumnFamily; } Slice cf_name_for_tracing() const { @@ -820,4 +821,4 @@ class BlockBasedTableIterator : public InternalIteratorBase { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_builder.cc b/table/block_based/block_builder.cc index a6a240c8e0..6f77ef97c0 100644 --- a/table/block_based/block_builder.cc +++ b/table/block_based/block_builder.cc @@ -40,7 +40,7 @@ #include "table/block_based/data_block_footer.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { BlockBuilder::BlockBuilder( int block_restart_interval, bool use_delta_encoding, @@ -193,4 +193,4 @@ void BlockBuilder::Add(const Slice& key, const Slice& value, estimate_ += buffer_.size() - curr_size; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_builder.h b/table/block_based/block_builder.h index 153e57569a..42c996e5b9 100644 --- a/table/block_based/block_builder.h +++ b/table/block_based/block_builder.h @@ -15,7 +15,7 @@ #include "rocksdb/table.h" #include "table/block_based/data_block_hash_index.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class BlockBuilder { public: @@ -72,4 +72,4 @@ class BlockBuilder { DataBlockHashIndexBuilder data_block_hash_index_builder_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_prefix_index.cc b/table/block_based/block_prefix_index.cc index 6e24f17cf6..f9d92c74cb 100644 --- a/table/block_based/block_prefix_index.cc +++ b/table/block_based/block_prefix_index.cc @@ -14,10 +14,10 @@ #include "util/coding.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { inline uint32_t Hash(const Slice& s) { - return rocksdb::Hash(s.data(), s.size(), 0); + return ROCKSDB_NAMESPACE::Hash(s.data(), s.size(), 0); } inline uint32_t PrefixToBucket(const Slice& prefix, uint32_t num_buckets) { @@ -229,4 +229,4 @@ uint32_t BlockPrefixIndex::GetBlocks(const Slice& key, uint32_t** blocks) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_prefix_index.h b/table/block_based/block_prefix_index.h index 105606db20..04121320e2 100644 --- a/table/block_based/block_prefix_index.h +++ b/table/block_based/block_prefix_index.h @@ -7,7 +7,7 @@ #include #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Comparator; class Iterator; @@ -63,4 +63,4 @@ class BlockPrefixIndex { uint32_t* block_array_buffer_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/block_test.cc b/table/block_based/block_test.cc index 38fa55089f..efa5b3ae39 100644 --- a/table/block_based/block_test.cc +++ b/table/block_based/block_test.cc @@ -27,7 +27,7 @@ #include "test_util/testutil.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static std::string RandomString(Random *rnd, int len) { std::string r; @@ -292,7 +292,7 @@ TEST_F(BlockTest, BlockReadAmpBitmap) { Random rnd(301); for (size_t block_size : block_sizes) { - std::shared_ptr stats = rocksdb::CreateDBStatistics(); + std::shared_ptr stats = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockReadAmpBitmap read_amp_bitmap(block_size, kBytesPerBit, stats.get()); BlockReadAmpBitmapSlowAndAccurate read_amp_slow_and_accurate; @@ -370,7 +370,7 @@ TEST_F(BlockTest, BlockWithReadAmpBitmap) { // Read the block sequentially using Next() { - std::shared_ptr stats = rocksdb::CreateDBStatistics(); + std::shared_ptr stats = ROCKSDB_NAMESPACE::CreateDBStatistics(); // create block reader BlockContents contents; @@ -403,7 +403,7 @@ TEST_F(BlockTest, BlockWithReadAmpBitmap) { // Read the block sequentially using Seek() { - std::shared_ptr stats = rocksdb::CreateDBStatistics(); + std::shared_ptr stats = ROCKSDB_NAMESPACE::CreateDBStatistics(); // create block reader BlockContents contents; @@ -438,7 +438,7 @@ TEST_F(BlockTest, BlockWithReadAmpBitmap) { // Read the block randomly { - std::shared_ptr stats = rocksdb::CreateDBStatistics(); + std::shared_ptr stats = ROCKSDB_NAMESPACE::CreateDBStatistics(); // create block reader BlockContents contents; @@ -477,7 +477,7 @@ TEST_F(BlockTest, BlockWithReadAmpBitmap) { } TEST_F(BlockTest, ReadAmpBitmapPow2) { - std::shared_ptr stats = rocksdb::CreateDBStatistics(); + std::shared_ptr stats = ROCKSDB_NAMESPACE::CreateDBStatistics(); ASSERT_EQ(BlockReadAmpBitmap(100, 1, stats.get()).GetBytesPerBit(), 1u); ASSERT_EQ(BlockReadAmpBitmap(100, 2, stats.get()).GetBytesPerBit(), 2u); ASSERT_EQ(BlockReadAmpBitmap(100, 4, stats.get()).GetBytesPerBit(), 4u); @@ -619,7 +619,7 @@ INSTANTIATE_TEST_CASE_P(P, IndexBlockTest, std::make_tuple(true, false), std::make_tuple(true, true))); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/table/block_based/block_type.h b/table/block_based/block_type.h index a60be2e6a7..b2a913746e 100644 --- a/table/block_based/block_type.h +++ b/table/block_based/block_type.h @@ -7,7 +7,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Represents the types of blocks used in the block based table format. // See https://github.com/facebook/rocksdb/wiki/Rocksdb-BlockBasedTable-Format @@ -27,4 +27,4 @@ enum class BlockType : uint8_t { kInvalid }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/cachable_entry.h b/table/block_based/cachable_entry.h index b4cd6ec675..598f1ef577 100644 --- a/table/block_based/cachable_entry.h +++ b/table/block_based/cachable_entry.h @@ -14,7 +14,7 @@ #include "rocksdb/cache.h" #include "rocksdb/cleanable.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // CachableEntry is a handle to an object that may or may not be in the block // cache. It is used in a variety of ways: @@ -217,4 +217,4 @@ private: bool own_value_ = false; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/data_block_footer.cc b/table/block_based/data_block_footer.cc index 2cf31b4c5e..5d5d8ed55e 100644 --- a/table/block_based/data_block_footer.cc +++ b/table/block_based/data_block_footer.cc @@ -11,7 +11,7 @@ #include "rocksdb/table.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const int kDataBlockIndexTypeBitShift = 31; @@ -56,4 +56,4 @@ void UnPackIndexTypeAndNumRestarts( } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/data_block_footer.h b/table/block_based/data_block_footer.h index e6ff20bccb..c1cfd47309 100644 --- a/table/block_based/data_block_footer.h +++ b/table/block_based/data_block_footer.h @@ -11,7 +11,7 @@ #include "rocksdb/table.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { uint32_t PackIndexTypeAndNumRestarts( BlockBasedTableOptions::DataBlockIndexType index_type, @@ -22,4 +22,4 @@ void UnPackIndexTypeAndNumRestarts( BlockBasedTableOptions::DataBlockIndexType* index_type, uint32_t* num_restarts); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/data_block_hash_index.cc b/table/block_based/data_block_hash_index.cc index 7737a9491e..2224758343 100644 --- a/table/block_based/data_block_hash_index.cc +++ b/table/block_based/data_block_hash_index.cc @@ -10,7 +10,7 @@ #include "util/coding.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void DataBlockHashIndexBuilder::Add(const Slice& key, const size_t restart_index) { @@ -90,4 +90,4 @@ uint8_t DataBlockHashIndex::Lookup(const char* data, uint32_t map_offset, return static_cast(*(bucket_table + idx * sizeof(uint8_t))); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/data_block_hash_index.h b/table/block_based/data_block_hash_index.h index 0af8b257c2..f356395f32 100644 --- a/table/block_based/data_block_hash_index.h +++ b/table/block_based/data_block_hash_index.h @@ -10,7 +10,7 @@ #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This is an experimental feature aiming to reduce the CPU utilization of // point-lookup within a data-block. It is only used in data blocks, and not // in meta-data blocks or per-table index blocks. @@ -133,4 +133,4 @@ class DataBlockHashIndex { uint16_t num_buckets_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/data_block_hash_index_test.cc b/table/block_based/data_block_hash_index_test.cc index a77e079cb9..8548c8508b 100644 --- a/table/block_based/data_block_hash_index_test.cc +++ b/table/block_based/data_block_hash_index_test.cc @@ -18,7 +18,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { bool SearchForOffset(DataBlockHashIndex& index, const char* data, uint16_t map_offset, const Slice& key, @@ -711,7 +711,7 @@ TEST(DataBlockHashIndex, BlockBoundary) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/table/block_based/filter_block.h b/table/block_based/filter_block.h index befc5e30c3..1ad8d3f18b 100644 --- a/table/block_based/filter_block.h +++ b/table/block_based/filter_block.h @@ -33,7 +33,7 @@ #include "trace_replay/block_cache_tracer.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const uint64_t kNotValid = ULLONG_MAX; class FilterPolicy; @@ -173,4 +173,4 @@ class FilterBlockReader { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/filter_block_reader_common.cc b/table/block_based/filter_block_reader_common.cc index 49a2688230..fa0802669c 100644 --- a/table/block_based/filter_block_reader_common.cc +++ b/table/block_based/filter_block_reader_common.cc @@ -9,7 +9,7 @@ #include "table/block_based/block_based_table_reader.h" #include "table/block_based/parsed_full_filter_block.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { template Status FilterBlockReaderCommon::ReadFilterBlock( @@ -99,4 +99,4 @@ template class FilterBlockReaderCommon; template class FilterBlockReaderCommon; template class FilterBlockReaderCommon; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/filter_block_reader_common.h b/table/block_based/filter_block_reader_common.h index 4e691e0d91..a18bc5449b 100644 --- a/table/block_based/filter_block_reader_common.h +++ b/table/block_based/filter_block_reader_common.h @@ -10,7 +10,7 @@ #include "table/block_based/cachable_entry.h" #include "table/block_based/filter_block.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class BlockBasedTable; class FilePrefetchBuffer; @@ -52,4 +52,4 @@ class FilterBlockReaderCommon : public FilterBlockReader { CachableEntry filter_block_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/filter_policy.cc b/table/block_based/filter_policy.cc index 9890a1d8f4..c8f23ee333 100644 --- a/table/block_based/filter_policy.cc +++ b/table/block_based/filter_policy.cc @@ -21,7 +21,7 @@ #include "util/coding.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -756,4 +756,4 @@ FilterBuildingContext::FilterBuildingContext( FilterPolicy::~FilterPolicy() { } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/filter_policy_internal.h b/table/block_based/filter_policy_internal.h index df182b524f..2ca9dc8595 100644 --- a/table/block_based/filter_policy_internal.h +++ b/table/block_based/filter_policy_internal.h @@ -16,7 +16,7 @@ #include "rocksdb/filter_policy.h" #include "rocksdb/table.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Slice; @@ -139,4 +139,4 @@ class BloomFilterPolicy : public FilterPolicy { FilterBitsReader* GetBloomBitsReader(const Slice& contents) const; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/flush_block_policy.cc b/table/block_based/flush_block_policy.cc index 31576848c0..f5cb2d227d 100644 --- a/table/block_based/flush_block_policy.cc +++ b/table/block_based/flush_block_policy.cc @@ -11,7 +11,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Flush block by size class FlushBlockBySizePolicy : public FlushBlockPolicy { @@ -85,4 +85,4 @@ FlushBlockPolicy* FlushBlockBySizePolicyFactory::NewFlushBlockPolicy( return new FlushBlockBySizePolicy(size, deviation, false, data_block_builder); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/flush_block_policy.h b/table/block_based/flush_block_policy.h index 1cc7361a3f..68c60c168c 100644 --- a/table/block_based/flush_block_policy.h +++ b/table/block_based/flush_block_policy.h @@ -5,7 +5,7 @@ #include "rocksdb/flush_block_policy.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // FlushBlockEveryKeyPolicy currently used only in tests. @@ -38,4 +38,4 @@ class FlushBlockEveryKeyPolicyFactory : public FlushBlockPolicyFactory { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/full_filter_block.cc b/table/block_based/full_filter_block.cc index b3b2f58136..e2f7f476fa 100644 --- a/table/block_based/full_filter_block.cc +++ b/table/block_based/full_filter_block.cc @@ -13,7 +13,7 @@ #include "table/block_based/block_based_table_reader.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { FullFilterBlockBuilder::FullFilterBlockBuilder( const SliceTransform* _prefix_extractor, bool whole_key_filtering, @@ -335,4 +335,4 @@ bool FullFilterBlockReader::IsFilterCompatible( } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/full_filter_block.h b/table/block_based/full_filter_block.h index 04f1ec2284..c72a58021e 100644 --- a/table/block_based/full_filter_block.h +++ b/table/block_based/full_filter_block.h @@ -19,7 +19,7 @@ #include "table/block_based/parsed_full_filter_block.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class FilterPolicy; class FilterBitsBuilder; @@ -136,4 +136,4 @@ class FullFilterBlockReader size_t prefix_extractor_full_length_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/full_filter_block_test.cc b/table/block_based/full_filter_block_test.cc index bde19121c9..496b149ab7 100644 --- a/table/block_based/full_filter_block_test.cc +++ b/table/block_based/full_filter_block_test.cc @@ -16,7 +16,7 @@ #include "util/hash.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TestFilterBitsBuilder : public FilterBitsBuilder { public: @@ -325,7 +325,7 @@ TEST_F(FullFilterBlockTest, SingleChunk) { /*lookup_context=*/nullptr)); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/table/block_based/index_builder.cc b/table/block_based/index_builder.cc index ce20c6cf6c..277bec61dd 100644 --- a/table/block_based/index_builder.cc +++ b/table/block_based/index_builder.cc @@ -21,7 +21,7 @@ #include "table/format.h" // Without anonymous namespace here, we fail the warning -Wmissing-prototypes -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // using namespace rocksdb; // Create a index builder based on its type. IndexBuilder* IndexBuilder::CreateIndexBuilder( @@ -219,4 +219,4 @@ Status PartitionedIndexBuilder::Finish( } size_t PartitionedIndexBuilder::NumPartitions() const { return partition_cnt_; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/index_builder.h b/table/block_based/index_builder.h index 47348b31f7..bfffc5996d 100644 --- a/table/block_based/index_builder.h +++ b/table/block_based/index_builder.h @@ -21,7 +21,7 @@ #include "table/block_based/block_builder.h" #include "table/format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // The interface for building index. // Instruction for adding a new concrete IndexBuilder: // 1. Create a subclass instantiated from IndexBuilder. @@ -36,7 +36,7 @@ class IndexBuilder { public: static IndexBuilder* CreateIndexBuilder( BlockBasedTableOptions::IndexType index_type, - const rocksdb::InternalKeyComparator* comparator, + const ROCKSDB_NAMESPACE::InternalKeyComparator* comparator, const InternalKeySliceTransform* int_key_slice_transform, const bool use_value_delta_encoding, const BlockBasedTableOptions& table_opt); @@ -365,7 +365,7 @@ class HashIndexBuilder : public IndexBuilder { class PartitionedIndexBuilder : public IndexBuilder { public: static PartitionedIndexBuilder* CreateIndexBuilder( - const rocksdb::InternalKeyComparator* comparator, + const ROCKSDB_NAMESPACE::InternalKeyComparator* comparator, const bool use_value_delta_encoding, const BlockBasedTableOptions& table_opt); @@ -440,4 +440,4 @@ class PartitionedIndexBuilder : public IndexBuilder { bool cut_filter_block = false; BlockHandle last_encoded_handle_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/mock_block_based_table.h b/table/block_based/mock_block_based_table.h index b38de08df0..54817bd676 100644 --- a/table/block_based/mock_block_based_table.h +++ b/table/block_based/mock_block_based_table.h @@ -9,7 +9,7 @@ #include "table/block_based/block_based_table_reader.h" #include "table/block_based/filter_policy_internal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace mock { class MockBlockBasedTable : public BlockBasedTable { @@ -53,4 +53,4 @@ class MockBlockBasedTableTester { }; } // namespace mock -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/parsed_full_filter_block.cc b/table/block_based/parsed_full_filter_block.cc index 5cc259d190..3e555387ea 100644 --- a/table/block_based/parsed_full_filter_block.cc +++ b/table/block_based/parsed_full_filter_block.cc @@ -7,7 +7,7 @@ #include "table/block_based/parsed_full_filter_block.h" #include "rocksdb/filter_policy.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { ParsedFullFilterBlock::ParsedFullFilterBlock(const FilterPolicy* filter_policy, BlockContents&& contents) @@ -19,4 +19,4 @@ ParsedFullFilterBlock::ParsedFullFilterBlock(const FilterPolicy* filter_policy, ParsedFullFilterBlock::~ParsedFullFilterBlock() = default; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/parsed_full_filter_block.h b/table/block_based/parsed_full_filter_block.h index 8f15f93505..36c619921d 100644 --- a/table/block_based/parsed_full_filter_block.h +++ b/table/block_based/parsed_full_filter_block.h @@ -9,7 +9,7 @@ #include "table/format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class FilterBitsReader; class FilterPolicy; @@ -37,4 +37,4 @@ class ParsedFullFilterBlock { std::unique_ptr filter_bits_reader_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/partitioned_filter_block.cc b/table/block_based/partitioned_filter_block.cc index 018960c134..2138d96ddd 100644 --- a/table/block_based/partitioned_filter_block.cc +++ b/table/block_based/partitioned_filter_block.cc @@ -15,7 +15,7 @@ #include "table/block_based/block_based_table_reader.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { PartitionedFilterBlockBuilder::PartitionedFilterBlockBuilder( const SliceTransform* _prefix_extractor, bool whole_key_filtering, @@ -385,4 +385,4 @@ bool PartitionedFilterBlockReader::index_value_is_full() const { return table()->get_rep()->index_value_is_full; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/partitioned_filter_block.h b/table/block_based/partitioned_filter_block.h index c5556dab49..314297cab5 100644 --- a/table/block_based/partitioned_filter_block.h +++ b/table/block_based/partitioned_filter_block.h @@ -18,7 +18,7 @@ #include "table/block_based/full_filter_block.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class PartitionedFilterBlockBuilder : public FullFilterBlockBuilder { public: @@ -119,4 +119,4 @@ class PartitionedFilterBlockReader : public FilterBlockReaderCommon { filter_map_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/partitioned_filter_block_test.cc b/table/block_based/partitioned_filter_block_test.cc index 315789f55b..071bad9ca1 100644 --- a/table/block_based/partitioned_filter_block_test.cc +++ b/table/block_based/partitioned_filter_block_test.cc @@ -18,7 +18,7 @@ #include "util/coding.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::map blooms; @@ -324,8 +324,8 @@ TEST_P(PartitionedFilterBlockTest, TwoBlocksPerKey) { TEST_P(PartitionedFilterBlockTest, SamePrefixInMultipleBlocks) { // some small number to cause partition cuts table_options_.metadata_block_size = 1; - std::unique_ptr prefix_extractor - (rocksdb::NewFixedPrefixTransform(1)); + std::unique_ptr prefix_extractor( + ROCKSDB_NAMESPACE::NewFixedPrefixTransform(1)); std::unique_ptr pib(NewIndexBuilder()); std::unique_ptr builder( NewBuilder(pib.get(), prefix_extractor.get())); @@ -364,7 +364,7 @@ TEST_P(PartitionedFilterBlockTest, PrefixInWrongPartitionBug) { // some small number to cause partition cuts table_options_.metadata_block_size = 1; std::unique_ptr prefix_extractor( - rocksdb::NewFixedPrefixTransform(2)); + ROCKSDB_NAMESPACE::NewFixedPrefixTransform(2)); std::unique_ptr pib(NewIndexBuilder()); std::unique_ptr builder( NewBuilder(pib.get(), prefix_extractor.get())); @@ -416,7 +416,7 @@ TEST_P(PartitionedFilterBlockTest, PartitionCount) { ASSERT_EQ(partitions, num_keys - 1 /* last two keys make one flush */); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/table/block_based/uncompression_dict_reader.cc b/table/block_based/uncompression_dict_reader.cc index 10ceab16f2..78e2b93c18 100644 --- a/table/block_based/uncompression_dict_reader.cc +++ b/table/block_based/uncompression_dict_reader.cc @@ -9,7 +9,7 @@ #include "table/block_based/block_based_table_reader.h" #include "util/compression.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status UncompressionDictReader::Create( const BlockBasedTable* table, FilePrefetchBuffer* prefetch_buffer, @@ -117,4 +117,4 @@ bool UncompressionDictReader::cache_dictionary_blocks() const { return table_->get_rep()->table_options.cache_index_and_filter_blocks; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_based/uncompression_dict_reader.h b/table/block_based/uncompression_dict_reader.h index bfaf0b4bc7..3e7826179e 100644 --- a/table/block_based/uncompression_dict_reader.h +++ b/table/block_based/uncompression_dict_reader.h @@ -10,7 +10,7 @@ #include "table/block_based/cachable_entry.h" #include "table/format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class BlockBasedTable; struct BlockCacheLookupContext; @@ -56,4 +56,4 @@ class UncompressionDictReader { CachableEntry uncompression_dict_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_fetcher.cc b/table/block_fetcher.cc index 3e9f6ff3f0..9ddee72ccc 100644 --- a/table/block_fetcher.cc +++ b/table/block_fetcher.cc @@ -27,7 +27,7 @@ #include "util/string_util.h" #include "util/xxhash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { inline void BlockFetcher::CheckBlockChecksum() { // Check the crc of the type and the block contents @@ -281,4 +281,4 @@ Status BlockFetcher::ReadBlockContents() { return status_; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/block_fetcher.h b/table/block_fetcher.h index f67c974bec..1b003df154 100644 --- a/table/block_fetcher.h +++ b/table/block_fetcher.h @@ -13,7 +13,7 @@ #include "table/block_based/block_type.h" #include "table/format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Retrieves a single block of a given file. Utilizes the prefetch buffer and/or // persistent cache provided (if any) to try to avoid reading from the file @@ -90,7 +90,7 @@ class BlockFetcher { CacheAllocationPtr compressed_buf_; char stack_buf_[kDefaultStackBufferSize]; bool got_from_prefetch_buffer_ = false; - rocksdb::CompressionType compression_type_; + ROCKSDB_NAMESPACE::CompressionType compression_type_; bool for_compaction_ = false; // return true if found @@ -106,4 +106,4 @@ class BlockFetcher { void InsertUncompressedBlockToPersistentCacheIfNeeded(); void CheckBlockChecksum(); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/cleanable_test.cc b/table/cleanable_test.cc index 8478adf523..f7d80a39db 100644 --- a/table/cleanable_test.cc +++ b/table/cleanable_test.cc @@ -12,7 +12,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CleanableTest : public testing::Test {}; @@ -268,10 +268,10 @@ TEST_F(CleanableTest, PinnableSlice) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/table/cuckoo/cuckoo_table_builder.cc b/table/cuckoo/cuckoo_table_builder.cc index 626de7b31d..3ddce0b6ff 100644 --- a/table/cuckoo/cuckoo_table_builder.cc +++ b/table/cuckoo/cuckoo_table_builder.cc @@ -24,7 +24,7 @@ #include "util/random.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const std::string CuckooTablePropertyNames::kEmptyKey = "rocksdb.cuckoo.bucket.empty.key"; const std::string CuckooTablePropertyNames::kNumHashFunc = @@ -524,5 +524,5 @@ const char* CuckooTableBuilder::GetFileChecksumFuncName() const { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/cuckoo/cuckoo_table_builder.h b/table/cuckoo/cuckoo_table_builder.h index 5ea6a5689e..d41dfed79c 100644 --- a/table/cuckoo/cuckoo_table_builder.h +++ b/table/cuckoo/cuckoo_table_builder.h @@ -18,7 +18,7 @@ #include "table/table_builder.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CuckooTableBuilder: public TableBuilder { public: @@ -131,6 +131,6 @@ class CuckooTableBuilder: public TableBuilder { std::string file_checksum_ = kUnknownFileChecksum; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/cuckoo/cuckoo_table_builder_test.cc b/table/cuckoo/cuckoo_table_builder_test.cc index 4f4c15a60e..005ce717d5 100644 --- a/table/cuckoo/cuckoo_table_builder_test.cc +++ b/table/cuckoo/cuckoo_table_builder_test.cc @@ -17,7 +17,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern const uint64_t kCuckooTableMagicNumber; namespace { @@ -644,7 +644,7 @@ TEST_F(CuckooBuilderTest, FailWhenSameKeyInserted) { ASSERT_TRUE(builder.Finish().IsNotSupported()); ASSERT_OK(file_writer->Close()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/table/cuckoo/cuckoo_table_factory.cc b/table/cuckoo/cuckoo_table_factory.cc index 4ca29f364c..5ba48f0993 100644 --- a/table/cuckoo/cuckoo_table_factory.cc +++ b/table/cuckoo/cuckoo_table_factory.cc @@ -10,7 +10,7 @@ #include "table/cuckoo/cuckoo_table_builder.h" #include "table/cuckoo/cuckoo_table_reader.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status CuckooTableFactory::NewTableReader( const TableReaderOptions& table_reader_options, @@ -68,5 +68,5 @@ TableFactory* NewCuckooTableFactory(const CuckooTableOptions& table_options) { return new CuckooTableFactory(table_options); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/cuckoo/cuckoo_table_factory.h b/table/cuckoo/cuckoo_table_factory.h index eb3c5e5176..1b5b6c2006 100644 --- a/table/cuckoo/cuckoo_table_factory.h +++ b/table/cuckoo/cuckoo_table_factory.h @@ -11,7 +11,7 @@ #include "util/murmurhash.h" #include "rocksdb/options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const uint32_t kCuckooMurmurSeedMultiplier = 816922183; static inline uint64_t CuckooHash( @@ -88,5 +88,5 @@ class CuckooTableFactory : public TableFactory { CuckooTableOptions table_options_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/cuckoo/cuckoo_table_reader.cc b/table/cuckoo/cuckoo_table_reader.cc index 982b14763f..cd460bd0a5 100644 --- a/table/cuckoo/cuckoo_table_reader.cc +++ b/table/cuckoo/cuckoo_table_reader.cc @@ -24,7 +24,7 @@ #include "table/meta_blocks.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { const uint64_t CACHE_LINE_MASK = ~((uint64_t)CACHE_LINE_SIZE - 1); const uint32_t kInvalidIndex = std::numeric_limits::max(); @@ -395,5 +395,5 @@ InternalIterator* CuckooTableReader::NewIterator( size_t CuckooTableReader::ApproximateMemoryUsage() const { return 0; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/table/cuckoo/cuckoo_table_reader.h b/table/cuckoo/cuckoo_table_reader.h index fb0445bcfb..65bd13e1a9 100644 --- a/table/cuckoo/cuckoo_table_reader.h +++ b/table/cuckoo/cuckoo_table_reader.h @@ -21,7 +21,7 @@ #include "rocksdb/options.h" #include "table/table_reader.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Arena; class TableReader; @@ -96,5 +96,5 @@ class CuckooTableReader: public TableReader { uint64_t max_num_buckets); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/cuckoo/cuckoo_table_reader_test.cc b/table/cuckoo/cuckoo_table_reader_test.cc index 65c7f4d652..cbca768a22 100644 --- a/table/cuckoo/cuckoo_table_reader_test.cc +++ b/table/cuckoo/cuckoo_table_reader_test.cc @@ -40,7 +40,7 @@ DEFINE_bool(write, false, "Should write new values to file in performance tests?"); DEFINE_bool(identity_as_first_hash, true, "use identity as first hash"); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { const uint32_t kNumHashFunc = 10; @@ -552,15 +552,14 @@ TEST_F(CuckooReaderTest, TestReadPerformance) { fprintf(stderr, "\n"); } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - if (rocksdb::port::kLittleEndian) { + if (ROCKSDB_NAMESPACE::port::kLittleEndian) { ::testing::InitGoogleTest(&argc, argv); ParseCommandLineFlags(&argc, &argv, true); return RUN_ALL_TESTS(); - } - else { + } else { fprintf(stderr, "SKIPPED as Cuckoo table doesn't support Big Endian\n"); return 0; } diff --git a/table/format.cc b/table/format.cc index 5e9805f402..ee3766eb8a 100644 --- a/table/format.cc +++ b/table/format.cc @@ -28,7 +28,7 @@ #include "util/stop_watch.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern const uint64_t kLegacyBlockBasedTableMagicNumber; extern const uint64_t kBlockBasedTableMagicNumber; @@ -267,14 +267,16 @@ std::string Footer::ToString() const { result.append("metaindex handle: " + metaindex_handle_.ToString() + "\n "); result.append("index handle: " + index_handle_.ToString() + "\n "); result.append("table_magic_number: " + - rocksdb::ToString(table_magic_number_) + "\n "); + ROCKSDB_NAMESPACE::ToString(table_magic_number_) + "\n "); } else { - result.append("checksum: " + rocksdb::ToString(checksum_) + "\n "); + result.append("checksum: " + ROCKSDB_NAMESPACE::ToString(checksum_) + + "\n "); result.append("metaindex handle: " + metaindex_handle_.ToString() + "\n "); result.append("index handle: " + index_handle_.ToString() + "\n "); - result.append("footer version: " + rocksdb::ToString(version_) + "\n "); + result.append("footer version: " + ROCKSDB_NAMESPACE::ToString(version_) + + "\n "); result.append("table_magic_number: " + - rocksdb::ToString(table_magic_number_) + "\n "); + ROCKSDB_NAMESPACE::ToString(table_magic_number_) + "\n "); } return result; } @@ -460,4 +462,4 @@ Status UncompressBlockContents(const UncompressionInfo& uncompression_info, ioptions, allocator); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/format.h b/table/format.h index 2ed80e2fc3..ad65fdbfb8 100644 --- a/table/format.h +++ b/table/format.h @@ -24,7 +24,7 @@ #include "port/port.h" // noexcept #include "table/persistent_cache_options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class RandomAccessFile; struct ReadOptions; @@ -341,4 +341,4 @@ inline BlockHandle::BlockHandle() inline BlockHandle::BlockHandle(uint64_t _offset, uint64_t _size) : offset_(_offset), size_(_size) {} -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/get_context.cc b/table/get_context.cc index cdb5798f78..0e7ac05986 100644 --- a/table/get_context.cc +++ b/table/get_context.cc @@ -14,7 +14,7 @@ #include "rocksdb/merge_operator.h" #include "rocksdb/statistics.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -363,4 +363,4 @@ void replayGetContextLog(const Slice& replay_log, const Slice& user_key, #endif // ROCKSDB_LITE } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/get_context.h b/table/get_context.h index 8a2f24464b..79bae22146 100644 --- a/table/get_context.h +++ b/table/get_context.h @@ -13,7 +13,7 @@ #include "rocksdb/types.h" #include "table/block_based/block.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MergeContext; class PinnedIteratorsManager; @@ -188,4 +188,4 @@ void replayGetContextLog(const Slice& replay_log, const Slice& user_key, GetContext* get_context, Cleanable* value_pinner = nullptr); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/internal_iterator.h b/table/internal_iterator.h index d7940eeffa..780db64b37 100644 --- a/table/internal_iterator.h +++ b/table/internal_iterator.h @@ -13,7 +13,7 @@ #include "rocksdb/status.h" #include "table/format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class PinnedIteratorsManager; @@ -179,4 +179,4 @@ template extern InternalIteratorBase* NewErrorInternalIterator( const Status& status, Arena* arena); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/iter_heap.h b/table/iter_heap.h index f30c122722..f6812fa03a 100644 --- a/table/iter_heap.h +++ b/table/iter_heap.h @@ -9,7 +9,7 @@ #include "db/dbformat.h" #include "table/iterator_wrapper.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // When used with std::priority_queue, this comparison functor puts the // iterator with the max/largest key on top. @@ -39,4 +39,4 @@ class MinIteratorComparator { const InternalKeyComparator* comparator_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/iterator.cc b/table/iterator.cc index f6c7f9cec3..4ecfc007ba 100644 --- a/table/iterator.cc +++ b/table/iterator.cc @@ -12,7 +12,7 @@ #include "table/internal_iterator.h" #include "table/iterator_wrapper.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Cleanable::Cleanable() { cleanup_.function = nullptr; @@ -207,4 +207,4 @@ template InternalIteratorBase* NewEmptyInternalIterator( Arena* arena); template InternalIteratorBase* NewEmptyInternalIterator(Arena* arena); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/iterator_wrapper.h b/table/iterator_wrapper.h index f8fdde565e..ac37f69199 100644 --- a/table/iterator_wrapper.h +++ b/table/iterator_wrapper.h @@ -14,7 +14,7 @@ #include "table/internal_iterator.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A internal wrapper class with an interface similar to Iterator that caches // the valid() and key() results for an underlying iterator. @@ -131,4 +131,4 @@ class Arena; template extern InternalIteratorBase* NewEmptyInternalIterator(Arena* arena); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/merger_test.cc b/table/merger_test.cc index 8efa2834db..466e0eb428 100644 --- a/table/merger_test.cc +++ b/table/merger_test.cc @@ -10,7 +10,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MergerTest : public testing::Test { public: @@ -172,7 +172,7 @@ TEST_F(MergerTest, SeekToLastTest) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/table/merging_iterator.cc b/table/merging_iterator.cc index 2ee379b052..205fb8d6d5 100644 --- a/table/merging_iterator.cc +++ b/table/merging_iterator.cc @@ -25,7 +25,7 @@ #include "util/heap.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Without anonymous namespace here, we fail the warning -Wmissing-prototypes namespace { typedef BinaryHeap MergerMaxIterHeap; @@ -466,4 +466,4 @@ InternalIterator* MergeIteratorBuilder::Finish() { return ret; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/merging_iterator.h b/table/merging_iterator.h index 21ff79bf6b..c4429bf582 100644 --- a/table/merging_iterator.h +++ b/table/merging_iterator.h @@ -12,7 +12,7 @@ #include "db/dbformat.h" #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Comparator; class Env; @@ -61,4 +61,4 @@ class MergeIteratorBuilder { Arena* arena; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/meta_blocks.cc b/table/meta_blocks.cc index 1ba52d6e1c..6920bb14e1 100644 --- a/table/meta_blocks.cc +++ b/table/meta_blocks.cc @@ -20,7 +20,7 @@ #include "test_util/sync_point.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { MetaIndexBuilder::MetaIndexBuilder() : meta_index_block_(new BlockBuilder(1 /* restart interval */)) {} @@ -341,7 +341,8 @@ Status ReadProperties(const Slice& handle_value, RandomAccessFileReader* file, } if (verification_buf != nullptr) { size_t len = static_cast(handle.size() + kBlockTrailerSize); - *verification_buf = rocksdb::AllocateBlock(len, memory_allocator); + *verification_buf = + ROCKSDB_NAMESPACE::AllocateBlock(len, memory_allocator); if (verification_buf->get() != nullptr) { memcpy(verification_buf->get(), block_contents.data.data(), len); } @@ -521,4 +522,4 @@ Status ReadMetaBlock(RandomAccessFileReader* file, return block_fetcher2.ReadBlockContents(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/meta_blocks.h b/table/meta_blocks.h index 63d66497f6..0fd140cf0a 100644 --- a/table/meta_blocks.h +++ b/table/meta_blocks.h @@ -20,7 +20,7 @@ #include "table/format.h" #include "util/kv_map.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class BlockBuilder; class BlockHandle; @@ -149,4 +149,4 @@ Status ReadMetaBlock(RandomAccessFileReader* file, bool compression_type_missing = false, MemoryAllocator* memory_allocator = nullptr); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/mock_table.cc b/table/mock_table.cc index be520cac37..9ef44628a7 100644 --- a/table/mock_table.cc +++ b/table/mock_table.cc @@ -13,7 +13,7 @@ #include "table/get_context.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace mock { namespace { @@ -145,4 +145,4 @@ void MockTableFactory::AssertLatestFile( } } // namespace mock -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/mock_table.h b/table/mock_table.h index b89a9d7a79..9e80c8d04d 100644 --- a/table/mock_table.h +++ b/table/mock_table.h @@ -24,7 +24,7 @@ #include "util/kv_map.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace mock { stl_wrappers::KVMap MakeMockFile( @@ -211,4 +211,4 @@ class MockTableFactory : public TableFactory { }; } // namespace mock -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/multiget_context.h b/table/multiget_context.h index a03e46fb6c..0c5848c822 100644 --- a/table/multiget_context.h +++ b/table/multiget_context.h @@ -14,7 +14,7 @@ #include "rocksdb/types.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class GetContext; struct KeyContext { @@ -256,4 +256,4 @@ class MultiGetContext { Range GetMultiGetRange() { return Range(this, num_keys_); } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/persistent_cache_helper.cc b/table/persistent_cache_helper.cc index 8431f13db3..8797c9b9b0 100644 --- a/table/persistent_cache_helper.cc +++ b/table/persistent_cache_helper.cc @@ -7,7 +7,7 @@ #include "table/block_based/block_based_table_reader.h" #include "table/format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void PersistentCacheHelper::InsertRawPage( const PersistentCacheOptions& cache_options, const BlockHandle& handle, @@ -110,4 +110,4 @@ Status PersistentCacheHelper::LookupUncompressedPage( return Status::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/persistent_cache_helper.h b/table/persistent_cache_helper.h index ac8ee0389b..1db8557296 100644 --- a/table/persistent_cache_helper.h +++ b/table/persistent_cache_helper.h @@ -10,7 +10,7 @@ #include "table/format.h" #include "table/persistent_cache_options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct BlockContents; @@ -41,4 +41,4 @@ class PersistentCacheHelper { BlockContents* contents); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/persistent_cache_options.h b/table/persistent_cache_options.h index acd640369a..7c65a041a9 100644 --- a/table/persistent_cache_options.h +++ b/table/persistent_cache_options.h @@ -9,7 +9,7 @@ #include "monitoring/statistics.h" #include "rocksdb/persistent_cache.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // PersistentCacheOptions // @@ -31,4 +31,4 @@ struct PersistentCacheOptions { Statistics* statistics = nullptr; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/plain/plain_table_bloom.cc b/table/plain/plain_table_bloom.cc index 0de541b568..7b68335241 100644 --- a/table/plain/plain_table_bloom.cc +++ b/table/plain/plain_table_bloom.cc @@ -11,7 +11,7 @@ #include "memory/allocator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -75,4 +75,4 @@ void BloomBlockBuilder::AddKeysHashes( Slice BloomBlockBuilder::Finish() { return bloom_.GetRawData(); } const std::string BloomBlockBuilder::kBloomBlock = "kBloomBlock"; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/plain/plain_table_bloom.h b/table/plain/plain_table_bloom.h index 8da256b3bb..fdacdb0d5f 100644 --- a/table/plain/plain_table_bloom.h +++ b/table/plain/plain_table_bloom.h @@ -17,7 +17,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Slice; class Allocator; class Logger; @@ -132,4 +132,4 @@ class BloomBlockBuilder { PlainTableBloomV1 bloom_; }; -}; // namespace rocksdb +}; // namespace ROCKSDB_NAMESPACE diff --git a/table/plain/plain_table_builder.cc b/table/plain/plain_table_builder.cc index a9a7c7008d..147e46db2e 100644 --- a/table/plain/plain_table_builder.cc +++ b/table/plain/plain_table_builder.cc @@ -29,7 +29,7 @@ #include "util/crc32c.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -310,5 +310,5 @@ const char* PlainTableBuilder::GetFileChecksumFuncName() const { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/plain/plain_table_builder.h b/table/plain/plain_table_builder.h index f94939ccf0..fe2bf3cf95 100644 --- a/table/plain/plain_table_builder.h +++ b/table/plain/plain_table_builder.h @@ -19,7 +19,7 @@ #include "table/plain/plain_table_key_coding.h" #include "table/table_builder.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class BlockBuilder; class BlockHandle; @@ -146,6 +146,6 @@ class PlainTableBuilder: public TableBuilder { bool IsTotalOrderMode() const { return (prefix_extractor_ == nullptr); } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/plain/plain_table_factory.cc b/table/plain/plain_table_factory.cc index 6c6905dab1..c2db8f395a 100644 --- a/table/plain/plain_table_factory.cc +++ b/table/plain/plain_table_factory.cc @@ -16,7 +16,7 @@ #include "table/plain/plain_table_reader.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status PlainTableFactory::NewTableReader( const TableReaderOptions& table_reader_options, @@ -231,5 +231,5 @@ const std::string PlainTablePropertyNames::kBloomVersion = const std::string PlainTablePropertyNames::kNumBloomBlocks = "rocksdb.plain.table.bloom.numblocks"; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/plain/plain_table_factory.h b/table/plain/plain_table_factory.h index 1bd155f93e..64dd171cbb 100644 --- a/table/plain/plain_table_factory.h +++ b/table/plain/plain_table_factory.h @@ -14,7 +14,7 @@ #include "rocksdb/options.h" #include "rocksdb/table.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct EnvOptions; @@ -219,5 +219,5 @@ static std::unordered_map plain_table_type_info = { {offsetof(struct PlainTableOptions, store_index_in_file), OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}}}; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/plain/plain_table_index.cc b/table/plain/plain_table_index.cc index b4207f348c..1099dfa6e4 100644 --- a/table/plain/plain_table_index.cc +++ b/table/plain/plain_table_index.cc @@ -11,7 +11,7 @@ #include "util/coding.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { inline uint32_t GetBucketIdFromHash(uint32_t hash, uint32_t num_buckets) { @@ -206,6 +206,6 @@ Slice PlainTableIndexBuilder::FillIndexes( const std::string PlainTableIndexBuilder::kPlainTableIndexBlock = "PlainTableIndexBlock"; -}; // namespace rocksdb +}; // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/plain/plain_table_index.h b/table/plain/plain_table_index.h index c4bb272282..86385b906b 100644 --- a/table/plain/plain_table_index.h +++ b/table/plain/plain_table_index.h @@ -16,7 +16,7 @@ #include "options/cf_options.h" #include "rocksdb/options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // The file contains two classes PlainTableIndex and PlainTableIndexBuilder // The two classes implement the index format of PlainTable. @@ -244,6 +244,6 @@ class PlainTableIndexBuilder { static const size_t kRecordsPerGroup = 256; }; -}; // namespace rocksdb +}; // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/plain/plain_table_key_coding.cc b/table/plain/plain_table_key_coding.cc index b70ce65e67..d82b969ba2 100644 --- a/table/plain/plain_table_key_coding.cc +++ b/table/plain/plain_table_key_coding.cc @@ -13,7 +13,7 @@ #include "table/plain/plain_table_factory.h" #include "table/plain/plain_table_reader.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { enum PlainTableEntryType : unsigned char { kFullKey = 0, @@ -494,5 +494,5 @@ Status PlainTableKeyDecoder::NextKeyNoValue(uint32_t start_offset, } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LIT diff --git a/table/plain/plain_table_key_coding.h b/table/plain/plain_table_key_coding.h index 5f65d5a656..d1460837d2 100644 --- a/table/plain/plain_table_key_coding.h +++ b/table/plain/plain_table_key_coding.h @@ -17,7 +17,7 @@ // These classes issue the lowest level of operations of PlainTable. // Actual data format of the key is documented in comments of class // PlainTableFactory. -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WritableFile; struct ParsedInternalKey; @@ -188,6 +188,6 @@ class PlainTableKeyDecoder { uint32_t* bytes_read); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/plain/plain_table_reader.cc b/table/plain/plain_table_reader.cc index 2b5ed9b9b0..55756d9c1d 100644 --- a/table/plain/plain_table_reader.cc +++ b/table/plain/plain_table_reader.cc @@ -39,7 +39,7 @@ #include "util/stop_watch.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -771,5 +771,5 @@ Status PlainTableIterator::status() const { return status_; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/plain/plain_table_reader.h b/table/plain/plain_table_reader.h index c956913a04..db7b0626f3 100644 --- a/table/plain/plain_table_reader.h +++ b/table/plain/plain_table_reader.h @@ -25,7 +25,7 @@ #include "table/plain/plain_table_index.h" #include "table/table_reader.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Block; struct BlockContents; @@ -242,5 +242,5 @@ class PlainTableReader: public TableReader { explicit PlainTableReader(const TableReader&) = delete; void operator=(const TableReader&) = delete; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/table/scoped_arena_iterator.h b/table/scoped_arena_iterator.h index 1de570dc7f..8d73d12ee1 100644 --- a/table/scoped_arena_iterator.h +++ b/table/scoped_arena_iterator.h @@ -10,7 +10,7 @@ #include "table/internal_iterator.h" #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ScopedArenaIterator { void reset(InternalIterator* iter) ROCKSDB_NOEXCEPT { @@ -58,4 +58,4 @@ class ScopedArenaIterator { private: InternalIterator* iter_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/sst_file_reader.cc b/table/sst_file_reader.cc index f9f17865b4..9e3ba6eabd 100644 --- a/table/sst_file_reader.cc +++ b/table/sst_file_reader.cc @@ -16,7 +16,7 @@ #include "table/table_builder.h" #include "table/table_reader.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct SstFileReader::Rep { Options options; @@ -86,6 +86,6 @@ Status SstFileReader::VerifyChecksum(const ReadOptions& read_options) { TableReaderCaller::kSSTFileReader); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/table/sst_file_reader_test.cc b/table/sst_file_reader_test.cc index dd7a510167..ac020a3ec2 100644 --- a/table/sst_file_reader_test.cc +++ b/table/sst_file_reader_test.cc @@ -15,7 +15,7 @@ #include "test_util/testutil.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::string EncodeAsString(uint64_t v) { char buf[16]; @@ -155,7 +155,7 @@ TEST_F(SstFileReaderTest, ReadFileWithGlobalSeqno) { ASSERT_OK(DestroyDB(db_name, options)); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/table/sst_file_writer.cc b/table/sst_file_writer.cc index be3804a198..a5d08ea77c 100644 --- a/table/sst_file_writer.cc +++ b/table/sst_file_writer.cc @@ -15,7 +15,7 @@ #include "table/sst_file_writer_collectors.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const std::string ExternalSstFilePropertyNames::kVersion = "rocksdb.external_sst_file.version"; @@ -316,4 +316,4 @@ uint64_t SstFileWriter::FileSize() { } #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/sst_file_writer_collectors.h b/table/sst_file_writer_collectors.h index e1827939f2..01ecec9717 100644 --- a/table/sst_file_writer_collectors.h +++ b/table/sst_file_writer_collectors.h @@ -10,7 +10,7 @@ #include "rocksdb/types.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Table Properties that are specific to tables created by SstFileWriter. struct ExternalSstFilePropertyNames { @@ -91,4 +91,4 @@ class SstFileWriterPropertiesCollectorFactory SequenceNumber global_seqno_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/table_builder.h b/table/table_builder.h index 863052ca87..541251073a 100644 --- a/table/table_builder.h +++ b/table/table_builder.h @@ -21,7 +21,7 @@ #include "rocksdb/table_properties.h" #include "trace_replay/block_cache_tracer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Slice; class Status; @@ -167,4 +167,4 @@ class TableBuilder { virtual const char* GetFileChecksumFuncName() const = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/table_properties.cc b/table/table_properties.cc index 6e481798c3..d1dacd1a53 100644 --- a/table/table_properties.cc +++ b/table/table_properties.cc @@ -13,7 +13,7 @@ #include "table/table_properties_internal.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const uint32_t TablePropertiesCollectorFactory::Context::kUnknownColumnFamily = port::kMaxInt32; @@ -125,10 +125,11 @@ std::string TableProperties::ToString( prop_delim, kv_delim); AppendProperty(result, "column family ID", - column_family_id == rocksdb::TablePropertiesCollectorFactory:: - Context::kUnknownColumnFamily + column_family_id == + ROCKSDB_NAMESPACE::TablePropertiesCollectorFactory:: + Context::kUnknownColumnFamily ? std::string("N/A") - : rocksdb::ToString(column_family_id), + : ROCKSDB_NAMESPACE::ToString(column_family_id), prop_delim, kv_delim); AppendProperty( result, "column family name", @@ -268,4 +269,4 @@ Status SeekToRangeDelBlock(InternalIterator* meta_iter, bool* is_found, return SeekToMetaBlock(meta_iter, kRangeDelBlock, is_found, block_handle); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/table_properties_internal.h b/table/table_properties_internal.h index 888b43d245..a7a92e3e1f 100644 --- a/table/table_properties_internal.h +++ b/table/table_properties_internal.h @@ -8,7 +8,7 @@ #include "rocksdb/status.h" #include "rocksdb/iterator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class BlockHandle; @@ -27,4 +27,4 @@ Status SeekToCompressionDictBlock(InternalIterator* meta_iter, bool* is_found, Status SeekToRangeDelBlock(InternalIterator* meta_iter, bool* is_found, BlockHandle* block_handle); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/table_reader.h b/table/table_reader.h index 712c20c9a5..4a08e3883c 100644 --- a/table/table_reader.h +++ b/table/table_reader.h @@ -16,7 +16,7 @@ #include "table/multiget_context.h" #include "table/table_reader_caller.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Iterator; struct ParsedInternalKey; @@ -134,4 +134,4 @@ class TableReader { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/table_reader_bench.cc b/table/table_reader_bench.cc index fec8930974..f1fd605aa4 100644 --- a/table/table_reader_bench.cc +++ b/table/table_reader_bench.cc @@ -31,7 +31,7 @@ int main() { using GFLAGS_NAMESPACE::ParseCommandLineFlags; using GFLAGS_NAMESPACE::SetUsageMessage; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { // Make a key that i determines the first 4 characters and j determines the @@ -74,7 +74,7 @@ void TableReaderBenchmark(Options& opts, EnvOptions& env_options, int num_keys2, int num_iter, int /*prefix_len*/, bool if_query_empty_keys, bool for_iterator, bool through_db, bool measured_by_nanosecond) { - rocksdb::InternalKeyComparator ikc(opts.comparator); + ROCKSDB_NAMESPACE::InternalKeyComparator ikc(opts.comparator); std::string file_name = test::PerThreadDBPath("rocksdb_table_reader_benchmark"); @@ -258,7 +258,7 @@ void TableReaderBenchmark(Options& opts, EnvOptions& env_options, } } } // namespace -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE DEFINE_bool(query_empty, false, "query non-existing keys instead of existing " "ones."); @@ -283,24 +283,24 @@ int main(int argc, char** argv) { " [OPTIONS]..."); ParseCommandLineFlags(&argc, &argv, true); - std::shared_ptr tf; - rocksdb::Options options; + std::shared_ptr tf; + ROCKSDB_NAMESPACE::Options options; if (FLAGS_prefix_len < 16) { - options.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform( - FLAGS_prefix_len)); + options.prefix_extractor.reset( + ROCKSDB_NAMESPACE::NewFixedPrefixTransform(FLAGS_prefix_len)); } - rocksdb::ReadOptions ro; - rocksdb::EnvOptions env_options; + ROCKSDB_NAMESPACE::ReadOptions ro; + ROCKSDB_NAMESPACE::EnvOptions env_options; options.create_if_missing = true; - options.compression = rocksdb::CompressionType::kNoCompression; + options.compression = ROCKSDB_NAMESPACE::CompressionType::kNoCompression; if (FLAGS_table_factory == "cuckoo_hash") { #ifndef ROCKSDB_LITE options.allow_mmap_reads = FLAGS_mmap_read; env_options.use_mmap_reads = FLAGS_mmap_read; - rocksdb::CuckooTableOptions table_options; + ROCKSDB_NAMESPACE::CuckooTableOptions table_options; table_options.hash_table_ratio = 0.75; - tf.reset(rocksdb::NewCuckooTableFactory(table_options)); + tf.reset(ROCKSDB_NAMESPACE::NewCuckooTableFactory(table_options)); #else fprintf(stderr, "Plain table is not supported in lite mode\n"); exit(1); @@ -310,20 +310,20 @@ int main(int argc, char** argv) { options.allow_mmap_reads = FLAGS_mmap_read; env_options.use_mmap_reads = FLAGS_mmap_read; - rocksdb::PlainTableOptions plain_table_options; + ROCKSDB_NAMESPACE::PlainTableOptions plain_table_options; plain_table_options.user_key_len = 16; plain_table_options.bloom_bits_per_key = (FLAGS_prefix_len == 16) ? 0 : 8; plain_table_options.hash_table_ratio = 0.75; - tf.reset(new rocksdb::PlainTableFactory(plain_table_options)); - options.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform( - FLAGS_prefix_len)); + tf.reset(new ROCKSDB_NAMESPACE::PlainTableFactory(plain_table_options)); + options.prefix_extractor.reset( + ROCKSDB_NAMESPACE::NewFixedPrefixTransform(FLAGS_prefix_len)); #else fprintf(stderr, "Cuckoo table is not supported in lite mode\n"); exit(1); #endif // ROCKSDB_LITE } else if (FLAGS_table_factory == "block_based") { - tf.reset(new rocksdb::BlockBasedTableFactory()); + tf.reset(new ROCKSDB_NAMESPACE::BlockBasedTableFactory()); } else { fprintf(stderr, "Invalid table type %s\n", FLAGS_table_factory.c_str()); } @@ -333,10 +333,10 @@ int main(int argc, char** argv) { bool measured_by_nanosecond = FLAGS_time_unit == "nanosecond"; options.table_factory = tf; - rocksdb::TableReaderBenchmark(options, env_options, ro, FLAGS_num_keys1, - FLAGS_num_keys2, FLAGS_iter, FLAGS_prefix_len, - FLAGS_query_empty, FLAGS_iterator, - FLAGS_through_db, measured_by_nanosecond); + ROCKSDB_NAMESPACE::TableReaderBenchmark( + options, env_options, ro, FLAGS_num_keys1, FLAGS_num_keys2, FLAGS_iter, + FLAGS_prefix_len, FLAGS_query_empty, FLAGS_iterator, FLAGS_through_db, + measured_by_nanosecond); } else { return 1; } diff --git a/table/table_reader_caller.h b/table/table_reader_caller.h index 90c6468719..7a57b5e987 100644 --- a/table/table_reader_caller.h +++ b/table/table_reader_caller.h @@ -5,7 +5,7 @@ #pragma once -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A list of callers for a table reader. It is used to trace the caller that // accesses on a block. This is only used for block cache tracing and analysis. // A user may use kUncategorized if the caller is not interesting for analysis @@ -36,4 +36,4 @@ enum TableReaderCaller : char { // All callers should be added before kMaxBlockCacheLookupCaller. kMaxBlockCacheLookupCaller }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/table_test.cc b/table/table_test.cc index ff2d5d0fb6..2a24c99eb2 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -56,7 +56,7 @@ #include "util/string_util.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern const uint64_t kLegacyBlockBasedTableMagicNumber; extern const uint64_t kLegacyPlainTableMagicNumber; @@ -317,7 +317,7 @@ class TableConstructor: public Constructor { largest_seqno_(largest_seqno), convert_to_internal_key_(convert_to_internal_key), level_(level) { - env_ = rocksdb::Env::Default(); + env_ = ROCKSDB_NAMESPACE::Env::Default(); } ~TableConstructor() override { Reset(); } @@ -428,7 +428,8 @@ class TableConstructor: public Constructor { bool ConvertToInternalKey() { return convert_to_internal_key_; } test::StringSink* TEST_GetSink() { - return rocksdb::test::GetStringSinkFromLegacyWriter(file_writer_.get()); + return ROCKSDB_NAMESPACE::test::GetStringSinkFromLegacyWriter( + file_writer_.get()); } BlockCacheTracer block_cache_tracer_; @@ -1073,7 +1074,7 @@ class BlockBasedTableTest virtual public ::testing::WithParamInterface { public: BlockBasedTableTest() : format_(GetParam()) { - env_ = rocksdb::Env::Default(); + env_ = ROCKSDB_NAMESPACE::Env::Default(); } BlockBasedTableOptions GetBlockBasedTableOptions() { @@ -1239,7 +1240,8 @@ class FileChecksumTestHelper { assert(file_checksum_func != nullptr); cur_uniq_id_ = checksum_uniq_id_++; test::StringSink* ss_rw = - rocksdb::test::GetStringSinkFromLegacyWriter(file_writer_.get()); + ROCKSDB_NAMESPACE::test::GetStringSinkFromLegacyWriter( + file_writer_.get()); file_reader_.reset(test::GetRandomAccessFileReader( new test::StringSource(ss_rw->contents()))); std::unique_ptr scratch(new char[2048]); @@ -3280,7 +3282,7 @@ TEST_F(PlainTableTest, BasicPlainTableProperties) { file_writer->Flush(); test::StringSink* ss = - rocksdb::test::GetStringSinkFromLegacyWriter(file_writer.get()); + ROCKSDB_NAMESPACE::test::GetStringSinkFromLegacyWriter(file_writer.get()); std::unique_ptr file_reader( test::GetRandomAccessFileReader( new test::StringSource(ss->contents(), 72242, true))); @@ -3867,24 +3869,27 @@ class PrefixTest : public testing::Test { namespace { // A simple PrefixExtractor that only works for test PrefixAndWholeKeyTest -class TestPrefixExtractor : public rocksdb::SliceTransform { +class TestPrefixExtractor : public ROCKSDB_NAMESPACE::SliceTransform { public: ~TestPrefixExtractor() override{}; const char* Name() const override { return "TestPrefixExtractor"; } - rocksdb::Slice Transform(const rocksdb::Slice& src) const override { + ROCKSDB_NAMESPACE::Slice Transform( + const ROCKSDB_NAMESPACE::Slice& src) const override { assert(IsValid(src)); - return rocksdb::Slice(src.data(), 3); + return ROCKSDB_NAMESPACE::Slice(src.data(), 3); } - bool InDomain(const rocksdb::Slice& src) const override { + bool InDomain(const ROCKSDB_NAMESPACE::Slice& src) const override { assert(IsValid(src)); return true; } - bool InRange(const rocksdb::Slice& /*dst*/) const override { return true; } + bool InRange(const ROCKSDB_NAMESPACE::Slice& /*dst*/) const override { + return true; + } - bool IsValid(const rocksdb::Slice& src) const { + bool IsValid(const ROCKSDB_NAMESPACE::Slice& src) const { if (src.size() != 4) { return false; } @@ -3906,30 +3911,30 @@ class TestPrefixExtractor : public rocksdb::SliceTransform { } // namespace TEST_F(PrefixTest, PrefixAndWholeKeyTest) { - rocksdb::Options options; - options.compaction_style = rocksdb::kCompactionStyleUniversal; + ROCKSDB_NAMESPACE::Options options; + options.compaction_style = ROCKSDB_NAMESPACE::kCompactionStyleUniversal; options.num_levels = 20; options.create_if_missing = true; options.optimize_filters_for_hits = false; options.target_file_size_base = 268435456; options.prefix_extractor = std::make_shared(); - rocksdb::BlockBasedTableOptions bbto; - bbto.filter_policy.reset(rocksdb::NewBloomFilterPolicy(10)); + ROCKSDB_NAMESPACE::BlockBasedTableOptions bbto; + bbto.filter_policy.reset(ROCKSDB_NAMESPACE::NewBloomFilterPolicy(10)); bbto.block_size = 262144; bbto.whole_key_filtering = true; const std::string kDBPath = test::PerThreadDBPath("table_prefix_test"); options.table_factory.reset(NewBlockBasedTableFactory(bbto)); DestroyDB(kDBPath, options); - rocksdb::DB* db; - ASSERT_OK(rocksdb::DB::Open(options, kDBPath, &db)); + ROCKSDB_NAMESPACE::DB* db; + ASSERT_OK(ROCKSDB_NAMESPACE::DB::Open(options, kDBPath, &db)); // Create a bunch of keys with 10 filters. for (int i = 0; i < 10; i++) { std::string prefix = "[" + std::to_string(i) + "]"; for (int j = 0; j < 10; j++) { std::string key = prefix + std::to_string(j); - db->Put(rocksdb::WriteOptions(), key, "1"); + db->Put(ROCKSDB_NAMESPACE::WriteOptions(), key, "1"); } } @@ -4397,7 +4402,7 @@ TEST_P(BlockBasedTableTest, PropertiesMetaBlockLast) { } TEST_P(BlockBasedTableTest, BadOptions) { - rocksdb::Options options; + ROCKSDB_NAMESPACE::Options options; options.compression = kNoCompression; BlockBasedTableOptions bbto = GetBlockBasedTableOptions(); bbto.block_size = 4000; @@ -4407,13 +4412,13 @@ TEST_P(BlockBasedTableTest, BadOptions) { test::PerThreadDBPath("block_based_table_bad_options_test"); options.table_factory.reset(NewBlockBasedTableFactory(bbto)); DestroyDB(kDBPath, options); - rocksdb::DB* db; - ASSERT_NOK(rocksdb::DB::Open(options, kDBPath, &db)); + ROCKSDB_NAMESPACE::DB* db; + ASSERT_NOK(ROCKSDB_NAMESPACE::DB::Open(options, kDBPath, &db)); bbto.block_size = 4096; options.compression = kSnappyCompression; options.table_factory.reset(NewBlockBasedTableFactory(bbto)); - ASSERT_NOK(rocksdb::DB::Open(options, kDBPath, &db)); + ASSERT_NOK(ROCKSDB_NAMESPACE::DB::Open(options, kDBPath, &db)); } TEST_F(BBTTailPrefetchTest, TestTailPrefetchStats) { @@ -4638,7 +4643,7 @@ TEST_P(BlockBasedTableTest, OutOfBoundOnNext) { ASSERT_FALSE(iter->IsOutOfBound()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/table/two_level_iterator.cc b/table/two_level_iterator.cc index 1cb00b6392..a17d56df5b 100644 --- a/table/two_level_iterator.cc +++ b/table/two_level_iterator.cc @@ -15,7 +15,7 @@ #include "table/block_based/block.h" #include "table/format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -208,4 +208,4 @@ InternalIteratorBase* NewTwoLevelIterator( InternalIteratorBase* first_level_iter) { return new TwoLevelIndexIterator(state, first_level_iter); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/table/two_level_iterator.h b/table/two_level_iterator.h index 545c29f493..885dff84b7 100644 --- a/table/two_level_iterator.h +++ b/table/two_level_iterator.h @@ -12,7 +12,7 @@ #include "rocksdb/env.h" #include "table/iterator_wrapper.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct ReadOptions; class InternalKeyComparator; @@ -40,4 +40,4 @@ extern InternalIteratorBase* NewTwoLevelIterator( TwoLevelIteratorState* state, InternalIteratorBase* first_level_iter); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/test_util/fault_injection_test_env.cc b/test_util/fault_injection_test_env.cc index 5c47b7ea45..8bbd2692ea 100644 --- a/test_util/fault_injection_test_env.cc +++ b/test_util/fault_injection_test_env.cc @@ -15,7 +15,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Assume a filename, and not a directory name like "/foo/bar/" std::string GetDirName(const std::string filename) { @@ -39,7 +39,7 @@ Status Truncate(Env* env, const std::string& filename, uint64_t length) { } std::unique_ptr scratch(new char[length]); - rocksdb::Slice result; + ROCKSDB_NAMESPACE::Slice result; s = orig_file->Read(length, &result, scratch.get()); #ifdef OS_WIN orig_file.reset(); @@ -434,4 +434,4 @@ void FaultInjectionTestEnv::UntrackFile(const std::string& f) { db_file_state_.erase(f); open_files_.erase(f); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/test_util/fault_injection_test_env.h b/test_util/fault_injection_test_env.h index b68b3faedc..9cc33a8d35 100644 --- a/test_util/fault_injection_test_env.h +++ b/test_util/fault_injection_test_env.h @@ -25,7 +25,7 @@ #include "util/mutexlock.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TestWritableFile; class FaultInjectionTestEnv; @@ -222,4 +222,4 @@ class FaultInjectionTestEnv : public EnvWrapper { Status error_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/test_util/mock_time_env.h b/test_util/mock_time_env.h index feada47771..32b40f79c5 100644 --- a/test_util/mock_time_env.h +++ b/test_util/mock_time_env.h @@ -7,7 +7,7 @@ #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MockTimeEnv : public EnvWrapper { public: @@ -42,4 +42,4 @@ class MockTimeEnv : public EnvWrapper { std::atomic current_time_{0}; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/test_util/sync_point.cc b/test_util/sync_point.cc index a09be9e8fa..d969ae3c82 100644 --- a/test_util/sync_point.cc +++ b/test_util/sync_point.cc @@ -10,7 +10,7 @@ int rocksdb_kill_odds = 0; std::vector rocksdb_kill_prefix_blacklist; #ifndef NDEBUG -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { SyncPoint* SyncPoint::GetInstance() { static SyncPoint sync_point; @@ -62,5 +62,5 @@ void SyncPoint::Process(const std::string& point, void* cb_arg) { impl_->Process(point, cb_arg); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // NDEBUG diff --git a/test_util/sync_point.h b/test_util/sync_point.h index cb4b1e7177..46bfd50d75 100644 --- a/test_util/sync_point.h +++ b/test_util/sync_point.h @@ -11,6 +11,8 @@ #include #include +#include "rocksdb/rocksdb_namespace.h" + // This is only set from db_stress.cc and for testing only. // If non-zero, kill at various points in source code with probability 1/this extern int rocksdb_kill_odds; @@ -22,7 +24,7 @@ extern std::vector rocksdb_kill_prefix_blacklist; #define TEST_KILL_RANDOM(kill_point, rocksdb_kill_odds) #else -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Kill the process with probability 1/odds for testing. extern void TestKillRandom(std::string kill_point, int odds, const std::string& srcfile, int srcline); @@ -38,7 +40,7 @@ extern void TestKillRandom(std::string kill_point, int odds, TestKillRandom(kill_point, rocksdb_kill_odds, __FILE__, __LINE__); \ } \ } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif #ifdef NDEBUG @@ -48,7 +50,7 @@ extern void TestKillRandom(std::string kill_point, int odds, #define INIT_SYNC_POINT_SINGLETONS() #else -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This class provides facility to reproduce race conditions deterministically // in unit tests. @@ -122,7 +124,7 @@ class SyncPoint { Data* impl_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE // Use TEST_SYNC_POINT to specify sync points inside code base. // Sync points can have happens-after depedency on other sync points, @@ -130,11 +132,13 @@ class SyncPoint { // utilized to re-produce race conditions between threads. // See TransactionLogIteratorRace in db_test.cc for an example use case. // TEST_SYNC_POINT is no op in release build. -#define TEST_SYNC_POINT(x) rocksdb::SyncPoint::GetInstance()->Process(x) -#define TEST_IDX_SYNC_POINT(x, index) \ - rocksdb::SyncPoint::GetInstance()->Process(x + std::to_string(index)) +#define TEST_SYNC_POINT(x) \ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->Process(x) +#define TEST_IDX_SYNC_POINT(x, index) \ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->Process(x + \ + std::to_string(index)) #define TEST_SYNC_POINT_CALLBACK(x, y) \ - rocksdb::SyncPoint::GetInstance()->Process(x, y) + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->Process(x, y) #define INIT_SYNC_POINT_SINGLETONS() \ - (void)rocksdb::SyncPoint::GetInstance(); + (void)ROCKSDB_NAMESPACE::SyncPoint::GetInstance(); #endif // NDEBUG diff --git a/test_util/sync_point_impl.cc b/test_util/sync_point_impl.cc index db44f472a0..7b939c5f4c 100644 --- a/test_util/sync_point_impl.cc +++ b/test_util/sync_point_impl.cc @@ -6,7 +6,7 @@ #include "test_util/sync_point_impl.h" #ifndef NDEBUG -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void TestKillRandom(std::string kill_point, int odds, const std::string& srcfile, int srcline) { @@ -125,5 +125,5 @@ void SyncPoint::Data::Process(const std::string& point, void* cb_arg) { cleared_points_.insert(point); cv_.notify_all(); } -} // rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/test_util/sync_point_impl.h b/test_util/sync_point_impl.h index d96d732578..b246c01985 100644 --- a/test_util/sync_point_impl.h +++ b/test_util/sync_point_impl.h @@ -21,7 +21,7 @@ #pragma once #ifndef NDEBUG -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct SyncPoint::Data { Data() : enabled_(false) {} // Enable proper deletion by subclasses @@ -70,5 +70,5 @@ struct SyncPoint::Data { } void Process(const std::string& point, void* cb_arg); }; -} +} // namespace ROCKSDB_NAMESPACE #endif // NDEBUG diff --git a/test_util/testharness.cc b/test_util/testharness.cc index 62cc535a19..d38d430806 100644 --- a/test_util/testharness.cc +++ b/test_util/testharness.cc @@ -11,7 +11,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace test { ::testing::AssertionResult AssertStatus(const char* s_expr, const Status& s) { @@ -53,4 +53,4 @@ int RandomSeed() { } } // namespace test -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/test_util/testharness.h b/test_util/testharness.h index 39e77f8a99..11f40ff837 100644 --- a/test_util/testharness.h +++ b/test_util/testharness.h @@ -18,7 +18,7 @@ #include #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace test { // Return the directory to use for temporary storage. @@ -36,10 +36,12 @@ int RandomSeed(); ::testing::AssertionResult AssertStatus(const char* s_expr, const Status& s); -#define ASSERT_OK(s) ASSERT_PRED_FORMAT1(rocksdb::test::AssertStatus, s) +#define ASSERT_OK(s) \ + ASSERT_PRED_FORMAT1(ROCKSDB_NAMESPACE::test::AssertStatus, s) #define ASSERT_NOK(s) ASSERT_FALSE((s).ok()) -#define EXPECT_OK(s) EXPECT_PRED_FORMAT1(rocksdb::test::AssertStatus, s) +#define EXPECT_OK(s) \ + EXPECT_PRED_FORMAT1(ROCKSDB_NAMESPACE::test::AssertStatus, s) #define EXPECT_NOK(s) EXPECT_FALSE((s).ok()) } // namespace test -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/test_util/testutil.cc b/test_util/testutil.cc index f27387ace6..2969a140a4 100644 --- a/test_util/testutil.cc +++ b/test_util/testutil.cc @@ -21,7 +21,7 @@ #include "file/writable_file_writer.h" #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace test { const uint32_t kDefaultFormatVersion = BlockBasedTableOptions().format_version; @@ -451,4 +451,4 @@ size_t GetLinesCount(const std::string& fname, const std::string& pattern) { } } // namespace test -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/test_util/testutil.h b/test_util/testutil.h index 7ec6a3c998..3f6b47929b 100644 --- a/test_util/testutil.h +++ b/test_util/testutil.h @@ -28,7 +28,7 @@ #include "util/mutexlock.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SequentialFile; class SequentialFileReader; @@ -496,8 +496,8 @@ class FilterNumber : public CompactionFilter { std::string last_merge_operand_key() { return last_merge_operand_key_; } - bool Filter(int /*level*/, const rocksdb::Slice& /*key*/, - const rocksdb::Slice& value, std::string* /*new_value*/, + bool Filter(int /*level*/, const ROCKSDB_NAMESPACE::Slice& /*key*/, + const ROCKSDB_NAMESPACE::Slice& value, std::string* /*new_value*/, bool* /*value_changed*/) const override { if (value.size() == sizeof(uint64_t)) { return num_ == DecodeFixed64(value.data()); @@ -505,8 +505,9 @@ class FilterNumber : public CompactionFilter { return true; } - bool FilterMergeOperand(int /*level*/, const rocksdb::Slice& key, - const rocksdb::Slice& value) const override { + bool FilterMergeOperand( + int /*level*/, const ROCKSDB_NAMESPACE::Slice& key, + const ROCKSDB_NAMESPACE::Slice& value) const override { last_merge_operand_key_ = key.ToString(); if (value.size() == sizeof(uint64_t)) { return num_ == DecodeFixed64(value.data()); @@ -798,4 +799,4 @@ bool IsDirectIOSupported(Env* env, const std::string& dir); size_t GetLinesCount(const std::string& fname, const std::string& pattern); } // namespace test -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/test_util/transaction_test_util.cc b/test_util/transaction_test_util.cc index 7043eb2d78..7367075954 100644 --- a/test_util/transaction_test_util.cc +++ b/test_util/transaction_test_util.cc @@ -24,7 +24,7 @@ #include "util/random.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { RandomTransactionInserter::RandomTransactionInserter( Random64* rand, const WriteOptions& write_options, @@ -382,6 +382,6 @@ Status RandomTransactionInserter::Verify(DB* db, uint16_t num_sets, return Status::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/test_util/transaction_test_util.h b/test_util/transaction_test_util.h index 1aa4196ab3..086b0ea6f6 100644 --- a/test_util/transaction_test_util.h +++ b/test_util/transaction_test_util.h @@ -12,7 +12,7 @@ #include "rocksdb/utilities/optimistic_transaction_db.h" #include "rocksdb/utilities/transaction_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DB; class Random64; @@ -127,6 +127,6 @@ class RandomTransactionInserter { bool DoInsert(DB* db, Transaction* txn, bool is_optimistic); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/tools/blob_dump.cc b/tools/blob_dump.cc index 7da6108580..2ae73ecfe0 100644 --- a/tools/blob_dump.cc +++ b/tools/blob_dump.cc @@ -11,8 +11,8 @@ #include "utilities/blob_db/blob_dump_tool.h" -using namespace rocksdb; -using namespace rocksdb::blob_db; +using namespace ROCKSDB_NAMESPACE; +using namespace ROCKSDB_NAMESPACE::blob_db; int main(int argc, char** argv) { using DisplayType = BlobDumpTool::DisplayType; diff --git a/tools/block_cache_analyzer/block_cache_trace_analyzer.cc b/tools/block_cache_analyzer/block_cache_trace_analyzer.cc index a1b97ca089..f90cb794b4 100644 --- a/tools/block_cache_analyzer/block_cache_trace_analyzer.cc +++ b/tools/block_cache_analyzer/block_cache_trace_analyzer.cc @@ -150,7 +150,7 @@ DEFINE_int32(analyze_correlation_coefficients_max_number_of_values, 1000000, DEFINE_string(human_readable_trace_file_path, "", "The filt path that saves human readable access records."); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { const std::string kMissRatioCurveFileName = "mrc"; @@ -1440,7 +1440,7 @@ BlockCacheTraceAnalyzer::BlockCacheTraceAnalyzer( bool compute_reuse_distance, bool mrc_only, bool is_human_readable_trace_file, std::unique_ptr&& cache_simulator) - : env_(rocksdb::Env::Default()), + : env_(ROCKSDB_NAMESPACE::Env::Default()), trace_file_path_(trace_file_path), output_dir_(output_dir), human_readable_trace_file_path_(human_readable_trace_file_path), @@ -2302,7 +2302,7 @@ int block_cache_trace_analyzer_tool(int argc, char** argv) { return 0; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // GFLAGS #endif // ROCKSDB_LITE diff --git a/tools/block_cache_analyzer/block_cache_trace_analyzer.h b/tools/block_cache_analyzer/block_cache_trace_analyzer.h index 4a15429e4c..48a5448133 100644 --- a/tools/block_cache_analyzer/block_cache_trace_analyzer.h +++ b/tools/block_cache_analyzer/block_cache_trace_analyzer.h @@ -15,7 +15,7 @@ #include "trace_replay/block_cache_tracer.h" #include "utilities/simulator_cache/cache_simulator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Statistics of a key refereneced by a Get. struct GetKeyInfo { @@ -366,7 +366,7 @@ class BlockCacheTraceAnalyzer { const std::map& label_predictions, uint32_t max_number_of_values) const; - rocksdb::Env* env_; + ROCKSDB_NAMESPACE::Env* env_; const std::string trace_file_path_; const std::string output_dir_; std::string human_readable_trace_file_path_; @@ -390,4 +390,4 @@ class BlockCacheTraceAnalyzer { int block_cache_trace_analyzer_tool(int argc, char** argv); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc b/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc index fc9ec34705..1dc7236293 100644 --- a/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc +++ b/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc @@ -26,7 +26,7 @@ int main() { #include "tools/block_cache_analyzer/block_cache_trace_analyzer.h" #include "trace_replay/block_cache_tracer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { const uint64_t kBlockSize = 1024; @@ -45,7 +45,7 @@ class BlockCacheTracerTest : public testing::Test { public: BlockCacheTracerTest() { test_path_ = test::PerThreadDBPath("block_cache_tracer_test"); - env_ = rocksdb::Env::Default(); + env_ = ROCKSDB_NAMESPACE::Env::Default(); EXPECT_OK(env_->CreateDir(test_path_)); trace_file_path_ = test_path_ + "/block_cache_trace"; block_cache_sim_config_path_ = test_path_ + "/block_cache_sim_config"; @@ -196,7 +196,8 @@ class BlockCacheTracerTest : public testing::Test { argv[argc++] = arg_buffer + cursor; cursor += static_cast(arg.size()) + 1; } - ASSERT_EQ(0, rocksdb::block_cache_trace_analyzer_tool(argc, argv)); + ASSERT_EQ(0, + ROCKSDB_NAMESPACE::block_cache_trace_analyzer_tool(argc, argv)); } Env* env_; @@ -699,7 +700,7 @@ TEST_F(BlockCacheTracerTest, MixedBlocks) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/tools/block_cache_analyzer/block_cache_trace_analyzer_tool.cc b/tools/block_cache_analyzer/block_cache_trace_analyzer_tool.cc index 63382cf8c2..44fec55989 100644 --- a/tools/block_cache_analyzer/block_cache_trace_analyzer_tool.cc +++ b/tools/block_cache_analyzer/block_cache_trace_analyzer_tool.cc @@ -13,7 +13,7 @@ int main() { #else // GFLAGS #include "tools/block_cache_analyzer/block_cache_trace_analyzer.h" int main(int argc, char** argv) { - return rocksdb::block_cache_trace_analyzer_tool(argc, argv); + return ROCKSDB_NAMESPACE::block_cache_trace_analyzer_tool(argc, argv); } #endif // GFLAGS #else // ROCKSDB_LITE diff --git a/tools/db_bench.cc b/tools/db_bench.cc index 1ad77295fa..d4fb50c143 100644 --- a/tools/db_bench.cc +++ b/tools/db_bench.cc @@ -15,5 +15,7 @@ int main() { } #else #include -int main(int argc, char** argv) { return rocksdb::db_bench_tool(argc, argv); } +int main(int argc, char** argv) { + return ROCKSDB_NAMESPACE::db_bench_tool(argc, argv); +} #endif // GFLAGS diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 3b6241c1a1..5c2ca01e60 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -309,22 +309,23 @@ DEFINE_bool(enable_numa, false, "CPU and memory of same node. Use \"$numactl --hardware\" command " "to see NUMA memory architecture."); -DEFINE_int64(db_write_buffer_size, rocksdb::Options().db_write_buffer_size, +DEFINE_int64(db_write_buffer_size, + ROCKSDB_NAMESPACE::Options().db_write_buffer_size, "Number of bytes to buffer in all memtables before compacting"); DEFINE_bool(cost_write_buffer_to_cache, false, "The usage of memtable is costed to the block cache"); -DEFINE_int64(write_buffer_size, rocksdb::Options().write_buffer_size, +DEFINE_int64(write_buffer_size, ROCKSDB_NAMESPACE::Options().write_buffer_size, "Number of bytes to buffer in memtable before compacting"); DEFINE_int32(max_write_buffer_number, - rocksdb::Options().max_write_buffer_number, + ROCKSDB_NAMESPACE::Options().max_write_buffer_number, "The number of in-memory memtables. Each memtable is of size" " write_buffer_size bytes."); DEFINE_int32(min_write_buffer_number_to_merge, - rocksdb::Options().min_write_buffer_number_to_merge, + ROCKSDB_NAMESPACE::Options().min_write_buffer_number_to_merge, "The minimum number of write buffers that will be merged together" "before writing to storage. This is cheap because it is an" "in-memory merge. If this feature is not enabled, then all these" @@ -335,7 +336,7 @@ DEFINE_int32(min_write_buffer_number_to_merge, " in each of these individual write buffers."); DEFINE_int32(max_write_buffer_number_to_maintain, - rocksdb::Options().max_write_buffer_number_to_maintain, + ROCKSDB_NAMESPACE::Options().max_write_buffer_number_to_maintain, "The total maximum number of write buffers to maintain in memory " "including copies of buffers that have already been flushed. " "Unlike max_write_buffer_number, this parameter does not affect " @@ -349,7 +350,7 @@ DEFINE_int32(max_write_buffer_number_to_maintain, "'max_write_buffer_number' will be used."); DEFINE_int64(max_write_buffer_size_to_maintain, - rocksdb::Options().max_write_buffer_size_to_maintain, + ROCKSDB_NAMESPACE::Options().max_write_buffer_size_to_maintain, "The total maximum size of write buffers to maintain in memory " "including copies of buffers that have already been flushed. " "Unlike max_write_buffer_number, this parameter does not affect " @@ -363,7 +364,7 @@ DEFINE_int64(max_write_buffer_size_to_maintain, "'max_write_buffer_number' will be used."); DEFINE_int32(max_background_jobs, - rocksdb::Options().max_background_jobs, + ROCKSDB_NAMESPACE::Options().max_background_jobs, "The maximum number of concurrent background jobs that can occur " "in parallel."); @@ -380,7 +381,7 @@ DEFINE_int32(num_low_pri_threads, 0, " that can occur in parallel."); DEFINE_int32(max_background_compactions, - rocksdb::Options().max_background_compactions, + ROCKSDB_NAMESPACE::Options().max_background_compactions, "The maximum number of concurrent background compactions" " that can occur in parallel."); @@ -394,16 +395,18 @@ static const bool FLAGS_subcompactions_dummy &ValidateUint32Range); DEFINE_int32(max_background_flushes, - rocksdb::Options().max_background_flushes, + ROCKSDB_NAMESPACE::Options().max_background_flushes, "The maximum number of concurrent background flushes" " that can occur in parallel."); -static rocksdb::CompactionStyle FLAGS_compaction_style_e; -DEFINE_int32(compaction_style, (int32_t) rocksdb::Options().compaction_style, +static ROCKSDB_NAMESPACE::CompactionStyle FLAGS_compaction_style_e; +DEFINE_int32(compaction_style, + (int32_t)ROCKSDB_NAMESPACE::Options().compaction_style, "style of compaction: level-based, universal and fifo"); -static rocksdb::CompactionPri FLAGS_compaction_pri_e; -DEFINE_int32(compaction_pri, (int32_t)rocksdb::Options().compaction_pri, +static ROCKSDB_NAMESPACE::CompactionPri FLAGS_compaction_pri_e; +DEFINE_int32(compaction_pri, + (int32_t)ROCKSDB_NAMESPACE::Options().compaction_pri, "priority of files to compaction: by size or by data age"); DEFINE_int32(universal_size_ratio, 0, @@ -455,7 +458,7 @@ DEFINE_bool(partition_index_and_filters, false, DEFINE_bool(partition_index, false, "Partition index blocks"); DEFINE_int64(metadata_block_size, - rocksdb::BlockBasedTableOptions().metadata_block_size, + ROCKSDB_NAMESPACE::BlockBasedTableOptions().metadata_block_size, "Max partition size when partitioning index/filters"); // The default reduces the overhead of reading time with flash. With HDD, which @@ -471,33 +474,37 @@ DEFINE_bool( "Pin top-level index of partitioned index/filter blocks in block cache."); DEFINE_int32(block_size, - static_cast(rocksdb::BlockBasedTableOptions().block_size), + static_cast( + ROCKSDB_NAMESPACE::BlockBasedTableOptions().block_size), "Number of bytes in a block."); -DEFINE_int32( - format_version, - static_cast(rocksdb::BlockBasedTableOptions().format_version), - "Format version of SST files."); +DEFINE_int32(format_version, + static_cast( + ROCKSDB_NAMESPACE::BlockBasedTableOptions().format_version), + "Format version of SST files."); DEFINE_int32(block_restart_interval, - rocksdb::BlockBasedTableOptions().block_restart_interval, + ROCKSDB_NAMESPACE::BlockBasedTableOptions().block_restart_interval, "Number of keys between restart points " "for delta encoding of keys in data block."); -DEFINE_int32(index_block_restart_interval, - rocksdb::BlockBasedTableOptions().index_block_restart_interval, - "Number of keys between restart points " - "for delta encoding of keys in index block."); +DEFINE_int32( + index_block_restart_interval, + ROCKSDB_NAMESPACE::BlockBasedTableOptions().index_block_restart_interval, + "Number of keys between restart points " + "for delta encoding of keys in index block."); DEFINE_int32(read_amp_bytes_per_bit, - rocksdb::BlockBasedTableOptions().read_amp_bytes_per_bit, + ROCKSDB_NAMESPACE::BlockBasedTableOptions().read_amp_bytes_per_bit, "Number of bytes per bit to be used in block read-amp bitmap"); -DEFINE_bool(enable_index_compression, - rocksdb::BlockBasedTableOptions().enable_index_compression, - "Compress the index block"); +DEFINE_bool( + enable_index_compression, + ROCKSDB_NAMESPACE::BlockBasedTableOptions().enable_index_compression, + "Compress the index block"); -DEFINE_bool(block_align, rocksdb::BlockBasedTableOptions().block_align, +DEFINE_bool(block_align, + ROCKSDB_NAMESPACE::BlockBasedTableOptions().block_align, "Align data blocks on page size"); DEFINE_bool(use_data_block_hash_index, false, @@ -517,11 +524,12 @@ DEFINE_int64(row_cache_size, 0, "Number of bytes to use as a cache of individual rows" " (0 = disabled)."); -DEFINE_int32(open_files, rocksdb::Options().max_open_files, +DEFINE_int32(open_files, ROCKSDB_NAMESPACE::Options().max_open_files, "Maximum number of files to keep open at the same time" " (use default if == 0)"); -DEFINE_int32(file_opening_threads, rocksdb::Options().max_file_opening_threads, +DEFINE_int32(file_opening_threads, + ROCKSDB_NAMESPACE::Options().max_file_opening_threads, "If open_files is set to -1, this option set the number of " "threads that will be used to open files during DB::Open()"); @@ -597,10 +605,10 @@ DEFINE_bool(verify_checksum, true, " from storage"); DEFINE_bool(statistics, false, "Database statistics"); -DEFINE_int32(stats_level, rocksdb::StatsLevel::kExceptDetailedTimers, +DEFINE_int32(stats_level, ROCKSDB_NAMESPACE::StatsLevel::kExceptDetailedTimers, "stats level for statistics"); DEFINE_string(statistics_string, "", "Serialized statistics string"); -static class std::shared_ptr dbstats; +static class std::shared_ptr dbstats; DEFINE_int64(writes, -1, "Number of write operations to do. If negative, do" " --num reads."); @@ -620,15 +628,16 @@ DEFINE_string(truth_db, "/dev/shm/truth_db/dbbench", DEFINE_int32(num_levels, 7, "The total number of levels"); -DEFINE_int64(target_file_size_base, rocksdb::Options().target_file_size_base, +DEFINE_int64(target_file_size_base, + ROCKSDB_NAMESPACE::Options().target_file_size_base, "Target file size at level-1"); DEFINE_int32(target_file_size_multiplier, - rocksdb::Options().target_file_size_multiplier, + ROCKSDB_NAMESPACE::Options().target_file_size_multiplier, "A multiplier to compute target level-N file size (N >= 2)"); DEFINE_uint64(max_bytes_for_level_base, - rocksdb::Options().max_bytes_for_level_base, + ROCKSDB_NAMESPACE::Options().max_bytes_for_level_base, "Max bytes for level-1"); DEFINE_bool(level_compaction_dynamic_level_bytes, false, @@ -642,17 +651,17 @@ DEFINE_string(max_bytes_for_level_multiplier_additional, "", "A vector that specifies additional fanout per level"); DEFINE_int32(level0_stop_writes_trigger, - rocksdb::Options().level0_stop_writes_trigger, + ROCKSDB_NAMESPACE::Options().level0_stop_writes_trigger, "Number of files in level-0" " that will trigger put stop."); DEFINE_int32(level0_slowdown_writes_trigger, - rocksdb::Options().level0_slowdown_writes_trigger, + ROCKSDB_NAMESPACE::Options().level0_slowdown_writes_trigger, "Number of files in level-0" " that will slow down writes."); DEFINE_int32(level0_file_num_compaction_trigger, - rocksdb::Options().level0_file_num_compaction_trigger, + ROCKSDB_NAMESPACE::Options().level0_file_num_compaction_trigger, "Number of files in level-0" " when compactions start"); @@ -759,19 +768,22 @@ DEFINE_bool(use_blob_db, false, "Open a BlobDB instance. " "Required for large value benchmark."); -DEFINE_bool(blob_db_enable_gc, - rocksdb::blob_db::BlobDBOptions().enable_garbage_collection, - "Enable BlobDB garbage collection."); +DEFINE_bool( + blob_db_enable_gc, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().enable_garbage_collection, + "Enable BlobDB garbage collection."); -DEFINE_double(blob_db_gc_cutoff, - rocksdb::blob_db::BlobDBOptions().garbage_collection_cutoff, - "Cutoff ratio for BlobDB garbage collection."); +DEFINE_double( + blob_db_gc_cutoff, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().garbage_collection_cutoff, + "Cutoff ratio for BlobDB garbage collection."); -DEFINE_bool(blob_db_is_fifo, rocksdb::blob_db::BlobDBOptions().is_fifo, +DEFINE_bool(blob_db_is_fifo, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().is_fifo, "Enable FIFO eviction strategy in BlobDB."); DEFINE_uint64(blob_db_max_db_size, - rocksdb::blob_db::BlobDBOptions().max_db_size, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().max_db_size, "Max size limit of the directory where blob files are stored."); DEFINE_uint64( @@ -779,26 +791,26 @@ DEFINE_uint64( "TTL range to generate BlobDB data (in seconds). 0 means no TTL."); DEFINE_uint64(blob_db_ttl_range_secs, - rocksdb::blob_db::BlobDBOptions().ttl_range_secs, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().ttl_range_secs, "TTL bucket size to use when creating blob files."); DEFINE_uint64(blob_db_min_blob_size, - rocksdb::blob_db::BlobDBOptions().min_blob_size, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().min_blob_size, "Smallest blob to store in a file. Blobs smaller than this " "will be inlined with the key in the LSM tree."); DEFINE_uint64(blob_db_bytes_per_sync, - rocksdb::blob_db::BlobDBOptions().bytes_per_sync, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().bytes_per_sync, "Bytes to sync blob file at."); DEFINE_uint64(blob_db_file_size, - rocksdb::blob_db::BlobDBOptions().blob_file_size, + ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().blob_file_size, "Target size of each blob file."); DEFINE_string(blob_db_compression_type, "snappy", "Algorithm to use to compress blob in blob file"); -static enum rocksdb::CompressionType FLAGS_blob_db_compression_type_e = - rocksdb::kSnappyCompression; +static enum ROCKSDB_NAMESPACE::CompressionType + FLAGS_blob_db_compression_type_e = ROCKSDB_NAMESPACE::kSnappyCompression; // Secondary DB instance Options DEFINE_bool(use_secondary_db, false, @@ -838,33 +850,34 @@ DEFINE_string(block_cache_trace_file, "", "Block cache trace file path."); DEFINE_int32(trace_replay_threads, 1, "The number of threads to replay, must >=1."); -static enum rocksdb::CompressionType StringToCompressionType(const char* ctype) { +static enum ROCKSDB_NAMESPACE::CompressionType StringToCompressionType( + const char* ctype) { assert(ctype); if (!strcasecmp(ctype, "none")) - return rocksdb::kNoCompression; + return ROCKSDB_NAMESPACE::kNoCompression; else if (!strcasecmp(ctype, "snappy")) - return rocksdb::kSnappyCompression; + return ROCKSDB_NAMESPACE::kSnappyCompression; else if (!strcasecmp(ctype, "zlib")) - return rocksdb::kZlibCompression; + return ROCKSDB_NAMESPACE::kZlibCompression; else if (!strcasecmp(ctype, "bzip2")) - return rocksdb::kBZip2Compression; + return ROCKSDB_NAMESPACE::kBZip2Compression; else if (!strcasecmp(ctype, "lz4")) - return rocksdb::kLZ4Compression; + return ROCKSDB_NAMESPACE::kLZ4Compression; else if (!strcasecmp(ctype, "lz4hc")) - return rocksdb::kLZ4HCCompression; + return ROCKSDB_NAMESPACE::kLZ4HCCompression; else if (!strcasecmp(ctype, "xpress")) - return rocksdb::kXpressCompression; + return ROCKSDB_NAMESPACE::kXpressCompression; else if (!strcasecmp(ctype, "zstd")) - return rocksdb::kZSTD; + return ROCKSDB_NAMESPACE::kZSTD; fprintf(stdout, "Cannot parse compression type '%s'\n", ctype); - return rocksdb::kSnappyCompression; // default value + return ROCKSDB_NAMESPACE::kSnappyCompression; // default value } static std::string ColumnFamilyName(size_t i) { if (i == 0) { - return rocksdb::kDefaultColumnFamilyName; + return ROCKSDB_NAMESPACE::kDefaultColumnFamilyName; } else { char name[100]; snprintf(name, sizeof(name), "column_family_name_%06zu", i); @@ -874,23 +887,23 @@ static std::string ColumnFamilyName(size_t i) { DEFINE_string(compression_type, "snappy", "Algorithm to use to compress the database"); -static enum rocksdb::CompressionType FLAGS_compression_type_e = - rocksdb::kSnappyCompression; +static enum ROCKSDB_NAMESPACE::CompressionType FLAGS_compression_type_e = + ROCKSDB_NAMESPACE::kSnappyCompression; DEFINE_int64(sample_for_compression, 0, "Sample every N block for compression"); -DEFINE_int32(compression_level, rocksdb::CompressionOptions().level, +DEFINE_int32(compression_level, ROCKSDB_NAMESPACE::CompressionOptions().level, "Compression level. The meaning of this value is library-" "dependent. If unset, we try to use the default for the library " "specified in `--compression_type`"); DEFINE_int32(compression_max_dict_bytes, - rocksdb::CompressionOptions().max_dict_bytes, + ROCKSDB_NAMESPACE::CompressionOptions().max_dict_bytes, "Maximum size of dictionary used to prime the compression " "library."); DEFINE_int32(compression_zstd_max_train_bytes, - rocksdb::CompressionOptions().zstd_max_train_bytes, + ROCKSDB_NAMESPACE::CompressionOptions().zstd_max_train_bytes, "Maximum size of training data passed to zstd's dictionary " "trainer."); @@ -917,9 +930,9 @@ DEFINE_string(env_uri, "", "URI for registry Env lookup. Mutually exclusive" DEFINE_string(hdfs, "", "Name of hdfs environment. Mutually exclusive with" " --env_uri."); -static std::shared_ptr env_guard; +static std::shared_ptr env_guard; -static rocksdb::Env* FLAGS_env = rocksdb::Env::Default(); +static ROCKSDB_NAMESPACE::Env* FLAGS_env = ROCKSDB_NAMESPACE::Env::Default(); DEFINE_int64(stats_interval, 0, "Stats are reported every N operations when " "this is greater than zero. When 0 the interval grows over time."); @@ -942,7 +955,8 @@ DEFINE_int32(thread_status_per_interval, 0, "Takes and report a snapshot of the current status of each thread" " when this is greater than 0."); -DEFINE_int32(perf_level, rocksdb::PerfLevel::kDisable, "Level of perf collection"); +DEFINE_int32(perf_level, ROCKSDB_NAMESPACE::PerfLevel::kDisable, + "Level of perf collection"); static bool ValidateRateLimit(const char* flagname, double value) { const double EPSILON = 1e-10; @@ -976,11 +990,12 @@ DEFINE_bool(unordered_write, false, DEFINE_bool(allow_concurrent_memtable_write, true, "Allow multi-writers to update mem tables in parallel."); -DEFINE_bool(inplace_update_support, rocksdb::Options().inplace_update_support, +DEFINE_bool(inplace_update_support, + ROCKSDB_NAMESPACE::Options().inplace_update_support, "Support in-place memtable update for smaller or same-size values"); DEFINE_uint64(inplace_update_num_locks, - rocksdb::Options().inplace_update_num_locks, + ROCKSDB_NAMESPACE::Options().inplace_update_num_locks, "Number of RW locks to protect in-place memtable updates"); DEFINE_bool(enable_write_thread_adaptive_yield, true, @@ -1098,7 +1113,8 @@ DEFINE_uint64( "If non-zero, db_bench will rate-limit the reads from RocksDB. This " "is the global rate in ops/second."); -DEFINE_uint64(max_compaction_bytes, rocksdb::Options().max_compaction_bytes, +DEFINE_uint64(max_compaction_bytes, + ROCKSDB_NAMESPACE::Options().max_compaction_bytes, "Max bytes allowed in one compaction"); #ifndef ROCKSDB_LITE @@ -1115,39 +1131,41 @@ DEFINE_uint64(wal_size_limit_MB, 0, "Set the size limit for the WAL Files" " in MB."); DEFINE_uint64(max_total_wal_size, 0, "Set total max WAL size"); -DEFINE_bool(mmap_read, rocksdb::Options().allow_mmap_reads, +DEFINE_bool(mmap_read, ROCKSDB_NAMESPACE::Options().allow_mmap_reads, "Allow reads to occur via mmap-ing files"); -DEFINE_bool(mmap_write, rocksdb::Options().allow_mmap_writes, +DEFINE_bool(mmap_write, ROCKSDB_NAMESPACE::Options().allow_mmap_writes, "Allow writes to occur via mmap-ing files"); -DEFINE_bool(use_direct_reads, rocksdb::Options().use_direct_reads, +DEFINE_bool(use_direct_reads, ROCKSDB_NAMESPACE::Options().use_direct_reads, "Use O_DIRECT for reading data"); DEFINE_bool(use_direct_io_for_flush_and_compaction, - rocksdb::Options().use_direct_io_for_flush_and_compaction, + ROCKSDB_NAMESPACE::Options().use_direct_io_for_flush_and_compaction, "Use O_DIRECT for background flush and compaction writes"); -DEFINE_bool(advise_random_on_open, rocksdb::Options().advise_random_on_open, +DEFINE_bool(advise_random_on_open, + ROCKSDB_NAMESPACE::Options().advise_random_on_open, "Advise random access on table file open"); DEFINE_string(compaction_fadvice, "NORMAL", "Access pattern advice when a file is compacted"); static auto FLAGS_compaction_fadvice_e = - rocksdb::Options().access_hint_on_compaction_start; + ROCKSDB_NAMESPACE::Options().access_hint_on_compaction_start; DEFINE_bool(use_tailing_iterator, false, "Use tailing iterator to access a series of keys instead of get"); -DEFINE_bool(use_adaptive_mutex, rocksdb::Options().use_adaptive_mutex, +DEFINE_bool(use_adaptive_mutex, ROCKSDB_NAMESPACE::Options().use_adaptive_mutex, "Use adaptive mutex"); -DEFINE_uint64(bytes_per_sync, rocksdb::Options().bytes_per_sync, +DEFINE_uint64(bytes_per_sync, ROCKSDB_NAMESPACE::Options().bytes_per_sync, "Allows OS to incrementally sync SST files to disk while they are" " being written, in the background. Issue one request for every" " bytes_per_sync written. 0 turns it off."); -DEFINE_uint64(wal_bytes_per_sync, rocksdb::Options().wal_bytes_per_sync, +DEFINE_uint64(wal_bytes_per_sync, + ROCKSDB_NAMESPACE::Options().wal_bytes_per_sync, "Allows OS to incrementally sync WAL files to disk while they are" " being written, in the background. Issue one request for every" " wal_bytes_per_sync written. 0 turns it off."); @@ -1213,15 +1231,17 @@ DEFINE_bool(identity_as_first_hash, false, "the first hash function of cuckoo " "table becomes an identity function. This is only valid when key " "is 8 bytes"); DEFINE_bool(dump_malloc_stats, true, "Dump malloc stats in LOG "); -DEFINE_uint64(stats_dump_period_sec, rocksdb::Options().stats_dump_period_sec, +DEFINE_uint64(stats_dump_period_sec, + ROCKSDB_NAMESPACE::Options().stats_dump_period_sec, "Gap between printing stats to log in seconds"); DEFINE_uint64(stats_persist_period_sec, - rocksdb::Options().stats_persist_period_sec, + ROCKSDB_NAMESPACE::Options().stats_persist_period_sec, "Gap between persisting stats in seconds"); -DEFINE_bool(persist_stats_to_disk, rocksdb::Options().persist_stats_to_disk, +DEFINE_bool(persist_stats_to_disk, + ROCKSDB_NAMESPACE::Options().persist_stats_to_disk, "whether to persist stats to disk"); DEFINE_uint64(stats_history_buffer_size, - rocksdb::Options().stats_history_buffer_size, + ROCKSDB_NAMESPACE::Options().stats_history_buffer_size, "Max number of stats snapshots to keep in memory"); DEFINE_int64(multiread_stride, 0, "Stride length for the keys in a MultiGet batch"); @@ -1302,7 +1322,7 @@ static const bool FLAGS_table_cache_numshardbits_dummy __attribute__((__unused__ RegisterFlagValidator(&FLAGS_table_cache_numshardbits, &ValidateTableCacheNumshardbits); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { struct ReportFileOpCounters { @@ -1769,7 +1789,7 @@ class ReporterAgent { std::atomic total_ops_done_; int64_t last_report_; const uint64_t report_interval_secs_; - rocksdb::port::Thread reporting_thread_; + ROCKSDB_NAMESPACE::port::Thread reporting_thread_; std::mutex mutex_; // will notify on stop std::condition_variable stop_cv_; @@ -2351,31 +2371,31 @@ class Benchmark { const Slice& input, std::string* compressed) { bool ok = true; switch (FLAGS_compression_type_e) { - case rocksdb::kSnappyCompression: + case ROCKSDB_NAMESPACE::kSnappyCompression: ok = Snappy_Compress(compression_info, input.data(), input.size(), compressed); break; - case rocksdb::kZlibCompression: + case ROCKSDB_NAMESPACE::kZlibCompression: ok = Zlib_Compress(compression_info, 2, input.data(), input.size(), compressed); break; - case rocksdb::kBZip2Compression: + case ROCKSDB_NAMESPACE::kBZip2Compression: ok = BZip2_Compress(compression_info, 2, input.data(), input.size(), compressed); break; - case rocksdb::kLZ4Compression: + case ROCKSDB_NAMESPACE::kLZ4Compression: ok = LZ4_Compress(compression_info, 2, input.data(), input.size(), compressed); break; - case rocksdb::kLZ4HCCompression: + case ROCKSDB_NAMESPACE::kLZ4HCCompression: ok = LZ4HC_Compress(compression_info, 2, input.data(), input.size(), compressed); break; - case rocksdb::kXpressCompression: + case ROCKSDB_NAMESPACE::kXpressCompression: ok = XPRESS_Compress(input.data(), input.size(), compressed); break; - case rocksdb::kZSTD: + case ROCKSDB_NAMESPACE::kZSTD: ok = ZSTD_Compress(compression_info, input.data(), input.size(), compressed); break; @@ -2464,7 +2484,7 @@ class Benchmark { fprintf(stdout, "WARNING: Assertions are enabled; benchmarks unnecessarily slow\n"); #endif - if (FLAGS_compression_type_e != rocksdb::kNoCompression) { + if (FLAGS_compression_type_e != ROCKSDB_NAMESPACE::kNoCompression) { // The test string should not be too small. const int len = FLAGS_block_size; std::string input_str(len, 'y'); @@ -3479,7 +3499,7 @@ class Benchmark { while (ok && bytes < 1024 * 1048576) { CacheAllocationPtr uncompressed; switch (FLAGS_compression_type_e) { - case rocksdb::kSnappyCompression: { + case ROCKSDB_NAMESPACE::kSnappyCompression: { // get size and allocate here to make comparison fair size_t ulength = 0; if (!Snappy_GetUncompressedLength(compressed.data(), @@ -3492,38 +3512,39 @@ class Benchmark { uncompressed.get()); break; } - case rocksdb::kZlibCompression: - uncompressed = Zlib_Uncompress(uncompression_info, compressed.data(), - compressed.size(), &decompress_size, 2); - ok = uncompressed.get() != nullptr; - break; - case rocksdb::kBZip2Compression: - uncompressed = BZip2_Uncompress(compressed.data(), compressed.size(), - &decompress_size, 2); - ok = uncompressed.get() != nullptr; - break; - case rocksdb::kLZ4Compression: - uncompressed = LZ4_Uncompress(uncompression_info, compressed.data(), - compressed.size(), &decompress_size, 2); - ok = uncompressed.get() != nullptr; - break; - case rocksdb::kLZ4HCCompression: - uncompressed = LZ4_Uncompress(uncompression_info, compressed.data(), - compressed.size(), &decompress_size, 2); - ok = uncompressed.get() != nullptr; - break; - case rocksdb::kXpressCompression: - uncompressed.reset(XPRESS_Uncompress( - compressed.data(), compressed.size(), &decompress_size)); - ok = uncompressed.get() != nullptr; - break; - case rocksdb::kZSTD: - uncompressed = ZSTD_Uncompress(uncompression_info, compressed.data(), - compressed.size(), &decompress_size); - ok = uncompressed.get() != nullptr; - break; - default: - ok = false; + case ROCKSDB_NAMESPACE::kZlibCompression: + uncompressed = + Zlib_Uncompress(uncompression_info, compressed.data(), + compressed.size(), &decompress_size, 2); + ok = uncompressed.get() != nullptr; + break; + case ROCKSDB_NAMESPACE::kBZip2Compression: + uncompressed = BZip2_Uncompress(compressed.data(), compressed.size(), + &decompress_size, 2); + ok = uncompressed.get() != nullptr; + break; + case ROCKSDB_NAMESPACE::kLZ4Compression: + uncompressed = LZ4_Uncompress(uncompression_info, compressed.data(), + compressed.size(), &decompress_size, 2); + ok = uncompressed.get() != nullptr; + break; + case ROCKSDB_NAMESPACE::kLZ4HCCompression: + uncompressed = LZ4_Uncompress(uncompression_info, compressed.data(), + compressed.size(), &decompress_size, 2); + ok = uncompressed.get() != nullptr; + break; + case ROCKSDB_NAMESPACE::kXpressCompression: + uncompressed.reset(XPRESS_Uncompress( + compressed.data(), compressed.size(), &decompress_size)); + ok = uncompressed.get() != nullptr; + break; + case ROCKSDB_NAMESPACE::kZSTD: + uncompressed = ZSTD_Uncompress(uncompression_info, compressed.data(), + compressed.size(), &decompress_size); + ok = uncompressed.get() != nullptr; + break; + default: + ok = false; } bytes += input.size(); thread->stats.FinishedOps(nullptr, nullptr, 1, kUncompress); @@ -3702,7 +3723,7 @@ class Benchmark { exit(1); } - rocksdb::CuckooTableOptions table_options; + ROCKSDB_NAMESPACE::CuckooTableOptions table_options; table_options.hash_table_ratio = FLAGS_cuckoo_hash_ratio; table_options.identity_as_first_hash = FLAGS_identity_as_first_hash; options.table_factory = std::shared_ptr( @@ -3764,10 +3785,10 @@ class Benchmark { block_based_options.block_align = FLAGS_block_align; if (FLAGS_use_data_block_hash_index) { block_based_options.data_block_index_type = - rocksdb::BlockBasedTableOptions::kDataBlockBinaryAndHash; + ROCKSDB_NAMESPACE::BlockBasedTableOptions::kDataBlockBinaryAndHash; } else { block_based_options.data_block_index_type = - rocksdb::BlockBasedTableOptions::kDataBlockBinarySearch; + ROCKSDB_NAMESPACE::BlockBasedTableOptions::kDataBlockBinarySearch; } block_based_options.data_block_hash_table_util_ratio = FLAGS_data_block_hash_table_util_ratio; @@ -4803,7 +4824,7 @@ class Benchmark { delete iter; thread->stats.AddBytes(bytes); - if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { + if (FLAGS_perf_level > ROCKSDB_NAMESPACE::PerfLevel::kDisable) { thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString()); } @@ -4862,7 +4883,7 @@ class Benchmark { thread->stats.AddBytes(bytes); thread->stats.AddMessage(msg); - if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { + if (FLAGS_perf_level > ROCKSDB_NAMESPACE::PerfLevel::kDisable) { thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString()); } @@ -4945,7 +4966,7 @@ class Benchmark { thread->stats.AddMessage(msg); - if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { + if (FLAGS_perf_level > ROCKSDB_NAMESPACE::PerfLevel::kDisable) { thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString()); } @@ -5039,7 +5060,7 @@ class Benchmark { thread->stats.AddBytes(bytes); thread->stats.AddMessage(msg); - if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { + if (FLAGS_perf_level > ROCKSDB_NAMESPACE::PerfLevel::kDisable) { thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString()); } @@ -5541,7 +5562,7 @@ class Benchmark { thread->stats.AddBytes(bytes); thread->stats.AddMessage(msg); - if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { + if (FLAGS_perf_level > ROCKSDB_NAMESPACE::PerfLevel::kDisable) { thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString()); } @@ -5675,7 +5696,7 @@ class Benchmark { found, read); thread->stats.AddBytes(bytes); thread->stats.AddMessage(msg); - if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { + if (FLAGS_perf_level > ROCKSDB_NAMESPACE::PerfLevel::kDisable) { thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString()); } @@ -6531,7 +6552,7 @@ class Benchmark { } thread->stats.AddMessage(msg); - if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { + if (FLAGS_perf_level > ROCKSDB_NAMESPACE::PerfLevel::kDisable) { thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString()); } @@ -6694,7 +6715,7 @@ class Benchmark { read); thread->stats.AddBytes(bytes); thread->stats.AddMessage(msg); - if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { + if (FLAGS_perf_level > ROCKSDB_NAMESPACE::PerfLevel::kDisable) { thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString()); } @@ -6888,7 +6909,7 @@ class Benchmark { }; int db_bench_tool(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); static bool initialized = false; if (!initialized) { SetUsageMessage(std::string("\nUSAGE:\n") + std::string(argv[0]) + @@ -6896,7 +6917,8 @@ int db_bench_tool(int argc, char** argv) { initialized = true; } ParseCommandLineFlags(&argc, &argv, true); - FLAGS_compaction_style_e = (rocksdb::CompactionStyle) FLAGS_compaction_style; + FLAGS_compaction_style_e = + (ROCKSDB_NAMESPACE::CompactionStyle)FLAGS_compaction_style; #ifndef ROCKSDB_LITE if (FLAGS_statistics && !FLAGS_statistics_string.empty()) { fprintf(stderr, @@ -6915,14 +6937,15 @@ int db_bench_tool(int argc, char** argv) { } #endif // ROCKSDB_LITE if (FLAGS_statistics) { - dbstats = rocksdb::CreateDBStatistics(); + dbstats = ROCKSDB_NAMESPACE::CreateDBStatistics(); } if (dbstats) { dbstats->set_stats_level(static_cast(FLAGS_stats_level)); } - FLAGS_compaction_pri_e = (rocksdb::CompactionPri)FLAGS_compaction_pri; + FLAGS_compaction_pri_e = + (ROCKSDB_NAMESPACE::CompactionPri)FLAGS_compaction_pri; - std::vector fanout = rocksdb::StringSplit( + std::vector fanout = ROCKSDB_NAMESPACE::StringSplit( FLAGS_max_bytes_for_level_multiplier_additional, ','); for (size_t j = 0; j < fanout.size(); j++) { FLAGS_max_bytes_for_level_multiplier_additional_v.push_back( @@ -6959,17 +6982,17 @@ int db_bench_tool(int argc, char** argv) { } if (!FLAGS_hdfs.empty()) { - FLAGS_env = new rocksdb::HdfsEnv(FLAGS_hdfs); + FLAGS_env = new ROCKSDB_NAMESPACE::HdfsEnv(FLAGS_hdfs); } if (!strcasecmp(FLAGS_compaction_fadvice.c_str(), "NONE")) - FLAGS_compaction_fadvice_e = rocksdb::Options::NONE; + FLAGS_compaction_fadvice_e = ROCKSDB_NAMESPACE::Options::NONE; else if (!strcasecmp(FLAGS_compaction_fadvice.c_str(), "NORMAL")) - FLAGS_compaction_fadvice_e = rocksdb::Options::NORMAL; + FLAGS_compaction_fadvice_e = ROCKSDB_NAMESPACE::Options::NORMAL; else if (!strcasecmp(FLAGS_compaction_fadvice.c_str(), "SEQUENTIAL")) - FLAGS_compaction_fadvice_e = rocksdb::Options::SEQUENTIAL; + FLAGS_compaction_fadvice_e = ROCKSDB_NAMESPACE::Options::SEQUENTIAL; else if (!strcasecmp(FLAGS_compaction_fadvice.c_str(), "WILLNEED")) - FLAGS_compaction_fadvice_e = rocksdb::Options::WILLNEED; + FLAGS_compaction_fadvice_e = ROCKSDB_NAMESPACE::Options::WILLNEED; else { fprintf(stdout, "Unknown compaction fadvice:%s\n", FLAGS_compaction_fadvice.c_str()); @@ -6983,11 +7006,11 @@ int db_bench_tool(int argc, char** argv) { // Note options sanitization may increase thread pool sizes according to // max_background_flushes/max_background_compactions/max_background_jobs FLAGS_env->SetBackgroundThreads(FLAGS_num_high_pri_threads, - rocksdb::Env::Priority::HIGH); + ROCKSDB_NAMESPACE::Env::Priority::HIGH); FLAGS_env->SetBackgroundThreads(FLAGS_num_bottom_pri_threads, - rocksdb::Env::Priority::BOTTOM); + ROCKSDB_NAMESPACE::Env::Priority::BOTTOM); FLAGS_env->SetBackgroundThreads(FLAGS_num_low_pri_threads, - rocksdb::Env::Priority::LOW); + ROCKSDB_NAMESPACE::Env::Priority::LOW); // Choose a location for the test database if none given with --db= if (FLAGS_db.empty()) { @@ -7008,18 +7031,18 @@ int db_bench_tool(int argc, char** argv) { exit(1); } - rocksdb::Benchmark benchmark; + ROCKSDB_NAMESPACE::Benchmark benchmark; benchmark.Run(); #ifndef ROCKSDB_LITE if (FLAGS_print_malloc_stats) { std::string stats_string; - rocksdb::DumpMallocStats(&stats_string); + ROCKSDB_NAMESPACE::DumpMallocStats(&stats_string); fprintf(stdout, "Malloc stats:\n%s\n", stats_string.c_str()); } #endif // ROCKSDB_LITE return 0; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/tools/db_bench_tool_test.cc b/tools/db_bench_tool_test.cc index 1f7fa93160..821c602bf3 100644 --- a/tools/db_bench_tool_test.cc +++ b/tools/db_bench_tool_test.cc @@ -17,7 +17,7 @@ #ifdef GFLAGS #include "util/gflags_compat.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { static const int kMaxArgCount = 100; static const size_t kArgBufferSize = 100000; @@ -304,7 +304,7 @@ TEST_F(DBBenchTest, OptionsFileFromFile) { VerifyOptions(opt); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/tools/db_repl_stress.cc b/tools/db_repl_stress.cc index c7ad71738f..717f5d3d84 100644 --- a/tools/db_repl_stress.cc +++ b/tools/db_repl_stress.cc @@ -27,7 +27,7 @@ int main() { // --num_inserts = the num of inserts the first thread should perform. // --wal_ttl = the wal ttl for the run. -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; using GFLAGS_NAMESPACE::ParseCommandLineFlags; using GFLAGS_NAMESPACE::SetUsageMessage; diff --git a/tools/db_sanity_test.cc b/tools/db_sanity_test.cc index b40fe6134c..b483ee84fb 100644 --- a/tools/db_sanity_test.cc +++ b/tools/db_sanity_test.cc @@ -20,7 +20,7 @@ #include "port/port.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SanityTest { public: @@ -273,7 +273,7 @@ bool RunSanityTests(const std::string& command, const std::string& path) { } } // namespace -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { std::string path, command; @@ -291,7 +291,7 @@ int main(int argc, char** argv) { path += "/"; } - bool sanity_ok = rocksdb::RunSanityTests(command, path); + bool sanity_ok = ROCKSDB_NAMESPACE::RunSanityTests(command, path); return sanity_ok ? 0 : 1; } diff --git a/tools/dump/db_dump_tool.cc b/tools/dump/db_dump_tool.cc index 06a47ce725..be3ff79628 100644 --- a/tools/dump/db_dump_tool.cc +++ b/tools/dump/db_dump_tool.cc @@ -13,13 +13,13 @@ #include "rocksdb/env.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { bool DbDumpTool::Run(const DumpOptions& dump_options, - rocksdb::Options options) { - rocksdb::DB* dbptr; - rocksdb::Status status; - std::unique_ptr dumpfile; + ROCKSDB_NAMESPACE::Options options) { + ROCKSDB_NAMESPACE::DB* dbptr; + ROCKSDB_NAMESPACE::Status status; + std::unique_ptr dumpfile; char hostname[1024]; int64_t timesec = 0; std::string abspath; @@ -28,35 +28,36 @@ bool DbDumpTool::Run(const DumpOptions& dump_options, static const char* magicstr = "ROCKDUMP"; static const char versionstr[8] = {0, 0, 0, 0, 0, 0, 0, 1}; - rocksdb::Env* env = rocksdb::Env::Default(); + ROCKSDB_NAMESPACE::Env* env = ROCKSDB_NAMESPACE::Env::Default(); // Open the database options.create_if_missing = false; - status = rocksdb::DB::OpenForReadOnly(options, dump_options.db_path, &dbptr); + status = ROCKSDB_NAMESPACE::DB::OpenForReadOnly(options, dump_options.db_path, + &dbptr); if (!status.ok()) { std::cerr << "Unable to open database '" << dump_options.db_path << "' for reading: " << status.ToString() << std::endl; return false; } - const std::unique_ptr db(dbptr); + const std::unique_ptr db(dbptr); status = env->NewWritableFile(dump_options.dump_location, &dumpfile, - rocksdb::EnvOptions()); + ROCKSDB_NAMESPACE::EnvOptions()); if (!status.ok()) { std::cerr << "Unable to open dump file '" << dump_options.dump_location << "' for writing: " << status.ToString() << std::endl; return false; } - rocksdb::Slice magicslice(magicstr, 8); + ROCKSDB_NAMESPACE::Slice magicslice(magicstr, 8); status = dumpfile->Append(magicslice); if (!status.ok()) { std::cerr << "Append failed: " << status.ToString() << std::endl; return false; } - rocksdb::Slice versionslice(versionstr, 8); + ROCKSDB_NAMESPACE::Slice versionslice(versionstr, 8); status = dumpfile->Append(versionslice); if (!status.ok()) { std::cerr << "Append failed: " << status.ToString() << std::endl; @@ -75,10 +76,10 @@ bool DbDumpTool::Run(const DumpOptions& dump_options, abspath.c_str(), hostname, timesec); } - rocksdb::Slice infoslice(json, strlen(json)); + ROCKSDB_NAMESPACE::Slice infoslice(json, strlen(json)); char infosize[4]; - rocksdb::EncodeFixed32(infosize, (uint32_t)infoslice.size()); - rocksdb::Slice infosizeslice(infosize, 4); + ROCKSDB_NAMESPACE::EncodeFixed32(infosize, (uint32_t)infoslice.size()); + ROCKSDB_NAMESPACE::Slice infosizeslice(infosize, 4); status = dumpfile->Append(infosizeslice); if (!status.ok()) { std::cerr << "Append failed: " << status.ToString() << std::endl; @@ -90,12 +91,12 @@ bool DbDumpTool::Run(const DumpOptions& dump_options, return false; } - const std::unique_ptr it( - db->NewIterator(rocksdb::ReadOptions())); + const std::unique_ptr it( + db->NewIterator(ROCKSDB_NAMESPACE::ReadOptions())); for (it->SeekToFirst(); it->Valid(); it->Next()) { char keysize[4]; - rocksdb::EncodeFixed32(keysize, (uint32_t)it->key().size()); - rocksdb::Slice keysizeslice(keysize, 4); + ROCKSDB_NAMESPACE::EncodeFixed32(keysize, (uint32_t)it->key().size()); + ROCKSDB_NAMESPACE::Slice keysizeslice(keysize, 4); status = dumpfile->Append(keysizeslice); if (!status.ok()) { std::cerr << "Append failed: " << status.ToString() << std::endl; @@ -108,8 +109,8 @@ bool DbDumpTool::Run(const DumpOptions& dump_options, } char valsize[4]; - rocksdb::EncodeFixed32(valsize, (uint32_t)it->value().size()); - rocksdb::Slice valsizeslice(valsize, 4); + ROCKSDB_NAMESPACE::EncodeFixed32(valsize, (uint32_t)it->value().size()); + ROCKSDB_NAMESPACE::Slice valsizeslice(valsize, 4); status = dumpfile->Append(valsizeslice); if (!status.ok()) { std::cerr << "Append failed: " << status.ToString() << std::endl; @@ -130,21 +131,21 @@ bool DbDumpTool::Run(const DumpOptions& dump_options, } bool DbUndumpTool::Run(const UndumpOptions& undump_options, - rocksdb::Options options) { - rocksdb::DB* dbptr; - rocksdb::Status status; - rocksdb::Env* env; - std::unique_ptr dumpfile; - rocksdb::Slice slice; + ROCKSDB_NAMESPACE::Options options) { + ROCKSDB_NAMESPACE::DB* dbptr; + ROCKSDB_NAMESPACE::Status status; + ROCKSDB_NAMESPACE::Env* env; + std::unique_ptr dumpfile; + ROCKSDB_NAMESPACE::Slice slice; char scratch8[8]; static const char* magicstr = "ROCKDUMP"; static const char versionstr[8] = {0, 0, 0, 0, 0, 0, 0, 1}; - env = rocksdb::Env::Default(); + env = ROCKSDB_NAMESPACE::Env::Default(); status = env->NewSequentialFile(undump_options.dump_location, &dumpfile, - rocksdb::EnvOptions()); + ROCKSDB_NAMESPACE::EnvOptions()); if (!status.ok()) { std::cerr << "Unable to open dump file '" << undump_options.dump_location << "' for reading: " << status.ToString() << std::endl; @@ -172,7 +173,7 @@ bool DbUndumpTool::Run(const UndumpOptions& undump_options, std::cerr << "Unable to read info blob size." << std::endl; return false; } - uint32_t infosize = rocksdb::DecodeFixed32(slice.data()); + uint32_t infosize = ROCKSDB_NAMESPACE::DecodeFixed32(slice.data()); status = dumpfile->Skip(infosize); if (!status.ok()) { std::cerr << "Unable to skip info blob: " << status.ToString() << std::endl; @@ -180,14 +181,14 @@ bool DbUndumpTool::Run(const UndumpOptions& undump_options, } options.create_if_missing = true; - status = rocksdb::DB::Open(options, undump_options.db_path, &dbptr); + status = ROCKSDB_NAMESPACE::DB::Open(options, undump_options.db_path, &dbptr); if (!status.ok()) { std::cerr << "Unable to open database '" << undump_options.db_path << "' for writing: " << status.ToString() << std::endl; return false; } - const std::unique_ptr db(dbptr); + const std::unique_ptr db(dbptr); uint32_t last_keysize = 64; size_t last_valsize = 1 << 20; @@ -196,12 +197,12 @@ bool DbUndumpTool::Run(const UndumpOptions& undump_options, while (1) { uint32_t keysize, valsize; - rocksdb::Slice keyslice; - rocksdb::Slice valslice; + ROCKSDB_NAMESPACE::Slice keyslice; + ROCKSDB_NAMESPACE::Slice valslice; status = dumpfile->Read(4, &slice, scratch8); if (!status.ok() || slice.size() != 4) break; - keysize = rocksdb::DecodeFixed32(slice.data()); + keysize = ROCKSDB_NAMESPACE::DecodeFixed32(slice.data()); if (keysize > last_keysize) { while (keysize > last_keysize) last_keysize *= 2; keyscratch = std::unique_ptr(new char[last_keysize]); @@ -222,7 +223,7 @@ bool DbUndumpTool::Run(const UndumpOptions& undump_options, << std::endl; return false; } - valsize = rocksdb::DecodeFixed32(slice.data()); + valsize = ROCKSDB_NAMESPACE::DecodeFixed32(slice.data()); if (valsize > last_valsize) { while (valsize > last_valsize) last_valsize *= 2; valscratch = std::unique_ptr(new char[last_valsize]); @@ -236,7 +237,7 @@ bool DbUndumpTool::Run(const UndumpOptions& undump_options, return false; } - status = db->Put(rocksdb::WriteOptions(), keyslice, valslice); + status = db->Put(ROCKSDB_NAMESPACE::WriteOptions(), keyslice, valslice); if (!status.ok()) { fprintf(stderr, "Unable to write database entry\n"); return false; @@ -244,7 +245,8 @@ bool DbUndumpTool::Run(const UndumpOptions& undump_options, } if (undump_options.compact_db) { - status = db->CompactRange(rocksdb::CompactRangeOptions(), nullptr, nullptr); + status = db->CompactRange(ROCKSDB_NAMESPACE::CompactRangeOptions(), nullptr, + nullptr); if (!status.ok()) { fprintf(stderr, "Unable to compact the database after loading the dumped file\n"); @@ -253,5 +255,5 @@ bool DbUndumpTool::Run(const UndumpOptions& undump_options, } return true; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/tools/dump/rocksdb_dump.cc b/tools/dump/rocksdb_dump.cc index 249371a273..358457e923 100644 --- a/tools/dump/rocksdb_dump.cc +++ b/tools/dump/rocksdb_dump.cc @@ -37,15 +37,15 @@ int main(int argc, char** argv) { return 1; } - rocksdb::DumpOptions dump_options; + ROCKSDB_NAMESPACE::DumpOptions dump_options; dump_options.db_path = FLAGS_db_path; dump_options.dump_location = FLAGS_dump_location; dump_options.anonymous = FLAGS_anonymous; - rocksdb::Options db_options; + ROCKSDB_NAMESPACE::Options db_options; if (FLAGS_db_options != "") { - rocksdb::Options parsed_options; - rocksdb::Status s = rocksdb::GetOptionsFromString( + ROCKSDB_NAMESPACE::Options parsed_options; + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::GetOptionsFromString( db_options, FLAGS_db_options, &parsed_options); if (!s.ok()) { fprintf(stderr, "Cannot parse provided db_options\n"); @@ -54,7 +54,7 @@ int main(int argc, char** argv) { db_options = parsed_options; } - rocksdb::DbDumpTool tool; + ROCKSDB_NAMESPACE::DbDumpTool tool; if (!tool.Run(dump_options, db_options)) { return 1; } diff --git a/tools/dump/rocksdb_undump.cc b/tools/dump/rocksdb_undump.cc index 450c7e4759..2ff128548d 100644 --- a/tools/dump/rocksdb_undump.cc +++ b/tools/dump/rocksdb_undump.cc @@ -36,15 +36,15 @@ int main(int argc, char **argv) { return 1; } - rocksdb::UndumpOptions undump_options; + ROCKSDB_NAMESPACE::UndumpOptions undump_options; undump_options.db_path = FLAGS_db_path; undump_options.dump_location = FLAGS_dump_location; undump_options.compact_db = FLAGS_compact; - rocksdb::Options db_options; + ROCKSDB_NAMESPACE::Options db_options; if (FLAGS_db_options != "") { - rocksdb::Options parsed_options; - rocksdb::Status s = rocksdb::GetOptionsFromString( + ROCKSDB_NAMESPACE::Options parsed_options; + ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::GetOptionsFromString( db_options, FLAGS_db_options, &parsed_options); if (!s.ok()) { fprintf(stderr, "Cannot parse provided db_options\n"); @@ -53,7 +53,7 @@ int main(int argc, char **argv) { db_options = parsed_options; } - rocksdb::DbUndumpTool tool; + ROCKSDB_NAMESPACE::DbUndumpTool tool; if (!tool.Run(undump_options, db_options)) { return 1; } diff --git a/tools/ldb.cc b/tools/ldb.cc index 83193132b0..482383be85 100644 --- a/tools/ldb.cc +++ b/tools/ldb.cc @@ -8,7 +8,7 @@ #include "rocksdb/ldb_tool.h" int main(int argc, char** argv) { - rocksdb::LDBTool tool; + ROCKSDB_NAMESPACE::LDBTool tool; tool.Run(argc, argv); return 0; } diff --git a/tools/ldb_cmd.cc b/tools/ldb_cmd.cc index 75bdf47dc8..48d32d2ef1 100644 --- a/tools/ldb_cmd.cc +++ b/tools/ldb_cmd.cc @@ -46,7 +46,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class FileChecksumFuncCrc32c; @@ -1843,7 +1843,8 @@ std::vector ReduceDBLevelsCommand::PrepareArgs( std::vector ret; ret.push_back("reduce_levels"); ret.push_back("--" + ARG_DB + "=" + db_path); - ret.push_back("--" + ARG_NEW_LEVELS + "=" + rocksdb::ToString(new_levels)); + ret.push_back("--" + ARG_NEW_LEVELS + "=" + + ROCKSDB_NAMESPACE::ToString(new_levels)); if(print_old_level) { ret.push_back("--" + ARG_PRINT_OLD_LEVELS); } @@ -3081,8 +3082,9 @@ void DumpSstFile(Options options, std::string filename, bool output_hex, } // no verification // TODO: add support for decoding blob indexes in ldb as well - rocksdb::SstFileDumper dumper(options, filename, /* verify_checksum */ false, - output_hex, /* decode_blob_index */ false); + ROCKSDB_NAMESPACE::SstFileDumper dumper( + options, filename, /* verify_checksum */ false, output_hex, + /* decode_blob_index */ false); Status st = dumper.ReadSequential(true, std::numeric_limits::max(), false, // has_from from_key, false, // has_to @@ -3094,9 +3096,9 @@ void DumpSstFile(Options options, std::string filename, bool output_hex, } if (show_properties) { - const rocksdb::TableProperties* table_properties; + const ROCKSDB_NAMESPACE::TableProperties* table_properties; - std::shared_ptr + std::shared_ptr table_properties_from_reader; st = dumper.ReadTableProperties(&table_properties_from_reader); if (!st.ok()) { @@ -3166,7 +3168,7 @@ void DBFileDumperCommand::DoCommand() { std::cout << "Write Ahead Log Files" << std::endl; std::cout << "==============================" << std::endl; - rocksdb::VectorLogPtr wal_files; + ROCKSDB_NAMESPACE::VectorLogPtr wal_files; s = db_->GetSortedWalFiles(wal_files); if (!s.ok()) { std::cerr << "Error when getting WAL files" << std::endl; @@ -3431,5 +3433,5 @@ void ListFileRangeDeletesCommand::DoCommand() { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/tools/ldb_cmd_impl.h b/tools/ldb_cmd_impl.h index 1e004b76ca..8477cae6fb 100644 --- a/tools/ldb_cmd_impl.h +++ b/tools/ldb_cmd_impl.h @@ -12,7 +12,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CompactorCommand : public LDBCommand { public: @@ -625,4 +625,4 @@ class ListFileRangeDeletesCommand : public LDBCommand { int max_keys_ = 1000; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/tools/ldb_cmd_test.cc b/tools/ldb_cmd_test.cc index b0bfc06ca7..80e2f0d1f4 100644 --- a/tools/ldb_cmd_test.cc +++ b/tools/ldb_cmd_test.cc @@ -21,7 +21,7 @@ using std::string; using std::vector; using std::map; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class LdbCmdTest : public testing::Test { public: @@ -50,12 +50,12 @@ TEST_F(LdbCmdTest, HexToString) { }; for (const auto& inPair : inputMap) { - auto actual = rocksdb::LDBCommand::HexToString(inPair.first); + auto actual = ROCKSDB_NAMESPACE::LDBCommand::HexToString(inPair.first); auto expected = inPair.second; for (unsigned int i = 0; i < actual.length(); i++) { EXPECT_EQ(expected[i], static_cast((signed char) actual[i])); } - auto reverse = rocksdb::LDBCommand::StringToHex(actual); + auto reverse = ROCKSDB_NAMESPACE::LDBCommand::StringToHex(actual); EXPECT_STRCASEEQ(inPair.first.c_str(), reverse.c_str()); } } @@ -66,7 +66,7 @@ TEST_F(LdbCmdTest, HexToStringBadInputs) { }; for (const auto badInput : badInputs) { try { - rocksdb::LDBCommand::HexToString(badInput); + ROCKSDB_NAMESPACE::LDBCommand::HexToString(badInput); std::cerr << "Should fail on bad hex value: " << badInput << "\n"; FAIL(); } catch (...) { @@ -439,7 +439,7 @@ TEST_F(LdbCmdTest, OptionParsing) { args.push_back("scan"); args.push_back("--ttl"); args.push_back("--timestamp"); - LDBCommand* command = rocksdb::LDBCommand::InitFromCmdLineArgs( + LDBCommand* command = ROCKSDB_NAMESPACE::LDBCommand::InitFromCmdLineArgs( args, opts, LDBOptions(), nullptr); const std::vector flags = command->TEST_GetFlags(); EXPECT_EQ(flags.size(), 2); @@ -456,7 +456,7 @@ TEST_F(LdbCmdTest, OptionParsing) { "--from='abcd/efg/hijk/lmn/" "opq:__rst.uvw.xyz?a=3+4+bcd+efghi&jk=lm_no&pq=rst-0&uv=wx-8&yz=a&bcd_" "ef=gh.ijk'"); - LDBCommand* command = rocksdb::LDBCommand::InitFromCmdLineArgs( + LDBCommand* command = ROCKSDB_NAMESPACE::LDBCommand::InitFromCmdLineArgs( args, opts, LDBOptions(), nullptr); const std::map option_map = command->TEST_GetOptionMap(); @@ -501,7 +501,7 @@ TEST_F(LdbCmdTest, ListFileTombstone) { char arg3[] = "list_file_range_deletes"; char* argv[] = {arg1, arg2, arg3}; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "ListFileRangeDeletesCommand::DoCommand:BeforePrint", [&](void* arg) { std::string* out_str = reinterpret_cast(arg); @@ -516,13 +516,13 @@ TEST_F(LdbCmdTest, ListFileTombstone) { } EXPECT_EQ(2, num_tb); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_EQ( 0, LDBCommandRunner::RunCommand(3, argv, opts, LDBOptions(), nullptr)); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } // Test the case of limiting tombstones @@ -534,7 +534,7 @@ TEST_F(LdbCmdTest, ListFileTombstone) { char arg4[] = "--max_keys=1"; char* argv[] = {arg1, arg2, arg3, arg4}; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "ListFileRangeDeletesCommand::DoCommand:BeforePrint", [&](void* arg) { std::string* out_str = reinterpret_cast(arg); @@ -549,16 +549,16 @@ TEST_F(LdbCmdTest, ListFileTombstone) { } EXPECT_EQ(1, num_tb); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_EQ( 0, LDBCommandRunner::RunCommand(4, argv, opts, LDBOptions(), nullptr)); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS extern "C" { @@ -569,7 +569,7 @@ void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {} #endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/tools/ldb_tool.cc b/tools/ldb_tool.cc index 1bb3fe1bb4..8174b7e0c7 100644 --- a/tools/ldb_tool.cc +++ b/tools/ldb_tool.cc @@ -8,7 +8,7 @@ #include "rocksdb/utilities/ldb_cmd.h" #include "tools/ldb_cmd_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { LDBOptions::LDBOptions() {} @@ -135,6 +135,6 @@ void LDBTool::Run(int argc, char** argv, Options options, ldb_options, column_families); exit(error_code); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/tools/rdb/db_wrapper.cc b/tools/rdb/db_wrapper.cc index c65eba4071..632cf05a84 100644 --- a/tools/rdb/db_wrapper.cc +++ b/tools/rdb/db_wrapper.cc @@ -84,7 +84,7 @@ Handle DBWrapper::Open(const Arguments& args) { std::string db_file = *v8::String::Utf8Value(args[0]->ToString()); - std::vector cfs = { rocksdb::kDefaultColumnFamilyName }; + std::vector cfs = {ROCKSDB_NAMESPACE::kDefaultColumnFamilyName}; if (!args[1]->IsUndefined()) { Handle array = Handle::Cast(args[1]); @@ -98,21 +98,21 @@ Handle DBWrapper::Open(const Arguments& args) { } if (cfs.size() == 1) { - db_wrapper->status_ = rocksdb::DB::Open( + db_wrapper->status_ = ROCKSDB_NAMESPACE::DB::Open( db_wrapper->options_, db_file, &db_wrapper->db_); return scope.Close(Boolean::New(db_wrapper->status_.ok())); } - std::vector families; + std::vector families; for (std::vector::size_type i = 0; i < cfs.size(); i++) { - families.push_back(rocksdb::ColumnFamilyDescriptor( - cfs[i], rocksdb::ColumnFamilyOptions())); + families.push_back(ROCKSDB_NAMESPACE::ColumnFamilyDescriptor( + cfs[i], ROCKSDB_NAMESPACE::ColumnFamilyOptions())); } - std::vector handles; - db_wrapper->status_ = rocksdb::DB::Open( + std::vector handles; + db_wrapper->status_ = ROCKSDB_NAMESPACE::DB::Open( db_wrapper->options_, db_file, families, &handles, &db_wrapper->db_); if (!db_wrapper->status_.ok()) { @@ -158,11 +158,12 @@ Handle DBWrapper::Get(const Arguments& args) { std::string value; if (args[1]->IsUndefined()) { - db_wrapper->status_ = db_wrapper->db_->Get( - rocksdb::ReadOptions(), key, &value); + db_wrapper->status_ = + db_wrapper->db_->Get(ROCKSDB_NAMESPACE::ReadOptions(), key, &value); } else if (db_wrapper->HasFamilyNamed(cf, db_wrapper)) { - db_wrapper->status_ = db_wrapper->db_->Get( - rocksdb::ReadOptions(), db_wrapper->columnFamilies_[cf], key, &value); + db_wrapper->status_ = + db_wrapper->db_->Get(ROCKSDB_NAMESPACE::ReadOptions(), + db_wrapper->columnFamilies_[cf], key, &value); } else { return scope.Close(Null()); } @@ -187,16 +188,12 @@ Handle DBWrapper::Put(const Arguments& args) { std::string cf = *v8::String::Utf8Value(args[2]->ToString()); if (args[2]->IsUndefined()) { - db_wrapper->status_ = db_wrapper->db_->Put( - rocksdb::WriteOptions(), key, value - ); + db_wrapper->status_ = + db_wrapper->db_->Put(ROCKSDB_NAMESPACE::WriteOptions(), key, value); } else if (db_wrapper->HasFamilyNamed(cf, db_wrapper)) { - db_wrapper->status_ = db_wrapper->db_->Put( - rocksdb::WriteOptions(), - db_wrapper->columnFamilies_[cf], - key, - value - ); + db_wrapper->status_ = + db_wrapper->db_->Put(ROCKSDB_NAMESPACE::WriteOptions(), + db_wrapper->columnFamilies_[cf], key, value); } else { return scope.Close(Boolean::New(false)); } @@ -217,14 +214,15 @@ Handle DBWrapper::Delete(const Arguments& args) { std::string arg1 = *v8::String::Utf8Value(args[1]->ToString()); if (args[1]->IsUndefined()) { - db_wrapper->status_ = db_wrapper->db_->Delete( - rocksdb::WriteOptions(), arg0); + db_wrapper->status_ = + db_wrapper->db_->Delete(ROCKSDB_NAMESPACE::WriteOptions(), arg0); } else { if (!db_wrapper->HasFamilyNamed(arg1, db_wrapper)) { return scope.Close(Boolean::New(false)); } - db_wrapper->status_ = db_wrapper->db_->Delete( - rocksdb::WriteOptions(), db_wrapper->columnFamilies_[arg1], arg0); + db_wrapper->status_ = + db_wrapper->db_->Delete(ROCKSDB_NAMESPACE::WriteOptions(), + db_wrapper->columnFamilies_[arg1], arg0); } return scope.Close(Boolean::New(db_wrapper->status_.ok())); @@ -232,19 +230,20 @@ Handle DBWrapper::Delete(const Arguments& args) { Handle DBWrapper::Dump(const Arguments& args) { HandleScope scope; - std::unique_ptr iterator; + std::unique_ptr iterator; DBWrapper* db_wrapper = ObjectWrap::Unwrap(args.This()); std::string arg0 = *v8::String::Utf8Value(args[0]->ToString()); if (args[0]->IsUndefined()) { - iterator.reset(db_wrapper->db_->NewIterator(rocksdb::ReadOptions())); + iterator.reset( + db_wrapper->db_->NewIterator(ROCKSDB_NAMESPACE::ReadOptions())); } else { if (!db_wrapper->HasFamilyNamed(arg0, db_wrapper)) { return scope.Close(Boolean::New(false)); } iterator.reset(db_wrapper->db_->NewIterator( - rocksdb::ReadOptions(), db_wrapper->columnFamilies_[arg0])); + ROCKSDB_NAMESPACE::ReadOptions(), db_wrapper->columnFamilies_[arg0])); } iterator->SeekToFirst(); @@ -275,9 +274,9 @@ Handle DBWrapper::CreateColumnFamily(const Arguments& args) { return scope.Close(Boolean::New(false)); } - rocksdb::ColumnFamilyHandle* cf; + ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf; db_wrapper->status_ = db_wrapper->db_->CreateColumnFamily( - rocksdb::ColumnFamilyOptions(), cf_name, &cf); + ROCKSDB_NAMESPACE::ColumnFamilyOptions(), cf_name, &cf); if (!db_wrapper->status_.ok()) { return scope.Close(Boolean::New(false)); @@ -288,7 +287,7 @@ Handle DBWrapper::CreateColumnFamily(const Arguments& args) { return scope.Close(Boolean::New(true)); } -bool DBWrapper::AddToBatch(rocksdb::WriteBatch& batch, bool del, +bool DBWrapper::AddToBatch(ROCKSDB_NAMESPACE::WriteBatch& batch, bool del, Handle array) { Handle put_pair; for (uint i = 0; i < array->Length(); i++) { @@ -319,7 +318,7 @@ bool DBWrapper::AddToBatch(rocksdb::WriteBatch& batch, bool del, return true; } -bool DBWrapper::AddToBatch(rocksdb::WriteBatch& batch, bool del, +bool DBWrapper::AddToBatch(ROCKSDB_NAMESPACE::WriteBatch& batch, bool del, Handle array, DBWrapper* db_wrapper, std::string cf) { Handle put_pair; @@ -364,7 +363,7 @@ Handle DBWrapper::WriteBatch(const Arguments& args) { DBWrapper* db_wrapper = ObjectWrap::Unwrap(args.This()); Handle sub_batches = Handle::Cast(args[0]); Local sub_batch; - rocksdb::WriteBatch batch; + ROCKSDB_NAMESPACE::WriteBatch batch; bool well_formed; for (uint i = 0; i < sub_batches->Length(); i++) { @@ -404,7 +403,8 @@ Handle DBWrapper::WriteBatch(const Arguments& args) { } } - db_wrapper->status_ = db_wrapper->db_->Write(rocksdb::WriteOptions(), &batch); + db_wrapper->status_ = + db_wrapper->db_->Write(ROCKSDB_NAMESPACE::WriteOptions(), &batch); return scope.Close(Boolean::New(db_wrapper->status_.ok())); } @@ -413,8 +413,8 @@ Handle DBWrapper::CompactRangeDefault(const Arguments& args) { HandleScope scope; DBWrapper* db_wrapper = ObjectWrap::Unwrap(args.This()); - rocksdb::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); - rocksdb::Slice end = *v8::String::Utf8Value(args[1]->ToString()); + ROCKSDB_NAMESPACE::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); + ROCKSDB_NAMESPACE::Slice end = *v8::String::Utf8Value(args[1]->ToString()); db_wrapper->status_ = db_wrapper->db_->CompactRange(&end, &begin); return scope.Close(Boolean::New(db_wrapper->status_.ok())); @@ -424,8 +424,8 @@ Handle DBWrapper::CompactColumnFamily(const Arguments& args) { HandleScope scope; DBWrapper* db_wrapper = ObjectWrap::Unwrap(args.This()); - rocksdb::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); - rocksdb::Slice end = *v8::String::Utf8Value(args[1]->ToString()); + ROCKSDB_NAMESPACE::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); + ROCKSDB_NAMESPACE::Slice end = *v8::String::Utf8Value(args[1]->ToString()); std::string cf = *v8::String::Utf8Value(args[2]->ToString()); db_wrapper->status_ = db_wrapper->db_->CompactRange( db_wrapper->columnFamilies_[cf], &begin, &end); @@ -441,8 +441,8 @@ Handle DBWrapper::CompactOptions(const Arguments& args) { } DBWrapper* db_wrapper = ObjectWrap::Unwrap(args.This()); - rocksdb::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); - rocksdb::Slice end = *v8::String::Utf8Value(args[1]->ToString()); + ROCKSDB_NAMESPACE::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); + ROCKSDB_NAMESPACE::Slice end = *v8::String::Utf8Value(args[1]->ToString()); Local options = args[2]->ToObject(); int target_level = -1, target_path_id = 0; @@ -473,8 +473,8 @@ Handle DBWrapper::CompactAll(const Arguments& args) { } DBWrapper* db_wrapper = ObjectWrap::Unwrap(args.This()); - rocksdb::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); - rocksdb::Slice end = *v8::String::Utf8Value(args[1]->ToString()); + ROCKSDB_NAMESPACE::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); + ROCKSDB_NAMESPACE::Slice end = *v8::String::Utf8Value(args[1]->ToString()); Local options = args[2]->ToObject(); std::string cf = *v8::String::Utf8Value(args[3]->ToString()); diff --git a/tools/rdb/db_wrapper.h b/tools/rdb/db_wrapper.h index da93e5b7c9..4b57320cd2 100644 --- a/tools/rdb/db_wrapper.h +++ b/tools/rdb/db_wrapper.h @@ -26,10 +26,11 @@ class DBWrapper : public node::ObjectWrap { // Helper methods static bool HasFamilyNamed(std::string& name, DBWrapper* db); - static bool AddToBatch(rocksdb::WriteBatch& batch, bool del, - Handle array); - static bool AddToBatch(rocksdb::WriteBatch& batch, bool del, - Handle array, DBWrapper* db_wrapper, std::string cf); + static bool AddToBatch(ROCKSDB_NAMESPACE::WriteBatch& batch, bool del, + Handle array); + static bool AddToBatch(ROCKSDB_NAMESPACE::WriteBatch& batch, bool del, + Handle array, DBWrapper* db_wrapper, + std::string cf); static Handle CompactRangeDefault(const v8::Arguments& args); static Handle CompactColumnFamily(const Arguments& args); static Handle CompactOptions(const Arguments& args); @@ -49,10 +50,10 @@ class DBWrapper : public node::ObjectWrap { static Handle Close(const Arguments& args); // Internal fields - rocksdb::Options options_; - rocksdb::Status status_; - rocksdb::DB* db_; - std::unordered_map + ROCKSDB_NAMESPACE::Options options_; + ROCKSDB_NAMESPACE::Status status_; + ROCKSDB_NAMESPACE::DB* db_; + std::unordered_map columnFamilies_; }; diff --git a/tools/reduce_levels_test.cc b/tools/reduce_levels_test.cc index 8b23dbf369..1b1044f958 100644 --- a/tools/reduce_levels_test.cc +++ b/tools/reduce_levels_test.cc @@ -15,7 +15,7 @@ #include "tools/ldb_cmd_impl.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ReduceLevelTest : public testing::Test { public: @@ -80,10 +80,11 @@ private: }; Status ReduceLevelTest::OpenDB(bool create_if_missing, int num_levels) { - rocksdb::Options opt; + ROCKSDB_NAMESPACE::Options opt; opt.num_levels = num_levels; opt.create_if_missing = create_if_missing; - rocksdb::Status st = rocksdb::DB::Open(opt, dbname_, &db_); + ROCKSDB_NAMESPACE::Status st = + ROCKSDB_NAMESPACE::DB::Open(opt, dbname_, &db_); if (!st.ok()) { fprintf(stderr, "Can't open the db:%s\n", st.ToString().c_str()); } @@ -91,8 +92,9 @@ Status ReduceLevelTest::OpenDB(bool create_if_missing, int num_levels) { } bool ReduceLevelTest::ReduceLevels(int target_level) { - std::vector args = rocksdb::ReduceDBLevelsCommand::PrepareArgs( - dbname_, target_level, false); + std::vector args = + ROCKSDB_NAMESPACE::ReduceDBLevelsCommand::PrepareArgs( + dbname_, target_level, false); LDBCommand* level_reducer = LDBCommand::InitFromCmdLineArgs( args, Options(), LDBOptions(), nullptr, LDBCommand::SelectCommand); level_reducer->Run(); @@ -200,7 +202,7 @@ TEST_F(ReduceLevelTest, All_Levels) { CloseDB(); } -} +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/tools/sst_dump.cc b/tools/sst_dump.cc index 4e10a8c063..1a0258c6d5 100644 --- a/tools/sst_dump.cc +++ b/tools/sst_dump.cc @@ -8,7 +8,7 @@ #include "rocksdb/sst_dump_tool.h" int main(int argc, char** argv) { - rocksdb::SSTDumpTool tool; + ROCKSDB_NAMESPACE::SSTDumpTool tool; tool.Run(argc, argv); return 0; } diff --git a/tools/sst_dump_test.cc b/tools/sst_dump_test.cc index 57bf3ac8b9..b8c475c3ba 100644 --- a/tools/sst_dump_test.cc +++ b/tools/sst_dump_test.cc @@ -20,7 +20,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const uint32_t optLength = 100; @@ -45,7 +45,7 @@ void createSST(const Options& opts, const std::string& file_name) { ReadOptions read_options; const ImmutableCFOptions imoptions(opts); const MutableCFOptions moptions(opts); - rocksdb::InternalKeyComparator ikc(opts.comparator); + ROCKSDB_NAMESPACE::InternalKeyComparator ikc(opts.comparator); std::unique_ptr tb; std::unique_ptr file; @@ -138,7 +138,7 @@ TEST_F(SSTDumpToolTest, EmptyFilter) { char* usage[3]; PopulateCommandArgs(file_path, "--command=raw", usage); - rocksdb::SSTDumpTool tool; + ROCKSDB_NAMESPACE::SSTDumpTool tool; ASSERT_TRUE(!tool.Run(3, usage, opts)); cleanup(opts, file_path); @@ -151,7 +151,8 @@ TEST_F(SSTDumpToolTest, FilterBlock) { Options opts; opts.env = env(); BlockBasedTableOptions table_opts; - table_opts.filter_policy.reset(rocksdb::NewBloomFilterPolicy(10, true)); + table_opts.filter_policy.reset( + ROCKSDB_NAMESPACE::NewBloomFilterPolicy(10, true)); opts.table_factory.reset(new BlockBasedTableFactory(table_opts)); std::string file_path = MakeFilePath("rocksdb_sst_test.sst"); createSST(opts, file_path); @@ -159,7 +160,7 @@ TEST_F(SSTDumpToolTest, FilterBlock) { char* usage[3]; PopulateCommandArgs(file_path, "--command=raw", usage); - rocksdb::SSTDumpTool tool; + ROCKSDB_NAMESPACE::SSTDumpTool tool; ASSERT_TRUE(!tool.Run(3, usage, opts)); cleanup(opts, file_path); @@ -172,7 +173,8 @@ TEST_F(SSTDumpToolTest, FullFilterBlock) { Options opts; opts.env = env(); BlockBasedTableOptions table_opts; - table_opts.filter_policy.reset(rocksdb::NewBloomFilterPolicy(10, false)); + table_opts.filter_policy.reset( + ROCKSDB_NAMESPACE::NewBloomFilterPolicy(10, false)); opts.table_factory.reset(new BlockBasedTableFactory(table_opts)); std::string file_path = MakeFilePath("rocksdb_sst_test.sst"); createSST(opts, file_path); @@ -180,7 +182,7 @@ TEST_F(SSTDumpToolTest, FullFilterBlock) { char* usage[3]; PopulateCommandArgs(file_path, "--command=raw", usage); - rocksdb::SSTDumpTool tool; + ROCKSDB_NAMESPACE::SSTDumpTool tool; ASSERT_TRUE(!tool.Run(3, usage, opts)); cleanup(opts, file_path); @@ -193,7 +195,8 @@ TEST_F(SSTDumpToolTest, GetProperties) { Options opts; opts.env = env(); BlockBasedTableOptions table_opts; - table_opts.filter_policy.reset(rocksdb::NewBloomFilterPolicy(10, false)); + table_opts.filter_policy.reset( + ROCKSDB_NAMESPACE::NewBloomFilterPolicy(10, false)); opts.table_factory.reset(new BlockBasedTableFactory(table_opts)); std::string file_path = MakeFilePath("rocksdb_sst_test.sst"); createSST(opts, file_path); @@ -201,7 +204,7 @@ TEST_F(SSTDumpToolTest, GetProperties) { char* usage[3]; PopulateCommandArgs(file_path, "--show_properties", usage); - rocksdb::SSTDumpTool tool; + ROCKSDB_NAMESPACE::SSTDumpTool tool; ASSERT_TRUE(!tool.Run(3, usage, opts)); cleanup(opts, file_path); @@ -214,7 +217,8 @@ TEST_F(SSTDumpToolTest, CompressedSizes) { Options opts; opts.env = env(); BlockBasedTableOptions table_opts; - table_opts.filter_policy.reset(rocksdb::NewBloomFilterPolicy(10, false)); + table_opts.filter_policy.reset( + ROCKSDB_NAMESPACE::NewBloomFilterPolicy(10, false)); opts.table_factory.reset(new BlockBasedTableFactory(table_opts)); std::string file_path = MakeFilePath("rocksdb_sst_test.sst"); createSST(opts, file_path); @@ -222,7 +226,7 @@ TEST_F(SSTDumpToolTest, CompressedSizes) { char* usage[3]; PopulateCommandArgs(file_path, "--command=recompress", usage); - rocksdb::SSTDumpTool tool; + ROCKSDB_NAMESPACE::SSTDumpTool tool; ASSERT_TRUE(!tool.Run(3, usage, opts)); cleanup(opts, file_path); @@ -241,7 +245,7 @@ TEST_F(SSTDumpToolTest, MemEnv) { char* usage[3]; PopulateCommandArgs(file_path, "--command=verify_checksum", usage); - rocksdb::SSTDumpTool tool; + ROCKSDB_NAMESPACE::SSTDumpTool tool; ASSERT_TRUE(!tool.Run(3, usage, opts)); cleanup(opts, file_path); @@ -250,7 +254,7 @@ TEST_F(SSTDumpToolTest, MemEnv) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS extern "C" { @@ -261,7 +265,7 @@ void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {} #endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/tools/sst_dump_tool.cc b/tools/sst_dump_tool.cc index 7c864ea5d4..be4dc961da 100644 --- a/tools/sst_dump_tool.cc +++ b/tools/sst_dump_tool.cc @@ -40,7 +40,7 @@ #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { SstFileDumper::SstFileDumper(const Options& options, const std::string& file_path, bool verify_checksum, @@ -208,12 +208,12 @@ int SstFileDumper::ShowAllCompressionSizes( compression_types) { ReadOptions read_options; Options opts; - opts.statistics = rocksdb::CreateDBStatistics(); + opts.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); opts.statistics->set_stats_level(StatsLevel::kAll); const ImmutableCFOptions imoptions(opts); const ColumnFamilyOptions cfo(opts); const MutableCFOptions moptions(cfo); - rocksdb::InternalKeyComparator ikc(opts.comparator); + ROCKSDB_NAMESPACE::InternalKeyComparator ikc(opts.comparator); std::vector > block_based_table_factories; @@ -278,8 +278,8 @@ Status SstFileDumper::ReadTableProperties(uint64_t table_magic_number, RandomAccessFileReader* file, uint64_t file_size) { TableProperties* table_properties = nullptr; - Status s = rocksdb::ReadTableProperties(file, file_size, table_magic_number, - ioptions_, &table_properties); + Status s = ROCKSDB_NAMESPACE::ReadTableProperties( + file, file_size, table_magic_number, ioptions_, &table_properties); if (s.ok()) { table_properties_.reset(table_properties); } else { @@ -575,14 +575,14 @@ int SSTDumpTool::Run(int argc, char** argv, Options options) { } else if (strncmp(argv[i], "--parse_internal_key=", 21) == 0) { std::string in_key(argv[i] + 21); try { - in_key = rocksdb::LDBCommand::HexToString(in_key); + in_key = ROCKSDB_NAMESPACE::LDBCommand::HexToString(in_key); } catch (...) { std::cerr << "ERROR: Invalid key input '" << in_key << "' Use 0x{hex representation of internal rocksdb key}" << std::endl; return -1; } - Slice sl_key = rocksdb::Slice(in_key); + Slice sl_key = ROCKSDB_NAMESPACE::Slice(in_key); ParsedInternalKey ikey; int retc = 0; if (!ParseInternalKey(sl_key, &ikey)) { @@ -606,10 +606,10 @@ int SSTDumpTool::Run(int argc, char** argv, Options options) { if (input_key_hex) { if (has_from || use_from_as_prefix) { - from_key = rocksdb::LDBCommand::HexToString(from_key); + from_key = ROCKSDB_NAMESPACE::LDBCommand::HexToString(from_key); } if (has_to) { - to_key = rocksdb::LDBCommand::HexToString(to_key); + to_key = ROCKSDB_NAMESPACE::LDBCommand::HexToString(to_key); } } @@ -619,12 +619,12 @@ int SSTDumpTool::Run(int argc, char** argv, Options options) { exit(1); } - std::shared_ptr env_guard; + std::shared_ptr env_guard; // If caller of SSTDumpTool::Run(...) does not specify a different env other // than Env::Default(), then try to load custom env based on dir_or_file. // Otherwise, the caller is responsible for creating custom env. - if (!options.env || options.env == rocksdb::Env::Default()) { + if (!options.env || options.env == ROCKSDB_NAMESPACE::Env::Default()) { Env* env = Env::Default(); Status s = Env::LoadEnv(env_uri ? env_uri : "", &env, &env_guard); if (!s.ok() && !s.IsNotFound()) { @@ -637,8 +637,8 @@ int SSTDumpTool::Run(int argc, char** argv, Options options) { } std::vector filenames; - rocksdb::Env* env = options.env; - rocksdb::Status st = env->GetChildren(dir_or_file, &filenames); + ROCKSDB_NAMESPACE::Env* env = options.env; + ROCKSDB_NAMESPACE::Status st = env->GetChildren(dir_or_file, &filenames); bool dir = true; if (!st.ok()) { filenames.clear(); @@ -647,8 +647,8 @@ int SSTDumpTool::Run(int argc, char** argv, Options options) { } fprintf(stdout, "from [%s] to [%s]\n", - rocksdb::Slice(from_key).ToString(true).c_str(), - rocksdb::Slice(to_key).ToString(true).c_str()); + ROCKSDB_NAMESPACE::Slice(from_key).ToString(true).c_str(), + ROCKSDB_NAMESPACE::Slice(to_key).ToString(true).c_str()); uint64_t total_read = 0; for (size_t i = 0; i < filenames.size(); i++) { @@ -662,8 +662,8 @@ int SSTDumpTool::Run(int argc, char** argv, Options options) { filename = std::string(dir_or_file) + "/" + filename; } - rocksdb::SstFileDumper dumper(options, filename, verify_checksum, - output_hex, decode_blob_index); + ROCKSDB_NAMESPACE::SstFileDumper dumper(options, filename, verify_checksum, + output_hex, decode_blob_index); if (!dumper.getStatus().ok()) { fprintf(stderr, "%s: %s\n", filename.c_str(), dumper.getStatus().ToString().c_str()); @@ -719,9 +719,9 @@ int SSTDumpTool::Run(int argc, char** argv, Options options) { } if (show_properties || show_summary) { - const rocksdb::TableProperties* table_properties; + const ROCKSDB_NAMESPACE::TableProperties* table_properties; - std::shared_ptr + std::shared_ptr table_properties_from_reader; st = dumper.ReadTableProperties(&table_properties_from_reader); if (!st.ok()) { @@ -773,6 +773,6 @@ int SSTDumpTool::Run(int argc, char** argv, Options options) { } return 0; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/tools/sst_dump_tool_imp.h b/tools/sst_dump_tool_imp.h index 5226502edf..28c217ef2f 100644 --- a/tools/sst_dump_tool_imp.h +++ b/tools/sst_dump_tool_imp.h @@ -13,7 +13,7 @@ #include "file/writable_file_writer.h" #include "options/cf_options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SstFileDumper { public: @@ -82,6 +82,6 @@ class SstFileDumper { std::unique_ptr table_properties_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/tools/trace_analyzer.cc b/tools/trace_analyzer.cc index 2aa84fd340..958078d1c1 100644 --- a/tools/trace_analyzer.cc +++ b/tools/trace_analyzer.cc @@ -13,7 +13,7 @@ int main() { #else #include "tools/trace_analyzer_tool.h" int main(int argc, char** argv) { - return rocksdb::trace_analyzer_tool(argc, argv); + return ROCKSDB_NAMESPACE::trace_analyzer_tool(argc, argv); } #endif #else diff --git a/tools/trace_analyzer_test.cc b/tools/trace_analyzer_test.cc index e453a4e9da..d98ea2e800 100644 --- a/tools/trace_analyzer_test.cc +++ b/tools/trace_analyzer_test.cc @@ -33,7 +33,7 @@ int main() { #include "tools/trace_analyzer_tool.h" #include "trace_replay/trace_replay.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { static const int kMaxArgCount = 100; @@ -46,7 +46,7 @@ class TraceAnalyzerTest : public testing::Test { TraceAnalyzerTest() : rnd_(0xFB) { // test_path_ = test::TmpDir() + "trace_analyzer_test"; test_path_ = test::PerThreadDBPath("trace_analyzer_test"); - env_ = rocksdb::Env::Default(); + env_ = ROCKSDB_NAMESPACE::Env::Default(); env_->CreateDir(test_path_); dbname_ = test_path_ + "/db"; } @@ -115,7 +115,7 @@ class TraceAnalyzerTest : public testing::Test { cursor += static_cast(arg.size()) + 1; } - ASSERT_EQ(0, rocksdb::trace_analyzer_tool(argc, argv)); + ASSERT_EQ(0, ROCKSDB_NAMESPACE::trace_analyzer_tool(argc, argv)); } void CheckFileContent(const std::vector& cnt, @@ -177,7 +177,7 @@ class TraceAnalyzerTest : public testing::Test { RunTraceAnalyzer(paras); } - rocksdb::Env* env_; + ROCKSDB_NAMESPACE::Env* env_; EnvOptions env_options_; std::string test_path_; std::string dbname_; @@ -709,7 +709,7 @@ TEST_F(TraceAnalyzerTest, Iterator) { CheckFileContent(top_qps, file_path, true); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/tools/trace_analyzer_tool.cc b/tools/trace_analyzer_tool.cc index 915f2727dc..e75845c29c 100644 --- a/tools/trace_analyzer_tool.cc +++ b/tools/trace_analyzer_tool.cc @@ -165,7 +165,7 @@ DEFINE_double(sample_ratio, 1.0, "If the trace size is extremely huge or user want to sample " "the trace when analyzing, sample ratio can be set (0, 1.0]"); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::map taOptToIndex = { {"get", 0}, {"put", 1}, @@ -274,8 +274,8 @@ TraceAnalyzer::TraceAnalyzer(std::string& trace_path, std::string& output_path, : trace_name_(trace_path), output_path_(output_path), analyzer_opts_(_analyzer_opts) { - rocksdb::EnvOptions env_options; - env_ = rocksdb::Env::Default(); + ROCKSDB_NAMESPACE::EnvOptions env_options; + env_ = ROCKSDB_NAMESPACE::Env::Default(); offset_ = 0; c_time_ = 0; total_requests_ = 0; @@ -695,7 +695,8 @@ Status TraceAnalyzer::MakeStatisticKeyStatsOrPrefix(TraceStats& stats) { // write the prefix cut of the accessed keys if (FLAGS_output_prefix_cut > 0 && stats.a_prefix_cut_f) { if (record.first.compare(0, FLAGS_output_prefix_cut, prefix) != 0) { - std::string prefix_out = rocksdb::LDBCommand::StringToHex(prefix); + std::string prefix_out = + ROCKSDB_NAMESPACE::LDBCommand::StringToHex(prefix); if (prefix_count == 0) { prefix_ave_access = 0.0; } else { @@ -912,7 +913,7 @@ Status TraceAnalyzer::MakeStatisticQPS() { stat.second.a_qps_prefix_stats.end()) { for (auto& qps_prefix : stat.second.a_qps_prefix_stats[qps_time]) { std::string qps_prefix_out = - rocksdb::LDBCommand::StringToHex(qps_prefix.first); + ROCKSDB_NAMESPACE::LDBCommand::StringToHex(qps_prefix.first); ret = snprintf(buffer_, sizeof(buffer_), "The prefix: %s Access count: %u\n", qps_prefix_out.c_str(), qps_prefix.second); @@ -1074,7 +1075,7 @@ Status TraceAnalyzer::ReProcessing() { return s; } - input_key = rocksdb::LDBCommand::HexToString(get_key); + input_key = ROCKSDB_NAMESPACE::LDBCommand::HexToString(get_key); for (int type = 0; type < kTaTypeNum; type++) { if (!ta_[type].enabled) { continue; @@ -1103,7 +1104,7 @@ Status TraceAnalyzer::ReProcessing() { 0) { prefix[type] = input_key.substr(0, FLAGS_output_prefix_cut); std::string prefix_out = - rocksdb::LDBCommand::StringToHex(prefix[type]); + ROCKSDB_NAMESPACE::LDBCommand::StringToHex(prefix[type]); ret = snprintf(buffer_, sizeof(buffer_), "%" PRIu64 " %s\n", cfs_[cf_id].w_count, prefix_out.c_str()); if (ret < 0) { @@ -1434,7 +1435,8 @@ Status TraceAnalyzer::OpenStatsOutputFiles(const std::string& type, // create the output path of the files to be opened Status TraceAnalyzer::CreateOutputFile( const std::string& type, const std::string& cf_name, - const std::string& ending, std::unique_ptr* f_ptr) { + const std::string& ending, + std::unique_ptr* f_ptr) { std::string path; path = output_path_ + "/" + FLAGS_output_prefix + "-" + type + "-" + cf_name + "-" + ending; @@ -1820,8 +1822,8 @@ void TraceAnalyzer::PrintStatistics() { printf("The Top %d keys that are accessed:\n", FLAGS_print_top_k_access); while (!stat.top_k_queue.empty()) { - std::string hex_key = - rocksdb::LDBCommand::StringToHex(stat.top_k_queue.top().second); + std::string hex_key = ROCKSDB_NAMESPACE::LDBCommand::StringToHex( + stat.top_k_queue.top().second); printf("Access_count: %" PRIu64 " %s\n", stat.top_k_queue.top().first, hex_key.c_str()); stat.top_k_queue.pop(); @@ -1919,7 +1921,7 @@ Status TraceAnalyzer::WriteTraceSequence(const uint32_t& type, const std::string& key, const size_t value_size, const uint64_t ts) { - std::string hex_key = rocksdb::LDBCommand::StringToHex(key); + std::string hex_key = ROCKSDB_NAMESPACE::LDBCommand::StringToHex(key); int ret; ret = snprintf(buffer_, sizeof(buffer_), "%u %u %zu %" PRIu64 "\n", type, cf_id, value_size, ts); @@ -1954,7 +1956,7 @@ int trace_analyzer_tool(int argc, char** argv) { exit(1); } - rocksdb::Status s = analyzer->PrepareProcessing(); + ROCKSDB_NAMESPACE::Status s = analyzer->PrepareProcessing(); if (!s.ok()) { fprintf(stderr, "%s\n", s.getState()); fprintf(stderr, "Cannot initiate the trace reader\n"); @@ -1993,7 +1995,7 @@ int trace_analyzer_tool(int argc, char** argv) { return 0; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // Endif of Gflag #endif // RocksDB LITE diff --git a/tools/trace_analyzer_tool.h b/tools/trace_analyzer_tool.h index 0082b2bbaf..d2df2c824e 100644 --- a/tools/trace_analyzer_tool.h +++ b/tools/trace_analyzer_tool.h @@ -18,7 +18,7 @@ #include "rocksdb/write_batch.h" #include "trace_replay/trace_replay.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBImpl; class WriteBatch; @@ -117,17 +117,17 @@ struct TraceStats { std::vector> correlation_output; std::map uni_key_num; - std::unique_ptr time_series_f; - std::unique_ptr a_key_f; - std::unique_ptr a_count_dist_f; - std::unique_ptr a_prefix_cut_f; - std::unique_ptr a_value_size_f; - std::unique_ptr a_key_size_f; - std::unique_ptr a_key_num_f; - std::unique_ptr a_qps_f; - std::unique_ptr a_top_qps_prefix_f; - std::unique_ptr w_key_f; - std::unique_ptr w_prefix_cut_f; + std::unique_ptr time_series_f; + std::unique_ptr a_key_f; + std::unique_ptr a_count_dist_f; + std::unique_ptr a_prefix_cut_f; + std::unique_ptr a_value_size_f; + std::unique_ptr a_key_size_f; + std::unique_ptr a_key_num_f; + std::unique_ptr a_qps_f; + std::unique_ptr a_top_qps_prefix_f; + std::unique_ptr w_key_f; + std::unique_ptr w_prefix_cut_f; TraceStats(); ~TraceStats(); @@ -196,7 +196,7 @@ class TraceAnalyzer { std::vector& GetTaVector() { return ta_; } private: - rocksdb::Env* env_; + ROCKSDB_NAMESPACE::Env* env_; EnvOptions env_options_; std::unique_ptr trace_reader_; size_t offset_; @@ -215,9 +215,11 @@ class TraceAnalyzer { uint64_t time_series_start_; uint32_t sample_max_; uint32_t cur_time_sec_; - std::unique_ptr trace_sequence_f_; // readable trace - std::unique_ptr qps_f_; // overall qps - std::unique_ptr cf_qps_f_; // The qps of each CF> + std::unique_ptr + trace_sequence_f_; // readable trace + std::unique_ptr qps_f_; // overall qps + std::unique_ptr + cf_qps_f_; // The qps of each CF> std::vector ta_; // The main statistic collecting data structure std::map cfs_; // All the cf_id appears in this trace; std::vector qps_peak_; @@ -232,14 +234,15 @@ class TraceAnalyzer { Status StatsUnitCorrelationUpdate(StatsUnit& unit, const uint32_t& type, const uint64_t& ts, const std::string& key); Status OpenStatsOutputFiles(const std::string& type, TraceStats& new_stats); - Status CreateOutputFile(const std::string& type, const std::string& cf_name, - const std::string& ending, - std::unique_ptr* f_ptr); + Status CreateOutputFile( + const std::string& type, const std::string& cf_name, + const std::string& ending, + std::unique_ptr* f_ptr); void CloseOutputFiles(); void PrintStatistics(); - Status TraceUnitWriter(std::unique_ptr& f_ptr, - TraceUnit& unit); + Status TraceUnitWriter( + std::unique_ptr& f_ptr, TraceUnit& unit); Status WriteTraceSequence(const uint32_t& type, const uint32_t& cf_id, const std::string& key, const size_t value_size, const uint64_t ts); @@ -284,6 +287,6 @@ class TraceWriteHandler : public WriteBatch::Handler { int trace_analyzer_tool(int argc, char** argv); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/tools/write_stress.cc b/tools/write_stress.cc index 7e7a1a7654..15b1da881c 100644 --- a/tools/write_stress.cc +++ b/tools/write_stress.cc @@ -104,7 +104,7 @@ DEFINE_bool(low_open_files_mode, false, "If true, we set max_open_files to 20, so that every file access " "needs to reopen it"); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const int kPrefixSize = 3; @@ -292,13 +292,13 @@ class WriteStress { std::unique_ptr db_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { SetUsageMessage(std::string("\nUSAGE:\n") + std::string(argv[0]) + " [OPTIONS]..."); ParseCommandLineFlags(&argc, &argv, true); - rocksdb::WriteStress write_stress; + ROCKSDB_NAMESPACE::WriteStress write_stress; return write_stress.Run(); } diff --git a/trace_replay/block_cache_tracer.cc b/trace_replay/block_cache_tracer.cc index 0cf394afa3..9a96f1baca 100644 --- a/trace_replay/block_cache_tracer.cc +++ b/trace_replay/block_cache_tracer.cc @@ -16,7 +16,7 @@ #include "util/hash.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { const unsigned int kCharSize = 1; @@ -312,7 +312,8 @@ BlockCacheHumanReadableTraceWriter::~BlockCacheHumanReadableTraceWriter() { } Status BlockCacheHumanReadableTraceWriter::NewWritableFile( - const std::string& human_readable_trace_file_path, rocksdb::Env* env) { + const std::string& human_readable_trace_file_path, + ROCKSDB_NAMESPACE::Env* env) { if (human_readable_trace_file_path.empty()) { return Status::InvalidArgument( "The provided human_readable_trace_file_path is null."); @@ -493,4 +494,4 @@ uint64_t BlockCacheTracer::NextGetId() { return prev_value; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/trace_replay/block_cache_tracer.h b/trace_replay/block_cache_tracer.h index 7c03e611df..5849273dcc 100644 --- a/trace_replay/block_cache_tracer.h +++ b/trace_replay/block_cache_tracer.h @@ -15,7 +15,7 @@ #include "table/table_reader_caller.h" #include "trace_replay/trace_replay.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { extern const uint64_t kMicrosInSecond; extern const uint64_t kSecondInMinute; @@ -204,14 +204,15 @@ class BlockCacheHumanReadableTraceWriter { ~BlockCacheHumanReadableTraceWriter(); Status NewWritableFile(const std::string& human_readable_trace_file_path, - rocksdb::Env* env); + ROCKSDB_NAMESPACE::Env* env); Status WriteHumanReadableTraceRecord(const BlockCacheTraceRecord& access, uint64_t block_id, uint64_t get_key_id); private: char trace_record_buffer_[1024 * 1024]; - std::unique_ptr human_readable_trace_file_writer_; + std::unique_ptr + human_readable_trace_file_writer_; }; // BlockCacheTraceReader helps read the trace file generated by @@ -290,4 +291,4 @@ class BlockCacheTracer { std::atomic get_id_counter_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/trace_replay/block_cache_tracer_test.cc b/trace_replay/block_cache_tracer_test.cc index cc245c30ed..b29600890d 100644 --- a/trace_replay/block_cache_tracer_test.cc +++ b/trace_replay/block_cache_tracer_test.cc @@ -10,7 +10,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { const uint64_t kBlockSize = 1024; @@ -27,7 +27,7 @@ class BlockCacheTracerTest : public testing::Test { public: BlockCacheTracerTest() { test_path_ = test::PerThreadDBPath("block_cache_tracer_test"); - env_ = rocksdb::Env::Default(); + env_ = ROCKSDB_NAMESPACE::Env::Default(); EXPECT_OK(env_->CreateDir(test_path_)); trace_file_path_ = test_path_ + "/block_cache_trace"; } @@ -370,7 +370,7 @@ TEST_F(BlockCacheTracerTest, HumanReadableTrace) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/trace_replay/trace_replay.cc b/trace_replay/trace_replay.cc index 41d98829b3..a0f9a504f0 100644 --- a/trace_replay/trace_replay.cc +++ b/trace_replay/trace_replay.cc @@ -15,7 +15,7 @@ #include "util/string_util.h" #include "util/threadpool_imp.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const std::string kTraceMagic = "feedcafedeadbeef"; @@ -482,4 +482,4 @@ void Replayer::BGWorkIterSeekForPrev(void* arg) { return; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/trace_replay/trace_replay.h b/trace_replay/trace_replay.h index 776a1e0ca1..e7ef598f02 100644 --- a/trace_replay/trace_replay.h +++ b/trace_replay/trace_replay.h @@ -13,7 +13,7 @@ #include "rocksdb/options.h" #include "rocksdb/trace_reader_writer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This file contains Tracer and Replayer classes that enable capturing and // replaying RocksDB traces. @@ -186,4 +186,4 @@ struct ReplayerWorkerArg { ReadOptions roptions; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/aligned_buffer.h b/util/aligned_buffer.h index dbff9c8109..c7b0728c9f 100644 --- a/util/aligned_buffer.h +++ b/util/aligned_buffer.h @@ -11,7 +11,7 @@ #include #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This file contains utilities to handle the alignment of pages and buffers. @@ -245,4 +245,4 @@ public: cursize_ = cursize; } }; -} +} // namespace ROCKSDB_NAMESPACE diff --git a/util/autovector.h b/util/autovector.h index 010d868958..1e6c4716be 100644 --- a/util/autovector.h +++ b/util/autovector.h @@ -11,7 +11,9 @@ #include #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_LITE template @@ -356,4 +358,4 @@ autovector& autovector::assign(const autovector& other) { return *this; } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/autovector_test.cc b/util/autovector_test.cc index 6b1b36e8d1..adddd1b028 100644 --- a/util/autovector_test.cc +++ b/util/autovector_test.cc @@ -17,7 +17,7 @@ using std::cout; using std::endl; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class AutoVectorTest : public testing::Test {}; const unsigned long kSize = 8; @@ -208,7 +208,7 @@ std::vector GetTestKeys(size_t size) { int index = 0; for (auto& key : keys) { - key = "item-" + rocksdb::ToString(index++); + key = "item-" + ROCKSDB_NAMESPACE::ToString(index++); } return keys; } @@ -322,7 +322,7 @@ TEST_F(AutoVectorTest, PerfBench) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/bloom_impl.h b/util/bloom_impl.h index 2a9fbaef2b..54c0484855 100644 --- a/util/bloom_impl.h +++ b/util/bloom_impl.h @@ -19,7 +19,7 @@ #include #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class BloomMath { public: @@ -480,4 +480,4 @@ class LegacyLocalityBloomImpl { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/bloom_test.cc b/util/bloom_test.cc index 6f4d486460..c88d7ee322 100644 --- a/util/bloom_test.cc +++ b/util/bloom_test.cc @@ -32,7 +32,7 @@ using GFLAGS_NAMESPACE::ParseCommandLineFlags; DEFINE_int32(bits_per_key, 10, ""); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const int kVerbose = 1; @@ -900,7 +900,7 @@ INSTANTIATE_TEST_CASE_P(Full, FullBloomTest, testing::Values(BloomFilterPolicy::kLegacyBloom, BloomFilterPolicy::kFastLocalBloom)); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/cast_util.h b/util/cast_util.h index 2dc8138ab3..d7d9a9e9c2 100644 --- a/util/cast_util.h +++ b/util/cast_util.h @@ -5,7 +5,7 @@ #pragma once -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // The helper function to assert the move from dynamic_cast<> to // static_cast<> is correct. This function is to deal with legacy code. // It is not recommanded to add new code to issue class casting. The preferred @@ -18,4 +18,4 @@ inline DestClass* static_cast_with_check(SrcClass* x) { #endif return ret; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/channel.h b/util/channel.h index a8a47680a2..705fa2d28f 100644 --- a/util/channel.h +++ b/util/channel.h @@ -10,7 +10,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { template class channel { @@ -64,4 +64,4 @@ class channel { std::queue buffer_; bool eof_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/coding.cc b/util/coding.cc index b5cfac869a..a54324d288 100644 --- a/util/coding.cc +++ b/util/coding.cc @@ -13,7 +13,7 @@ #include "rocksdb/slice.h" #include "rocksdb/slice_transform.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // conversion' conversion from 'type1' to 'type2', possible loss of data #if defined(_MSC_VER) @@ -86,4 +86,4 @@ const char* GetVarint64Ptr(const char* p, const char* limit, uint64_t* value) { return nullptr; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/coding.h b/util/coding.h index 3ad6d95700..d46654ec4d 100644 --- a/util/coding.h +++ b/util/coding.h @@ -26,7 +26,7 @@ #define PLATFORM_UNALIGNED_ACCESS_NOT_ALLOWED #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // The maximum length of a varint in bytes for 64-bit. const unsigned int kMaxVarint64Length = 10; @@ -477,4 +477,4 @@ inline void GetUnaligned(const T *memory, T *value) { #endif } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/coding_test.cc b/util/coding_test.cc index 7f73e00e15..383e3f5148 100644 --- a/util/coding_test.cc +++ b/util/coding_test.cc @@ -11,7 +11,7 @@ #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Coding { }; TEST(Coding, Fixed16) { @@ -209,7 +209,7 @@ TEST(Coding, Strings) { ASSERT_EQ("", input.ToString()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/compaction_job_stats_impl.cc b/util/compaction_job_stats_impl.cc index fe9efd1f09..4d16891e42 100644 --- a/util/compaction_job_stats_impl.cc +++ b/util/compaction_job_stats_impl.cc @@ -5,7 +5,7 @@ #include "rocksdb/compaction_job_stats.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE @@ -88,4 +88,4 @@ void CompactionJobStats::Add(const CompactionJobStats& /*stats*/) {} #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/comparator.cc b/util/comparator.cc index 717ebb5235..48340bd969 100644 --- a/util/comparator.cc +++ b/util/comparator.cc @@ -15,7 +15,7 @@ #include "port/port.h" #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { class BytewiseComparatorImpl : public Comparator { @@ -213,4 +213,4 @@ const Comparator* ReverseBytewiseComparator() { return &rbytewise; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/compression.h b/util/compression.h index 6f442ebea2..8169841ba5 100644 --- a/util/compression.h +++ b/util/compression.h @@ -49,7 +49,7 @@ #if ZSTD_VERSION_NUMBER >= 10103 // v1.1.3+ #include #endif // ZSTD_VERSION_NUMBER >= 10103 -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Need this for the context allocation override // On windows we need to do this explicitly #if (ZSTD_VERSION_NUMBER >= 500) @@ -121,11 +121,11 @@ class ZSTDUncompressCachedData { int64_t cache_idx_ = -1; // -1 means this instance owns the context }; #endif // (ZSTD_VERSION_NUMBER >= 500) -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ZSTD #if !(defined ZSTD) || !(ZSTD_VERSION_NUMBER >= 500) -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ZSTDUncompressCachedData { void* padding; // unused public: @@ -144,14 +144,14 @@ class ZSTDUncompressCachedData { private: void ignore_padding__() { padding = nullptr; } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif #if defined(XPRESS) #include "port/xpress.h" #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Holds dictionary and related data, like ZSTD's digested compression // dictionary. @@ -1404,4 +1404,4 @@ inline std::string ZSTD_TrainDictionary(const std::string& samples, #endif // ZSTD_VERSION_NUMBER >= 10103 } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/compression_context_cache.cc b/util/compression_context_cache.cc index 6fb5c4fcd9..a06cfb279a 100644 --- a/util/compression_context_cache.cc +++ b/util/compression_context_cache.cc @@ -14,7 +14,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace compression_cache { void* const SentinelValue = nullptr; @@ -105,4 +105,4 @@ void CompressionContextCache::ReturnCachedZSTDUncompressData(int64_t idx) { CompressionContextCache::~CompressionContextCache() { delete rep_; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/compression_context_cache.h b/util/compression_context_cache.h index 4ea6ae35e7..7b7b2d507a 100644 --- a/util/compression_context_cache.h +++ b/util/compression_context_cache.h @@ -19,7 +19,9 @@ #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { class ZSTDUncompressCachedData; class CompressionContextCache { @@ -42,4 +44,4 @@ class CompressionContextCache { Rep* rep_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/concurrent_task_limiter_impl.cc b/util/concurrent_task_limiter_impl.cc index e1ce4bef72..2342677d89 100644 --- a/util/concurrent_task_limiter_impl.cc +++ b/util/concurrent_task_limiter_impl.cc @@ -10,7 +10,7 @@ #include "util/concurrent_task_limiter_impl.h" #include "rocksdb/concurrent_task_limiter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { ConcurrentTaskLimiterImpl::ConcurrentTaskLimiterImpl( const std::string& name, int32_t max_outstanding_task) @@ -64,4 +64,4 @@ TaskLimiterToken::~TaskLimiterToken() { assert(limiter_->outstanding_tasks_ >= 0); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/concurrent_task_limiter_impl.h b/util/concurrent_task_limiter_impl.h index 4e6251f6ae..d8c1e03cb0 100644 --- a/util/concurrent_task_limiter_impl.h +++ b/util/concurrent_task_limiter_impl.h @@ -14,7 +14,7 @@ #include "rocksdb/env.h" #include "rocksdb/concurrent_task_limiter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TaskLimiterToken; @@ -64,4 +64,4 @@ class TaskLimiterToken { void operator=(const TaskLimiterToken&) = delete; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/core_local.h b/util/core_local.h index 4cc4fd90cb..b444a11522 100644 --- a/util/core_local.h +++ b/util/core_local.h @@ -14,7 +14,7 @@ #include "port/port.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // An array of core-local values. Ideally the value type, T, is cache aligned to // prevent false sharing. @@ -80,4 +80,4 @@ T* CoreLocalArray::AccessAtCore(size_t core_idx) const { return &data_[core_idx]; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/crc32c.cc b/util/crc32c.cc index 9e838b830f..f09368f94d 100644 --- a/util/crc32c.cc +++ b/util/crc32c.cc @@ -39,7 +39,7 @@ #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace crc32c { #if defined(HAVE_POWER8) && defined(HAS_ALTIVEC) @@ -1252,4 +1252,4 @@ uint32_t Extend(uint32_t crc, const char* buf, size_t size) { } // namespace crc32c -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/crc32c.h b/util/crc32c.h index faee5d54b3..a3c7cd1d7c 100644 --- a/util/crc32c.h +++ b/util/crc32c.h @@ -12,7 +12,9 @@ #include #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { namespace crc32c { extern std::string IsFastCrc32Supported(); @@ -46,4 +48,4 @@ inline uint32_t Unmask(uint32_t masked_crc) { } } // namespace crc32c -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/crc32c_test.cc b/util/crc32c_test.cc index 90f0c815cc..3e4f7396e7 100644 --- a/util/crc32c_test.cc +++ b/util/crc32c_test.cc @@ -10,7 +10,7 @@ #include "test_util/testharness.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace crc32c { class CRC { }; @@ -138,7 +138,7 @@ TEST(CRC, Mask) { } } // namespace crc32c -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE // copied from folly const uint64_t FNV_64_HASH_START = 14695981039346656037ULL; @@ -162,12 +162,16 @@ int main(int argc, char** argv) { // Populate a buffer with a deterministic pattern // on which to compute checksums - const uint8_t* src = (uint8_t*)rocksdb::crc32c::buffer; - uint64_t* dst = (uint64_t*)rocksdb::crc32c::buffer; - const uint64_t* end = (const uint64_t*)(rocksdb::crc32c::buffer + rocksdb::crc32c::BUFFER_SIZE); + const uint8_t* src = (uint8_t*)ROCKSDB_NAMESPACE::crc32c::buffer; + uint64_t* dst = (uint64_t*)ROCKSDB_NAMESPACE::crc32c::buffer; + const uint64_t* end = + (const uint64_t*)(ROCKSDB_NAMESPACE::crc32c::buffer + + ROCKSDB_NAMESPACE::crc32c::BUFFER_SIZE); *dst++ = 0; while (dst < end) { - rocksdb::EncodeFixed64(reinterpret_cast(dst), fnv64_buf((const char*)src, sizeof(uint64_t))); + ROCKSDB_NAMESPACE::EncodeFixed64( + reinterpret_cast(dst), + fnv64_buf((const char*)src, sizeof(uint64_t))); dst++; src += sizeof(uint64_t); } diff --git a/util/defer.h b/util/defer.h index dcf02ca55e..cb0b42a366 100644 --- a/util/defer.h +++ b/util/defer.h @@ -7,7 +7,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Defers the execution of the provided function until the Defer // object goes out of scope. @@ -49,4 +49,4 @@ class Defer final { std::function fn_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/defer_test.cc b/util/defer_test.cc index cd7d242d15..e13b25efbf 100644 --- a/util/defer_test.cc +++ b/util/defer_test.cc @@ -8,7 +8,7 @@ #include "test_util/testharness.h" #include "util/defer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DeferTest {}; @@ -30,10 +30,10 @@ TEST(DeferTest, FunctionScope) { ASSERT_EQ(4, v); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/duplicate_detector.h b/util/duplicate_detector.h index 1fab009751..72920ca3ce 100644 --- a/util/duplicate_detector.h +++ b/util/duplicate_detector.h @@ -9,7 +9,7 @@ #include "util/set_comparator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // During recovery if the memtable is flushed we cannot rely on its help on // duplicate key detection and as key insert will not be attempted. This class // will be used as a emulator of memtable to tell if insertion of a key/seq @@ -65,4 +65,4 @@ class DuplicateDetector { keys_[cf] = CFKeys(SetComparator(cmp)); } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/dynamic_bloom.cc b/util/dynamic_bloom.cc index ebbae149de..60d4b2cf29 100644 --- a/util/dynamic_bloom.cc +++ b/util/dynamic_bloom.cc @@ -12,7 +12,7 @@ #include "rocksdb/slice.h" #include "util/hash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -67,4 +67,4 @@ DynamicBloom::DynamicBloom(Allocator* allocator, uint32_t total_bits, data_ = reinterpret_cast*>(raw); } -} // rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/dynamic_bloom.h b/util/dynamic_bloom.h index eb19c369dc..d1f22cc756 100644 --- a/util/dynamic_bloom.h +++ b/util/dynamic_bloom.h @@ -15,7 +15,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Slice; class Allocator; @@ -211,4 +211,4 @@ inline void DynamicBloom::AddHash(uint32_t h32, const OrFunc& or_func) { } } -} // rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/dynamic_bloom_test.cc b/util/dynamic_bloom_test.cc index e4a8c66e30..47d04a36c6 100644 --- a/util/dynamic_bloom_test.cc +++ b/util/dynamic_bloom_test.cc @@ -34,7 +34,7 @@ DEFINE_int32(bits_per_key, 10, ""); DEFINE_int32(num_probes, 6, ""); DEFINE_bool(enable_perf, false, ""); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct KeyMaker { uint64_t a; @@ -312,7 +312,7 @@ TEST_F(DynamicBloomTest, concurrent_with_perf) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/file_checksum_helper.cc b/util/file_checksum_helper.cc index 5036ca2787..51dcf6a82f 100644 --- a/util/file_checksum_helper.cc +++ b/util/file_checksum_helper.cc @@ -9,7 +9,7 @@ #include "util/file_checksum_helper.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void FileChecksumListImpl::reset() { checksum_map_.clear(); } @@ -82,4 +82,4 @@ FileChecksumFunc* CreateFileChecksumFuncCrc32c() { return file_checksum_crc32c; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/file_checksum_helper.h b/util/file_checksum_helper.h index a5affeff28..7ad9ea7323 100644 --- a/util/file_checksum_helper.h +++ b/util/file_checksum_helper.h @@ -12,7 +12,7 @@ #include "util/crc32c.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This is the class to generate the file checksum based on Crc32. It // will be used as the default checksum method for SST file checksum @@ -114,4 +114,4 @@ class FileChecksumListImpl : public FileChecksumList { checksum_map_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/file_reader_writer_test.cc b/util/file_reader_writer_test.cc index 7192c19f44..f37bd59310 100644 --- a/util/file_reader_writer_test.cc +++ b/util/file_reader_writer_test.cc @@ -14,7 +14,7 @@ #include "test_util/testutil.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WritableFileWriterTest : public testing::Test {}; @@ -436,7 +436,7 @@ INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P( ReadExceedsReadaheadSize, ReadaheadSequentialFileTest, ::testing::ValuesIn(ReadaheadSequentialFileTest::GetReadaheadSizeList())); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/filelock_test.cc b/util/filelock_test.cc index 3244563d7c..20efd513f4 100644 --- a/util/filelock_test.cc +++ b/util/filelock_test.cc @@ -11,17 +11,17 @@ #include "test_util/testharness.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class LockTest : public testing::Test { public: static LockTest* current_; std::string file_; - rocksdb::Env* env_; + ROCKSDB_NAMESPACE::Env* env_; LockTest() : file_(test::PerThreadDBPath("db_testlock_file")), - env_(rocksdb::Env::Default()) { + env_(ROCKSDB_NAMESPACE::Env::Default()) { current_ = this; } @@ -133,7 +133,7 @@ TEST_F(LockTest, LockBySameThread) { } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/filter_bench.cc b/util/filter_bench.cc index 482865129f..ab9be15c6c 100644 --- a/util/filter_bench.cc +++ b/util/filter_bench.cc @@ -101,26 +101,26 @@ void _always_assert_fail(int line, const char *file, const char *expr) { #define PREDICT_FP_RATE #endif -using rocksdb::Arena; -using rocksdb::BlockContents; -using rocksdb::BloomFilterPolicy; -using rocksdb::BloomHash; -using rocksdb::BuiltinFilterBitsBuilder; -using rocksdb::CachableEntry; -using rocksdb::EncodeFixed32; -using rocksdb::fastrange32; -using rocksdb::FilterBitsReader; -using rocksdb::FilterBuildingContext; -using rocksdb::FullFilterBlockReader; -using rocksdb::GetSliceHash; -using rocksdb::GetSliceHash64; -using rocksdb::Lower32of64; -using rocksdb::ParsedFullFilterBlock; -using rocksdb::PlainTableBloomV1; -using rocksdb::Random32; -using rocksdb::Slice; -using rocksdb::StderrLogger; -using rocksdb::mock::MockBlockBasedTableTester; +using ROCKSDB_NAMESPACE::Arena; +using ROCKSDB_NAMESPACE::BlockContents; +using ROCKSDB_NAMESPACE::BloomFilterPolicy; +using ROCKSDB_NAMESPACE::BloomHash; +using ROCKSDB_NAMESPACE::BuiltinFilterBitsBuilder; +using ROCKSDB_NAMESPACE::CachableEntry; +using ROCKSDB_NAMESPACE::EncodeFixed32; +using ROCKSDB_NAMESPACE::fastrange32; +using ROCKSDB_NAMESPACE::FilterBitsReader; +using ROCKSDB_NAMESPACE::FilterBuildingContext; +using ROCKSDB_NAMESPACE::FullFilterBlockReader; +using ROCKSDB_NAMESPACE::GetSliceHash; +using ROCKSDB_NAMESPACE::GetSliceHash64; +using ROCKSDB_NAMESPACE::Lower32of64; +using ROCKSDB_NAMESPACE::ParsedFullFilterBlock; +using ROCKSDB_NAMESPACE::PlainTableBloomV1; +using ROCKSDB_NAMESPACE::Random32; +using ROCKSDB_NAMESPACE::Slice; +using ROCKSDB_NAMESPACE::StderrLogger; +using ROCKSDB_NAMESPACE::mock::MockBlockBasedTableTester; struct KeyMaker { KeyMaker(size_t avg_size) @@ -316,7 +316,8 @@ void FilterBench::Go() { double weighted_predicted_fp_rate = 0.0; #endif - rocksdb::StopWatchNano timer(rocksdb::Env::Default(), true); + ROCKSDB_NAMESPACE::StopWatchNano timer(ROCKSDB_NAMESPACE::Env::Default(), + true); while (total_memory_used < 1024 * 1024 * FLAGS_working_mem_size_mb) { uint32_t filter_id = random_.Next(); @@ -530,7 +531,8 @@ double FilterBench::RandomQueryTest(uint32_t inside_threshold, bool dry_run, batch_slice_ptrs[i] = &batch_slices[i]; } - rocksdb::StopWatchNano timer(rocksdb::Env::Default(), true); + ROCKSDB_NAMESPACE::StopWatchNano timer(ROCKSDB_NAMESPACE::Env::Default(), + true); for (uint64_t q = 0; q < max_queries; q += batch_size) { bool inside_this_time = random_.Next() <= inside_threshold; @@ -597,7 +599,7 @@ double FilterBench::RandomQueryTest(uint32_t inside_threshold, bool dry_run, may_match = info.full_block_reader_->KeyMayMatch( batch_slices[i], /*prefix_extractor=*/nullptr, - /*block_offset=*/rocksdb::kNotValid, + /*block_offset=*/ROCKSDB_NAMESPACE::kNotValid, /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr, /*lookup_context=*/nullptr); @@ -663,7 +665,7 @@ double FilterBench::RandomQueryTest(uint32_t inside_threshold, bool dry_run, } int main(int argc, char **argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); SetUsageMessage(std::string("\nUSAGE:\n") + std::string(argv[0]) + " [-quick] [OTHER OPTIONS]..."); ParseCommandLineFlags(&argc, &argv, true); diff --git a/util/hash.cc b/util/hash.cc index 7daffb251d..d72be8a452 100644 --- a/util/hash.cc +++ b/util/hash.cc @@ -13,7 +13,7 @@ #include "util/util.h" #include "util/xxhash.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { uint32_t Hash(const char* data, size_t n, uint32_t seed) { // MurmurHash1 - fast but mediocre quality @@ -80,4 +80,4 @@ uint64_t Hash64(const char* data, size_t n) { return XXH3p_64bits(data, n); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/hash.h b/util/hash.h index 888773c0ee..17490a366c 100644 --- a/util/hash.h +++ b/util/hash.h @@ -23,7 +23,7 @@ #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Stable/persistent 64-bit hash. Higher quality and generally faster than // Hash(), especially for inputs > 24 bytes. @@ -117,4 +117,4 @@ inline size_t fastrange64(uint64_t hash, size_t range) { #endif } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/hash_map.h b/util/hash_map.h index 7b08fb3993..6eb42506b4 100644 --- a/util/hash_map.h +++ b/util/hash_map.h @@ -12,7 +12,7 @@ #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // This is similar to std::unordered_map, except that it tries to avoid // allocating or deallocating memory as much as possible. With @@ -64,4 +64,4 @@ class HashMap { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/hash_test.cc b/util/hash_test.cc index 81fcf6bf13..9c3c6efe91 100644 --- a/util/hash_test.cc +++ b/util/hash_test.cc @@ -14,13 +14,13 @@ #include "util/coding.h" #include "util/hash.h" -using rocksdb::EncodeFixed32; -using rocksdb::GetSliceHash64; -using rocksdb::Hash; -using rocksdb::Hash64; -using rocksdb::Lower32of64; -using rocksdb::Upper32of64; -using rocksdb::Slice; +using ROCKSDB_NAMESPACE::EncodeFixed32; +using ROCKSDB_NAMESPACE::GetSliceHash64; +using ROCKSDB_NAMESPACE::Hash; +using ROCKSDB_NAMESPACE::Hash64; +using ROCKSDB_NAMESPACE::Lower32of64; +using ROCKSDB_NAMESPACE::Slice; +using ROCKSDB_NAMESPACE::Upper32of64; // The hash algorithm is part of the file format, for example for the Bloom // filters. Test that the hash values are stable for a set of random strings of @@ -266,7 +266,7 @@ TEST(HashTest, Hash64LargeValueSchema) { } TEST(Fastrange32Test, Values) { - using rocksdb::fastrange32; + using ROCKSDB_NAMESPACE::fastrange32; // Zero range EXPECT_EQ(fastrange32(0, 0), 0U); EXPECT_EQ(fastrange32(123, 0), 0U); @@ -304,7 +304,7 @@ TEST(Fastrange32Test, Values) { } TEST(Fastrange64Test, Values) { - using rocksdb::fastrange64; + using ROCKSDB_NAMESPACE::fastrange64; // Zero range EXPECT_EQ(fastrange64(0, 0), 0U); EXPECT_EQ(fastrange64(123, 0), 0U); @@ -362,12 +362,12 @@ TEST(Fastrange64Test, Values) { // for inspection of disassembly uint32_t fastrange32(uint32_t hash, uint32_t range) { - return rocksdb::fastrange32(hash, range); + return ROCKSDB_NAMESPACE::fastrange32(hash, range); } // for inspection of disassembly size_t fastrange64(uint64_t hash, size_t range) { - return rocksdb::fastrange64(hash, range); + return ROCKSDB_NAMESPACE::fastrange64(hash, range); } int main(int argc, char** argv) { diff --git a/util/heap.h b/util/heap.h index 6093c20e2b..c72d944d32 100644 --- a/util/heap.h +++ b/util/heap.h @@ -11,7 +11,7 @@ #include "port/port.h" #include "util/autovector.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Binary heap implementation optimized for use in multi-way merge sort. // Comparison to std::priority_queue: @@ -163,4 +163,4 @@ class BinaryHeap { size_t root_cmp_cache_ = port::kMaxSizet; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/heap_test.cc b/util/heap_test.cc index d036a62ebc..1f188e73b4 100644 --- a/util/heap_test.cc +++ b/util/heap_test.cc @@ -25,7 +25,7 @@ DEFINE_int64(iters, 100000, "number of pseudo-random operations in each test"); * std::priority_queue on a pseudo-random sequence of operations. */ -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { using HeapTestValue = uint64_t; using Params = std::tuple; @@ -128,7 +128,7 @@ INSTANTIATE_TEST_CASE_P( ::testing::Values(Params(1, 3, 0x176a1019ab0b612e)) ); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/kv_map.h b/util/kv_map.h index d5ba3307f1..0f713ccea1 100644 --- a/util/kv_map.h +++ b/util/kv_map.h @@ -11,7 +11,7 @@ #include "rocksdb/slice.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace stl_wrappers { struct LessOfComparator { @@ -30,4 +30,4 @@ struct LessOfComparator { typedef std::map KVMap; } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/util/log_write_bench.cc b/util/log_write_bench.cc index 0b5eee00a2..60798babfb 100644 --- a/util/log_write_bench.cc +++ b/util/log_write_bench.cc @@ -29,7 +29,7 @@ DEFINE_int32(record_interval, 10000, "Interval between records (microSec)"); DEFINE_int32(bytes_per_sync, 0, "bytes_per_sync parameter in EnvOptions"); DEFINE_bool(enable_sync, false, "sync after each write."); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void RunBenchmark() { std::string file_name = test::PerThreadDBPath("log_write_benchmark.log"); DBOptions options; @@ -72,14 +72,14 @@ void RunBenchmark() { fprintf(stderr, "Distribution of latency of append+flush: \n%s", hist.ToString().c_str()); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { SetUsageMessage(std::string("\nUSAGE:\n") + std::string(argv[0]) + " [OPTIONS]..."); ParseCommandLineFlags(&argc, &argv, true); - rocksdb::RunBenchmark(); + ROCKSDB_NAMESPACE::RunBenchmark(); return 0; } diff --git a/util/murmurhash.h b/util/murmurhash.h index cbfc4068ed..1dbb573981 100644 --- a/util/murmurhash.h +++ b/util/murmurhash.h @@ -33,10 +33,10 @@ typedef unsigned int murmur_t; #endif // Allow slice to be hashable by murmur hash. -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct murmur_hash { size_t operator()(const Slice& slice) const { return MurmurHash(slice.data(), static_cast(slice.size()), 0); } }; -} // rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/mutexlock.h b/util/mutexlock.h index 7516683a77..91ba4fda75 100644 --- a/util/mutexlock.h +++ b/util/mutexlock.h @@ -14,7 +14,7 @@ #include #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Helper class that locks a mutex on construction and unlocks the mutex when // the destructor of the MutexLock object is invoked. @@ -132,4 +132,4 @@ class SpinMutex { std::atomic locked_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/random.cc b/util/random.cc index 5e2cf62641..38c36defd0 100644 --- a/util/random.cc +++ b/util/random.cc @@ -20,7 +20,7 @@ #define STORAGE_DECL static #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Random* Random::GetTLSInstance() { STORAGE_DECL Random* tls_instance; @@ -35,4 +35,4 @@ Random* Random::GetTLSInstance() { return rv; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/random.h b/util/random.h index d1031bff73..f97b2126f3 100644 --- a/util/random.h +++ b/util/random.h @@ -8,10 +8,12 @@ // found in the LICENSE file. See the AUTHORS file for names of contributors. #pragma once -#include #include +#include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { // A very simple random number generator. Not especially good at // generating truly random bits, but good enough for our needs in this @@ -161,4 +163,4 @@ class Random64 { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/random_test.cc b/util/random_test.cc index 244b73444d..ad52081935 100644 --- a/util/random_test.cc +++ b/util/random_test.cc @@ -13,7 +13,7 @@ #include "test_util/testharness.h" #include "util/random.h" -using rocksdb::Random; +using ROCKSDB_NAMESPACE::Random; TEST(RandomTest, Uniform) { const int average = 20; diff --git a/util/rate_limiter.cc b/util/rate_limiter.cc index 0ee06a121b..b1eefe6201 100644 --- a/util/rate_limiter.cc +++ b/util/rate_limiter.cc @@ -14,7 +14,7 @@ #include "test_util/sync_point.h" #include "util/aligned_buffer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { size_t RateLimiter::RequestToken(size_t bytes, size_t alignment, Env::IOPriority io_priority, Statistics* stats, @@ -336,4 +336,4 @@ RateLimiter* NewGenericRateLimiter( mode, Env::Default(), auto_tuned); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/rate_limiter.h b/util/rate_limiter.h index cb91f0aeb5..5f047a5677 100644 --- a/util/rate_limiter.h +++ b/util/rate_limiter.h @@ -19,7 +19,7 @@ #include "util/mutexlock.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class GenericRateLimiter : public RateLimiter { public: @@ -110,4 +110,4 @@ class GenericRateLimiter : public RateLimiter { std::chrono::microseconds tuned_time_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/rate_limiter_test.cc b/util/rate_limiter_test.cc index f7809b989b..6ca91e9e2e 100644 --- a/util/rate_limiter_test.cc +++ b/util/rate_limiter_test.cc @@ -19,7 +19,7 @@ #include "test_util/testharness.h" #include "util/random.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // TODO(yhchiang): the rate will not be accurate when we run test in parallel. class RateLimiterTest : public testing::Test {}; @@ -128,7 +128,7 @@ TEST_F(RateLimiterTest, LimitChangeTest) { // starvation test when limit changes to a smaller value int64_t refill_period = 1000 * 1000; auto* env = Env::Default(); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); struct Arg { Arg(int32_t _request_size, Env::IOPriority _pri, std::shared_ptr _limiter) @@ -152,7 +152,7 @@ TEST_F(RateLimiterTest, LimitChangeTest) { std::make_shared( target, refill_period, 10, RateLimiter::Mode::kWritesOnly, Env::Default(), false /* auto_tuned */); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"GenericRateLimiter::Request", "RateLimiterTest::LimitChangeTest:changeLimitStart"}, {"RateLimiterTest::LimitChangeTest:changeLimitEnd", @@ -194,12 +194,12 @@ TEST_F(RateLimiterTest, AutoTuneIncreaseWhenFull) { // has determined the bytes are not available; and (2) before Refill() // computes the next refill time (ensuring refill time in the future allows // the next request to drain the rate limiter). - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "GenericRateLimiter::Refill", [&](void* /*arg*/) { special_env.SleepForMicroseconds(static_cast( std::chrono::microseconds(kTimePerRefill).count())); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // verify rate limit increases after a sequence of periods where rate limiter // is always drained @@ -214,7 +214,7 @@ TEST_F(RateLimiterTest, AutoTuneIncreaseWhenFull) { int64_t new_bytes_per_sec = rate_limiter->GetSingleBurstBytes(); ASSERT_GT(new_bytes_per_sec, orig_bytes_per_sec); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); // decreases after a sequence of periods where rate limiter is not drained orig_bytes_per_sec = new_bytes_per_sec; @@ -227,7 +227,7 @@ TEST_F(RateLimiterTest, AutoTuneIncreaseWhenFull) { ASSERT_LT(new_bytes_per_sec, orig_bytes_per_sec); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/repeatable_thread.h b/util/repeatable_thread.h index 4226f35396..1ac8edee6d 100644 --- a/util/repeatable_thread.h +++ b/util/repeatable_thread.h @@ -13,7 +13,7 @@ #include "test_util/mock_time_env.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Simple wrapper around port::Thread that supports calling a callback every // X seconds. If you pass in 0, then it will call your callback repeatedly @@ -146,4 +146,4 @@ class RepeatableThread { port::Thread thread_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/repeatable_thread_test.cc b/util/repeatable_thread_test.cc index 8a993e3699..a18aa6cd11 100644 --- a/util/repeatable_thread_test.cc +++ b/util/repeatable_thread_test.cc @@ -14,23 +14,24 @@ class RepeatableThreadTest : public testing::Test { public: RepeatableThreadTest() - : mock_env_(new rocksdb::MockTimeEnv(rocksdb::Env::Default())) {} + : mock_env_(new ROCKSDB_NAMESPACE::MockTimeEnv( + ROCKSDB_NAMESPACE::Env::Default())) {} protected: - std::unique_ptr mock_env_; + std::unique_ptr mock_env_; }; TEST_F(RepeatableThreadTest, TimedTest) { constexpr uint64_t kSecond = 1000000; // 1s = 1000000us constexpr int kIteration = 3; - rocksdb::Env* env = rocksdb::Env::Default(); - rocksdb::port::Mutex mutex; - rocksdb::port::CondVar test_cv(&mutex); + ROCKSDB_NAMESPACE::Env* env = ROCKSDB_NAMESPACE::Env::Default(); + ROCKSDB_NAMESPACE::port::Mutex mutex; + ROCKSDB_NAMESPACE::port::CondVar test_cv(&mutex); int count = 0; uint64_t prev_time = env->NowMicros(); - rocksdb::RepeatableThread thread( + ROCKSDB_NAMESPACE::RepeatableThread thread( [&] { - rocksdb::MutexLock l(&mutex); + ROCKSDB_NAMESPACE::MutexLock l(&mutex); count++; uint64_t now = env->NowMicros(); assert(count == 1 || prev_time + 1 * kSecond <= now); @@ -42,7 +43,7 @@ TEST_F(RepeatableThreadTest, TimedTest) { "rt_test", env, 1 * kSecond); // Wait for execution finish. { - rocksdb::MutexLock l(&mutex); + ROCKSDB_NAMESPACE::MutexLock l(&mutex); while (count < kIteration) { test_cv.Wait(); } @@ -59,9 +60,9 @@ TEST_F(RepeatableThreadTest, MockEnvTest) { std::atomic count{0}; #if defined(OS_MACOSX) && !defined(NDEBUG) - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "InstrumentedCondVar::TimedWaitInternal", [&](void* arg) { // Obtain the current (real) time in seconds and add 1000 extra seconds // to ensure that RepeatableThread::wait invokes TimedWait with a time @@ -83,11 +84,11 @@ TEST_F(RepeatableThreadTest, MockEnvTest) { *reinterpret_cast(arg) = mock_env_->RealNowMicros() + 1000; } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); #endif // OS_MACOSX && !NDEBUG - rocksdb::RepeatableThread thread([&] { count++; }, "rt_test", mock_env_.get(), - 1 * kSecond, 1 * kSecond); + ROCKSDB_NAMESPACE::RepeatableThread thread( + [&] { count++; }, "rt_test", mock_env_.get(), 1 * kSecond, 1 * kSecond); for (int i = 1; i <= kIteration; i++) { // Bump current time thread.TEST_WaitForRun([&] { mock_env_->set_current_time(i); }); diff --git a/util/set_comparator.h b/util/set_comparator.h index 4ecd004036..9b5cfc1dc5 100644 --- a/util/set_comparator.h +++ b/util/set_comparator.h @@ -5,7 +5,7 @@ #pragma once -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A comparator to be used in std::set struct SetComparator { explicit SetComparator() : user_comparator_(BytewiseComparator()) {} @@ -19,4 +19,4 @@ struct SetComparator { private: const Comparator* user_comparator_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/slice.cc b/util/slice.cc index 165da96e1a..6db11cc947 100644 --- a/util/slice.cc +++ b/util/slice.cc @@ -13,7 +13,7 @@ #include "util/string_util.h" #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -240,4 +240,4 @@ PinnableSlice& PinnableSlice::operator=(PinnableSlice&& other) { return *this; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/slice_test.cc b/util/slice_test.cc index bdcd36cd02..9e8a8e3400 100644 --- a/util/slice_test.cc +++ b/util/slice_test.cc @@ -9,7 +9,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Use this to keep track of the cleanups that were actually performed void Multiplier(void* arg1, void* arg2) { @@ -154,10 +154,10 @@ TEST_F(PinnableSliceTest, Move) { ASSERT_EQ(2, res); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/slice_transform_test.cc b/util/slice_transform_test.cc index 96d90a9cd9..6550cadeab 100644 --- a/util/slice_transform_test.cc +++ b/util/slice_transform_test.cc @@ -16,7 +16,7 @@ #include "rocksdb/table.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SliceTransformTest : public testing::Test {}; @@ -98,7 +98,7 @@ uint64_t TestGetTickerCount(const Options& options, Tickers ticker_type) { TEST_F(SliceTransformDBTest, CapPrefix) { last_options_.prefix_extractor.reset(NewCappedPrefixTransform(8)); - last_options_.statistics = rocksdb::CreateDBStatistics(); + last_options_.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); BlockBasedTableOptions bbto; bbto.filter_policy.reset(NewBloomFilterPolicy(10, false)); bbto.whole_key_filtering = false; @@ -145,7 +145,7 @@ TEST_F(SliceTransformDBTest, CapPrefix) { ASSERT_EQ(TestGetTickerCount(last_options_, BLOOM_FILTER_PREFIX_USEFUL), 3U); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/status.cc b/util/status.cc index d75f9271eb..3b1ffde566 100644 --- a/util/status.cc +++ b/util/status.cc @@ -15,7 +15,7 @@ #include #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const char* Status::CopyState(const char* state) { #ifdef OS_WIN @@ -140,4 +140,4 @@ std::string Status::ToString() const { return result; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/stderr_logger.h b/util/stderr_logger.h index 8612fce08f..abf8f57010 100644 --- a/util/stderr_logger.h +++ b/util/stderr_logger.h @@ -10,7 +10,7 @@ #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Prints logs to stderr for faster debugging class StderrLogger : public Logger { @@ -28,4 +28,4 @@ class StderrLogger : public Logger { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/stop_watch.h b/util/stop_watch.h index afa708e370..ad4905960c 100644 --- a/util/stop_watch.h +++ b/util/stop_watch.h @@ -7,7 +7,7 @@ #include "monitoring/statistics.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Auto-scoped. // Records the measure time into the corresponding histogram if statistics // is not nullptr. It is also saved into *elapsed if the pointer is not nullptr @@ -115,4 +115,4 @@ class StopWatchNano { uint64_t start_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/string_util.cc b/util/string_util.cc index 4a194f3a9c..bb234f2394 100644 --- a/util/string_util.cc +++ b/util/string_util.cc @@ -20,7 +20,7 @@ #include "port/sys_time.h" #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const std::string kNullptrString = "nullptr"; @@ -406,4 +406,4 @@ bool SerializeIntVector(const std::vector& vec, std::string* value) { return true; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/string_util.h b/util/string_util.h index 122a6c3567..a761be66c5 100644 --- a/util/string_util.h +++ b/util/string_util.h @@ -11,7 +11,9 @@ #include #include -namespace rocksdb { +#include "rocksdb/rocksdb_namespace.h" + +namespace ROCKSDB_NAMESPACE { class Slice; @@ -133,4 +135,4 @@ bool SerializeIntVector(const std::vector& vec, std::string* value); extern const std::string kNullptrString; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/thread_list_test.cc b/util/thread_list_test.cc index 37f59bab8c..44c3ebc99e 100644 --- a/util/thread_list_test.cc +++ b/util/thread_list_test.cc @@ -12,7 +12,7 @@ #ifdef ROCKSDB_USING_THREAD_STATUS -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SimulatedBackgroundTask { public: @@ -335,7 +335,7 @@ TEST_F(ThreadListTest, SimpleEventTest) { ThreadStatus::NUM_OP_TYPES); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/thread_local.cc b/util/thread_local.cc index 7346eff11e..9fa16f609c 100644 --- a/util/thread_local.cc +++ b/util/thread_local.cc @@ -12,7 +12,7 @@ #include "port/likely.h" #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct Entry { Entry() : ptr(nullptr) {} @@ -551,4 +551,4 @@ void ThreadLocalPtr::Fold(FoldFunc func, void* res) { Instance()->Fold(id_, func, res); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/thread_local.h b/util/thread_local.h index 5dad729215..c4b762ab6f 100644 --- a/util/thread_local.h +++ b/util/thread_local.h @@ -18,7 +18,7 @@ #include "util/autovector.h" #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Cleanup function that will be called for a stored thread local // pointer (if not NULL) when one of the following happens: @@ -98,4 +98,4 @@ private: const uint32_t id_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/thread_local_test.cc b/util/thread_local_test.cc index af9954c8ab..b788b1773d 100644 --- a/util/thread_local_test.cc +++ b/util/thread_local_test.cc @@ -15,7 +15,7 @@ #include "util/autovector.h" #include "util/thread_local.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ThreadLocalTest : public testing::Test { public: @@ -551,7 +551,7 @@ void* AccessThreadLocal(void* /*arg*/) { // this test and only see an ASAN error on SyncPoint, it means you pass the // test. TEST_F(ThreadLocalTest, DISABLED_MainThreadDiesFirst) { - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"AccessThreadLocal:Start", "MainThreadDiesFirst:End"}, {"PosixEnv::~PosixEnv():End", "AccessThreadLocal:End"}}); @@ -561,7 +561,7 @@ TEST_F(ThreadLocalTest, DISABLED_MainThreadDiesFirst) { #ifndef ROCKSDB_LITE try { #endif // ROCKSDB_LITE - rocksdb::port::Thread th(&AccessThreadLocal, nullptr); + ROCKSDB_NAMESPACE::port::Thread th(&AccessThreadLocal, nullptr); th.detach(); TEST_SYNC_POINT("MainThreadDiesFirst:End"); #ifndef ROCKSDB_LITE @@ -572,7 +572,7 @@ TEST_F(ThreadLocalTest, DISABLED_MainThreadDiesFirst) { #endif // ROCKSDB_LITE } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/util/thread_operation.h b/util/thread_operation.h index f1827da0a0..b5d4b6906d 100644 --- a/util/thread_operation.h +++ b/util/thread_operation.h @@ -17,7 +17,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_USING_THREAD_STATUS @@ -118,4 +118,4 @@ struct StateInfo { }; #endif // ROCKSDB_USING_THREAD_STATUS -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/threadpool_imp.cc b/util/threadpool_imp.cc index 8d0e01e038..bf216c9569 100644 --- a/util/threadpool_imp.cc +++ b/util/threadpool_imp.cc @@ -31,7 +31,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void ThreadPoolImpl::PthreadCall(const char* label, int result) { if (result != 0) { @@ -504,4 +504,4 @@ ThreadPool* NewThreadPool(int num_threads) { return thread_pool; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/threadpool_imp.h b/util/threadpool_imp.h index 3cdafb839f..e3c12577b0 100644 --- a/util/threadpool_imp.h +++ b/util/threadpool_imp.h @@ -14,8 +14,7 @@ #include #include -namespace rocksdb { - +namespace ROCKSDB_NAMESPACE { class ThreadPoolImpl : public ThreadPool { public: @@ -110,4 +109,4 @@ class ThreadPoolImpl : public ThreadPool { std::unique_ptr impl_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/timer_queue.h b/util/timer_queue.h index a5f74ae567..3bd517531a 100644 --- a/util/timer_queue.h +++ b/util/timer_queue.h @@ -225,6 +225,6 @@ class TimerQueue { public: std::vector& getContainer() { return this->c; } } m_items; - rocksdb::port::Thread m_th; + ROCKSDB_NAMESPACE::port::Thread m_th; bool closed_ = false; }; diff --git a/util/user_comparator_wrapper.h b/util/user_comparator_wrapper.h index 43797709c9..fdb27f33e2 100644 --- a/util/user_comparator_wrapper.h +++ b/util/user_comparator_wrapper.h @@ -11,7 +11,7 @@ #include "monitoring/perf_context_imp.h" #include "rocksdb/comparator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Wrapper of user comparator, with auto increment to // perf_context.user_key_comparison_count. @@ -62,4 +62,4 @@ class UserComparatorWrapper final : public Comparator { const Comparator* user_comparator_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/util/vector_iterator.h b/util/vector_iterator.h index d5945b6b7f..fc26ec0c02 100644 --- a/util/vector_iterator.h +++ b/util/vector_iterator.h @@ -10,7 +10,7 @@ #include "rocksdb/slice.h" #include "table/internal_iterator.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Iterator over a vector of keys/values class VectorIterator : public InternalIterator { @@ -98,4 +98,4 @@ class VectorIterator : public InternalIterator { size_t current_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/backupable/backupable_db.cc b/utilities/backupable/backupable_db.cc index af121f0dde..0ca67670b2 100644 --- a/utilities/backupable/backupable_db.cc +++ b/utilities/backupable/backupable_db.cc @@ -41,7 +41,7 @@ #include "util/string_util.h" #include "utilities/checkpoint/checkpoint_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void BackupStatistics::IncrementNumberSuccessBackup() { number_success_backup++; @@ -257,7 +257,7 @@ class BackupEngineImpl : public BackupEngine { bool tmp = false, const std::string& file = "") const { assert(file.size() == 0 || file[0] != '/'); - return GetPrivateDirRel() + "/" + rocksdb::ToString(backup_id) + + return GetPrivateDirRel() + "/" + ROCKSDB_NAMESPACE::ToString(backup_id) + (tmp ? ".tmp" : "") + "/" + file; } inline std::string GetSharedFileRel(const std::string& file = "", @@ -278,8 +278,8 @@ class BackupEngineImpl : public BackupEngine { assert(file.size() == 0 || file[0] != '/'); std::string file_copy = file; return file_copy.insert(file_copy.find_last_of('.'), - "_" + rocksdb::ToString(checksum_value) + "_" + - rocksdb::ToString(file_size)); + "_" + ROCKSDB_NAMESPACE::ToString(checksum_value) + + "_" + ROCKSDB_NAMESPACE::ToString(file_size)); } inline std::string GetFileFromChecksumFile(const std::string& file) const { assert(file.size() == 0 || file[0] != '/'); @@ -293,7 +293,7 @@ class BackupEngineImpl : public BackupEngine { } inline std::string GetBackupMetaFile(BackupID backup_id, bool tmp) const { return GetBackupMetaDir() + "/" + (tmp ? "." : "") + - rocksdb::ToString(backup_id) + (tmp ? ".tmp" : ""); + ROCKSDB_NAMESPACE::ToString(backup_id) + (tmp ? ".tmp" : ""); } // If size_limit == 0, there is no size limit, copy everything. @@ -623,7 +623,7 @@ Status BackupEngineImpl::Initialize() { ROCKS_LOG_INFO(options_.info_log, "Detected backup %s", file.c_str()); BackupID backup_id = 0; sscanf(file.c_str(), "%u", &backup_id); - if (backup_id == 0 || file != rocksdb::ToString(backup_id)) { + if (backup_id == 0 || file != ROCKSDB_NAMESPACE::ToString(backup_id)) { if (!read_only_) { // invalid file name, delete that auto s = backup_env_->DeleteFile(GetBackupMetaDir() + "/" + file); @@ -1811,7 +1811,7 @@ Status BackupEngineImpl::BackupMeta::LoadFromFile( line.remove_prefix(checksum_prefix.size()); checksum_value = static_cast( strtoul(line.data(), nullptr, 10)); - if (line != rocksdb::ToString(checksum_value)) { + if (line != ROCKSDB_NAMESPACE::ToString(checksum_value)) { return Status::Corruption("Invalid checksum value for " + filename + " in " + meta_filename_); } @@ -1984,6 +1984,6 @@ Status BackupEngineReadOnly::Open(Env* env, const BackupableDBOptions& options, return Status::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/backupable/backupable_db_test.cc b/utilities/backupable/backupable_db_test.cc index 98aad78e45..efdb34b30a 100644 --- a/utilities/backupable/backupable_db_test.cc +++ b/utilities/backupable/backupable_db_test.cc @@ -32,7 +32,7 @@ #include "util/stderr_logger.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -1096,7 +1096,8 @@ TEST_F(BackupableDBTest, BackupOptions) { db_.reset(); db_.reset(OpenDB()); ASSERT_OK(backup_engine_->CreateNewBackup(db_.get(), true)); - rocksdb::GetLatestOptionsFileName(db_->GetName(), options_.env, &name); + ROCKSDB_NAMESPACE::GetLatestOptionsFileName(db_->GetName(), options_.env, + &name); ASSERT_OK(file_manager_->FileExists(OptionsPath(backupdir_, i) + name)); backup_chroot_env_->GetChildren(OptionsPath(backupdir_, i), &filenames); for (auto fn : filenames) { @@ -1117,7 +1118,7 @@ TEST_F(BackupableDBTest, SetOptionsBackupRaceCondition) { {"BackupableDBTest::SetOptionsBackupRaceCondition:AfterSetOptions", "CheckpointImpl::CreateCheckpoint:SavedLiveFiles2"}}); SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread setoptions_thread{[this]() { + ROCKSDB_NAMESPACE::port::Thread setoptions_thread{[this]() { TEST_SYNC_POINT( "BackupableDBTest::SetOptionsBackupRaceCondition:BeforeSetOptions"); DBImpl* dbi = static_cast(db_.get()); @@ -1571,20 +1572,21 @@ TEST_F(BackupableDBTest, ChangeManifestDuringBackupCreation) { OpenDBAndBackupEngine(true); FillDB(db_.get(), 0, 100); - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"CheckpointImpl::CreateCheckpoint:SavedLiveFiles1", "VersionSet::LogAndApply:WriteManifest"}, {"VersionSet::LogAndApply:WriteManifestDone", "CheckpointImpl::CreateCheckpoint:SavedLiveFiles2"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread flush_thread{[this]() { ASSERT_OK(db_->Flush(FlushOptions())); }}; + ROCKSDB_NAMESPACE::port::Thread flush_thread{ + [this]() { ASSERT_OK(db_->Flush(FlushOptions())); }}; ASSERT_OK(backup_engine_->CreateNewBackup(db_.get(), false)); flush_thread.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); // The last manifest roll would've already been cleaned up by the full scan // that happens when CreateNewBackup invokes EnableFileDeletions. We need to @@ -1842,10 +1844,10 @@ TEST_P(BackupableDBTestWithParam, BackupUsingDirectIO) { } // anon namespace -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/blob_db/blob_compaction_filter.cc b/utilities/blob_db/blob_compaction_filter.cc index 22350f542e..5900f09269 100644 --- a/utilities/blob_db/blob_compaction_filter.cc +++ b/utilities/blob_db/blob_compaction_filter.cc @@ -10,7 +10,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { CompactionFilter::Decision BlobIndexCompactionFilterBase::FilterV2( @@ -325,5 +325,5 @@ BlobIndexCompactionFilterFactoryGC::CreateCompactionFilter( } } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_compaction_filter.h b/utilities/blob_db/blob_compaction_filter.h index aea7a5e25c..409df26ac8 100644 --- a/utilities/blob_db/blob_compaction_filter.h +++ b/utilities/blob_db/blob_compaction_filter.h @@ -14,7 +14,7 @@ #include "utilities/blob_db/blob_db_gc_stats.h" #include "utilities/blob_db/blob_db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { struct BlobCompactionContext { @@ -164,5 +164,5 @@ class BlobIndexCompactionFilterFactoryGC }; } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_db.cc b/utilities/blob_db/blob_db.cc index 7d922287ae..f568ecd1a4 100644 --- a/utilities/blob_db/blob_db.cc +++ b/utilities/blob_db/blob_db.cc @@ -10,7 +10,7 @@ #include #include "utilities/blob_db/blob_db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { Status BlobDB::Open(const Options& options, const BlobDBOptions& bdb_options, @@ -98,5 +98,5 @@ void BlobDBOptions::Dump(Logger* log) const { } } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/blob_db/blob_db.h b/utilities/blob_db/blob_db.h index 0616a88798..72a5804335 100644 --- a/utilities/blob_db/blob_db.h +++ b/utilities/blob_db/blob_db.h @@ -14,7 +14,7 @@ #include "rocksdb/status.h" #include "rocksdb/utilities/stackable_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { @@ -83,7 +83,7 @@ struct BlobDBOptions { class BlobDB : public StackableDB { public: - using rocksdb::StackableDB::Put; + using ROCKSDB_NAMESPACE::StackableDB::Put; virtual Status Put(const WriteOptions& options, const Slice& key, const Slice& value) override = 0; virtual Status Put(const WriteOptions& options, @@ -96,7 +96,7 @@ class BlobDB : public StackableDB { return Put(options, key, value); } - using rocksdb::StackableDB::Delete; + using ROCKSDB_NAMESPACE::StackableDB::Delete; virtual Status Delete(const WriteOptions& options, ColumnFamilyHandle* column_family, const Slice& key) override { @@ -134,7 +134,7 @@ class BlobDB : public StackableDB { return PutUntil(options, key, value, expiration); } - using rocksdb::StackableDB::Get; + using ROCKSDB_NAMESPACE::StackableDB::Get; virtual Status Get(const ReadOptions& options, ColumnFamilyHandle* column_family, const Slice& key, PinnableSlice* value) override = 0; @@ -148,7 +148,7 @@ class BlobDB : public StackableDB { return Get(options, DefaultColumnFamily(), key, value, expiration); } - using rocksdb::StackableDB::MultiGet; + using ROCKSDB_NAMESPACE::StackableDB::MultiGet; virtual std::vector MultiGet( const ReadOptions& options, const std::vector& keys, @@ -179,14 +179,14 @@ class BlobDB : public StackableDB { } } - using rocksdb::StackableDB::SingleDelete; + using ROCKSDB_NAMESPACE::StackableDB::SingleDelete; virtual Status SingleDelete(const WriteOptions& /*wopts*/, ColumnFamilyHandle* /*column_family*/, const Slice& /*key*/) override { return Status::NotSupported("Not supported operation in blob db."); } - using rocksdb::StackableDB::Merge; + using ROCKSDB_NAMESPACE::StackableDB::Merge; virtual Status Merge(const WriteOptions& /*options*/, ColumnFamilyHandle* /*column_family*/, const Slice& /*key*/, const Slice& /*value*/) override { @@ -195,7 +195,7 @@ class BlobDB : public StackableDB { virtual Status Write(const WriteOptions& opts, WriteBatch* updates) override = 0; - using rocksdb::StackableDB::NewIterator; + using ROCKSDB_NAMESPACE::StackableDB::NewIterator; virtual Iterator* NewIterator(const ReadOptions& options) override = 0; virtual Iterator* NewIterator(const ReadOptions& options, ColumnFamilyHandle* column_family) override { @@ -228,7 +228,7 @@ class BlobDB : public StackableDB { output_path_id, output_file_names, compaction_job_info); } - using rocksdb::StackableDB::Close; + using ROCKSDB_NAMESPACE::StackableDB::Close; virtual Status Close() override = 0; // Opening blob db. @@ -257,5 +257,5 @@ Status DestroyBlobDB(const std::string& dbname, const Options& options, const BlobDBOptions& bdb_options); } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_db_gc_stats.h b/utilities/blob_db/blob_db_gc_stats.h index 47635d4155..1e6e4a25d7 100644 --- a/utilities/blob_db/blob_db_gc_stats.h +++ b/utilities/blob_db/blob_db_gc_stats.h @@ -7,7 +7,7 @@ #ifndef ROCKSDB_LITE -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { @@ -48,5 +48,5 @@ class BlobDBGarbageCollectionStats { }; } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_db_impl.cc b/utilities/blob_db/blob_db_impl.cc index 47456e0b96..5f2ca24981 100644 --- a/utilities/blob_db/blob_db_impl.cc +++ b/utilities/blob_db/blob_db_impl.cc @@ -48,7 +48,7 @@ namespace { int kBlockBasedTableVersionFormat = 2; } // end namespace -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { bool BlobFileComparator::operator()( @@ -2112,5 +2112,5 @@ void BlobDBImpl::TEST_ProcessCompactionJobInfo(const CompactionJobInfo& info) { #endif // !NDEBUG } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_db_impl.h b/utilities/blob_db/blob_db_impl.h index 2b475a30d2..c1e649cc59 100644 --- a/utilities/blob_db/blob_db_impl.h +++ b/utilities/blob_db/blob_db_impl.h @@ -34,7 +34,7 @@ #include "utilities/blob_db/blob_log_reader.h" #include "utilities/blob_db/blob_log_writer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBImpl; class ColumnFamilyHandle; @@ -491,5 +491,5 @@ class BlobDBImpl : public BlobDB { }; } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_db_impl_filesnapshot.cc b/utilities/blob_db/blob_db_impl_filesnapshot.cc index 4544ecb5a2..168c7ce9da 100644 --- a/utilities/blob_db/blob_db_impl_filesnapshot.cc +++ b/utilities/blob_db/blob_db_impl_filesnapshot.cc @@ -13,7 +13,7 @@ // BlobDBImpl methods to get snapshot of files, e.g. for replication. -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { Status BlobDBImpl::DisableFileDeletions() { @@ -105,5 +105,5 @@ void BlobDBImpl::GetLiveFilesMetaData(std::vector* metadata) { } } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/blob_db/blob_db_iterator.h b/utilities/blob_db/blob_db_iterator.h index 529d81529c..af07117eb4 100644 --- a/utilities/blob_db/blob_db_iterator.h +++ b/utilities/blob_db/blob_db_iterator.h @@ -12,10 +12,10 @@ #include "util/stop_watch.h" #include "utilities/blob_db/blob_db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { -using rocksdb::ManagedSnapshot; +using ROCKSDB_NAMESPACE::ManagedSnapshot; class BlobDBIterator : public Iterator { public: @@ -143,5 +143,5 @@ class BlobDBIterator : public Iterator { PinnableSlice value_; }; } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/blob_db/blob_db_listener.h b/utilities/blob_db/blob_db_listener.h index af976af810..c26d7bd27d 100644 --- a/utilities/blob_db/blob_db_listener.h +++ b/utilities/blob_db/blob_db_listener.h @@ -13,7 +13,7 @@ #include "util/mutexlock.h" #include "utilities/blob_db/blob_db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { class BlobDBListener : public EventListener { @@ -62,5 +62,5 @@ class BlobDBListenerGC : public BlobDBListener { }; } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/blob_db/blob_db_test.cc b/utilities/blob_db/blob_db_test.cc index 3a3d8f1d5d..9fee52e8cd 100644 --- a/utilities/blob_db/blob_db_test.cc +++ b/utilities/blob_db/blob_db_test.cc @@ -31,7 +31,7 @@ #include "utilities/blob_db/blob_db.h" #include "utilities/blob_db/blob_db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { class BlobDBTest : public testing::Test { @@ -595,7 +595,7 @@ TEST_F(BlobDBTest, SstFileManager) { Options db_options; int files_scheduled_to_delete = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SstFileManagerImpl::ScheduleFileDeletion", [&](void *arg) { assert(arg); const std::string *const file_path = @@ -629,7 +629,7 @@ TEST_F(BlobDBTest, SstFileManager) { TEST_F(BlobDBTest, SstFileManagerRestart) { int files_scheduled_to_delete = 0; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "SstFileManagerImpl::ScheduleFileDeletion", [&](void *arg) { assert(arg); const std::string *const file_path = @@ -1925,7 +1925,7 @@ TEST_F(BlobDBTest, ShutdownWait) { {"BlobDBTest.ShutdownWait:3", "BlobDBImpl::EvictExpiredFiles:3"}, }); // Force all tasks to be scheduled immediately. - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "TimeQueue::Add:item.end", [&](void *arg) { std::chrono::steady_clock::time_point *tp = static_cast(arg); @@ -1933,7 +1933,7 @@ TEST_F(BlobDBTest, ShutdownWait) { std::chrono::steady_clock::now() - std::chrono::milliseconds(10000); }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "BlobDBImpl::EvictExpiredFiles:cb", [&](void * /*arg*/) { // Sleep 3 ms to increase the chance of data race. // We've synced up the code so that EvictExpiredFiles() @@ -1973,7 +1973,7 @@ TEST_F(BlobDBTest, ShutdownWait) { } } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE // A black-box test for the ttl wrapper around rocksdb int main(int argc, char** argv) { diff --git a/utilities/blob_db/blob_dump_tool.cc b/utilities/blob_db/blob_dump_tool.cc index 69e7f19b54..58f26128f8 100644 --- a/utilities/blob_db/blob_dump_tool.cc +++ b/utilities/blob_db/blob_dump_tool.cc @@ -20,7 +20,7 @@ #include "util/coding.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { BlobDumpTool::BlobDumpTool() @@ -273,6 +273,6 @@ std::string BlobDumpTool::GetString(std::pair p) { } } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_dump_tool.h b/utilities/blob_db/blob_dump_tool.h index 39f83737d4..498543ada2 100644 --- a/utilities/blob_db/blob_dump_tool.h +++ b/utilities/blob_db/blob_dump_tool.h @@ -13,7 +13,7 @@ #include "rocksdb/status.h" #include "utilities/blob_db/blob_log_format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { class BlobDumpTool { @@ -52,6 +52,6 @@ class BlobDumpTool { }; } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_file.cc b/utilities/blob_db/blob_file.cc index 999f8d5b2b..f32e29529c 100644 --- a/utilities/blob_db/blob_file.cc +++ b/utilities/blob_db/blob_file.cc @@ -21,7 +21,7 @@ #include "logging/logging.h" #include "utilities/blob_db/blob_db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { @@ -316,5 +316,5 @@ Status BlobFile::ReadMetadata(Env* env, const EnvOptions& env_options) { } } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_file.h b/utilities/blob_db/blob_file.h index 81755f384f..17d39b542e 100644 --- a/utilities/blob_db/blob_file.h +++ b/utilities/blob_db/blob_file.h @@ -18,7 +18,7 @@ #include "utilities/blob_db/blob_log_reader.h" #include "utilities/blob_db/blob_log_writer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { class BlobDBImpl; @@ -248,5 +248,5 @@ class BlobFile { } }; } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_log_format.cc b/utilities/blob_db/blob_log_format.cc index 8726cb8f1f..64894ca7ba 100644 --- a/utilities/blob_db/blob_log_format.cc +++ b/utilities/blob_db/blob_log_format.cc @@ -10,7 +10,7 @@ #include "util/coding.h" #include "util/crc32c.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { void BlobLogHeader::EncodeTo(std::string* dst) { @@ -145,5 +145,5 @@ Status BlobLogRecord::CheckBlobCRC() const { } } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_log_format.h b/utilities/blob_db/blob_log_format.h index 34eacd5e02..26cdf6e715 100644 --- a/utilities/blob_db/blob_log_format.h +++ b/utilities/blob_db/blob_log_format.h @@ -18,7 +18,7 @@ #include "rocksdb/status.h" #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { constexpr uint32_t kMagicNumber = 2395959; // 0x00248f37 @@ -129,5 +129,5 @@ struct BlobLogRecord { }; } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_log_reader.cc b/utilities/blob_db/blob_log_reader.cc index 2ede0a8f2f..1a4b5ac815 100644 --- a/utilities/blob_db/blob_log_reader.cc +++ b/utilities/blob_db/blob_log_reader.cc @@ -13,7 +13,7 @@ #include "monitoring/statistics.h" #include "util/stop_watch.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { Reader::Reader(std::unique_ptr&& file_reader, Env* env, @@ -101,5 +101,5 @@ Status Reader::ReadRecord(BlobLogRecord* record, ReadLevel level, } } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_log_reader.h b/utilities/blob_db/blob_log_reader.h index 6c3990e304..45fda284ab 100644 --- a/utilities/blob_db/blob_log_reader.h +++ b/utilities/blob_db/blob_log_reader.h @@ -17,7 +17,7 @@ #include "rocksdb/status.h" #include "utilities/blob_db/blob_log_format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SequentialFileReader; class Logger; @@ -78,5 +78,5 @@ class Reader { }; } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_log_writer.cc b/utilities/blob_db/blob_log_writer.cc index 5087f67e79..2fe92263b3 100644 --- a/utilities/blob_db/blob_log_writer.cc +++ b/utilities/blob_db/blob_log_writer.cc @@ -16,7 +16,7 @@ #include "util/stop_watch.h" #include "utilities/blob_db/blob_log_format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace blob_db { Writer::Writer(std::unique_ptr&& dest, Env* env, @@ -135,5 +135,5 @@ Status Writer::EmitPhysicalRecord(const std::string& headerbuf, } } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/blob_db/blob_log_writer.h b/utilities/blob_db/blob_log_writer.h index faf2cfd26c..29dbd00f16 100644 --- a/utilities/blob_db/blob_log_writer.h +++ b/utilities/blob_db/blob_log_writer.h @@ -17,7 +17,7 @@ #include "rocksdb/types.h" #include "utilities/blob_db/blob_log_format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WritableFileWriter; @@ -90,5 +90,5 @@ class Writer { }; } // namespace blob_db -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/cassandra/cassandra_compaction_filter.cc b/utilities/cassandra/cassandra_compaction_filter.cc index 1b99d3a8b7..f0a00e4d1f 100644 --- a/utilities/cassandra/cassandra_compaction_filter.cc +++ b/utilities/cassandra/cassandra_compaction_filter.cc @@ -8,8 +8,7 @@ #include "rocksdb/slice.h" #include "utilities/cassandra/format.h" - -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { const char* CassandraCompactionFilter::Name() const { @@ -45,4 +44,4 @@ CompactionFilter::Decision CassandraCompactionFilter::FilterV2( } } // namespace cassandra -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/cassandra/cassandra_compaction_filter.h b/utilities/cassandra/cassandra_compaction_filter.h index 4ee2445a1a..ac25881062 100644 --- a/utilities/cassandra/cassandra_compaction_filter.h +++ b/utilities/cassandra/cassandra_compaction_filter.h @@ -8,7 +8,7 @@ #include "rocksdb/compaction_filter.h" #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { /** @@ -39,4 +39,4 @@ private: int32_t gc_grace_period_in_seconds_; }; } // namespace cassandra -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/cassandra/cassandra_format_test.cc b/utilities/cassandra/cassandra_format_test.cc index 7af21247eb..a8e6ad3f1c 100644 --- a/utilities/cassandra/cassandra_format_test.cc +++ b/utilities/cassandra/cassandra_format_test.cc @@ -10,9 +10,9 @@ #include "utilities/cassandra/serialize.h" #include "utilities/cassandra/test_utils.h" -using namespace rocksdb::cassandra; +using namespace ROCKSDB_NAMESPACE::cassandra; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { TEST(ColumnTest, Column) { @@ -359,7 +359,7 @@ TEST(RowValueTest, ExpireTtlShouldConvertExpiredColumnsToTombstones) { EXPECT_FALSE(changed); } } // namespace cassandra -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/cassandra/cassandra_functional_test.cc b/utilities/cassandra/cassandra_functional_test.cc index cec9ce7d88..501988423d 100644 --- a/utilities/cassandra/cassandra_functional_test.cc +++ b/utilities/cassandra/cassandra_functional_test.cc @@ -15,9 +15,9 @@ #include "utilities/cassandra/test_utils.h" #include "utilities/merge_operators.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { // Path to the database on file system @@ -303,7 +303,7 @@ TEST_F(CassandraFunctionalTest, CompactionShouldRemoveTombstoneFromPut) { } } // namespace cassandra -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/cassandra/cassandra_row_merge_test.cc b/utilities/cassandra/cassandra_row_merge_test.cc index 88dee118b5..9e9ff14949 100644 --- a/utilities/cassandra/cassandra_row_merge_test.cc +++ b/utilities/cassandra/cassandra_row_merge_test.cc @@ -8,7 +8,7 @@ #include "utilities/cassandra/format.h" #include "utilities/cassandra/test_utils.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { TEST(RowValueMergeTest, Merge) { @@ -104,7 +104,7 @@ TEST(RowValueMergeTest, MergeWithRowTombstone) { } } // namespace cassandra -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/cassandra/cassandra_serialize_test.cc b/utilities/cassandra/cassandra_serialize_test.cc index bfce2a36e3..491540bfec 100644 --- a/utilities/cassandra/cassandra_serialize_test.cc +++ b/utilities/cassandra/cassandra_serialize_test.cc @@ -6,9 +6,9 @@ #include "test_util/testharness.h" #include "utilities/cassandra/serialize.h" -using namespace rocksdb::cassandra; +using namespace ROCKSDB_NAMESPACE::cassandra; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { TEST(SerializeTest, SerializeI64) { @@ -180,7 +180,7 @@ TEST(SerializeTest, DeserializeI8) { } } // namespace cassandra -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/cassandra/format.cc b/utilities/cassandra/format.cc index 42cd7206b6..a767f41e79 100644 --- a/utilities/cassandra/format.cc +++ b/utilities/cassandra/format.cc @@ -11,7 +11,7 @@ #include "utilities/cassandra/serialize.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { namespace { const int32_t kDefaultLocalDeletionTime = @@ -36,13 +36,13 @@ int8_t ColumnBase::Index() const { } void ColumnBase::Serialize(std::string* dest) const { - rocksdb::cassandra::Serialize(mask_, dest); - rocksdb::cassandra::Serialize(index_, dest); + ROCKSDB_NAMESPACE::cassandra::Serialize(mask_, dest); + ROCKSDB_NAMESPACE::cassandra::Serialize(index_, dest); } std::shared_ptr ColumnBase::Deserialize(const char* src, std::size_t offset) { - int8_t mask = rocksdb::cassandra::Deserialize(src, offset); + int8_t mask = ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); if ((mask & ColumnTypeMask::DELETION_MASK) != 0) { return Tombstone::Deserialize(src, offset); } else if ((mask & ColumnTypeMask::EXPIRATION_MASK) != 0) { @@ -72,20 +72,22 @@ std::size_t Column::Size() const { void Column::Serialize(std::string* dest) const { ColumnBase::Serialize(dest); - rocksdb::cassandra::Serialize(timestamp_, dest); - rocksdb::cassandra::Serialize(value_size_, dest); + ROCKSDB_NAMESPACE::cassandra::Serialize(timestamp_, dest); + ROCKSDB_NAMESPACE::cassandra::Serialize(value_size_, dest); dest->append(value_, value_size_); } std::shared_ptr Column::Deserialize(const char *src, std::size_t offset) { - int8_t mask = rocksdb::cassandra::Deserialize(src, offset); + int8_t mask = ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(mask); - int8_t index = rocksdb::cassandra::Deserialize(src, offset); + int8_t index = ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(index); - int64_t timestamp = rocksdb::cassandra::Deserialize(src, offset); + int64_t timestamp = + ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(timestamp); - int32_t value_size = rocksdb::cassandra::Deserialize(src, offset); + int32_t value_size = + ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(value_size); return std::make_shared( mask, index, timestamp, value_size, src + offset); @@ -107,7 +109,7 @@ std::size_t ExpiringColumn::Size() const { void ExpiringColumn::Serialize(std::string* dest) const { Column::Serialize(dest); - rocksdb::cassandra::Serialize(ttl_, dest); + ROCKSDB_NAMESPACE::cassandra::Serialize(ttl_, dest); } std::chrono::time_point ExpiringColumn::TimePoint() const { @@ -138,17 +140,19 @@ std::shared_ptr ExpiringColumn::ToTombstone() const { std::shared_ptr ExpiringColumn::Deserialize( const char *src, std::size_t offset) { - int8_t mask = rocksdb::cassandra::Deserialize(src, offset); + int8_t mask = ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(mask); - int8_t index = rocksdb::cassandra::Deserialize(src, offset); + int8_t index = ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(index); - int64_t timestamp = rocksdb::cassandra::Deserialize(src, offset); + int64_t timestamp = + ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(timestamp); - int32_t value_size = rocksdb::cassandra::Deserialize(src, offset); + int32_t value_size = + ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(value_size); const char* value = src + offset; offset += value_size; - int32_t ttl = rocksdb::cassandra::Deserialize(src, offset); + int32_t ttl = ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); return std::make_shared( mask, index, timestamp, value_size, value, ttl); } @@ -172,8 +176,8 @@ std::size_t Tombstone::Size() const { void Tombstone::Serialize(std::string* dest) const { ColumnBase::Serialize(dest); - rocksdb::cassandra::Serialize(local_deletion_time_, dest); - rocksdb::cassandra::Serialize(marked_for_delete_at_, dest); + ROCKSDB_NAMESPACE::cassandra::Serialize(local_deletion_time_, dest); + ROCKSDB_NAMESPACE::cassandra::Serialize(marked_for_delete_at_, dest); } bool Tombstone::Collectable(int32_t gc_grace_period_in_seconds) const { @@ -185,15 +189,15 @@ bool Tombstone::Collectable(int32_t gc_grace_period_in_seconds) const { std::shared_ptr Tombstone::Deserialize(const char *src, std::size_t offset) { - int8_t mask = rocksdb::cassandra::Deserialize(src, offset); + int8_t mask = ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(mask); - int8_t index = rocksdb::cassandra::Deserialize(src, offset); + int8_t index = ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(index); int32_t local_deletion_time = - rocksdb::cassandra::Deserialize(src, offset); + ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(int32_t); int64_t marked_for_delete_at = - rocksdb::cassandra::Deserialize(src, offset); + ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); return std::make_shared( mask, index, local_deletion_time, marked_for_delete_at); } @@ -231,8 +235,8 @@ bool RowValue::IsTombstone() const { } void RowValue::Serialize(std::string* dest) const { - rocksdb::cassandra::Serialize(local_deletion_time_, dest); - rocksdb::cassandra::Serialize(marked_for_delete_at_, dest); + ROCKSDB_NAMESPACE::cassandra::Serialize(local_deletion_time_, dest); + ROCKSDB_NAMESPACE::cassandra::Serialize(marked_for_delete_at_, dest); for (const auto& column : columns_) { column -> Serialize(dest); } @@ -302,10 +306,10 @@ RowValue RowValue::Deserialize(const char *src, std::size_t size) { std::size_t offset = 0; assert(size >= sizeof(local_deletion_time_) + sizeof(marked_for_delete_at_)); int32_t local_deletion_time = - rocksdb::cassandra::Deserialize(src, offset); + ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(int32_t); int64_t marked_for_delete_at = - rocksdb::cassandra::Deserialize(src, offset); + ROCKSDB_NAMESPACE::cassandra::Deserialize(src, offset); offset += sizeof(int64_t); if (offset == size) { return RowValue(local_deletion_time, marked_for_delete_at); @@ -383,4 +387,4 @@ RowValue RowValue::Merge(std::vector&& values) { } } // namepsace cassandrda -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/cassandra/format.h b/utilities/cassandra/format.h index b7f6e32f6b..3f9b433c71 100644 --- a/utilities/cassandra/format.h +++ b/utilities/cassandra/format.h @@ -62,7 +62,7 @@ #include "rocksdb/slice.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { // Identify the type of the column. @@ -194,4 +194,4 @@ private: }; } // namepsace cassandrda -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/cassandra/merge_operator.cc b/utilities/cassandra/merge_operator.cc index 4e529a6f2a..82fe5d6614 100644 --- a/utilities/cassandra/merge_operator.cc +++ b/utilities/cassandra/merge_operator.cc @@ -13,7 +13,7 @@ #include "utilities/merge_operators.h" #include "utilities/cassandra/format.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { // Implementation for the merge operation (merges two Cassandra values) @@ -64,4 +64,4 @@ const char* CassandraValueMergeOperator::Name() const { } // namespace cassandra -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/cassandra/merge_operator.h b/utilities/cassandra/merge_operator.h index 4d02c26de4..b5bf7c520e 100644 --- a/utilities/cassandra/merge_operator.h +++ b/utilities/cassandra/merge_operator.h @@ -7,7 +7,7 @@ #include "rocksdb/merge_operator.h" #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { /** @@ -41,4 +41,4 @@ private: size_t operands_limit_; }; } // namespace cassandra -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/cassandra/serialize.h b/utilities/cassandra/serialize.h index 64ccd4c29f..cd980ade0f 100644 --- a/utilities/cassandra/serialize.h +++ b/utilities/cassandra/serialize.h @@ -10,7 +10,7 @@ #pragma once -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { namespace { const int64_t kCharMask = 0xFFLL; @@ -72,4 +72,4 @@ inline int64_t Deserialize(const char* src, std::size_t offset) { } } // namepsace cassandrda -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/cassandra/test_utils.cc b/utilities/cassandra/test_utils.cc index d4dc8f00a4..47919bf626 100644 --- a/utilities/cassandra/test_utils.cc +++ b/utilities/cassandra/test_utils.cc @@ -5,7 +5,7 @@ #include "test_utils.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { const char kData[] = {'d', 'a', 't', 'a'}; const char kExpiringData[] = {'e', 'd', 'a', 't', 'a'}; @@ -72,4 +72,4 @@ int32_t ToSeconds(int64_t microseconds) { return (int32_t)(microseconds / (int64_t)1000000); } } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/cassandra/test_utils.h b/utilities/cassandra/test_utils.h index f58bd73001..235b35a029 100644 --- a/utilities/cassandra/test_utils.h +++ b/utilities/cassandra/test_utils.h @@ -9,7 +9,7 @@ #include "utilities/cassandra/format.h" #include "utilities/cassandra/serialize.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace cassandra { extern const char kData[]; extern const char kExpiringData[]; @@ -43,4 +43,4 @@ void VerifyRowValueColumns( int64_t ToMicroSeconds(int64_t seconds); int32_t ToSeconds(int64_t microseconds); } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/checkpoint/checkpoint_impl.cc b/utilities/checkpoint/checkpoint_impl.cc index 33cf9ae1da..98e6096099 100644 --- a/utilities/checkpoint/checkpoint_impl.cc +++ b/utilities/checkpoint/checkpoint_impl.cc @@ -27,7 +27,7 @@ #include "rocksdb/utilities/checkpoint.h" #include "test_util/sync_point.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status Checkpoint::Create(DB* db, Checkpoint** checkpoint_ptr) { *checkpoint_ptr = new CheckpointImpl(db); @@ -363,7 +363,7 @@ Status CheckpointImpl::ExportColumnFamily( s = db_->GetEnv()->CreateDir(tmp_export_dir); if (s.ok()) { - s = db_->Flush(rocksdb::FlushOptions(), handle); + s = db_->Flush(ROCKSDB_NAMESPACE::FlushOptions(), handle); } ColumnFamilyMetaData db_metadata; @@ -511,6 +511,6 @@ Status CheckpointImpl::ExportFilesInMetaData( return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/checkpoint/checkpoint_impl.h b/utilities/checkpoint/checkpoint_impl.h index 0d87b635b8..81ee8320b5 100644 --- a/utilities/checkpoint/checkpoint_impl.h +++ b/utilities/checkpoint/checkpoint_impl.h @@ -12,7 +12,7 @@ #include "file/filename.h" #include "rocksdb/db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CheckpointImpl : public Checkpoint { public: @@ -74,6 +74,6 @@ class CheckpointImpl : public Checkpoint { DB* db_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/checkpoint/checkpoint_test.cc b/utilities/checkpoint/checkpoint_test.cc index d7410960a4..1a31c40ff7 100644 --- a/utilities/checkpoint/checkpoint_test.cc +++ b/utilities/checkpoint/checkpoint_test.cc @@ -28,7 +28,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CheckpointTest : public testing::Test { protected: // Sequence of option configurations to try @@ -75,9 +75,9 @@ class CheckpointTest : public testing::Test { } ~CheckpointTest() override { - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->LoadDependency({}); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({}); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); if (cfh_reverse_comp_) { EXPECT_OK(db_->DestroyColumnFamilyHandle(cfh_reverse_comp_)); cfh_reverse_comp_ = nullptr; @@ -417,11 +417,11 @@ TEST_F(CheckpointTest, ExportColumnFamilyNegativeTest) { TEST_F(CheckpointTest, CheckpointCF) { Options options = CurrentOptions(); CreateAndReopenWithCF({"one", "two", "three", "four", "five"}, options); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"CheckpointTest::CheckpointCF:2", "DBImpl::GetLiveFiles:2"}, {"DBImpl::GetLiveFiles:1", "CheckpointTest::CheckpointCF:1"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(Put(0, "Default", "Default")); ASSERT_OK(Put(1, "one", "one")); @@ -437,7 +437,7 @@ TEST_F(CheckpointTest, CheckpointCF) { Status s; // Take a snapshot - rocksdb::port::Thread t([&]() { + ROCKSDB_NAMESPACE::port::Thread t([&]() { Checkpoint* checkpoint; ASSERT_OK(Checkpoint::Create(db_, &checkpoint)); ASSERT_OK(checkpoint->CreateCheckpoint(snapshot_name_)); @@ -452,7 +452,7 @@ TEST_F(CheckpointTest, CheckpointCF) { ASSERT_OK(Put(5, "five", "fifteen")); TEST_SYNC_POINT("CheckpointTest::CheckpointCF:2"); t.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_OK(Put(1, "one", "twentyone")); ASSERT_OK(Put(2, "two", "twentytwo")); ASSERT_OK(Put(3, "three", "twentythree")); @@ -487,7 +487,7 @@ TEST_F(CheckpointTest, CheckpointCFNoFlush) { Options options = CurrentOptions(); CreateAndReopenWithCF({"one", "two", "three", "four", "five"}, options); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(Put(0, "Default", "Default")); ASSERT_OK(Put(1, "one", "one")); @@ -501,16 +501,16 @@ TEST_F(CheckpointTest, CheckpointCFNoFlush) { Status s; // Take a snapshot - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCallFlush:start", [&](void* /*arg*/) { // Flush should never trigger. FAIL(); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); Checkpoint* checkpoint; ASSERT_OK(Checkpoint::Create(db_, &checkpoint)); ASSERT_OK(checkpoint->CreateCheckpoint(snapshot_name_, 1000000)); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); delete checkpoint; ASSERT_OK(Put(1, "one", "two")); @@ -548,7 +548,7 @@ TEST_F(CheckpointTest, CurrentFileModifiedWhileCheckpointing) { options.max_manifest_file_size = 0; // always rollover manifest for file add Reopen(options); - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {// Get past the flush in the checkpoint thread before adding any keys to // the db so the checkpoint thread won't hit the WriteManifest // syncpoints. @@ -560,9 +560,9 @@ TEST_F(CheckpointTest, CurrentFileModifiedWhileCheckpointing) { "VersionSet::LogAndApply:WriteManifest"}, {"VersionSet::LogAndApply:WriteManifestDone", "CheckpointImpl::CreateCheckpoint:SavedLiveFiles2"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread t([&]() { + ROCKSDB_NAMESPACE::port::Thread t([&]() { Checkpoint* checkpoint; ASSERT_OK(Checkpoint::Create(db_, &checkpoint)); ASSERT_OK(checkpoint->CreateCheckpoint(snapshot_name_)); @@ -574,7 +574,7 @@ TEST_F(CheckpointTest, CurrentFileModifiedWhileCheckpointing) { ASSERT_OK(Flush()); t.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); DB* snapshotDB; // Successful Open() implies that CURRENT pointed to the manifest in the @@ -636,13 +636,13 @@ TEST_F(CheckpointTest, CurrentFileModifiedWhileCheckpointing2PC) { } delete tx; } - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"CheckpointImpl::CreateCheckpoint:SavedLiveFiles1", "CheckpointTest::CurrentFileModifiedWhileCheckpointing2PC:PreCommit"}, {"CheckpointTest::CurrentFileModifiedWhileCheckpointing2PC:PostCommit", "CheckpointImpl::CreateCheckpoint:SavedLiveFiles2"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread t([&]() { + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::port::Thread t([&]() { Checkpoint* checkpoint; ASSERT_OK(Checkpoint::Create(txdb, &checkpoint)); ASSERT_OK(checkpoint->CreateCheckpoint(snapshot_name_)); @@ -656,7 +656,7 @@ TEST_F(CheckpointTest, CurrentFileModifiedWhileCheckpointing2PC) { "CheckpointTest::CurrentFileModifiedWhileCheckpointing2PC:PostCommit"); t.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); // No more than two logs files should exist. std::vector files; @@ -682,7 +682,7 @@ TEST_F(CheckpointTest, CurrentFileModifiedWhileCheckpointing2PC) { ColumnFamilyDescriptor("CFA", ColumnFamilyOptions())); column_families.push_back( ColumnFamilyDescriptor("CFB", ColumnFamilyOptions())); - std::vector cf_handles; + std::vector cf_handles; ASSERT_OK(TransactionDB::Open(options, txn_db_options, snapshot_name_, column_families, &cf_handles, &snapshotDB)); ASSERT_OK(snapshotDB->Get(read_options, "foo", &value)); @@ -810,10 +810,10 @@ TEST_F(CheckpointTest, CheckpointReadOnlyDBWithMultipleColumnFamilies) { delete snapshot_db; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc b/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc index 49760ba5a9..c97eef41da 100644 --- a/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc +++ b/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc @@ -10,7 +10,7 @@ #include "rocksdb/slice.h" #include "utilities/compaction_filters/remove_emptyvalue_compactionfilter.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const char* RemoveEmptyValueCompactionFilter::Name() const { return "RemoveEmptyValueCompactionFilter"; @@ -25,5 +25,5 @@ bool RemoveEmptyValueCompactionFilter::Filter(int /*level*/, return existing_value.empty(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/compaction_filters/remove_emptyvalue_compactionfilter.h b/utilities/compaction_filters/remove_emptyvalue_compactionfilter.h index b4a389bc1b..f5dbec900a 100644 --- a/utilities/compaction_filters/remove_emptyvalue_compactionfilter.h +++ b/utilities/compaction_filters/remove_emptyvalue_compactionfilter.h @@ -12,7 +12,7 @@ #include "rocksdb/compaction_filter.h" #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class RemoveEmptyValueCompactionFilter : public CompactionFilter { public: @@ -23,5 +23,5 @@ class RemoveEmptyValueCompactionFilter : public CompactionFilter { std::string* new_value, bool* value_changed) const override; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/convenience/info_log_finder.cc b/utilities/convenience/info_log_finder.cc index 646362aa2c..980262f22f 100644 --- a/utilities/convenience/info_log_finder.cc +++ b/utilities/convenience/info_log_finder.cc @@ -11,7 +11,7 @@ #include "file/filename.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status GetInfoLogList(DB* db, std::vector* info_log_list) { if (!db) { @@ -22,4 +22,4 @@ Status GetInfoLogList(DB* db, std::vector* info_log_list) { return GetInfoLogFiles(options.env, options.db_log_dir, db->GetName(), &parent_path, info_log_list); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/debug.cc b/utilities/debug.cc index 3c35f4c112..b51f9da0d0 100644 --- a/utilities/debug.cc +++ b/utilities/debug.cc @@ -9,7 +9,7 @@ #include "db/db_impl/db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status GetAllKeyVersions(DB* db, Slice begin_key, Slice end_key, size_t max_num_ikeys, @@ -75,6 +75,6 @@ Status GetAllKeyVersions(DB* db, ColumnFamilyHandle* cfh, Slice begin_key, return Status::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/env_librados.cc b/utilities/env_librados.cc index 73482ac6ae..5842edbc70 100644 --- a/utilities/env_librados.cc +++ b/utilities/env_librados.cc @@ -6,7 +6,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { /* GLOBAL DIFINE */ // #define DEBUG #ifdef DEBUG @@ -1494,4 +1494,4 @@ EnvLibrados* EnvLibrados::Default() { return &default_env; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/env_librados_test.cc b/utilities/env_librados_test.cc index e5f9189459..d5167acc00 100644 --- a/utilities/env_librados_test.cc +++ b/utilities/env_librados_test.cc @@ -45,7 +45,7 @@ private: high_resolution_clock::time_point _start; }; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class EnvLibradosTest : public testing::Test { public: @@ -390,7 +390,7 @@ TEST_F(EnvLibradosTest, DBLoadKeysInRandomOrder) { Status s1 = DB::Open(options1, kDBPath1, &db1); assert(s1.ok()); - rocksdb::Random64 r1(time(nullptr)); + ROCKSDB_NAMESPACE::Random64 r1(time(nullptr)); timer.Reset(); for (int i = 0; i < max_loop; ++i) { @@ -426,7 +426,7 @@ TEST_F(EnvLibradosTest, DBLoadKeysInRandomOrder) { Status s2 = DB::Open(options2, kDBPath2, &db2); assert(s2.ok()); - rocksdb::Random64 r2(time(nullptr)); + ROCKSDB_NAMESPACE::Random64 r2(time(nullptr)); timer.Reset(); for (int i = 0; i < max_loop; ++i) { @@ -468,7 +468,7 @@ TEST_F(EnvLibradosTest, DBBulkLoadKeysInRandomOrder) { Status s1 = DB::Open(options1, kDBPath1, &db1); assert(s1.ok()); - rocksdb::Random64 r1(time(nullptr)); + ROCKSDB_NAMESPACE::Random64 r1(time(nullptr)); timer.Reset(); for (int i = 0; i < max_loop; ++i) { @@ -507,7 +507,7 @@ TEST_F(EnvLibradosTest, DBBulkLoadKeysInRandomOrder) { Status s2 = DB::Open(options2, kDBPath2, &db2); assert(s2.ok()); - rocksdb::Random64 r2(time(nullptr)); + ROCKSDB_NAMESPACE::Random64 r2(time(nullptr)); timer.Reset(); for (int i = 0; i < max_loop; ++i) { @@ -552,7 +552,7 @@ TEST_F(EnvLibradosTest, DBBulkLoadKeysInSequentialOrder) { Status s1 = DB::Open(options1, kDBPath1, &db1); assert(s1.ok()); - rocksdb::Random64 r1(time(nullptr)); + ROCKSDB_NAMESPACE::Random64 r1(time(nullptr)); timer.Reset(); for (int i = 0; i < max_loop; ++i) { @@ -591,7 +591,7 @@ TEST_F(EnvLibradosTest, DBBulkLoadKeysInSequentialOrder) { Status s2 = DB::Open(options2, kDBPath2, &db2); assert(s2.ok()); - rocksdb::Random64 r2(time(nullptr)); + ROCKSDB_NAMESPACE::Random64 r2(time(nullptr)); timer.Reset(); for (int i = 0; i < max_loop; ++i) { @@ -637,8 +637,7 @@ TEST_F(EnvLibradosTest, DBRandomRead) { Status s1 = DB::Open(options1, kDBPath1, &db1); assert(s1.ok()); - rocksdb::Random64 r1(time(nullptr)); - + ROCKSDB_NAMESPACE::Random64 r1(time(nullptr)); for (int i = 0; i < max_loop; ++i) { WriteBatch batch; @@ -689,7 +688,7 @@ TEST_F(EnvLibradosTest, DBRandomRead) { Status s2 = DB::Open(options2, kDBPath2, &db2); assert(s2.ok()); - rocksdb::Random64 r2(time(nullptr)); + ROCKSDB_NAMESPACE::Random64 r2(time(nullptr)); for (int i = 0; i < max_loop; ++i) { WriteBatch batch; @@ -936,7 +935,7 @@ TEST_F(EnvLibradosMutipoolTest, DBBulkLoadKeysInRandomOrder) { Status s1 = DB::Open(options1, kDBPath1, &db1); assert(s1.ok()); - rocksdb::Random64 r1(time(nullptr)); + ROCKSDB_NAMESPACE::Random64 r1(time(nullptr)); timer.Reset(); for (int i = 0; i < max_loop; ++i) { @@ -979,7 +978,7 @@ TEST_F(EnvLibradosMutipoolTest, DBBulkLoadKeysInRandomOrder) { } assert(s2.ok()); - rocksdb::Random64 r2(time(nullptr)); + ROCKSDB_NAMESPACE::Random64 r2(time(nullptr)); timer.Reset(); for (int i = 0; i < max_loop; ++i) { @@ -1129,7 +1128,7 @@ TEST_F(EnvLibradosMutipoolTest, DBTransactionDB) { DestroyDB(kDBPath, options); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/env_mirror.cc b/utilities/env_mirror.cc index e83f5a6050..dbb5e8021f 100644 --- a/utilities/env_mirror.cc +++ b/utilities/env_mirror.cc @@ -11,7 +11,7 @@ #include "rocksdb/utilities/env_mirror.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // An implementation of Env that mirrors all work over two backend // Env's. This is useful for debugging purposes. @@ -258,5 +258,5 @@ Status EnvMirror::ReuseWritableFile(const std::string& fname, return as; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/env_mirror_test.cc b/utilities/env_mirror_test.cc index 6b20f1f133..0be9d7db2e 100644 --- a/utilities/env_mirror_test.cc +++ b/utilities/env_mirror_test.cc @@ -10,7 +10,7 @@ #include "env/mock_env.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class EnvMirrorTest : public testing::Test { public: @@ -205,7 +205,7 @@ TEST_F(EnvMirrorTest, LargeWrite) { delete[] scratch; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/env_timed.cc b/utilities/env_timed.cc index 82fc6401c6..fc6627da2f 100644 --- a/utilities/env_timed.cc +++ b/utilities/env_timed.cc @@ -7,7 +7,7 @@ #include "rocksdb/env.h" #include "rocksdb/status.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE @@ -142,4 +142,4 @@ Env* NewTimedEnv(Env* /*base_env*/) { return nullptr; } #endif // !ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/env_timed_test.cc b/utilities/env_timed_test.cc index 989c79a391..f1695185e6 100644 --- a/utilities/env_timed_test.cc +++ b/utilities/env_timed_test.cc @@ -9,7 +9,7 @@ #include "rocksdb/perf_context.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TimedEnvTest : public testing::Test { }; @@ -26,7 +26,7 @@ TEST_F(TimedEnvTest, BasicTest) { ASSERT_GT(get_perf_context()->env_new_writable_file_nanos, 0); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/leveldb_options/leveldb_options.cc b/utilities/leveldb_options/leveldb_options.cc index 977585fbd7..5698b21ce2 100644 --- a/utilities/leveldb_options/leveldb_options.cc +++ b/utilities/leveldb_options/leveldb_options.cc @@ -15,7 +15,7 @@ #include "rocksdb/options.h" #include "rocksdb/table.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { LevelDBOptions::LevelDBOptions() : comparator(BytewiseComparator()), @@ -53,4 +53,4 @@ Options ConvertOptions(const LevelDBOptions& leveldb_options) { return options; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/memory/memory_test.cc b/utilities/memory/memory_test.cc index 9181ff7dfd..9e253df44a 100644 --- a/utilities/memory/memory_test.cc +++ b/utilities/memory/memory_test.cc @@ -15,7 +15,7 @@ #include "test_util/testutil.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MemoryTest : public testing::Test { public: @@ -257,7 +257,7 @@ TEST_F(MemoryTest, MemTableAndTableReadersTotal) { delete dbs[i]; } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { #if !(defined NDEBUG) || !defined(OS_WIN) diff --git a/utilities/memory/memory_util.cc b/utilities/memory/memory_util.cc index 47ca4b7bb7..13c81aec4a 100644 --- a/utilities/memory/memory_util.cc +++ b/utilities/memory/memory_util.cc @@ -9,7 +9,7 @@ #include "db/db_impl/db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status MemoryUtil::GetApproximateMemoryUsageByType( const std::vector& dbs, @@ -48,5 +48,5 @@ Status MemoryUtil::GetApproximateMemoryUsageByType( return Status::OK(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/merge_operators.h b/utilities/merge_operators.h index 6e3464bdfb..018d097b1f 100644 --- a/utilities/merge_operators.h +++ b/utilities/merge_operators.h @@ -11,7 +11,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MergeOperators { public: @@ -52,4 +52,4 @@ class MergeOperators { } }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/bytesxor.cc b/utilities/merge_operators/bytesxor.cc index 1444580eb4..859affb5ec 100644 --- a/utilities/merge_operators/bytesxor.cc +++ b/utilities/merge_operators/bytesxor.cc @@ -8,7 +8,7 @@ #include "utilities/merge_operators/bytesxor.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::shared_ptr MergeOperators::CreateBytesXOROperator() { return std::make_shared(); @@ -56,4 +56,4 @@ void BytesXOROperator::XOR(const Slice* existing_value, } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/bytesxor.h b/utilities/merge_operators/bytesxor.h index 762e372445..ab0c5aecc6 100644 --- a/utilities/merge_operators/bytesxor.h +++ b/utilities/merge_operators/bytesxor.h @@ -14,7 +14,7 @@ #include "util/coding.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A 'model' merge operator that XORs two (same sized) array of bytes. // Implemented as an AssociativeMergeOperator for simplicity and example. @@ -36,4 +36,4 @@ class BytesXOROperator : public AssociativeMergeOperator { std::string* new_value) const; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/max.cc b/utilities/merge_operators/max.cc index 1ef66a34b0..2270c1f031 100644 --- a/utilities/merge_operators/max.cc +++ b/utilities/merge_operators/max.cc @@ -9,9 +9,9 @@ #include "rocksdb/slice.h" #include "utilities/merge_operators.h" -using rocksdb::Slice; -using rocksdb::Logger; -using rocksdb::MergeOperator; +using ROCKSDB_NAMESPACE::Logger; +using ROCKSDB_NAMESPACE::MergeOperator; +using ROCKSDB_NAMESPACE::Slice; namespace { // anonymous namespace @@ -69,9 +69,9 @@ class MaxOperator : public MergeOperator { } // end of anonymous namespace -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::shared_ptr MergeOperators::CreateMaxOperator() { return std::make_shared(); } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/put.cc b/utilities/merge_operators/put.cc index a4b135fef5..901d69e945 100644 --- a/utilities/merge_operators/put.cc +++ b/utilities/merge_operators/put.cc @@ -8,7 +8,7 @@ #include "rocksdb/merge_operator.h" #include "utilities/merge_operators.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; namespace { // anonymous namespace @@ -71,7 +71,7 @@ class PutOperatorV2 : public PutOperator { } // end of anonymous namespace -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::shared_ptr MergeOperators::CreateDeprecatedPutOperator() { return std::make_shared(); @@ -80,4 +80,4 @@ std::shared_ptr MergeOperators::CreateDeprecatedPutOperator() { std::shared_ptr MergeOperators::CreatePutOperator() { return std::make_shared(); } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/sortlist.cc b/utilities/merge_operators/sortlist.cc index 3d0de94f50..b6bd65b36a 100644 --- a/utilities/merge_operators/sortlist.cc +++ b/utilities/merge_operators/sortlist.cc @@ -7,11 +7,11 @@ #include "rocksdb/slice.h" #include "utilities/merge_operators.h" -using rocksdb::Logger; -using rocksdb::MergeOperator; -using rocksdb::Slice; +using ROCKSDB_NAMESPACE::Logger; +using ROCKSDB_NAMESPACE::MergeOperator; +using ROCKSDB_NAMESPACE::Slice; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { bool SortList::FullMergeV2(const MergeOperationInput& merge_in, MergeOperationOutput* merge_out) const { @@ -97,4 +97,4 @@ std::vector SortList::Merge(std::vector& left, std::shared_ptr MergeOperators::CreateSortOperator() { return std::make_shared(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/sortlist.h b/utilities/merge_operators/sortlist.h index 02c93edf5e..5e08bd583f 100644 --- a/utilities/merge_operators/sortlist.h +++ b/utilities/merge_operators/sortlist.h @@ -12,7 +12,7 @@ #include "rocksdb/merge_operator.h" #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SortList : public MergeOperator { public: @@ -35,4 +35,4 @@ class SortList : public MergeOperator { std::vector Merge(std::vector& left, std::vector& right) const; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/string_append/stringappend.cc b/utilities/merge_operators/string_append/stringappend.cc index d9c135fd37..534f7a5661 100644 --- a/utilities/merge_operators/string_append/stringappend.cc +++ b/utilities/merge_operators/string_append/stringappend.cc @@ -13,7 +13,7 @@ #include "rocksdb/merge_operator.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Constructor: also specify the delimiter character. StringAppendOperator::StringAppendOperator(char delim_char) @@ -56,4 +56,4 @@ std::shared_ptr MergeOperators::CreateStringAppendOperator(char d return std::make_shared(delim_char); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/string_append/stringappend.h b/utilities/merge_operators/string_append/stringappend.h index 621d15153d..388612f1e2 100644 --- a/utilities/merge_operators/string_append/stringappend.h +++ b/utilities/merge_operators/string_append/stringappend.h @@ -8,7 +8,7 @@ #include "rocksdb/merge_operator.h" #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class StringAppendOperator : public AssociativeMergeOperator { public: @@ -28,4 +28,4 @@ class StringAppendOperator : public AssociativeMergeOperator { }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/string_append/stringappend2.cc b/utilities/merge_operators/string_append/stringappend2.cc index 6e46d80a13..b8c676ee56 100644 --- a/utilities/merge_operators/string_append/stringappend2.cc +++ b/utilities/merge_operators/string_append/stringappend2.cc @@ -13,7 +13,7 @@ #include "rocksdb/merge_operator.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Constructor: also specify the delimiter character. StringAppendTESTOperator::StringAppendTESTOperator(char delim_char) @@ -114,4 +114,4 @@ MergeOperators::CreateStringAppendTESTOperator() { return std::make_shared(','); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/string_append/stringappend2.h b/utilities/merge_operators/string_append/stringappend2.h index 7379169b6c..452164d8e5 100644 --- a/utilities/merge_operators/string_append/stringappend2.h +++ b/utilities/merge_operators/string_append/stringappend2.h @@ -18,7 +18,7 @@ #include "rocksdb/merge_operator.h" #include "rocksdb/slice.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class StringAppendTESTOperator : public MergeOperator { public: @@ -46,4 +46,4 @@ class StringAppendTESTOperator : public MergeOperator { }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/merge_operators/string_append/stringappend_test.cc b/utilities/merge_operators/string_append/stringappend_test.cc index f0b83f621e..c5f5e3e7cd 100644 --- a/utilities/merge_operators/string_append/stringappend_test.cc +++ b/utilities/merge_operators/string_append/stringappend_test.cc @@ -18,9 +18,9 @@ #include "utilities/merge_operators/string_append/stringappend.h" #include "utilities/merge_operators/string_append/stringappend2.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Path to the database on file system const std::string kDbName = test::PerThreadDBPath("stringappend_test"); @@ -142,7 +142,8 @@ TEST_F(StringAppendOperatorTest, IteratorTest) { slists.Append("k2", "a3"); std::string res; - std::unique_ptr it(db_->NewIterator(ReadOptions())); + std::unique_ptr it( + db_->NewIterator(ReadOptions())); std::string k1("k1"); std::string k2("k2"); bool first = true; @@ -466,7 +467,7 @@ TEST_F(StringAppendOperatorTest, PersistentFlushAndCompaction) { // Append, Flush, Get slists.Append("c", "asdasd"); - db->Flush(rocksdb::FlushOptions()); + db->Flush(ROCKSDB_NAMESPACE::FlushOptions()); success = slists.Get("c", &c); ASSERT_TRUE(success); ASSERT_EQ(c, "asdasd"); @@ -474,7 +475,7 @@ TEST_F(StringAppendOperatorTest, PersistentFlushAndCompaction) { // Append, Flush, Append, Get slists.Append("a", "x"); slists.Append("b", "y"); - db->Flush(rocksdb::FlushOptions()); + db->Flush(ROCKSDB_NAMESPACE::FlushOptions()); slists.Append("a", "t"); slists.Append("a", "r"); slists.Append("b", "2"); @@ -545,7 +546,7 @@ TEST_F(StringAppendOperatorTest, PersistentFlushAndCompaction) { // Append, Flush, Compact, Get slists.Append("b", "afcg"); - db->Flush(rocksdb::FlushOptions()); + db->Flush(ROCKSDB_NAMESPACE::FlushOptions()); db->CompactRange(CompactRangeOptions(), nullptr, nullptr); slists.Get("b", &b); ASSERT_EQ(b, "y\n2\nmonkey\ndf\nl;\nafcg"); @@ -575,7 +576,7 @@ TEST_F(StringAppendOperatorTest, SimpleTestNullDelimiter) { ASSERT_EQ(res, checker); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/merge_operators/uint64add.cc b/utilities/merge_operators/uint64add.cc index e71ecfd9a5..3ef2409282 100644 --- a/utilities/merge_operators/uint64add.cc +++ b/utilities/merge_operators/uint64add.cc @@ -12,7 +12,7 @@ #include "util/coding.h" #include "utilities/merge_operators.h" -using namespace rocksdb; +using namespace ROCKSDB_NAMESPACE; namespace { // anonymous namespace @@ -60,10 +60,10 @@ class UInt64AddOperator : public AssociativeMergeOperator { } -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::shared_ptr MergeOperators::CreateUInt64AddOperator() { return std::make_shared(); } -} +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/object_registry.cc b/utilities/object_registry.cc index 3706e791e0..38e55020e7 100644 --- a/utilities/object_registry.cc +++ b/utilities/object_registry.cc @@ -8,7 +8,7 @@ #include "logging/logging.h" #include "rocksdb/env.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE // Looks through the "type" factories for one that matches "name". // If found, returns the pointer to the Entry matching this name. @@ -84,4 +84,4 @@ void ObjectRegistry::Dump(Logger *logger) const { } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/object_registry_test.cc b/utilities/object_registry_test.cc index 826931845d..bbb76b142b 100644 --- a/utilities/object_registry_test.cc +++ b/utilities/object_registry_test.cc @@ -8,7 +8,7 @@ #include "rocksdb/utilities/object_registry.h" #include "test_util/testharness.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class EnvRegistryTest : public testing::Test { public: @@ -156,7 +156,7 @@ TEST_F(EnvRegistryTest, CheckUnique) { ASSERT_EQ(unique, nullptr); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/option_change_migration/option_change_migration.cc b/utilities/option_change_migration/option_change_migration.cc index f83481cf7c..f2382297bf 100644 --- a/utilities/option_change_migration/option_change_migration.cc +++ b/utilities/option_change_migration/option_change_migration.cc @@ -8,7 +8,7 @@ #ifndef ROCKSDB_LITE #include "rocksdb/db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { // Return a version of Options `opts` that allow us to open/write into a DB // without triggering an automatic compaction or stalling. This is guaranteed @@ -156,13 +156,13 @@ Status OptionChangeMigration(std::string dbname, const Options& old_opts, "Do not how to migrate to this compaction style"); } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #else -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status OptionChangeMigration(std::string /*dbname*/, const Options& /*old_opts*/, const Options& /*new_opts*/) { return Status::NotSupported(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/option_change_migration/option_change_migration_test.cc b/utilities/option_change_migration/option_change_migration_test.cc index 1f239b71c3..5bc883ff75 100644 --- a/utilities/option_change_migration/option_change_migration_test.cc +++ b/utilities/option_change_migration/option_change_migration_test.cc @@ -11,7 +11,7 @@ #include #include "db/db_test_util.h" #include "port/stack_trace.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBOptionChangeMigrationTests : public DBTestBase, @@ -416,10 +416,10 @@ TEST_F(DBOptionChangeMigrationTest, CompactedSrcToUniversal) { } #endif // ROCKSDB_LITE -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/options/options_util.cc b/utilities/options/options_util.cc index fb5b3c2e7f..0719798e31 100644 --- a/utilities/options/options_util.cc +++ b/utilities/options/options_util.cc @@ -12,7 +12,7 @@ #include "options/options_parser.h" #include "rocksdb/options.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status LoadOptionsFromFile(const std::string& file_name, Env* env, DBOptions* db_options, std::vector* cf_descs, @@ -110,5 +110,5 @@ Status CheckOptionsCompatibility( kDefaultLevel, ignore_unknown_options); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/options/options_util_test.cc b/utilities/options/options_util_test.cc index cebaf9e3f7..30ad76a99d 100644 --- a/utilities/options/options_util_test.cc +++ b/utilities/options/options_util_test.cc @@ -26,7 +26,7 @@ using GFLAGS_NAMESPACE::ParseCommandLineFlags; DEFINE_bool(enable_print, false, "Print options generated to console."); #endif // GFLAGS -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class OptionsUtilTest : public testing::Test { public: OptionsUtilTest() : rnd_(0xFB) { @@ -343,7 +343,7 @@ TEST_F(OptionsUtilTest, SanityCheck) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/persistent_cache/block_cache_tier.cc b/utilities/persistent_cache/block_cache_tier.cc index 2169f90695..6587375717 100644 --- a/utilities/persistent_cache/block_cache_tier.cc +++ b/utilities/persistent_cache/block_cache_tier.cc @@ -16,7 +16,7 @@ #include "util/stop_watch.h" #include "utilities/persistent_cache/block_cache_tier_file.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // // BlockCacheImpl @@ -420,6 +420,6 @@ Status NewPersistentCache(Env* const env, const std::string& path, return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ifndef ROCKSDB_LITE diff --git a/utilities/persistent_cache/block_cache_tier.h b/utilities/persistent_cache/block_cache_tier.h index 00dd9a173e..ae0c13fdbe 100644 --- a/utilities/persistent_cache/block_cache_tier.h +++ b/utilities/persistent_cache/block_cache_tier.h @@ -35,7 +35,7 @@ #include "util/crc32c.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // // Block cache tier implementation @@ -141,7 +141,7 @@ class BlockCacheTier : public PersistentCacheTier { port::RWMutex lock_; // Synchronization const PersistentCacheConfig opt_; // BlockCache options BoundedQueue insert_ops_; // Ops waiting for insert - rocksdb::port::Thread insert_th_; // Insert thread + ROCKSDB_NAMESPACE::port::Thread insert_th_; // Insert thread uint32_t writer_cache_id_ = 0; // Current cache file identifier WriteableCacheFile* cache_file_ = nullptr; // Current cache file reference CacheWriteBufferAllocator buffer_allocator_; // Buffer provider @@ -151,6 +151,6 @@ class BlockCacheTier : public PersistentCacheTier { Statistics stats_; // Statistics }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/block_cache_tier_file.cc b/utilities/persistent_cache/block_cache_tier_file.cc index 8e6fb0f81b..87ae603c5b 100644 --- a/utilities/persistent_cache/block_cache_tier_file.cc +++ b/utilities/persistent_cache/block_cache_tier_file.cc @@ -18,7 +18,7 @@ #include "port/port.h" #include "util/crc32c.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // // File creation factories @@ -603,6 +603,6 @@ void ThreadedWriter::DispatchIO(const IO& io) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/block_cache_tier_file.h b/utilities/persistent_cache/block_cache_tier_file.h index b93f8f4b5c..95be4ec3cc 100644 --- a/utilities/persistent_cache/block_cache_tier_file.h +++ b/utilities/persistent_cache/block_cache_tier_file.h @@ -46,7 +46,7 @@ // // Write IO code path : // -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WriteableCacheFile; struct BlockInfo; @@ -291,6 +291,6 @@ class ThreadedWriter : public Writer { std::vector threads_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/block_cache_tier_file_buffer.h b/utilities/persistent_cache/block_cache_tier_file_buffer.h index dd8c83f43e..23013d7201 100644 --- a/utilities/persistent_cache/block_cache_tier_file_buffer.h +++ b/utilities/persistent_cache/block_cache_tier_file_buffer.h @@ -12,7 +12,7 @@ #include "memory/arena.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // // CacheWriteBuffer @@ -124,4 +124,4 @@ class CacheWriteBufferAllocator { std::list bufs_; // Buffer stash }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/persistent_cache/block_cache_tier_metadata.cc b/utilities/persistent_cache/block_cache_tier_metadata.cc index 3382fda31d..c99322e6b6 100644 --- a/utilities/persistent_cache/block_cache_tier_metadata.cc +++ b/utilities/persistent_cache/block_cache_tier_metadata.cc @@ -8,7 +8,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { bool BlockCacheTierMetadata::Insert(BlockCacheFile* file) { return cache_file_index_.Insert(file); @@ -81,6 +81,6 @@ void BlockCacheTierMetadata::RemoveAllKeys(BlockCacheFile* f) { f->block_infos().clear(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/block_cache_tier_metadata.h b/utilities/persistent_cache/block_cache_tier_metadata.h index 14082bb455..92adae2bf8 100644 --- a/utilities/persistent_cache/block_cache_tier_metadata.h +++ b/utilities/persistent_cache/block_cache_tier_metadata.h @@ -17,7 +17,7 @@ #include "utilities/persistent_cache/hash_table_evictable.h" #include "utilities/persistent_cache/lrulist.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // // Block Cache Tier Metadata @@ -120,6 +120,6 @@ class BlockCacheTierMetadata { BlockIndexType block_index_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/hash_table.h b/utilities/persistent_cache/hash_table.h index 874495a7b9..3d0a1f9939 100644 --- a/utilities/persistent_cache/hash_table.h +++ b/utilities/persistent_cache/hash_table.h @@ -18,7 +18,7 @@ #include "rocksdb/env.h" #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // HashTable // @@ -233,6 +233,6 @@ class HashTable { std::unique_ptr locks_; // Granular locks }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/hash_table_bench.cc b/utilities/persistent_cache/hash_table_bench.cc index 7797f458ca..a1f05007ed 100644 --- a/utilities/persistent_cache/hash_table_bench.cc +++ b/utilities/persistent_cache/hash_table_bench.cc @@ -32,7 +32,7 @@ DEFINE_int32(nthread_write, 1, "insert %"); DEFINE_int32(nthread_read, 1, "lookup %"); DEFINE_int32(nthread_erase, 1, "erase %"); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // // HashTableImpl interface @@ -269,7 +269,7 @@ class GranularLockImpl : public HashTableImpl { HashTable impl_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE // // main @@ -284,18 +284,20 @@ int main(int argc, char** argv) { // printf("Micro benchmarking std::unordered_map \n"); { - rocksdb::SimpleImpl impl; - rocksdb::HashTableBenchmark _(&impl, FLAGS_nsec, FLAGS_nthread_write, - FLAGS_nthread_read, FLAGS_nthread_erase); + ROCKSDB_NAMESPACE::SimpleImpl impl; + ROCKSDB_NAMESPACE::HashTableBenchmark _( + &impl, FLAGS_nsec, FLAGS_nthread_write, FLAGS_nthread_read, + FLAGS_nthread_erase); } // // Micro benchmark scalable hash table // printf("Micro benchmarking scalable hash map \n"); { - rocksdb::GranularLockImpl impl; - rocksdb::HashTableBenchmark _(&impl, FLAGS_nsec, FLAGS_nthread_write, - FLAGS_nthread_read, FLAGS_nthread_erase); + ROCKSDB_NAMESPACE::GranularLockImpl impl; + ROCKSDB_NAMESPACE::HashTableBenchmark _( + &impl, FLAGS_nsec, FLAGS_nthread_write, FLAGS_nthread_read, + FLAGS_nthread_erase); } return 0; diff --git a/utilities/persistent_cache/hash_table_evictable.h b/utilities/persistent_cache/hash_table_evictable.h index 40b693cec5..d27205d088 100644 --- a/utilities/persistent_cache/hash_table_evictable.h +++ b/utilities/persistent_cache/hash_table_evictable.h @@ -13,7 +13,7 @@ #include "utilities/persistent_cache/hash_table.h" #include "utilities/persistent_cache/lrulist.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Evictable Hash Table // @@ -163,6 +163,6 @@ class EvictableHashTable : private HashTable { std::unique_ptr lru_lists_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/hash_table_test.cc b/utilities/persistent_cache/hash_table_test.cc index 9cc1534973..62a5b1d40c 100644 --- a/utilities/persistent_cache/hash_table_test.cc +++ b/utilities/persistent_cache/hash_table_test.cc @@ -17,7 +17,7 @@ #ifndef ROCKSDB_LITE -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct HashTableTest : public testing::Test { ~HashTableTest() override { map_.Clear(&HashTableTest::ClearNode); } @@ -151,7 +151,7 @@ TEST_F(EvictableHashTableTest, TestEvict) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif int main(int argc, char** argv) { diff --git a/utilities/persistent_cache/lrulist.h b/utilities/persistent_cache/lrulist.h index 1d2ef3182c..a608890fc3 100644 --- a/utilities/persistent_cache/lrulist.h +++ b/utilities/persistent_cache/lrulist.h @@ -11,7 +11,7 @@ #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // LRU element definition // @@ -169,6 +169,6 @@ class LRUList { T* tail_ = nullptr; // back (hot) }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/persistent_cache_bench.cc b/utilities/persistent_cache/persistent_cache_bench.cc index 8bc795455c..359fcdd1d8 100644 --- a/utilities/persistent_cache/persistent_cache_bench.cc +++ b/utilities/persistent_cache/persistent_cache_bench.cc @@ -43,7 +43,7 @@ DEFINE_string(cache_type, "block_cache", DEFINE_bool(benchmark, false, "Benchmark mode"); DEFINE_int32(volatile_cache_pct, 10, "Percentage of cache in memory tier."); -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::unique_ptr NewVolatileCache() { assert(FLAGS_cache_size != std::numeric_limits::max()); @@ -301,7 +301,7 @@ class CacheTierBenchmark { mutable Stats stats_; // Stats }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE // // main @@ -329,16 +329,16 @@ int main(int argc, char** argv) { fprintf(stderr, "%s\n", msg.str().c_str()); - std::shared_ptr cache; + std::shared_ptr cache; if (FLAGS_cache_type == "block_cache") { fprintf(stderr, "Using block cache implementation\n"); - cache = rocksdb::NewBlockCache(); + cache = ROCKSDB_NAMESPACE::NewBlockCache(); } else if (FLAGS_cache_type == "volatile") { fprintf(stderr, "Using volatile cache implementation\n"); - cache = rocksdb::NewVolatileCache(); + cache = ROCKSDB_NAMESPACE::NewVolatileCache(); } else if (FLAGS_cache_type == "tiered") { fprintf(stderr, "Using tiered cache implementation\n"); - cache = rocksdb::NewTieredCache(); + cache = ROCKSDB_NAMESPACE::NewTieredCache(); } else { fprintf(stderr, "Unknown option for cache\n"); } @@ -349,8 +349,8 @@ int main(int argc, char** argv) { abort(); } - std::unique_ptr benchmark( - new rocksdb::CacheTierBenchmark(std::move(cache))); + std::unique_ptr benchmark( + new ROCKSDB_NAMESPACE::CacheTierBenchmark(std::move(cache))); return 0; } diff --git a/utilities/persistent_cache/persistent_cache_test.cc b/utilities/persistent_cache/persistent_cache_test.cc index e52cf9bbcf..dce6e08e0a 100644 --- a/utilities/persistent_cache/persistent_cache_test.cc +++ b/utilities/persistent_cache/persistent_cache_test.cc @@ -19,7 +19,7 @@ #include "utilities/persistent_cache/block_cache_tier.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { static const double kStressFactor = .125; @@ -27,7 +27,7 @@ static const double kStressFactor = .125; static void OnOpenForRead(void* arg) { int* val = static_cast(arg); *val &= ~O_DIRECT; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "NewRandomAccessFile:O_DIRECT", std::bind(OnOpenForRead, std::placeholders::_1)); } @@ -35,7 +35,7 @@ static void OnOpenForRead(void* arg) { static void OnOpenForWrite(void* arg) { int* val = static_cast(arg); *val &= ~O_DIRECT; - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "NewWritableFile:O_DIRECT", std::bind(OnOpenForWrite, std::placeholders::_1)); } @@ -137,11 +137,11 @@ std::unique_ptr NewTieredCache( PersistentCacheTierTest::PersistentCacheTierTest() : path_(test::PerThreadDBPath("cache_test")) { #ifdef OS_LINUX - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::SyncPoint::GetInstance()->SetCallBack("NewRandomAccessFile:O_DIRECT", - OnOpenForRead); - rocksdb::SyncPoint::GetInstance()->SetCallBack("NewWritableFile:O_DIRECT", - OnOpenForWrite); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "NewRandomAccessFile:O_DIRECT", OnOpenForRead); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "NewWritableFile:O_DIRECT", OnOpenForWrite); #endif } @@ -150,14 +150,14 @@ TEST_F(PersistentCacheTierTest, DISABLED_BlockCacheInsertWithFileCreateError) { cache_ = NewBlockCache(Env::Default(), path_, /*size=*/std::numeric_limits::max(), /*direct_writes=*/ false); - rocksdb::SyncPoint::GetInstance()->SetCallBack( - "BlockCacheTier::NewCacheFile:DeleteDir", OnDeleteDir); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "BlockCacheTier::NewCacheFile:DeleteDir", OnDeleteDir); RunNegativeInsertTest(/*nthreads=*/ 1, /*max_keys*/ static_cast(10 * 1024 * kStressFactor)); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } #if defined(TRAVIS) || defined(ROCKSDB_VALGRIND_RUN) @@ -273,8 +273,8 @@ static void UniqueIdCallback(void* arg) { *result = 0; } - rocksdb::SyncPoint::GetInstance()->ClearTrace(); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "GetUniqueIdFromFile:FS_IOC_GETVERSION", UniqueIdCallback); } #endif @@ -296,11 +296,11 @@ TEST_F(PersistentCacheTierTest, FactoryTest) { PersistentCacheDBTest::PersistentCacheDBTest() : DBTestBase("/cache_test") { #ifdef OS_LINUX - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "GetUniqueIdFromFile:FS_IOC_GETVERSION", UniqueIdCallback); - rocksdb::SyncPoint::GetInstance()->SetCallBack("NewRandomAccessFile:O_DIRECT", - OnOpenForRead); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( + "NewRandomAccessFile:O_DIRECT", OnOpenForRead); #endif } @@ -319,7 +319,7 @@ void PersistentCacheDBTest::RunTest( Options options; options.write_buffer_size = static_cast(64 * 1024 * kStressFactor); // small write buffer - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options = CurrentOptions(options); // setup page cache @@ -463,7 +463,7 @@ TEST_F(PersistentCacheDBTest, TieredCacheTest) { } #endif -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/persistent_cache/persistent_cache_test.h b/utilities/persistent_cache/persistent_cache_test.h index 29c334442c..47611ecd30 100644 --- a/utilities/persistent_cache/persistent_cache_test.h +++ b/utilities/persistent_cache/persistent_cache_test.h @@ -26,7 +26,7 @@ #include "test_util/testharness.h" #include "utilities/persistent_cache/volatile_tier_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // // Unit tests for testing PersistentCacheTier @@ -280,6 +280,6 @@ class PersistentCacheDBTest : public DBTestBase { const size_t max_keys, const size_t max_usecase); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/persistent_cache_tier.cc b/utilities/persistent_cache/persistent_cache_tier.cc index 01b675aec5..3847a4ee9b 100644 --- a/utilities/persistent_cache/persistent_cache_tier.cc +++ b/utilities/persistent_cache/persistent_cache_tier.cc @@ -11,7 +11,7 @@ #include #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { std::string PersistentCacheConfig::ToString() const { std::string ret; @@ -158,6 +158,6 @@ bool PersistentTieredCache::IsCompressed() { return tiers_.front()->IsCompressed(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/persistent_cache_tier.h b/utilities/persistent_cache/persistent_cache_tier.h index 8803c33558..3905957ded 100644 --- a/utilities/persistent_cache/persistent_cache_tier.h +++ b/utilities/persistent_cache/persistent_cache_tier.h @@ -52,7 +52,7 @@ // | // V // null -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Persistent Cache Config // @@ -331,6 +331,6 @@ class PersistentTieredCache : public PersistentCacheTier { std::list tiers_; // list of tiers top-down }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/persistent_cache_util.h b/utilities/persistent_cache/persistent_cache_util.h index 254c038f98..2a769652db 100644 --- a/utilities/persistent_cache/persistent_cache_util.h +++ b/utilities/persistent_cache/persistent_cache_util.h @@ -9,7 +9,7 @@ #include "util/mutexlock.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // // Simple synchronized queue implementation with the option of @@ -64,4 +64,4 @@ class BoundedQueue { const size_t max_size_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/persistent_cache/volatile_tier_impl.cc b/utilities/persistent_cache/volatile_tier_impl.cc index 177fc91690..ee63f828cb 100644 --- a/utilities/persistent_cache/volatile_tier_impl.cc +++ b/utilities/persistent_cache/volatile_tier_impl.cc @@ -9,7 +9,7 @@ #include -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void VolatileCacheTier::DeleteCacheData(VolatileCacheTier::CacheData* data) { assert(data); @@ -133,6 +133,6 @@ bool VolatileCacheTier::Evict() { return true; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/persistent_cache/volatile_tier_impl.h b/utilities/persistent_cache/volatile_tier_impl.h index dba500ccbb..6116e894bf 100644 --- a/utilities/persistent_cache/volatile_tier_impl.h +++ b/utilities/persistent_cache/volatile_tier_impl.h @@ -38,7 +38,7 @@ // implementation is not concurrent at this point though. // // The eviction algorithm is LRU -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class VolatileCacheTier : public PersistentCacheTier { public: @@ -137,6 +137,6 @@ class VolatileCacheTier : public PersistentCacheTier { Statistics stats_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif diff --git a/utilities/simulator_cache/cache_simulator.cc b/utilities/simulator_cache/cache_simulator.cc index 98a5c8a695..16a78ea71e 100644 --- a/utilities/simulator_cache/cache_simulator.cc +++ b/utilities/simulator_cache/cache_simulator.cc @@ -7,7 +7,7 @@ #include #include "db/dbformat.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { const std::string kGhostCachePrefix = "ghost_"; @@ -271,4 +271,4 @@ void BlockCacheTraceSimulator::Access(const BlockCacheTraceRecord& access) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/simulator_cache/cache_simulator.h b/utilities/simulator_cache/cache_simulator.h index 6f2a7e84d2..6d49790131 100644 --- a/utilities/simulator_cache/cache_simulator.h +++ b/utilities/simulator_cache/cache_simulator.h @@ -10,7 +10,7 @@ #include "cache/lru_cache.h" #include "trace_replay/block_cache_tracer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // A cache configuration provided by user. struct CacheConfiguration { @@ -228,4 +228,4 @@ class BlockCacheTraceSimulator { uint64_t trace_start_time_ = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/simulator_cache/cache_simulator_test.cc b/utilities/simulator_cache/cache_simulator_test.cc index 085e113ffe..a205315ccc 100644 --- a/utilities/simulator_cache/cache_simulator_test.cc +++ b/utilities/simulator_cache/cache_simulator_test.cc @@ -10,7 +10,7 @@ #include "test_util/testharness.h" #include "test_util/testutil.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { const std::string kBlockKeyPrefix = "test-block-"; const std::string kRefKeyPrefix = "test-get-"; @@ -27,7 +27,7 @@ class CacheSimulatorTest : public testing::Test { const size_t kNumBlocks = 5; const size_t kValueSize = 1000; - CacheSimulatorTest() { env_ = rocksdb::Env::Default(); } + CacheSimulatorTest() { env_ = ROCKSDB_NAMESPACE::Env::Default(); } BlockCacheTraceRecord GenerateGetRecord(uint64_t getid) { BlockCacheTraceRecord record; @@ -486,7 +486,7 @@ TEST_F(CacheSimulatorTest, GhostHybridRowBlockCacheSimulator) { cache_simulator->miss_ratio_stats().user_miss_ratio())); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/simulator_cache/sim_cache.cc b/utilities/simulator_cache/sim_cache.cc index cf534dddba..ec411cf9af 100644 --- a/utilities/simulator_cache/sim_cache.cc +++ b/utilities/simulator_cache/sim_cache.cc @@ -13,7 +13,7 @@ #include "util/mutexlock.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -351,4 +351,4 @@ std::shared_ptr NewSimCache(std::shared_ptr sim_cache, return std::make_shared(sim_cache, cache); } -} // end namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/simulator_cache/sim_cache_test.cc b/utilities/simulator_cache/sim_cache_test.cc index e66228107e..6cb4958139 100644 --- a/utilities/simulator_cache/sim_cache_test.cc +++ b/utilities/simulator_cache/sim_cache_test.cc @@ -8,7 +8,7 @@ #include "db/db_test_util.h" #include "port/stack_trace.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class SimCacheTest : public DBTestBase { private: @@ -34,7 +34,7 @@ class SimCacheTest : public DBTestBase { Options options = CurrentOptions(); options.create_if_missing = true; // options.compression = kNoCompression; - options.statistics = rocksdb::CreateDBStatistics(); + options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); options.table_factory.reset(new BlockBasedTableFactory(table_options)); return options; } @@ -216,10 +216,10 @@ TEST_F(SimCacheTest, SimCacheLogging) { ASSERT_GT(fsize, max_size - 100); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/table_properties_collectors/compact_on_deletion_collector.cc b/utilities/table_properties_collectors/compact_on_deletion_collector.cc index eaf2c501d1..89d666d4d6 100644 --- a/utilities/table_properties_collectors/compact_on_deletion_collector.cc +++ b/utilities/table_properties_collectors/compact_on_deletion_collector.cc @@ -9,7 +9,7 @@ #include #include "rocksdb/utilities/table_properties_collectors.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { CompactOnDeletionCollector::CompactOnDeletionCollector( size_t sliding_window_size, size_t deletion_trigger) @@ -86,5 +86,5 @@ std::shared_ptr new CompactOnDeletionCollectorFactory( sliding_window_size, deletion_trigger)); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/table_properties_collectors/compact_on_deletion_collector.h b/utilities/table_properties_collectors/compact_on_deletion_collector.h index 96c8db896f..cc559ab2b8 100644 --- a/utilities/table_properties_collectors/compact_on_deletion_collector.h +++ b/utilities/table_properties_collectors/compact_on_deletion_collector.h @@ -7,7 +7,7 @@ #ifndef ROCKSDB_LITE #include "rocksdb/utilities/table_properties_collectors.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class CompactOnDeletionCollector : public TablePropertiesCollector { public: @@ -68,5 +68,5 @@ class CompactOnDeletionCollector : public TablePropertiesCollector { bool need_compaction_; bool finished_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc b/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc index 57eed10701..9b94cc2729 100644 --- a/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc +++ b/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc @@ -25,9 +25,9 @@ int main(int /*argc*/, char** /*argv*/) { {1000, 10000, 10000, 127, 128, 129, 255, 256, 257, 2, 10000}; const int kDeletionTriggers[] = {500, 9500, 4323, 47, 61, 128, 250, 250, 250, 2, 2}; - rocksdb::TablePropertiesCollectorFactory::Context context; - context.column_family_id = - rocksdb::TablePropertiesCollectorFactory::Context::kUnknownColumnFamily; + ROCKSDB_NAMESPACE::TablePropertiesCollectorFactory::Context context; + context.column_family_id = ROCKSDB_NAMESPACE:: + TablePropertiesCollectorFactory::Context::kUnknownColumnFamily; std::vector window_sizes; std::vector deletion_triggers; @@ -38,7 +38,7 @@ int main(int /*argc*/, char** /*argv*/) { } // randomize tests - rocksdb::Random rnd(301); + ROCKSDB_NAMESPACE::Random rnd(301); const int kMaxTestSize = 100000l; for (int random_test = 0; random_test < 10; random_test++) { int window_size = rnd.Uniform(kMaxTestSize) + 1; @@ -58,21 +58,21 @@ int main(int /*argc*/, char** /*argv*/) { const int kBias = (kNumDeletionTrigger + kBucketSize - 1) / kBucketSize; // Simple test { - auto factory = rocksdb::NewCompactOnDeletionCollectorFactory( + auto factory = ROCKSDB_NAMESPACE::NewCompactOnDeletionCollectorFactory( kWindowSize, kNumDeletionTrigger); const int kSample = 10; for (int delete_rate = 0; delete_rate <= kSample; ++delete_rate) { - std::unique_ptr collector( + std::unique_ptr collector( factory->CreateTablePropertiesCollector(context)); int deletions = 0; for (int i = 0; i < kPaddedWindowSize; ++i) { if (i % kSample < delete_rate) { collector->AddUserKey("hello", "rocksdb", - rocksdb::kEntryDelete, 0, 0); + ROCKSDB_NAMESPACE::kEntryDelete, 0, 0); deletions++; } else { collector->AddUserKey("hello", "rocksdb", - rocksdb::kEntryPut, 0, 0); + ROCKSDB_NAMESPACE::kEntryPut, 0, 0); } } if (collector->NeedCompact() != @@ -90,35 +90,35 @@ int main(int /*argc*/, char** /*argv*/) { // Only one section of a file satisfies the compaction trigger { - auto factory = rocksdb::NewCompactOnDeletionCollectorFactory( + auto factory = ROCKSDB_NAMESPACE::NewCompactOnDeletionCollectorFactory( kWindowSize, kNumDeletionTrigger); const int kSample = 10; for (int delete_rate = 0; delete_rate <= kSample; ++delete_rate) { - std::unique_ptr collector( + std::unique_ptr collector( factory->CreateTablePropertiesCollector(context)); int deletions = 0; for (int section = 0; section < 5; ++section) { int initial_entries = rnd.Uniform(kWindowSize) + kWindowSize; for (int i = 0; i < initial_entries; ++i) { collector->AddUserKey("hello", "rocksdb", - rocksdb::kEntryPut, 0, 0); + ROCKSDB_NAMESPACE::kEntryPut, 0, 0); } } for (int i = 0; i < kPaddedWindowSize; ++i) { if (i % kSample < delete_rate) { collector->AddUserKey("hello", "rocksdb", - rocksdb::kEntryDelete, 0, 0); + ROCKSDB_NAMESPACE::kEntryDelete, 0, 0); deletions++; } else { collector->AddUserKey("hello", "rocksdb", - rocksdb::kEntryPut, 0, 0); + ROCKSDB_NAMESPACE::kEntryPut, 0, 0); } } for (int section = 0; section < 5; ++section) { int ending_entries = rnd.Uniform(kWindowSize) + kWindowSize; for (int i = 0; i < ending_entries; ++i) { collector->AddUserKey("hello", "rocksdb", - rocksdb::kEntryPut, 0, 0); + ROCKSDB_NAMESPACE::kEntryPut, 0, 0); } } if (collector->NeedCompact() != (deletions >= kNumDeletionTrigger) && @@ -137,8 +137,8 @@ int main(int /*argc*/, char** /*argv*/) { // TEST 3: Issues a lots of deletes, but their density is not // high enough to trigger compaction. { - std::unique_ptr collector; - auto factory = rocksdb::NewCompactOnDeletionCollectorFactory( + std::unique_ptr collector; + auto factory = ROCKSDB_NAMESPACE::NewCompactOnDeletionCollectorFactory( kWindowSize, kNumDeletionTrigger); collector.reset(factory->CreateTablePropertiesCollector(context)); assert(collector->NeedCompact() == false); @@ -150,10 +150,10 @@ int main(int /*argc*/, char** /*argv*/) { for (int i = 0; i < kPaddedWindowSize; ++i) { if (i < kDeletionsPerSection) { collector->AddUserKey("hello", "rocksdb", - rocksdb::kEntryDelete, 0, 0); + ROCKSDB_NAMESPACE::kEntryDelete, 0, 0); } else { collector->AddUserKey("hello", "rocksdb", - rocksdb::kEntryPut, 0, 0); + ROCKSDB_NAMESPACE::kEntryPut, 0, 0); } } } diff --git a/utilities/trace/file_trace_reader_writer.cc b/utilities/trace/file_trace_reader_writer.cc index 17506c7ff1..7160f7a4c9 100644 --- a/utilities/trace/file_trace_reader_writer.cc +++ b/utilities/trace/file_trace_reader_writer.cc @@ -11,7 +11,7 @@ #include "trace_replay/trace_replay.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { const unsigned int FileTraceReader::kBufferSize = 1024; // 1KB @@ -120,4 +120,4 @@ Status NewFileTraceWriter(Env* env, const EnvOptions& env_options, return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/trace/file_trace_reader_writer.h b/utilities/trace/file_trace_reader_writer.h index 863f5d9d06..a9eafa5af1 100644 --- a/utilities/trace/file_trace_reader_writer.h +++ b/utilities/trace/file_trace_reader_writer.h @@ -7,7 +7,7 @@ #include "rocksdb/trace_reader_writer.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class RandomAccessFileReader; class WritableFileWriter; @@ -45,4 +45,4 @@ class FileTraceWriter : public TraceWriter { std::unique_ptr file_writer_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/transactions/optimistic_transaction.cc b/utilities/transactions/optimistic_transaction.cc index 357d06801e..b01102bb26 100644 --- a/utilities/transactions/optimistic_transaction.cc +++ b/utilities/transactions/optimistic_transaction.cc @@ -21,7 +21,7 @@ #include "utilities/transactions/optimistic_transaction.h" #include "utilities/transactions/optimistic_transaction_db_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct WriteOptions; @@ -182,6 +182,6 @@ Status OptimisticTransaction::SetName(const TransactionName& /* unused */) { return Status::InvalidArgument("Optimistic transactions cannot be named."); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/optimistic_transaction.h b/utilities/transactions/optimistic_transaction.h index dddcdb2f3c..c337de2af3 100644 --- a/utilities/transactions/optimistic_transaction.h +++ b/utilities/transactions/optimistic_transaction.h @@ -24,7 +24,7 @@ #include "utilities/transactions/transaction_base.h" #include "utilities/transactions/transaction_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class OptimisticTransaction : public TransactionBaseImpl { public: @@ -96,6 +96,6 @@ class OptimisticTransactionCallback : public WriteCallback { OptimisticTransaction* txn_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/optimistic_transaction_db_impl.cc b/utilities/transactions/optimistic_transaction_db_impl.cc index 58a7903c33..bffb3d5ed8 100644 --- a/utilities/transactions/optimistic_transaction_db_impl.cc +++ b/utilities/transactions/optimistic_transaction_db_impl.cc @@ -16,7 +16,7 @@ #include "rocksdb/utilities/optimistic_transaction_db.h" #include "utilities/transactions/optimistic_transaction.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Transaction* OptimisticTransactionDBImpl::BeginTransaction( const WriteOptions& write_options, @@ -107,5 +107,5 @@ void OptimisticTransactionDBImpl::ReinitializeTransaction( txn_impl->Reinitialize(this, write_options, txn_options); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/optimistic_transaction_db_impl.h b/utilities/transactions/optimistic_transaction_db_impl.h index cc3b375c40..d895d49b89 100644 --- a/utilities/transactions/optimistic_transaction_db_impl.h +++ b/utilities/transactions/optimistic_transaction_db_impl.h @@ -14,7 +14,7 @@ #include "rocksdb/options.h" #include "rocksdb/utilities/optimistic_transaction_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class OptimisticTransactionDBImpl : public OptimisticTransactionDB { public: @@ -67,5 +67,5 @@ class OptimisticTransactionDBImpl : public OptimisticTransactionDB { OptimisticTransactionOptions()); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/optimistic_transaction_test.cc b/utilities/transactions/optimistic_transaction_test.cc index fc30c60be4..63c1a255c6 100644 --- a/utilities/transactions/optimistic_transaction_test.cc +++ b/utilities/transactions/optimistic_transaction_test.cc @@ -24,7 +24,7 @@ using std::string; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class OptimisticTransactionTest : public testing::Test, @@ -370,10 +370,10 @@ TEST_P(OptimisticTransactionTest, CheckKeySkipOldMemtable) { // For the second attempt, hold flush from beginning. The memtable // will be switched to immutable after calling TEST_SwitchMemtable() // while CheckKey() is called. - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"OptimisticTransactionTest.CheckKeySkipOldMemtable", "FlushJob::Start"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); } // force a memtable flush. The memtable should still be kept @@ -430,7 +430,7 @@ TEST_P(OptimisticTransactionTest, CheckKeySkipOldMemtable) { ASSERT_TRUE(s.ok()); TEST_SYNC_POINT("OptimisticTransactionTest.CheckKeySkipOldMemtable"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); SetPerfLevel(PerfLevel::kDisable); @@ -1515,7 +1515,7 @@ INSTANTIATE_TEST_CASE_P( testing::Values(OccValidationPolicy::kValidateSerial, OccValidationPolicy::kValidateParallel)); -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/transactions/pessimistic_transaction.cc b/utilities/transactions/pessimistic_transaction.cc index c709d34b1c..5ae5fed082 100644 --- a/utilities/transactions/pessimistic_transaction.cc +++ b/utilities/transactions/pessimistic_transaction.cc @@ -25,7 +25,7 @@ #include "utilities/transactions/pessimistic_transaction_db.h" #include "utilities/transactions/transaction_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct WriteOptions; @@ -718,6 +718,6 @@ Status PessimisticTransaction::SetName(const TransactionName& name) { return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/pessimistic_transaction.h b/utilities/transactions/pessimistic_transaction.h index c91d9217b2..8f2c844058 100644 --- a/utilities/transactions/pessimistic_transaction.h +++ b/utilities/transactions/pessimistic_transaction.h @@ -28,7 +28,7 @@ #include "utilities/transactions/transaction_base.h" #include "utilities/transactions/transaction_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class PessimisticTransactionDB; @@ -220,6 +220,6 @@ class WriteCommittedTxn : public PessimisticTransaction { Status RollbackInternal() override; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/pessimistic_transaction_db.cc b/utilities/transactions/pessimistic_transaction_db.cc index 4aee1147bb..30d5b79f68 100644 --- a/utilities/transactions/pessimistic_transaction_db.cc +++ b/utilities/transactions/pessimistic_transaction_db.cc @@ -24,7 +24,7 @@ #include "utilities/transactions/write_prepared_txn_db.h" #include "utilities/transactions/write_unprepared_txn_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { PessimisticTransactionDB::PessimisticTransactionDB( DB* db, const TransactionDBOptions& txn_db_options) @@ -628,5 +628,5 @@ void PessimisticTransactionDB::UnregisterTransaction(Transaction* txn) { transactions_.erase(it); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/pessimistic_transaction_db.h b/utilities/transactions/pessimistic_transaction_db.h index 6859c1aeb3..39346dddd9 100644 --- a/utilities/transactions/pessimistic_transaction_db.h +++ b/utilities/transactions/pessimistic_transaction_db.h @@ -24,7 +24,7 @@ #include "utilities/transactions/transaction_lock_mgr.h" #include "utilities/transactions/write_prepared_txn.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class PessimisticTransactionDB : public TransactionDB { public: @@ -216,5 +216,5 @@ class WriteCommittedTxnDB : public PessimisticTransactionDB { virtual Status Write(const WriteOptions& opts, WriteBatch* updates) override; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/snapshot_checker.cc b/utilities/transactions/snapshot_checker.cc index 695c020ef7..9c43bef43b 100644 --- a/utilities/transactions/snapshot_checker.cc +++ b/utilities/transactions/snapshot_checker.cc @@ -11,7 +11,7 @@ #include "utilities/transactions/write_prepared_txn_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { #ifdef ROCKSDB_LITE WritePreparedSnapshotChecker::WritePreparedSnapshotChecker( @@ -46,4 +46,4 @@ SnapshotCheckerResult WritePreparedSnapshotChecker::CheckInSnapshot( #endif // ROCKSDB_LITE DisableGCSnapshotChecker DisableGCSnapshotChecker::instance_; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/transactions/transaction_base.cc b/utilities/transactions/transaction_base.cc index 54b5b6204a..805d4ab36a 100644 --- a/utilities/transactions/transaction_base.cc +++ b/utilities/transactions/transaction_base.cc @@ -17,7 +17,7 @@ #include "util/cast_util.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { TransactionBaseImpl::TransactionBaseImpl(DB* db, const WriteOptions& write_options) @@ -832,6 +832,6 @@ Status TransactionBaseImpl::RebuildFromWriteBatch(WriteBatch* src_batch) { WriteBatch* TransactionBaseImpl::GetCommitTimeWriteBatch() { return &commit_time_batch_; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/transaction_base.h b/utilities/transactions/transaction_base.h index 082b0b4f5b..f279676c60 100644 --- a/utilities/transactions/transaction_base.h +++ b/utilities/transactions/transaction_base.h @@ -23,7 +23,7 @@ #include "util/autovector.h" #include "utilities/transactions/transaction_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TransactionBaseImpl : public Transaction { public: @@ -369,6 +369,6 @@ class TransactionBaseImpl : public Transaction { void SetSnapshotInternal(const Snapshot* snapshot); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/transaction_db_mutex_impl.cc b/utilities/transactions/transaction_db_mutex_impl.cc index 244a950773..345c4be902 100644 --- a/utilities/transactions/transaction_db_mutex_impl.cc +++ b/utilities/transactions/transaction_db_mutex_impl.cc @@ -14,7 +14,7 @@ #include "rocksdb/utilities/transaction_db_mutex.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TransactionDBMutexImpl : public TransactionDBMutex { public: @@ -130,6 +130,6 @@ Status TransactionDBCondVarImpl::WaitFor( return s; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/transaction_db_mutex_impl.h b/utilities/transactions/transaction_db_mutex_impl.h index 2cce05ba04..fbee928320 100644 --- a/utilities/transactions/transaction_db_mutex_impl.h +++ b/utilities/transactions/transaction_db_mutex_impl.h @@ -8,7 +8,7 @@ #include "rocksdb/utilities/transaction_db_mutex.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class TransactionDBMutex; class TransactionDBCondVar; @@ -21,6 +21,6 @@ class TransactionDBMutexFactoryImpl : public TransactionDBMutexFactory { std::shared_ptr AllocateCondVar() override; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/transaction_lock_mgr.cc b/utilities/transactions/transaction_lock_mgr.cc index 45d04d188f..82b6140333 100644 --- a/utilities/transactions/transaction_lock_mgr.cc +++ b/utilities/transactions/transaction_lock_mgr.cc @@ -25,7 +25,7 @@ #include "util/thread_local.h" #include "utilities/transactions/pessimistic_transaction_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct LockInfo { bool exclusive; @@ -741,5 +741,5 @@ void TransactionLockMgr::Resize(uint32_t target_size) { dlock_buffer_.Resize(target_size); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/transaction_lock_mgr.h b/utilities/transactions/transaction_lock_mgr.h index 16a40d7b7a..b4fd859295 100644 --- a/utilities/transactions/transaction_lock_mgr.h +++ b/utilities/transactions/transaction_lock_mgr.h @@ -20,7 +20,7 @@ #include "util/thread_local.h" #include "utilities/transactions/pessimistic_transaction.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class ColumnFamilyHandle; struct LockInfo; @@ -154,5 +154,5 @@ class TransactionLockMgr { const autovector& wait_ids); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/transaction_test.cc b/utilities/transactions/transaction_test.cc index 30491c6981..bdc2609f5a 100644 --- a/utilities/transactions/transaction_test.cc +++ b/utilities/transactions/transaction_test.cc @@ -34,7 +34,7 @@ using std::string; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { INSTANTIATE_TEST_CASE_P( DBAsBaseDB, TransactionTest, @@ -282,7 +282,7 @@ TEST_P(TransactionTest, WaitingTxn) { ASSERT_TRUE(txn1); ASSERT_TRUE(txn2); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "TransactionLockMgr::AcquireWithTimeout:WaitingTxn", [&](void* /*arg*/) { std::string key; uint32_t cf_id; @@ -335,7 +335,7 @@ TEST_P(TransactionTest, WaitingTxn) { ASSERT_EQ(cf_iterator->second.ids.size(), 1); ASSERT_EQ(cf_iterator->second.ids[0], txn1->GetID()); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); s = txn2->GetForUpdate(read_options, "foo", &value); ASSERT_TRUE(s.IsTimedOut()); @@ -343,8 +343,8 @@ TEST_P(TransactionTest, WaitingTxn) { ASSERT_EQ(get_perf_context()->key_lock_wait_count, 1); ASSERT_GE(get_perf_context()->key_lock_wait_time, 0); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); delete cfa; delete txn1; @@ -508,10 +508,10 @@ TEST_P(TransactionTest, DeadlockCycleShared) { } std::atomic checkpoints(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "TransactionLockMgr::AcquireWithTimeout:WaitingTxn", [&](void* /*arg*/) { checkpoints.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // We want the leaf transactions to block and hold everyone back. std::vector threads; @@ -531,8 +531,8 @@ TEST_P(TransactionTest, DeadlockCycleShared) { /* sleep override */ std::this_thread::sleep_for(std::chrono::milliseconds(100)); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); // Complete the cycle T[16 - 31] -> T1 for (uint32_t i = 15; i < 31; i++) { @@ -641,10 +641,10 @@ TEST_P(TransactionTest, DeadlockCycleShared) { } std::atomic checkpoints_shared(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "TransactionLockMgr::AcquireWithTimeout:WaitingTxn", [&](void* /*arg*/) { checkpoints_shared.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); std::vector threads_shared; for (uint32_t i = 0; i < 1; i++) { @@ -663,8 +663,8 @@ TEST_P(TransactionTest, DeadlockCycleShared) { /* sleep override */ std::this_thread::sleep_for(std::chrono::milliseconds(100)); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); // Complete the cycle T2 -> T1 with a shared lock. auto s = txns_shared[1]->GetForUpdate(read_options, "0", nullptr, false); @@ -714,10 +714,10 @@ TEST_P(TransactionStressTest, DeadlockCycle) { } std::atomic checkpoints(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "TransactionLockMgr::AcquireWithTimeout:WaitingTxn", [&](void* /*arg*/) { checkpoints.fetch_add(1); }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // We want the last transaction in the chain to block and hold everyone // back. @@ -737,8 +737,8 @@ TEST_P(TransactionStressTest, DeadlockCycle) { /* sleep override */ std::this_thread::sleep_for(std::chrono::milliseconds(100)); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); // Complete the cycle Tlen -> T1 auto s = txns[len - 1]->GetForUpdate(read_options, "0", nullptr); @@ -1453,7 +1453,7 @@ TEST_P(TransactionTest, DISABLED_TwoPhaseMultiThreadTest) { std::atomic t_wait_on_prepare(0); std::atomic t_wait_on_commit(0); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WriteThread::JoinBatchGroup:Wait", [&](void* arg) { auto* writer = reinterpret_cast(arg); @@ -1474,7 +1474,7 @@ TEST_P(TransactionTest, DISABLED_TwoPhaseMultiThreadTest) { } }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); // do all the writes std::vector threads; @@ -1485,8 +1485,8 @@ TEST_P(TransactionTest, DISABLED_TwoPhaseMultiThreadTest) { t.join(); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); ReadOptions read_options; std::string value; @@ -2881,8 +2881,8 @@ TEST_P(TransactionTest, MultiGetLargeBatchedTest) { s = wb.Put(handles[1], std::to_string(2), "new_val" + std::to_string(2)); ASSERT_OK(s); // Write a lot of merges so when we call MultiGetFromBatchAndDB later on, - // it is forced to use std::vector in rocksdb::autovector to allocate - // MergeContexts. The number of merges needs to be > + // it is forced to use std::vector in ROCKSDB_NAMESPACE::autovector to + // allocate MergeContexts. The number of merges needs to be > // MultiGetContext::MAX_BATCH_SIZE for (int i = 8; i < MultiGetContext::MAX_BATCH_SIZE + 24; ++i) { s = wb.Merge(handles[1], std::to_string(i), "merge"); @@ -5208,9 +5208,9 @@ TEST_P(TransactionTest, ToggleAutoCompactionTest) { TEST_P(TransactionStressTest, ExpiredTransactionDataRace1) { // In this test, txn1 should succeed committing, // as the callback is called after txn1 starts committing. - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"TransactionTest::ExpirableTransactionDataRace:1"}}); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "TransactionTest::ExpirableTransactionDataRace:1", [&](void* /*arg*/) { WriteOptions write_options; TransactionOptions txn_options; @@ -5228,7 +5228,7 @@ TEST_P(TransactionStressTest, ExpiredTransactionDataRace1) { delete txn2; }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); WriteOptions write_options; TransactionOptions txn_options; @@ -5248,7 +5248,7 @@ TEST_P(TransactionStressTest, ExpiredTransactionDataRace1) { ASSERT_EQ("1", value); delete txn1; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } #ifndef ROCKSDB_VALGRIND_RUN @@ -5593,7 +5593,7 @@ TEST_P(TransactionTest, GetWithoutSnapshot) { WriteOptions write_options; std::atomic finish = {false}; db->Put(write_options, "key", "value"); - rocksdb::port::Thread commit_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread commit_thread([&]() { for (int i = 0; i < 100; i++) { TransactionOptions txn_options; Transaction* txn = db->BeginTransaction(write_options, txn_options); @@ -5606,7 +5606,7 @@ TEST_P(TransactionTest, GetWithoutSnapshot) { } finish = true; }); - rocksdb::port::Thread read_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread read_thread([&]() { while (!finish) { ReadOptions ropt; PinnableSlice pinnable_val; @@ -6205,7 +6205,7 @@ TEST_P(TransactionTest, DoubleCrashInRecovery) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/transactions/transaction_test.h b/utilities/transactions/transaction_test.h index 73d6b2b849..2e533d379b 100644 --- a/utilities/transactions/transaction_test.h +++ b/utilities/transactions/transaction_test.h @@ -31,7 +31,7 @@ #include "port/port.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Return true if the ith bit is set in combination represented by comb bool IsInCombination(size_t i, size_t comb) { return comb & (size_t(1) << i); } @@ -514,4 +514,4 @@ class MySQLStyleTransactionTest const bool with_slow_threads_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE diff --git a/utilities/transactions/transaction_util.cc b/utilities/transactions/transaction_util.cc index 5e3c27f09c..23532ae42a 100644 --- a/utilities/transactions/transaction_util.cc +++ b/utilities/transactions/transaction_util.cc @@ -16,7 +16,7 @@ #include "rocksdb/utilities/write_batch_with_index.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status TransactionUtil::CheckKeyForConflicts( DBImpl* db_impl, ColumnFamilyHandle* column_family, const std::string& key, @@ -177,7 +177,6 @@ Status TransactionUtil::CheckKeysForConflicts(DBImpl* db_impl, return result; } - -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/transaction_util.h b/utilities/transactions/transaction_util.h index b1f9f24cb4..2e48f84a46 100644 --- a/utilities/transactions/transaction_util.h +++ b/utilities/transactions/transaction_util.h @@ -18,7 +18,7 @@ #include "rocksdb/status.h" #include "rocksdb/types.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct TransactionKeyMapInfo { // Earliest sequence number that is relevant to this transaction for this key @@ -98,6 +98,6 @@ class TransactionUtil { SequenceNumber min_uncommitted = kMaxSequenceNumber); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/write_prepared_transaction_test.cc b/utilities/transactions/write_prepared_transaction_test.cc index f82e90bd52..0171b9716c 100644 --- a/utilities/transactions/write_prepared_transaction_test.cc +++ b/utilities/transactions/write_prepared_transaction_test.cc @@ -40,7 +40,7 @@ using std::string; -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { using CommitEntry = WritePreparedTxnDB::CommitEntry; using CommitEntry64b = WritePreparedTxnDB::CommitEntry64b; @@ -157,14 +157,14 @@ TEST(PreparedHeap, EmptyAtTheEnd) { // successfully emptied at the end. TEST(PreparedHeap, Concurrent) { const size_t t_cnt = 10; - rocksdb::port::Thread t[t_cnt + 1]; + ROCKSDB_NAMESPACE::port::Thread t[t_cnt + 1]; WritePreparedTxnDB::PreparedHeap heap; port::RWMutex prepared_mutex; std::atomic last; for (size_t n = 0; n < 100; n++) { last = 0; - t[0] = rocksdb::port::Thread([&]() { + t[0] = ROCKSDB_NAMESPACE::port::Thread([&]() { Random rnd(1103); for (size_t seq = 1; seq <= t_cnt; seq++) { // This is not recommended usage but we should be resilient against it. @@ -178,14 +178,15 @@ TEST(PreparedHeap, Concurrent) { } }); for (size_t i = 1; i <= t_cnt; i++) { - t[i] = rocksdb::port::Thread([&heap, &prepared_mutex, &last, i]() { - auto seq = i; - do { - std::this_thread::yield(); - } while (last.load() < seq); - WriteLock wl(&prepared_mutex); - heap.erase(seq); - }); + t[i] = + ROCKSDB_NAMESPACE::port::Thread([&heap, &prepared_mutex, &last, i]() { + auto seq = i; + do { + std::this_thread::yield(); + } while (last.load() < seq); + WriteLock wl(&prepared_mutex); + heap.erase(seq); + }); } for (size_t i = 0; i <= t_cnt; i++) { t[i].join(); @@ -421,7 +422,7 @@ class WritePreparedTransactionTestBase : public TransactionTestBase { wp_db->UpdateSnapshots(old_snapshots, ++version); // Starting from the first thread, cut each thread at two points - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"WritePreparedTxnDB::CheckAgainstSnapshots:p:" + std::to_string(a1), "WritePreparedTxnDB::UpdateSnapshots:s:start"}, {"WritePreparedTxnDB::UpdateSnapshots:p:" + std::to_string(b1), @@ -433,23 +434,24 @@ class WritePreparedTransactionTestBase : public TransactionTestBase { {"WritePreparedTxnDB::CheckAgainstSnapshots:p:end", "WritePreparedTxnDB::UpdateSnapshots:s:" + std::to_string(b2)}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); { ASSERT_TRUE(wp_db->old_commit_map_empty_); - rocksdb::port::Thread t1( + ROCKSDB_NAMESPACE::port::Thread t1( [&]() { wp_db->UpdateSnapshots(new_snapshots, version); }); - rocksdb::port::Thread t2([&]() { wp_db->CheckAgainstSnapshots(entry); }); + ROCKSDB_NAMESPACE::port::Thread t2( + [&]() { wp_db->CheckAgainstSnapshots(entry); }); t1.join(); t2.join(); ASSERT_FALSE(wp_db->old_commit_map_empty_); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); wp_db->old_commit_map_empty_ = true; wp_db->UpdateSnapshots(empty_snapshots, ++version); wp_db->UpdateSnapshots(old_snapshots, ++version); // Starting from the second thread, cut each thread at two points - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"WritePreparedTxnDB::UpdateSnapshots:p:" + std::to_string(a1), "WritePreparedTxnDB::CheckAgainstSnapshots:s:start"}, {"WritePreparedTxnDB::CheckAgainstSnapshots:p:" + std::to_string(b1), @@ -461,17 +463,18 @@ class WritePreparedTransactionTestBase : public TransactionTestBase { {"WritePreparedTxnDB::UpdateSnapshots:p:end", "WritePreparedTxnDB::CheckAgainstSnapshots:s:" + std::to_string(b2)}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); { ASSERT_TRUE(wp_db->old_commit_map_empty_); - rocksdb::port::Thread t1( + ROCKSDB_NAMESPACE::port::Thread t1( [&]() { wp_db->UpdateSnapshots(new_snapshots, version); }); - rocksdb::port::Thread t2([&]() { wp_db->CheckAgainstSnapshots(entry); }); + ROCKSDB_NAMESPACE::port::Thread t2( + [&]() { wp_db->CheckAgainstSnapshots(entry); }); t1.join(); t2.join(); ASSERT_FALSE(wp_db->old_commit_map_empty_); } - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } // Verify value of keys. @@ -827,10 +830,10 @@ TEST_P(WritePreparedTransactionTest, CheckKeySkipOldMemtable) { // For the second attempt, hold flush from beginning. The memtable // will be switched to immutable after calling TEST_SwitchMemtable() // while CheckKey() is called. - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"WritePreparedTransactionTest.CheckKeySkipOldMemtable", "FlushJob::Start"}}); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); } // force a memtable flush. The memtable should still be kept @@ -915,7 +918,7 @@ TEST_P(WritePreparedTransactionTest, CheckKeySkipOldMemtable) { ASSERT_OK(txn4->Commit()); TEST_SYNC_POINT("WritePreparedTransactionTest.CheckKeySkipOldMemtable"); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); SetPerfLevel(PerfLevel::kDisable); @@ -1368,7 +1371,7 @@ TEST_P(WritePreparedTransactionTest, MaxCatchupWithNewSnapshot) { const int writes = 50; const int batch_cnt = 4; - rocksdb::port::Thread t1([&]() { + ROCKSDB_NAMESPACE::port::Thread t1([&]() { for (int i = 0; i < writes; i++) { WriteBatch batch; // For duplicate keys cause 4 commit entries, each evicting an entry that @@ -1381,7 +1384,7 @@ TEST_P(WritePreparedTransactionTest, MaxCatchupWithNewSnapshot) { } }); - rocksdb::port::Thread t2([&]() { + ROCKSDB_NAMESPACE::port::Thread t2([&]() { while (wp_db->max_evicted_seq_ == 0) { // wait for insert thread std::this_thread::yield(); } @@ -1417,7 +1420,7 @@ TEST_P(WritePreparedTransactionTest, MaxCatchupWithUnbackedSnapshot) { WritePreparedTxnDB* wp_db = dynamic_cast(db); const int writes = 50; - rocksdb::port::Thread t1([&]() { + ROCKSDB_NAMESPACE::port::Thread t1([&]() { for (int i = 0; i < writes; i++) { WriteBatch batch; batch.Put("key", "foo"); @@ -1425,7 +1428,7 @@ TEST_P(WritePreparedTransactionTest, MaxCatchupWithUnbackedSnapshot) { } }); - rocksdb::port::Thread t2([&]() { + ROCKSDB_NAMESPACE::port::Thread t2([&]() { while (wp_db->max_evicted_seq_ == 0) { // wait for insert thread std::this_thread::yield(); } @@ -1607,7 +1610,7 @@ TEST_P(WritePreparedTransactionTest, SmallestUnCommittedSeq) { port::Mutex mutex; Random rnd(1103); - rocksdb::port::Thread commit_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread commit_thread([&]() { for (int i = 0; i < cnt; i++) { uint32_t index = rnd.Uniform(cnt - i); Transaction* txn; @@ -1623,7 +1626,7 @@ TEST_P(WritePreparedTransactionTest, SmallestUnCommittedSeq) { committed_txns.push_back(txn); } }); - rocksdb::port::Thread read_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread read_thread([&]() { while (1) { MutexLock l(&mutex); if (txns.empty()) { @@ -1686,10 +1689,10 @@ TEST_P(SeqAdvanceConcurrentTest, SeqAdvanceConcurrent) { linked = 0; std::atomic batch_formed(false); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WriteThread::EnterAsBatchGroupLeader:End", [&](void* /*arg*/) { batch_formed = true; }); - rocksdb::SyncPoint::GetInstance()->SetCallBack( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WriteThread::JoinBatchGroup:Wait", [&](void* /*arg*/) { linked++; if (linked == 1) { @@ -1707,7 +1710,7 @@ TEST_P(SeqAdvanceConcurrentTest, SeqAdvanceConcurrent) { // but it should be tolerable. }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); for (size_t bi = 0; bi < txn_cnt; bi++) { // get the bi-th digit in number system based on type_cnt size_t d = (n % base[bi + 1]) / base[bi]; @@ -1758,8 +1761,8 @@ TEST_P(SeqAdvanceConcurrentTest, SeqAdvanceConcurrent) { seq = db_impl->TEST_GetLastVisibleSequence(); ASSERT_EQ(exp_seq, seq); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); // Check if recovery preserves the last sequence number db_impl->FlushWAL(true); @@ -3039,14 +3042,14 @@ TEST_P(WritePreparedTransactionTest, NonAtomicCommitOfDelayedPrepared) { if (split_read) { if (split_before_mutex) { // split before acquiring prepare_mutex_ - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"WritePreparedTxnDB::IsInSnapshot:prepared_mutex_:pause", "AtomicCommitOfDelayedPrepared:Commit:before"}, {"AtomicCommitOfDelayedPrepared:Commit:after", "WritePreparedTxnDB::IsInSnapshot:prepared_mutex_:resume"}}); } else { // split right after reading from the commit cache - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"WritePreparedTxnDB::IsInSnapshot:GetCommitEntry:pause", "AtomicCommitOfDelayedPrepared:Commit:before"}, {"AtomicCommitOfDelayedPrepared:Commit:after", @@ -3054,7 +3057,7 @@ TEST_P(WritePreparedTransactionTest, NonAtomicCommitOfDelayedPrepared) { } } else { // split commit // split right before removing from delayed_prepared_ - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"WritePreparedTxnDB::RemovePrepared:pause", "AtomicCommitOfDelayedPrepared:Read:before"}, {"AtomicCommitOfDelayedPrepared:Read:after", @@ -3062,7 +3065,7 @@ TEST_P(WritePreparedTransactionTest, NonAtomicCommitOfDelayedPrepared) { } SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread commit_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread commit_thread([&]() { TEST_SYNC_POINT("AtomicCommitOfDelayedPrepared:Commit:before"); ASSERT_OK(txn->Commit()); if (split_before_mutex) { @@ -3081,7 +3084,7 @@ TEST_P(WritePreparedTransactionTest, NonAtomicCommitOfDelayedPrepared) { delete txn; }); - rocksdb::port::Thread read_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread read_thread([&]() { TEST_SYNC_POINT("AtomicCommitOfDelayedPrepared:Read:before"); ReadOptions roptions; roptions.snapshot = snap; @@ -3096,8 +3099,8 @@ TEST_P(WritePreparedTransactionTest, NonAtomicCommitOfDelayedPrepared) { read_thread.join(); commit_thread.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } // for split_before_mutex } // for split_read } @@ -3132,14 +3135,14 @@ TEST_P(WritePreparedTransactionTest, NonAtomicUpdateOfDelayedPrepared) { ASSERT_LT(txn->GetId(), snap->GetSequenceNumber()); // split right after reading delayed_prepared_empty_ - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"WritePreparedTxnDB::IsInSnapshot:delayed_prepared_empty_:pause", "AtomicUpdateOfDelayedPrepared:before"}, {"AtomicUpdateOfDelayedPrepared:after", "WritePreparedTxnDB::IsInSnapshot:delayed_prepared_empty_:resume"}}); SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread commit_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread commit_thread([&]() { TEST_SYNC_POINT("AtomicUpdateOfDelayedPrepared:before"); // Commit a bunch of entries to advance max evicted seq and make the // prepared a delayed prepared @@ -3154,7 +3157,7 @@ TEST_P(WritePreparedTransactionTest, NonAtomicUpdateOfDelayedPrepared) { TEST_SYNC_POINT("AtomicUpdateOfDelayedPrepared:after"); }); - rocksdb::port::Thread read_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread read_thread([&]() { ReadOptions roptions; roptions.snapshot = snap; PinnableSlice value; @@ -3169,8 +3172,8 @@ TEST_P(WritePreparedTransactionTest, NonAtomicUpdateOfDelayedPrepared) { commit_thread.join(); ASSERT_OK(txn->Commit()); delete txn; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } // Eviction from commit cache and update of max evicted seq are two non-atomic @@ -3210,14 +3213,14 @@ TEST_P(WritePreparedTransactionTest, NonAtomicUpdateOfMaxEvictedSeq) { ASSERT_LE(txn->GetId(), snap->GetSequenceNumber()); // split right after reading max_evicted_seq_ - rocksdb::SyncPoint::GetInstance()->LoadDependency( + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency( {{"WritePreparedTxnDB::IsInSnapshot:max_evicted_seq_:pause", "NonAtomicUpdateOfMaxEvictedSeq:before"}, {"NonAtomicUpdateOfMaxEvictedSeq:after", "WritePreparedTxnDB::IsInSnapshot:max_evicted_seq_:resume"}}); SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread commit_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread commit_thread([&]() { TEST_SYNC_POINT("NonAtomicUpdateOfMaxEvictedSeq:before"); // Commit a bunch of entries to advance max evicted seq beyond txn->GetId() size_t tries = 0; @@ -3231,7 +3234,7 @@ TEST_P(WritePreparedTransactionTest, NonAtomicUpdateOfMaxEvictedSeq) { TEST_SYNC_POINT("NonAtomicUpdateOfMaxEvictedSeq:after"); }); - rocksdb::port::Thread read_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread read_thread([&]() { ReadOptions roptions; roptions.snapshot = snap; PinnableSlice value; @@ -3247,8 +3250,8 @@ TEST_P(WritePreparedTransactionTest, NonAtomicUpdateOfMaxEvictedSeq) { delete txn; txn1->Commit(); delete txn1; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } // Test when we add a prepared seq when the max_evicted_seq_ already goes beyond @@ -3287,7 +3290,7 @@ TEST_P(WritePreparedTransactionTest, AddPreparedBeforeMax) { // t1) Insert prepared entry, t2) commit other entries to advance max // evicted sec and finish checking the existing prepared entries, t1) // AddPrepared, t2) update max_evicted_seq_ - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"AddPreparedCallback::AddPrepared::begin:pause", "AddPreparedBeforeMax::read_thread:start"}, {"AdvanceMaxEvictedSeq::update_max:pause", @@ -3297,13 +3300,13 @@ TEST_P(WritePreparedTransactionTest, AddPreparedBeforeMax) { }); SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread write_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread write_thread([&]() { txn_mutex_.Lock(); ASSERT_OK(txn->Prepare()); txn_mutex_.Unlock(); }); - rocksdb::port::Thread read_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread read_thread([&]() { TEST_SYNC_POINT("AddPreparedBeforeMax::read_thread:start"); // Publish seq number with a commit ASSERT_OK(txn1->Commit()); @@ -3332,8 +3335,8 @@ TEST_P(WritePreparedTransactionTest, AddPreparedBeforeMax) { delete txn2; ASSERT_OK(txn->Commit()); delete txn; - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } // When an old prepared entry gets committed, there is a gap between the time @@ -3347,7 +3350,7 @@ TEST_P(WritePreparedTransactionTest, CommitOfDelayedPrepared) { ReOpen(); std::atomic snap = {nullptr}; std::atomic exp_prepare = {0}; - rocksdb::port::Thread callback_thread; + ROCKSDB_NAMESPACE::port::Thread callback_thread; // Value is synchronized via snap PinnableSlice value; // Take a snapshot after publish and before RemovePrepared:Start @@ -3365,27 +3368,27 @@ TEST_P(WritePreparedTransactionTest, CommitOfDelayedPrepared) { // We need to spawn a thread to avoid deadlock since getting a // snpashot might end up calling AdvanceSeqByOne which needs joining // the write queue. - callback_thread = rocksdb::port::Thread(snap_callback); + callback_thread = ROCKSDB_NAMESPACE::port::Thread(snap_callback); TEST_SYNC_POINT("callback:end"); } }; // Wait for the first snapshot be taken in GetSnapshotInternal. Although // it might be updated before GetSnapshotInternal finishes but this should // cover most of the cases. - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"WritePreparedTxnDB::GetSnapshotInternal:first", "callback:end"}, }); SyncPoint::GetInstance()->SetCallBack("RemovePrepared:Start", callback); SyncPoint::GetInstance()->EnableProcessing(); // Thread to cause frequent evictions - rocksdb::port::Thread eviction_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread eviction_thread([&]() { // Too many txns might cause commit_seq - prepare_seq in another thread // to go beyond DELTA_UPPERBOUND for (int i = 0; i < 25 * (1 << commit_cache_bits); i++) { db->Put(WriteOptions(), Slice("key1"), Slice("value1")); } }); - rocksdb::port::Thread write_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread write_thread([&]() { for (int i = 0; i < 25 * (1 << commit_cache_bits); i++) { Transaction* txn = db->BeginTransaction(WriteOptions(), TransactionOptions()); @@ -3424,8 +3427,8 @@ TEST_P(WritePreparedTransactionTest, CommitOfDelayedPrepared) { }); write_thread.join(); eviction_thread.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); - rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearAllCallBacks(); } } } @@ -3433,7 +3436,7 @@ TEST_P(WritePreparedTransactionTest, CommitOfDelayedPrepared) { // Test that updating the commit map will not affect the existing snapshots TEST_P(WritePreparedTransactionTest, AtomicCommit) { for (bool skip_prepare : {true, false}) { - rocksdb::SyncPoint::GetInstance()->LoadDependency({ + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ {"WritePreparedTxnDB::AddCommitted:start", "AtomicCommit::GetSnapshot:start"}, {"AtomicCommit::Get:end", @@ -3442,8 +3445,8 @@ TEST_P(WritePreparedTransactionTest, AtomicCommit) { {"AtomicCommit::Get2:end", "WritePreparedTxnDB::AddCommitted:end:pause:"}, }); - rocksdb::SyncPoint::GetInstance()->EnableProcessing(); - rocksdb::port::Thread write_thread([&]() { + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); + ROCKSDB_NAMESPACE::port::Thread write_thread([&]() { if (skip_prepare) { db->Put(WriteOptions(), Slice("key"), Slice("value")); } else { @@ -3456,7 +3459,7 @@ TEST_P(WritePreparedTransactionTest, AtomicCommit) { delete txn; } }); - rocksdb::port::Thread read_thread([&]() { + ROCKSDB_NAMESPACE::port::Thread read_thread([&]() { ReadOptions roptions; TEST_SYNC_POINT("AtomicCommit::GetSnapshot:start"); roptions.snapshot = db->GetSnapshot(); @@ -3470,7 +3473,7 @@ TEST_P(WritePreparedTransactionTest, AtomicCommit) { }); read_thread.join(); write_thread.join(); - rocksdb::SyncPoint::GetInstance()->DisableProcessing(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } } @@ -3502,7 +3505,7 @@ TEST_P(WritePreparedTransactionTest, WC_WP_WALForwardIncompatibility) { CrossCompatibilityTest(WRITE_PREPARED, WRITE_COMMITTED, !empty_wal); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/transactions/write_prepared_txn.cc b/utilities/transactions/write_prepared_txn.cc index f8eef361b8..216d83555c 100644 --- a/utilities/transactions/write_prepared_txn.cc +++ b/utilities/transactions/write_prepared_txn.cc @@ -20,7 +20,7 @@ #include "utilities/transactions/pessimistic_transaction.h" #include "utilities/transactions/write_prepared_txn_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { struct WriteOptions; @@ -468,6 +468,6 @@ Status WritePreparedTxn::RebuildFromWriteBatch(WriteBatch* src_batch) { return ret; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/write_prepared_txn.h b/utilities/transactions/write_prepared_txn.h index aaebaf48af..30d9bdb99b 100644 --- a/utilities/transactions/write_prepared_txn.h +++ b/utilities/transactions/write_prepared_txn.h @@ -30,7 +30,7 @@ #include "utilities/transactions/transaction_base.h" #include "utilities/transactions/transaction_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WritePreparedTxnDB; @@ -114,6 +114,6 @@ class WritePreparedTxn : public PessimisticTransaction { size_t prepare_batch_cnt_ = 0; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/write_prepared_txn_db.cc b/utilities/transactions/write_prepared_txn_db.cc index f399ea99d4..051fae554d 100644 --- a/utilities/transactions/write_prepared_txn_db.cc +++ b/utilities/transactions/write_prepared_txn_db.cc @@ -25,7 +25,7 @@ #include "utilities/transactions/pessimistic_transaction.h" #include "utilities/transactions/transaction_db_mutex_impl.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { Status WritePreparedTxnDB::Initialize( const std::vector& compaction_enabled_cf_indices, @@ -994,5 +994,5 @@ void SubBatchCounter::AddKey(const uint32_t cf, const Slice& key) { } } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/write_prepared_txn_db.h b/utilities/transactions/write_prepared_txn_db.h index 52b91fe4ba..964b72689f 100644 --- a/utilities/transactions/write_prepared_txn_db.h +++ b/utilities/transactions/write_prepared_txn_db.h @@ -29,7 +29,7 @@ #include "utilities/transactions/transaction_lock_mgr.h" #include "utilities/transactions/write_prepared_txn.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { enum SnapshotBackup : bool { kUnbackedByDBSnapshot, kBackedByDBSnapshot }; // A PessimisticTransactionDB that writes data to DB after prepare phase of 2PC. @@ -1107,5 +1107,5 @@ bool WritePreparedTxnDB::ValidateSnapshot( return true; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/write_unprepared_transaction_test.cc b/utilities/transactions/write_unprepared_transaction_test.cc index af0bb03bd8..8b1613b2e1 100644 --- a/utilities/transactions/write_unprepared_transaction_test.cc +++ b/utilities/transactions/write_unprepared_transaction_test.cc @@ -9,7 +9,7 @@ #include "utilities/transactions/write_unprepared_txn.h" #include "utilities/transactions/write_unprepared_txn_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WriteUnpreparedTransactionTestBase : public TransactionTestBase { public: @@ -708,8 +708,7 @@ TEST_P(WriteUnpreparedTransactionTest, UntrackedKeys) { delete txn; } - -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/transactions/write_unprepared_txn.cc b/utilities/transactions/write_unprepared_txn.cc index dd4caed8c1..01ec298cf2 100644 --- a/utilities/transactions/write_unprepared_txn.cc +++ b/utilities/transactions/write_unprepared_txn.cc @@ -10,7 +10,7 @@ #include "util/cast_util.h" #include "utilities/transactions/write_unprepared_txn_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { bool WriteUnpreparedTxnReadCallback::IsVisibleFullCheck(SequenceNumber seq) { // Since unprep_seqs maps prep_seq => prepare_batch_cnt, to check if seq is @@ -994,6 +994,6 @@ WriteUnpreparedTxn::GetUnpreparedSequenceNumbers() { return unprep_seqs_; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/write_unprepared_txn.h b/utilities/transactions/write_unprepared_txn.h index e15ce34876..30c8f4c555 100644 --- a/utilities/transactions/write_unprepared_txn.h +++ b/utilities/transactions/write_unprepared_txn.h @@ -12,7 +12,7 @@ #include "utilities/transactions/write_prepared_txn.h" #include "utilities/transactions/write_unprepared_txn_db.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WriteUnpreparedTxnDB; class WriteUnpreparedTxn; @@ -336,6 +336,6 @@ class WriteUnpreparedTxn : public WritePreparedTxn { KeySet untracked_keys_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/write_unprepared_txn_db.cc b/utilities/transactions/write_unprepared_txn_db.cc index 298b66aba9..ca365d044e 100644 --- a/utilities/transactions/write_unprepared_txn_db.cc +++ b/utilities/transactions/write_unprepared_txn_db.cc @@ -10,7 +10,7 @@ #include "rocksdb/utilities/transaction_db.h" #include "util/cast_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // Instead of reconstructing a Transaction object, and calling rollback on it, // we can be more efficient with RollbackRecoveredTransaction by skipping @@ -464,5 +464,5 @@ Iterator* WriteUnpreparedTxnDB::NewIterator(const ReadOptions& options, return db_iter; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/transactions/write_unprepared_txn_db.h b/utilities/transactions/write_unprepared_txn_db.h index 65cb4b9195..ad8e40f943 100644 --- a/utilities/transactions/write_unprepared_txn_db.h +++ b/utilities/transactions/write_unprepared_txn_db.h @@ -9,7 +9,7 @@ #include "utilities/transactions/write_prepared_txn_db.h" #include "utilities/transactions/write_unprepared_txn.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class WriteUnpreparedTxn; @@ -144,5 +144,5 @@ class WriteUnpreparedRollbackPreReleaseCallback : public PreReleaseCallback { SequenceNumber rollback_seq_; }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/ttl/db_ttl_impl.cc b/utilities/ttl/db_ttl_impl.cc index 2c79d01ba1..9ebaa247f8 100644 --- a/utilities/ttl/db_ttl_impl.cc +++ b/utilities/ttl/db_ttl_impl.cc @@ -14,7 +14,7 @@ #include "rocksdb/utilities/db_ttl.h" #include "util/coding.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { void DBWithTTLImpl::SanitizeOptions(int32_t ttl, ColumnFamilyOptions* options, Env* env) { @@ -331,5 +331,5 @@ void DBWithTTLImpl::SetTtl(ColumnFamilyHandle *h, int32_t ttl) { filter->SetTtl(ttl); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/ttl/db_ttl_impl.h b/utilities/ttl/db_ttl_impl.h index 0425808020..ab6063a47f 100644 --- a/utilities/ttl/db_ttl_impl.h +++ b/utilities/ttl/db_ttl_impl.h @@ -23,8 +23,7 @@ #undef GetCurrentTime #endif - -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class DBWithTTLImpl : public DBWithTTL { public: @@ -358,5 +357,5 @@ class TtlMergeOperator : public MergeOperator { std::shared_ptr user_merge_op_; Env* env_; }; -} +} // namespace ROCKSDB_NAMESPACE #endif // ROCKSDB_LITE diff --git a/utilities/ttl/ttl_test.cc b/utilities/ttl/ttl_test.cc index f95ce4b79c..3960bc625d 100644 --- a/utilities/ttl/ttl_test.cc +++ b/utilities/ttl/ttl_test.cc @@ -15,7 +15,7 @@ #include #endif -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { @@ -674,7 +674,7 @@ TEST_F(TtlTest, ChangeTtlOnOpenDb) { CloseTtl(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE // A black-box test for the ttl wrapper around rocksdb int main(int argc, char** argv) { diff --git a/utilities/util_merge_operators_test.cc b/utilities/util_merge_operators_test.cc index d591ac8f12..3b043ea2fb 100644 --- a/utilities/util_merge_operators_test.cc +++ b/utilities/util_merge_operators_test.cc @@ -7,7 +7,7 @@ #include "test_util/testutil.h" #include "utilities/merge_operators.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class UtilMergeOperatorTest : public testing::Test { public: @@ -91,7 +91,7 @@ TEST_F(UtilMergeOperatorTest, MaxMergeOperator) { EXPECT_EQ("a", PartialMerge("a", "")); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/utilities/write_batch_with_index/write_batch_with_index.cc b/utilities/write_batch_with_index/write_batch_with_index.cc index a3ef816dd7..2df6bcaf38 100644 --- a/utilities/write_batch_with_index/write_batch_with_index.cc +++ b/utilities/write_batch_with_index/write_batch_with_index.cc @@ -22,7 +22,7 @@ #include "util/string_util.h" #include "utilities/write_batch_with_index/write_batch_with_index_internal.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { // when direction == forward // * current_at_base_ <=> base_iterator > delta_iterator @@ -1061,5 +1061,5 @@ size_t WriteBatchWithIndex::GetDataSize() const { return rep->write_batch.GetDataSize(); } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/write_batch_with_index/write_batch_with_index_internal.cc b/utilities/write_batch_with_index/write_batch_with_index_internal.cc index 243672ce4d..8c1222f216 100644 --- a/utilities/write_batch_with_index/write_batch_with_index_internal.cc +++ b/utilities/write_batch_with_index/write_batch_with_index_internal.cc @@ -16,7 +16,7 @@ #include "util/coding.h" #include "util/string_util.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class Env; class Logger; @@ -283,6 +283,6 @@ WriteBatchWithIndexInternal::Result WriteBatchWithIndexInternal::GetFromBatch( return result; } -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/write_batch_with_index/write_batch_with_index_internal.h b/utilities/write_batch_with_index/write_batch_with_index_internal.h index 3eed7c724c..6a859e072b 100644 --- a/utilities/write_batch_with_index/write_batch_with_index_internal.h +++ b/utilities/write_batch_with_index/write_batch_with_index_internal.h @@ -18,7 +18,7 @@ #include "rocksdb/status.h" #include "rocksdb/utilities/write_batch_with_index.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { class MergeContext; struct Options; @@ -141,5 +141,5 @@ class WriteBatchWithIndexInternal { std::string* value, bool overwrite_key, Status* s); }; -} // namespace rocksdb +} // namespace ROCKSDB_NAMESPACE #endif // !ROCKSDB_LITE diff --git a/utilities/write_batch_with_index/write_batch_with_index_test.cc b/utilities/write_batch_with_index/write_batch_with_index_test.cc index ed28fa8fd2..ac4ab7af4a 100644 --- a/utilities/write_batch_with_index/write_batch_with_index_test.cc +++ b/utilities/write_batch_with_index/write_batch_with_index_test.cc @@ -20,7 +20,7 @@ #include "utilities/merge_operators.h" #include "utilities/merge_operators/string_append/stringappend.h" -namespace rocksdb { +namespace ROCKSDB_NAMESPACE { namespace { class ColumnFamilyHandleImplDummy : public ColumnFamilyHandleImpl { @@ -1827,10 +1827,10 @@ TEST_F(WriteBatchWithIndexTest, SingleDeleteDeltaIterTest) { ASSERT_EQ("B:b3,E:ee,", value); } -} // namespace +} // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { - rocksdb::port::InstallStackTraceHandler(); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }