[RocksJava] Integrate review comments from yhchiang
This commit is contained in:
parent
b011e201fa
commit
c73d13bb81
@ -6,7 +6,7 @@
|
|||||||
package org.rocksdb;
|
package org.rocksdb;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checksum types used in conjunction with BlockBasedTable..
|
* Checksum types used in conjunction with BlockBasedTable.
|
||||||
*/
|
*/
|
||||||
public enum ChecksumType {
|
public enum ChecksumType {
|
||||||
/**
|
/**
|
||||||
@ -22,12 +22,6 @@ public enum ChecksumType {
|
|||||||
*/
|
*/
|
||||||
kxxHash((byte) 2);
|
kxxHash((byte) 2);
|
||||||
|
|
||||||
private final byte value_;
|
|
||||||
|
|
||||||
private ChecksumType(byte value) {
|
|
||||||
value_ = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the byte value of the enumerations value
|
* Returns the byte value of the enumerations value
|
||||||
*
|
*
|
||||||
@ -36,4 +30,10 @@ public enum ChecksumType {
|
|||||||
public byte getValue() {
|
public byte getValue() {
|
||||||
return value_;
|
return value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ChecksumType(byte value) {
|
||||||
|
value_ = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final byte value_;
|
||||||
}
|
}
|
||||||
|
@ -38,12 +38,6 @@ public enum EncodingType {
|
|||||||
*/
|
*/
|
||||||
kPrefix((byte) 1);
|
kPrefix((byte) 1);
|
||||||
|
|
||||||
private final byte value_;
|
|
||||||
|
|
||||||
private EncodingType(byte value) {
|
|
||||||
value_ = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the byte value of the enumerations value
|
* Returns the byte value of the enumerations value
|
||||||
*
|
*
|
||||||
@ -52,4 +46,10 @@ public enum EncodingType {
|
|||||||
public byte getValue() {
|
public byte getValue() {
|
||||||
return value_;
|
return value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private EncodingType(byte value) {
|
||||||
|
value_ = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final byte value_;
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,6 @@ public enum IndexType {
|
|||||||
*/
|
*/
|
||||||
kHashSearch((byte) 1);
|
kHashSearch((byte) 1);
|
||||||
|
|
||||||
private final byte value_;
|
|
||||||
|
|
||||||
private IndexType(byte value) {
|
|
||||||
value_ = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the byte value of the enumerations value
|
* Returns the byte value of the enumerations value
|
||||||
*
|
*
|
||||||
@ -34,4 +28,10 @@ public enum IndexType {
|
|||||||
public byte getValue() {
|
public byte getValue() {
|
||||||
return value_;
|
return value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IndexType(byte value) {
|
||||||
|
value_ = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final byte value_;
|
||||||
}
|
}
|
||||||
|
@ -14,49 +14,32 @@ public class BlockBasedTableConfigTest {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
BlockBasedTableConfig blockBasedTableConfig =
|
BlockBasedTableConfig blockBasedTableConfig =
|
||||||
new BlockBasedTableConfig();
|
new BlockBasedTableConfig();
|
||||||
assert(!blockBasedTableConfig.noBlockCache());
|
|
||||||
blockBasedTableConfig.setNoBlockCache(true);
|
blockBasedTableConfig.setNoBlockCache(true);
|
||||||
assert(blockBasedTableConfig.noBlockCache());
|
assert(blockBasedTableConfig.noBlockCache());
|
||||||
assert(blockBasedTableConfig.blockCacheSize() == (8*1024*1024));
|
|
||||||
blockBasedTableConfig.setBlockCacheSize(8*1024);
|
blockBasedTableConfig.setBlockCacheSize(8*1024);
|
||||||
assert(blockBasedTableConfig.blockCacheSize() == (8*1024));
|
assert(blockBasedTableConfig.blockCacheSize() == (8*1024));
|
||||||
assert(blockBasedTableConfig.blockSizeDeviation() == 10);
|
|
||||||
blockBasedTableConfig.setBlockSizeDeviation(12);
|
blockBasedTableConfig.setBlockSizeDeviation(12);
|
||||||
assert(blockBasedTableConfig.blockSizeDeviation() == 12);
|
assert(blockBasedTableConfig.blockSizeDeviation() == 12);
|
||||||
assert(blockBasedTableConfig.blockRestartInterval() == 16);
|
|
||||||
blockBasedTableConfig.setBlockRestartInterval(15);
|
blockBasedTableConfig.setBlockRestartInterval(15);
|
||||||
assert(blockBasedTableConfig.blockRestartInterval() == 15);
|
assert(blockBasedTableConfig.blockRestartInterval() == 15);
|
||||||
assert(blockBasedTableConfig.wholeKeyFiltering());
|
|
||||||
blockBasedTableConfig.setWholeKeyFiltering(false);
|
blockBasedTableConfig.setWholeKeyFiltering(false);
|
||||||
assert(!blockBasedTableConfig.wholeKeyFiltering());
|
assert(!blockBasedTableConfig.wholeKeyFiltering());
|
||||||
assert(!blockBasedTableConfig.cacheIndexAndFilterBlocks());
|
|
||||||
blockBasedTableConfig.setCacheIndexAndFilterBlocks(true);
|
blockBasedTableConfig.setCacheIndexAndFilterBlocks(true);
|
||||||
assert(blockBasedTableConfig.cacheIndexAndFilterBlocks());
|
assert(blockBasedTableConfig.cacheIndexAndFilterBlocks());
|
||||||
assert(blockBasedTableConfig.hashIndexAllowCollision());
|
|
||||||
blockBasedTableConfig.setHashIndexAllowCollision(false);
|
blockBasedTableConfig.setHashIndexAllowCollision(false);
|
||||||
assert(!blockBasedTableConfig.hashIndexAllowCollision());
|
assert(!blockBasedTableConfig.hashIndexAllowCollision());
|
||||||
assert(blockBasedTableConfig.blockCacheCompressedSize() == 0);
|
|
||||||
blockBasedTableConfig.setBlockCacheCompressedSize(40);
|
blockBasedTableConfig.setBlockCacheCompressedSize(40);
|
||||||
assert(blockBasedTableConfig.blockCacheCompressedSize() == 40);
|
assert(blockBasedTableConfig.blockCacheCompressedSize() == 40);
|
||||||
assert(blockBasedTableConfig.checksumType().equals(
|
|
||||||
ChecksumType.kCRC32c));
|
|
||||||
blockBasedTableConfig.setChecksumType(ChecksumType.kNoChecksum);
|
blockBasedTableConfig.setChecksumType(ChecksumType.kNoChecksum);
|
||||||
assert(blockBasedTableConfig.checksumType().equals(
|
|
||||||
ChecksumType.kNoChecksum));
|
|
||||||
blockBasedTableConfig.setChecksumType(ChecksumType.kxxHash);
|
blockBasedTableConfig.setChecksumType(ChecksumType.kxxHash);
|
||||||
assert(blockBasedTableConfig.checksumType().equals(
|
assert(blockBasedTableConfig.checksumType().equals(
|
||||||
ChecksumType.kxxHash));
|
ChecksumType.kxxHash));
|
||||||
assert(blockBasedTableConfig.indexType().equals(
|
|
||||||
IndexType.kBinarySearch));
|
|
||||||
blockBasedTableConfig.setIndexType(IndexType.kHashSearch);
|
blockBasedTableConfig.setIndexType(IndexType.kHashSearch);
|
||||||
assert(blockBasedTableConfig.indexType().equals(
|
assert(blockBasedTableConfig.indexType().equals(
|
||||||
IndexType.kHashSearch));
|
IndexType.kHashSearch));
|
||||||
assert(blockBasedTableConfig.blockCacheCompressedNumShardBits()
|
|
||||||
== 0);
|
|
||||||
blockBasedTableConfig.setBlockCacheCompressedNumShardBits(4);
|
blockBasedTableConfig.setBlockCacheCompressedNumShardBits(4);
|
||||||
assert(blockBasedTableConfig.blockCacheCompressedNumShardBits()
|
assert(blockBasedTableConfig.blockCacheCompressedNumShardBits()
|
||||||
== 4);
|
== 4);
|
||||||
assert(blockBasedTableConfig.cacheNumShardBits() == 0);
|
|
||||||
blockBasedTableConfig.setCacheNumShardBits(5);
|
blockBasedTableConfig.setCacheNumShardBits(5);
|
||||||
assert(blockBasedTableConfig.cacheNumShardBits() == 5);
|
assert(blockBasedTableConfig.cacheNumShardBits() == 5);
|
||||||
System.out.println("BlockBasedTableConfig test passed");
|
System.out.println("BlockBasedTableConfig test passed");
|
||||||
|
@ -12,30 +12,21 @@ public class PlainTableConfigTest {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
PlainTableConfig plainTableConfig = new PlainTableConfig();
|
PlainTableConfig plainTableConfig = new PlainTableConfig();
|
||||||
assert(plainTableConfig.keySize() == 0);
|
|
||||||
plainTableConfig.setKeySize(5);
|
plainTableConfig.setKeySize(5);
|
||||||
assert(plainTableConfig.keySize() == 5);
|
assert(plainTableConfig.keySize() == 5);
|
||||||
assert(plainTableConfig.bloomBitsPerKey() == 10);
|
|
||||||
plainTableConfig.setBloomBitsPerKey(11);
|
plainTableConfig.setBloomBitsPerKey(11);
|
||||||
assert(plainTableConfig.bloomBitsPerKey() == 11);
|
assert(plainTableConfig.bloomBitsPerKey() == 11);
|
||||||
assert(plainTableConfig.hashTableRatio() == 0.75);
|
|
||||||
plainTableConfig.setHashTableRatio(0.95);
|
plainTableConfig.setHashTableRatio(0.95);
|
||||||
assert(plainTableConfig.hashTableRatio() == 0.95);
|
assert(plainTableConfig.hashTableRatio() == 0.95);
|
||||||
assert(plainTableConfig.indexSparseness() == 16);
|
|
||||||
plainTableConfig.setIndexSparseness(18);
|
plainTableConfig.setIndexSparseness(18);
|
||||||
assert(plainTableConfig.indexSparseness() == 18);
|
assert(plainTableConfig.indexSparseness() == 18);
|
||||||
assert(plainTableConfig.hugePageTlbSize() == 0);
|
|
||||||
plainTableConfig.setHugePageTlbSize(1);
|
plainTableConfig.setHugePageTlbSize(1);
|
||||||
assert(plainTableConfig.hugePageTlbSize() == 1);
|
assert(plainTableConfig.hugePageTlbSize() == 1);
|
||||||
assert(plainTableConfig.encodingType().equals(
|
|
||||||
EncodingType.kPlain));
|
|
||||||
plainTableConfig.setEncodingType(EncodingType.kPrefix);
|
plainTableConfig.setEncodingType(EncodingType.kPrefix);
|
||||||
assert(plainTableConfig.encodingType().equals(
|
assert(plainTableConfig.encodingType().equals(
|
||||||
EncodingType.kPrefix));
|
EncodingType.kPrefix));
|
||||||
assert(!plainTableConfig.fullScanMode());
|
|
||||||
plainTableConfig.setFullScanMode(true);
|
plainTableConfig.setFullScanMode(true);
|
||||||
assert(plainTableConfig.fullScanMode());
|
assert(plainTableConfig.fullScanMode());
|
||||||
assert(!plainTableConfig.storeIndexInFile());
|
|
||||||
plainTableConfig.setStoreIndexInFile(true);
|
plainTableConfig.setStoreIndexInFile(true);
|
||||||
assert(plainTableConfig.storeIndexInFile());
|
assert(plainTableConfig.storeIndexInFile());
|
||||||
System.out.println("PlainTableConfig test passed");
|
System.out.println("PlainTableConfig test passed");
|
||||||
|
Loading…
Reference in New Issue
Block a user