|
|
@ -18,7 +18,7 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
blockSizeDeviation_ = 10; |
|
|
|
blockSizeDeviation_ = 10; |
|
|
|
blockRestartInterval_ = 16; |
|
|
|
blockRestartInterval_ = 16; |
|
|
|
wholeKeyFiltering_ = true; |
|
|
|
wholeKeyFiltering_ = true; |
|
|
|
bitsPerKey_ = 10; |
|
|
|
filter_ = null; |
|
|
|
cacheIndexAndFilterBlocks_ = false; |
|
|
|
cacheIndexAndFilterBlocks_ = false; |
|
|
|
hashIndexAllowCollision_ = true; |
|
|
|
hashIndexAllowCollision_ = true; |
|
|
|
blockCacheCompressedSize_ = 0; |
|
|
|
blockCacheCompressedSize_ = 0; |
|
|
@ -182,30 +182,30 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
* |
|
|
|
* |
|
|
|
* Filter instance can be re-used in multiple options instances. |
|
|
|
* Filter instance can be re-used in multiple options instances. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param Filter policy java instance. |
|
|
|
* @param Filter Filter Policy java instance. |
|
|
|
* @return the reference to the current config. |
|
|
|
* @return the reference to the current config. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public BlockBasedTableConfig setFilterBitsPerKey(int bitsPerKey) { |
|
|
|
public BlockBasedTableConfig setFilter(Filter filter) { |
|
|
|
bitsPerKey_ = bitsPerKey; |
|
|
|
filter_ = filter; |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Indicating if we'd put index/filter blocks to the block cache. |
|
|
|
* Indicating if we'd put index/filter blocks to the block cache. |
|
|
|
If not specified, each "table reader" object will pre-load index/filter |
|
|
|
If not specified, each "table reader" object will pre-load index/filter |
|
|
|
block during table initialization. |
|
|
|
block during table initialization. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return if index and filter blocks should be put in block cache. |
|
|
|
* @return if index and filter blocks should be put in block cache. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean cacheIndexAndFilterBlocks() { |
|
|
|
public boolean cacheIndexAndFilterBlocks() { |
|
|
|
return cacheIndexAndFilterBlocks_; |
|
|
|
return cacheIndexAndFilterBlocks_; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Indicating if we'd put index/filter blocks to the block cache. |
|
|
|
* Indicating if we'd put index/filter blocks to the block cache. |
|
|
|
If not specified, each "table reader" object will pre-load index/filter |
|
|
|
If not specified, each "table reader" object will pre-load index/filter |
|
|
|
block during table initialization. |
|
|
|
block during table initialization. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param index and filter blocks should be put in block cache. |
|
|
|
* @param index and filter blocks should be put in block cache. |
|
|
|
* @return the reference to the current config. |
|
|
|
* @return the reference to the current config. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -214,25 +214,25 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
cacheIndexAndFilterBlocks_ = cacheIndexAndFilterBlocks; |
|
|
|
cacheIndexAndFilterBlocks_ = cacheIndexAndFilterBlocks; |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Influence the behavior when kHashSearch is used. |
|
|
|
* Influence the behavior when kHashSearch is used. |
|
|
|
if false, stores a precise prefix to block range mapping |
|
|
|
if false, stores a precise prefix to block range mapping |
|
|
|
if true, does not store prefix and allows prefix hash collision |
|
|
|
if true, does not store prefix and allows prefix hash collision |
|
|
|
(less memory consumption) |
|
|
|
(less memory consumption) |
|
|
|
* |
|
|
|
* |
|
|
|
* @return if hash collisions should be allowed. |
|
|
|
* @return if hash collisions should be allowed. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean hashIndexAllowCollision() { |
|
|
|
public boolean hashIndexAllowCollision() { |
|
|
|
return hashIndexAllowCollision_; |
|
|
|
return hashIndexAllowCollision_; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Influence the behavior when kHashSearch is used. |
|
|
|
* Influence the behavior when kHashSearch is used. |
|
|
|
if false, stores a precise prefix to block range mapping |
|
|
|
if false, stores a precise prefix to block range mapping |
|
|
|
if true, does not store prefix and allows prefix hash collision |
|
|
|
if true, does not store prefix and allows prefix hash collision |
|
|
|
(less memory consumption) |
|
|
|
(less memory consumption) |
|
|
|
* |
|
|
|
* |
|
|
|
* @param if hash collisions should be allowed. |
|
|
|
* @param if hash collisions should be allowed. |
|
|
|
* @return the reference to the current config. |
|
|
|
* @return the reference to the current config. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -241,21 +241,21 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
hashIndexAllowCollision_ = hashIndexAllowCollision; |
|
|
|
hashIndexAllowCollision_ = hashIndexAllowCollision; |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Size of compressed block cache. If 0, then block_cache_compressed is set |
|
|
|
* Size of compressed block cache. If 0, then block_cache_compressed is set |
|
|
|
* to null. |
|
|
|
* to null. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return size of compressed block cache. |
|
|
|
* @return size of compressed block cache. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public long blockCacheCompressedSize() { |
|
|
|
public long blockCacheCompressedSize() { |
|
|
|
return blockCacheCompressedSize_; |
|
|
|
return blockCacheCompressedSize_; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Size of compressed block cache. If 0, then block_cache_compressed is set |
|
|
|
* Size of compressed block cache. If 0, then block_cache_compressed is set |
|
|
|
* to null. |
|
|
|
* to null. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param size of compressed block cache. |
|
|
|
* @param size of compressed block cache. |
|
|
|
* @return the reference to the current config. |
|
|
|
* @return the reference to the current config. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -264,7 +264,7 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
blockCacheCompressedSize_ = blockCacheCompressedSize; |
|
|
|
blockCacheCompressedSize_ = blockCacheCompressedSize; |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Controls the number of shards for the block compressed cache. |
|
|
|
* Controls the number of shards for the block compressed cache. |
|
|
|
* This is applied only if blockCompressedCacheSize is set to non-negative. |
|
|
|
* This is applied only if blockCompressedCacheSize is set to non-negative. |
|
|
@ -276,7 +276,7 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
public int blockCacheCompressedNumShardBits() { |
|
|
|
public int blockCacheCompressedNumShardBits() { |
|
|
|
return blockCacheCompressedNumShardBits_; |
|
|
|
return blockCacheCompressedNumShardBits_; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Controls the number of shards for the block compressed cache. |
|
|
|
* Controls the number of shards for the block compressed cache. |
|
|
|
* This is applied only if blockCompressedCacheSize is set to non-negative. |
|
|
|
* This is applied only if blockCompressedCacheSize is set to non-negative. |
|
|
@ -293,17 +293,23 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override protected long newTableFactoryHandle() { |
|
|
|
@Override protected long newTableFactoryHandle() { |
|
|
|
|
|
|
|
long filterHandle = 0; |
|
|
|
|
|
|
|
if (filter_ != null) { |
|
|
|
|
|
|
|
filterHandle = filter_.nativeHandle_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return newTableFactoryHandle(noBlockCache_, blockCacheSize_, |
|
|
|
return newTableFactoryHandle(noBlockCache_, blockCacheSize_, |
|
|
|
blockCacheNumShardBits_, blockSize_, blockSizeDeviation_, |
|
|
|
blockCacheNumShardBits_, blockSize_, blockSizeDeviation_, |
|
|
|
blockRestartInterval_, wholeKeyFiltering_, bitsPerKey_, |
|
|
|
blockRestartInterval_, wholeKeyFiltering_, |
|
|
|
cacheIndexAndFilterBlocks_, hashIndexAllowCollision_, |
|
|
|
filterHandle, cacheIndexAndFilterBlocks_, |
|
|
|
blockCacheCompressedSize_, blockCacheCompressedNumShardBits_); |
|
|
|
hashIndexAllowCollision_, blockCacheCompressedSize_, |
|
|
|
|
|
|
|
blockCacheCompressedNumShardBits_); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private native long newTableFactoryHandle( |
|
|
|
private native long newTableFactoryHandle( |
|
|
|
boolean noBlockCache, long blockCacheSize, int blockCacheNumShardBits, |
|
|
|
boolean noBlockCache, long blockCacheSize, int blockCacheNumShardBits, |
|
|
|
long blockSize, int blockSizeDeviation, int blockRestartInterval, |
|
|
|
long blockSize, int blockSizeDeviation, int blockRestartInterval, |
|
|
|
boolean wholeKeyFiltering, int bitsPerKey, |
|
|
|
boolean wholeKeyFiltering, long filterPolicyHandle, |
|
|
|
boolean cacheIndexAndFilterBlocks, boolean hashIndexAllowCollision, |
|
|
|
boolean cacheIndexAndFilterBlocks, boolean hashIndexAllowCollision, |
|
|
|
long blockCacheCompressedSize, int blockCacheCompressedNumShardBits); |
|
|
|
long blockCacheCompressedSize, int blockCacheCompressedNumShardBits); |
|
|
|
|
|
|
|
|
|
|
@ -315,7 +321,7 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
private int blockSizeDeviation_; |
|
|
|
private int blockSizeDeviation_; |
|
|
|
private int blockRestartInterval_; |
|
|
|
private int blockRestartInterval_; |
|
|
|
private boolean wholeKeyFiltering_; |
|
|
|
private boolean wholeKeyFiltering_; |
|
|
|
private int bitsPerKey_; |
|
|
|
private Filter filter_; |
|
|
|
private boolean cacheIndexAndFilterBlocks_; |
|
|
|
private boolean cacheIndexAndFilterBlocks_; |
|
|
|
private boolean hashIndexAllowCollision_; |
|
|
|
private boolean hashIndexAllowCollision_; |
|
|
|
private long blockCacheCompressedSize_; |
|
|
|
private long blockCacheCompressedSize_; |
|
|
|