|
|
@ -22,7 +22,11 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
wholeKeyFiltering_ = true; |
|
|
|
wholeKeyFiltering_ = true; |
|
|
|
filter_ = null; |
|
|
|
filter_ = null; |
|
|
|
cacheIndexAndFilterBlocks_ = false; |
|
|
|
cacheIndexAndFilterBlocks_ = false; |
|
|
|
|
|
|
|
cacheIndexAndFilterBlocksWithHighPriority_ = false; |
|
|
|
pinL0FilterAndIndexBlocksInCache_ = false; |
|
|
|
pinL0FilterAndIndexBlocksInCache_ = false; |
|
|
|
|
|
|
|
partitionFilters_ = false; |
|
|
|
|
|
|
|
metadataBlockSize_ = 4096; |
|
|
|
|
|
|
|
pinTopLevelIndexAndFilter_ = true; |
|
|
|
hashIndexAllowCollision_ = true; |
|
|
|
hashIndexAllowCollision_ = true; |
|
|
|
blockCacheCompressedSize_ = 0; |
|
|
|
blockCacheCompressedSize_ = 0; |
|
|
|
blockCacheCompressedNumShardBits_ = 0; |
|
|
|
blockCacheCompressedNumShardBits_ = 0; |
|
|
@ -246,6 +250,31 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Indicates if index and filter blocks will be treated as high-priority in the block cache. |
|
|
|
|
|
|
|
* See note below about applicability. If not specified, defaults to false. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return if index and filter blocks will be treated as high-priority. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean cacheIndexAndFilterBlocksWithHighPriority() { |
|
|
|
|
|
|
|
return cacheIndexAndFilterBlocksWithHighPriority_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* If true, cache index and filter blocks with high priority. If set to true, |
|
|
|
|
|
|
|
* depending on implementation of block cache, index and filter blocks may be |
|
|
|
|
|
|
|
* less likely to be evicted than data blocks. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param cacheIndexAndFilterBlocksWithHighPriority if index and filter blocks |
|
|
|
|
|
|
|
* will be treated as high-priority. |
|
|
|
|
|
|
|
* @return the reference to the current config. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public BlockBasedTableConfig setCacheIndexAndFilterBlocksWithHighPriority( |
|
|
|
|
|
|
|
final boolean cacheIndexAndFilterBlocksWithHighPriority) { |
|
|
|
|
|
|
|
cacheIndexAndFilterBlocksWithHighPriority_ = cacheIndexAndFilterBlocksWithHighPriority; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Indicating if we'd like to pin L0 index/filter blocks to the block cache. |
|
|
|
* Indicating if we'd like to pin L0 index/filter blocks to the block cache. |
|
|
|
If not specified, defaults to false. |
|
|
|
If not specified, defaults to false. |
|
|
@ -269,6 +298,70 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Indicating if we're using partitioned filters. Defaults to false. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return if we're using partition filters. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean partitionFilters() { |
|
|
|
|
|
|
|
return partitionFilters_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Use partitioned full filters for each SST file. This option is incompatible with |
|
|
|
|
|
|
|
* block-based filters. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param partitionFilters use partition filters. |
|
|
|
|
|
|
|
* @return the reference to the current config. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public BlockBasedTableConfig setPartitionFilters(final boolean partitionFilters) { |
|
|
|
|
|
|
|
partitionFilters_ = partitionFilters; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @return block size for partitioned metadata. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public long metadataBlockSize() { |
|
|
|
|
|
|
|
return metadataBlockSize_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Set block size for partitioned metadata. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param metadataBlockSize Partitioned metadata block size. |
|
|
|
|
|
|
|
* @return the reference to the current config. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public BlockBasedTableConfig setMetadataBlockSize( |
|
|
|
|
|
|
|
final long metadataBlockSize) { |
|
|
|
|
|
|
|
metadataBlockSize_ = metadataBlockSize; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Indicates if top-level index and filter blocks should be pinned. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return if top-level index and filter blocks should be pinned. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean pinTopLevelIndexAndFilter() { |
|
|
|
|
|
|
|
return pinTopLevelIndexAndFilter_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* If cacheIndexAndFilterBlocks is true and the below is true, then |
|
|
|
|
|
|
|
* the top-level index of partitioned filter and index blocks are stored in |
|
|
|
|
|
|
|
* the cache, but a reference is held in the "table reader" object so the |
|
|
|
|
|
|
|
* blocks are pinned and only evicted from cache when the table reader is |
|
|
|
|
|
|
|
* freed. This is not limited to l0 in LSM tree. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param pinTopLevelIndexAndFilter if top-level index and filter blocks should be pinned. |
|
|
|
|
|
|
|
* @return the reference to the current config. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public BlockBasedTableConfig setPinTopLevelIndexAndFilter(final boolean pinTopLevelIndexAndFilter) { |
|
|
|
|
|
|
|
pinTopLevelIndexAndFilter_ = pinTopLevelIndexAndFilter; |
|
|
|
|
|
|
|
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 |
|
|
@ -440,20 +533,27 @@ public class BlockBasedTableConfig extends TableFormatConfig { |
|
|
|
return newTableFactoryHandle(noBlockCache_, blockCacheSize_, blockCacheNumShardBits_, |
|
|
|
return newTableFactoryHandle(noBlockCache_, blockCacheSize_, blockCacheNumShardBits_, |
|
|
|
blockCacheHandle, blockSize_, blockSizeDeviation_, blockRestartInterval_, |
|
|
|
blockCacheHandle, blockSize_, blockSizeDeviation_, blockRestartInterval_, |
|
|
|
wholeKeyFiltering_, filterHandle, cacheIndexAndFilterBlocks_, |
|
|
|
wholeKeyFiltering_, filterHandle, cacheIndexAndFilterBlocks_, |
|
|
|
pinL0FilterAndIndexBlocksInCache_, hashIndexAllowCollision_, blockCacheCompressedSize_, |
|
|
|
cacheIndexAndFilterBlocksWithHighPriority_, pinL0FilterAndIndexBlocksInCache_, |
|
|
|
blockCacheCompressedNumShardBits_, checksumType_.getValue(), indexType_.getValue(), |
|
|
|
partitionFilters_, metadataBlockSize_, pinTopLevelIndexAndFilter_, |
|
|
|
formatVersion_); |
|
|
|
hashIndexAllowCollision_, blockCacheCompressedSize_, blockCacheCompressedNumShardBits_, |
|
|
|
|
|
|
|
checksumType_.getValue(), indexType_.getValue(), formatVersion_); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private native long newTableFactoryHandle(boolean noBlockCache, long blockCacheSize, |
|
|
|
private native long newTableFactoryHandle(boolean noBlockCache, long blockCacheSize, |
|
|
|
int blockCacheNumShardBits, long blockCacheHandle, long blockSize, int blockSizeDeviation, |
|
|
|
int blockCacheNumShardBits, long blockCacheHandle, long blockSize, int blockSizeDeviation, |
|
|
|
int blockRestartInterval, boolean wholeKeyFiltering, long filterPolicyHandle, |
|
|
|
int blockRestartInterval, boolean wholeKeyFiltering, long filterPolicyHandle, |
|
|
|
boolean cacheIndexAndFilterBlocks, boolean pinL0FilterAndIndexBlocksInCache, |
|
|
|
boolean cacheIndexAndFilterBlocks, boolean cacheIndexAndFilterBlocksWithHighPriority, |
|
|
|
boolean hashIndexAllowCollision, long blockCacheCompressedSize, |
|
|
|
boolean pinL0FilterAndIndexBlocksInCache, boolean partitionFilters, long metadataBlockSize, |
|
|
|
int blockCacheCompressedNumShardBits, byte checkSumType, byte indexType, int formatVersion); |
|
|
|
boolean pinTopLevelIndexAndFilter, boolean hashIndexAllowCollision, |
|
|
|
|
|
|
|
long blockCacheCompressedSize, int blockCacheCompressedNumShardBits, |
|
|
|
|
|
|
|
byte checkSumType, byte indexType, int formatVersion); |
|
|
|
|
|
|
|
|
|
|
|
private boolean cacheIndexAndFilterBlocks_; |
|
|
|
private boolean cacheIndexAndFilterBlocks_; |
|
|
|
|
|
|
|
private boolean cacheIndexAndFilterBlocksWithHighPriority_; |
|
|
|
private boolean pinL0FilterAndIndexBlocksInCache_; |
|
|
|
private boolean pinL0FilterAndIndexBlocksInCache_; |
|
|
|
|
|
|
|
private boolean partitionFilters_; |
|
|
|
|
|
|
|
private long metadataBlockSize_; |
|
|
|
|
|
|
|
private boolean pinTopLevelIndexAndFilter_; |
|
|
|
private IndexType indexType_; |
|
|
|
private IndexType indexType_; |
|
|
|
private boolean hashIndexAllowCollision_; |
|
|
|
private boolean hashIndexAllowCollision_; |
|
|
|
private ChecksumType checksumType_; |
|
|
|
private ChecksumType checksumType_; |
|
|
|