X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Frocksdb%2Fjava%2Frocksjni%2Ftable.cc;h=9e3f4b6637f643968b53b06bf70a29ab7fcc443f;hb=f67539c23b11f3b8a2ecaeeddf7a403ae1c442a8;hp=1ccc550ab622d37bf652cafa69ea7bcd8e85dfda;hpb=64a4c04e6850c6d9086e4c37f57c4eada541b05e;p=ceph.git diff --git a/ceph/src/rocksdb/java/rocksjni/table.cc b/ceph/src/rocksdb/java/rocksjni/table.cc index 1ccc550ab..9e3f4b663 100644 --- a/ceph/src/rocksdb/java/rocksjni/table.cc +++ b/ceph/src/rocksdb/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,49 +73,55 @@ 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) { + } 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 { + options.no_block_cache = true; + options.block_cache = nullptr; } } 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)); } } @@ -123,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; } @@ -135,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)); }