Skip to content

Commit

Permalink
HBASE-27386 Use encoded size for calculating compression ratio in blo…
Browse files Browse the repository at this point in the history
…ck size predicator (#4795)

Signed-off-by: Ankit Singhal <[email protected]>
  • Loading branch information
wchevreuil authored Sep 23, 2022
1 parent cc4268a commit da87a8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ private void finishBlock() throws IOException {
// We need to cache the unencoded/uncompressed size before changing the block state
int rawBlockSize = 0;
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
// block is ready, but not yet encoded or compressed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1220,8 +1220,8 @@ public void testDataBlockSizeEncoded() throws Exception {
public void testDataBlockSizeCompressed() throws Exception {
conf.set(BLOCK_COMPRESSED_SIZE_PREDICATOR,
PreviousBlockCompressionRatePredicator.class.getName());
testDataBlockSizeWithCompressionRatePredicator(11,
(s, c) -> (c > 1 && c < 11) ? s >= BLOCKSIZE_SMALL * 10 : true);
testDataBlockSizeWithCompressionRatePredicator(12,
(s, c) -> (c > 2 && c < 11) ? s >= BLOCKSIZE_SMALL * 10 : true);
}

@Test
Expand Down

0 comments on commit da87a8e

Please sign in to comment.