@InterfaceAudience.Private public class PreviousBlockCompressionRatePredicator extends Object implements BlockCompressedSizePredicator
Modifier and Type | Field and Description |
---|---|
private int |
adjustedBlockSize |
private int |
compressionRatio |
private int |
configuredMaxBlockSize |
BLOCK_COMPRESSED_SIZE_PREDICATOR, MAX_BLOCK_SIZE_UNCOMPRESSED
Constructor and Description |
---|
PreviousBlockCompressionRatePredicator() |
Modifier and Type | Method and Description |
---|---|
boolean |
shouldFinishBlock(int uncompressed)
Returns true if the passed uncompressed size is larger than the limit calculated by
updateLatestBlockSizes . |
void |
updateLatestBlockSizes(HFileContext context,
int uncompressed,
int compressed)
Recalculates compression rate for the last block and adjusts the block size limit as:
BLOCK_SIZE * (uncompressed/compressed).
|
private int adjustedBlockSize
private int compressionRatio
private int configuredMaxBlockSize
public PreviousBlockCompressionRatePredicator()
public void updateLatestBlockSizes(HFileContext context, int uncompressed, int compressed)
updateLatestBlockSizes
in interface BlockCompressedSizePredicator
context
- HFIleContext containing the configured max block size.uncompressed
- the uncompressed size of last block written.compressed
- the compressed size of last block written.public boolean shouldFinishBlock(int uncompressed)
updateLatestBlockSizes
.shouldFinishBlock
in interface BlockCompressedSizePredicator
uncompressed
- true if the block should be finished.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.