[ 
https://issues.apache.org/jira/browse/HADOOP-17144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17183989#comment-17183989
 ] 

Masatake Iwasaki commented on HADOOP-17144:
-------------------------------------------

{noformat}
@@ -185,7 +185,7 @@ void MeasureSingleFileLz4(const string & path, 
CompressResult & total, size_t bl
     size_t currentblocksize = std::min(data.length() - start, blockSize);
     uint64_t startTime = t.now();
     for (int i = 0; i < times; i++) {
-      int osize = LZ4_compress((char*)data.data() + start, outputBuffer, 
currentblocksize);
+      int osize = LZ4_compress_default((char*)data.data() + start, 
outputBuffer, currentblocksize, LZ4_compressBound(currentblocksize));
       result.compressedSize += osize;
       result.uncompressedSize += currentblocksize;
     }
{noformat}

There is no guarantee that LZ4_compressBound(currentblocksize) > 
sizeof(outputBuffer). How about updating the calculation of the maxlength?

{noformat}
  size_t maxlength = std::max((size_t)(blockSize * 1.005), blockSize + 8);
  char * outputBuffer = new char[maxlength];
{noformat}


> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to