apurtell commented on a change in pull request #3244:
URL: https://github.com/apache/hbase/pull/3244#discussion_r630326851



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java
##########
@@ -256,6 +267,43 @@ public void write(Cell cell) throws IOException {
         }
       }
     }
+
+    private byte[] compressValue(Cell cell) throws IOException {
+      Deflater deflater = compression.getValueCompressor().getDeflater();
+      if (cell instanceof ByteBufferExtendedCell) {
+        
deflater.setInput(((ByteBufferExtendedCell)cell).getValueByteBuffer().array(),
+          ((ByteBufferExtendedCell)cell).getValueByteBuffer().arrayOffset() +
+          ((ByteBufferExtendedCell)cell).getValuePosition(),
+          cell.getValueLength());
+      } else {
+        deflater.setInput(cell.getValueArray(), cell.getValueOffset(), 
cell.getValueLength());
+      }
+      ByteArrayOutputStream baos = new ByteArrayOutputStream();

Review comment:
       You are sizing your buffer too small. Read the Deflater/Inflater javadoc 
and code to learn more, please. Do let me know if I am doing something wrong. 
As far as I am aware, my API usage is correct. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to