[ https://issues.apache.org/jira/browse/HADOOP-17144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17183976#comment-17183976 ]
Masatake Iwasaki commented on HADOOP-17144: ------------------------------------------- Thanks for the update, [~hemanthboyina]. {noformat} @@ -66,11 +66,12 @@ */ public Lz4Decompressor(int directBufferSize) { this.directBufferSize = directBufferSize; - - compressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); + // is the size of destination buffer (which must be already allocated), + // presumed an upper bound of decompressed size + int dstCapacity = (directBufferSize) + ((directBufferSize) / 255) + 16; + compressedDirectBuf = ByteBuffer.allocateDirect(dstCapacity); uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf.position(directBufferSize); - } {noformat} Since user of Lz4Decompressor provides already compressed data as input, we do not need to expand the internal buffer? {noformat} /** @@ -120,7 +121,7 @@ public synchronized void setInput(byte[] b, int off, int len) { * consumed. */ synchronized void setInputFromSavedData() { - compressedDirectBufLen = Math.min(userBufLen, directBufferSize); + compressedDirectBufLen = userBufLen; // Reinitialize lz4's input direct buffer compressedDirectBuf.rewind(); {noformat} This looks incorrect since the userBufLen could be greater than directBufferSize. cc and whitespace warnings should be addressed too. > Update Hadoop's lz4 to v1.9.2 > ----------------------------- > > Key: HADOOP-17144 > URL: https://issues.apache.org/jira/browse/HADOOP-17144 > Project: Hadoop Common > Issue Type: Improvement > Reporter: Hemanth Boyina > Assignee: Hemanth Boyina > Priority: Major > Attachments: HADOOP-17144.001.patch, HADOOP-17144.002.patch, > HADOOP-17144.003.patch, HADOOP-17144.004.patch > > > Update hadoop's native lz4 to v1.9.2 -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org