HBASE-27386 Use encoded size for calculating compression ratio in block size predicator (#4795)
Signed-off-by: Ankit Singhal <ankit@apache.org>
This commit is contained in:
parent
cc4268a7d2
commit
da87a8e70c
|
@ -933,7 +933,7 @@ public class HFileBlock implements Cacheable {
|
||||||
// We need to cache the unencoded/uncompressed size before changing the block state
|
// We need to cache the unencoded/uncompressed size before changing the block state
|
||||||
int rawBlockSize = 0;
|
int rawBlockSize = 0;
|
||||||
if (this.getEncodingState() != null) {
|
if (this.getEncodingState() != null) {
|
||||||
rawBlockSize = blockSizeWritten();
|
rawBlockSize = encodedBlockSizeWritten();
|
||||||
}
|
}
|
||||||
// We need to set state before we can package the block up for cache-on-write. In a way, the
|
// We need to set state before we can package the block up for cache-on-write. In a way, the
|
||||||
// block is ready, but not yet encoded or compressed.
|
// block is ready, but not yet encoded or compressed.
|
||||||
|
|
|
@ -1220,8 +1220,8 @@ public class TestHStoreFile {
|
||||||
public void testDataBlockSizeCompressed() throws Exception {
|
public void testDataBlockSizeCompressed() throws Exception {
|
||||||
conf.set(BLOCK_COMPRESSED_SIZE_PREDICATOR,
|
conf.set(BLOCK_COMPRESSED_SIZE_PREDICATOR,
|
||||||
PreviousBlockCompressionRatePredicator.class.getName());
|
PreviousBlockCompressionRatePredicator.class.getName());
|
||||||
testDataBlockSizeWithCompressionRatePredicator(11,
|
testDataBlockSizeWithCompressionRatePredicator(12,
|
||||||
(s, c) -> (c > 1 && c < 11) ? s >= BLOCKSIZE_SMALL * 10 : true);
|
(s, c) -> (c > 2 && c < 11) ? s >= BLOCKSIZE_SMALL * 10 : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue