parent
2c1bd8846f
commit
b011e201fa
@ -0,0 +1,64 @@ |
|||||||
|
// Copyright (c) 2014, Facebook, Inc. All rights reserved.
|
||||||
|
// This source code is licensed under the BSD-style license found in the
|
||||||
|
// LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
// of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
package org.rocksdb.test; |
||||||
|
|
||||||
|
import org.rocksdb.BlockBasedTableConfig; |
||||||
|
import org.rocksdb.ChecksumType; |
||||||
|
import org.rocksdb.IndexType; |
||||||
|
|
||||||
|
public class BlockBasedTableConfigTest { |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
BlockBasedTableConfig blockBasedTableConfig = |
||||||
|
new BlockBasedTableConfig(); |
||||||
|
assert(!blockBasedTableConfig.noBlockCache()); |
||||||
|
blockBasedTableConfig.setNoBlockCache(true); |
||||||
|
assert(blockBasedTableConfig.noBlockCache()); |
||||||
|
assert(blockBasedTableConfig.blockCacheSize() == (8*1024*1024)); |
||||||
|
blockBasedTableConfig.setBlockCacheSize(8*1024); |
||||||
|
assert(blockBasedTableConfig.blockCacheSize() == (8*1024)); |
||||||
|
assert(blockBasedTableConfig.blockSizeDeviation() == 10); |
||||||
|
blockBasedTableConfig.setBlockSizeDeviation(12); |
||||||
|
assert(blockBasedTableConfig.blockSizeDeviation() == 12); |
||||||
|
assert(blockBasedTableConfig.blockRestartInterval() == 16); |
||||||
|
blockBasedTableConfig.setBlockRestartInterval(15); |
||||||
|
assert(blockBasedTableConfig.blockRestartInterval() == 15); |
||||||
|
assert(blockBasedTableConfig.wholeKeyFiltering()); |
||||||
|
blockBasedTableConfig.setWholeKeyFiltering(false); |
||||||
|
assert(!blockBasedTableConfig.wholeKeyFiltering()); |
||||||
|
assert(!blockBasedTableConfig.cacheIndexAndFilterBlocks()); |
||||||
|
blockBasedTableConfig.setCacheIndexAndFilterBlocks(true); |
||||||
|
assert(blockBasedTableConfig.cacheIndexAndFilterBlocks()); |
||||||
|
assert(blockBasedTableConfig.hashIndexAllowCollision()); |
||||||
|
blockBasedTableConfig.setHashIndexAllowCollision(false); |
||||||
|
assert(!blockBasedTableConfig.hashIndexAllowCollision()); |
||||||
|
assert(blockBasedTableConfig.blockCacheCompressedSize() == 0); |
||||||
|
blockBasedTableConfig.setBlockCacheCompressedSize(40); |
||||||
|
assert(blockBasedTableConfig.blockCacheCompressedSize() == 40); |
||||||
|
assert(blockBasedTableConfig.checksumType().equals( |
||||||
|
ChecksumType.kCRC32c)); |
||||||
|
blockBasedTableConfig.setChecksumType(ChecksumType.kNoChecksum); |
||||||
|
assert(blockBasedTableConfig.checksumType().equals( |
||||||
|
ChecksumType.kNoChecksum)); |
||||||
|
blockBasedTableConfig.setChecksumType(ChecksumType.kxxHash); |
||||||
|
assert(blockBasedTableConfig.checksumType().equals( |
||||||
|
ChecksumType.kxxHash)); |
||||||
|
assert(blockBasedTableConfig.indexType().equals( |
||||||
|
IndexType.kBinarySearch)); |
||||||
|
blockBasedTableConfig.setIndexType(IndexType.kHashSearch); |
||||||
|
assert(blockBasedTableConfig.indexType().equals( |
||||||
|
IndexType.kHashSearch)); |
||||||
|
assert(blockBasedTableConfig.blockCacheCompressedNumShardBits() |
||||||
|
== 0); |
||||||
|
blockBasedTableConfig.setBlockCacheCompressedNumShardBits(4); |
||||||
|
assert(blockBasedTableConfig.blockCacheCompressedNumShardBits() |
||||||
|
== 4); |
||||||
|
assert(blockBasedTableConfig.cacheNumShardBits() == 0); |
||||||
|
blockBasedTableConfig.setCacheNumShardBits(5); |
||||||
|
assert(blockBasedTableConfig.cacheNumShardBits() == 5); |
||||||
|
System.out.println("BlockBasedTableConfig test passed"); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
// Copyright (c) 2014, Facebook, Inc. All rights reserved.
|
||||||
|
// This source code is licensed under the BSD-style license found in the
|
||||||
|
// LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
// of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
package org.rocksdb.test; |
||||||
|
|
||||||
|
import org.rocksdb.EncodingType; |
||||||
|
import org.rocksdb.PlainTableConfig; |
||||||
|
|
||||||
|
public class PlainTableConfigTest { |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
PlainTableConfig plainTableConfig = new PlainTableConfig(); |
||||||
|
assert(plainTableConfig.keySize() == 0); |
||||||
|
plainTableConfig.setKeySize(5); |
||||||
|
assert(plainTableConfig.keySize() == 5); |
||||||
|
assert(plainTableConfig.bloomBitsPerKey() == 10); |
||||||
|
plainTableConfig.setBloomBitsPerKey(11); |
||||||
|
assert(plainTableConfig.bloomBitsPerKey() == 11); |
||||||
|
assert(plainTableConfig.hashTableRatio() == 0.75); |
||||||
|
plainTableConfig.setHashTableRatio(0.95); |
||||||
|
assert(plainTableConfig.hashTableRatio() == 0.95); |
||||||
|
assert(plainTableConfig.indexSparseness() == 16); |
||||||
|
plainTableConfig.setIndexSparseness(18); |
||||||
|
assert(plainTableConfig.indexSparseness() == 18); |
||||||
|
assert(plainTableConfig.hugePageTlbSize() == 0); |
||||||
|
plainTableConfig.setHugePageTlbSize(1); |
||||||
|
assert(plainTableConfig.hugePageTlbSize() == 1); |
||||||
|
assert(plainTableConfig.encodingType().equals( |
||||||
|
EncodingType.kPlain)); |
||||||
|
plainTableConfig.setEncodingType(EncodingType.kPrefix); |
||||||
|
assert(plainTableConfig.encodingType().equals( |
||||||
|
EncodingType.kPrefix)); |
||||||
|
assert(!plainTableConfig.fullScanMode()); |
||||||
|
plainTableConfig.setFullScanMode(true); |
||||||
|
assert(plainTableConfig.fullScanMode()); |
||||||
|
assert(!plainTableConfig.storeIndexInFile()); |
||||||
|
plainTableConfig.setStoreIndexInFile(true); |
||||||
|
assert(plainTableConfig.storeIndexInFile()); |
||||||
|
System.out.println("PlainTableConfig test passed"); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue