shahrs87 commented on a change in pull request #3244:
URL: https://github.com/apache/hbase/pull/3244#discussion_r629711573
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java
##########
@@ -256,6 +278,26 @@ public void write(Cell cell) throws IOException {
}
}
}
+
+ private byte[] compressValue(Cell cell) throws IOException {
+ byte[] buffer = new byte[4096];
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ Deflater deflater = compression.getValueCompressor().getDeflater();
+ deflater.setInput(cell.getValueArray(), cell.getValueOffset(),
cell.getValueLength());
+ boolean finished = false;
+ do {
+ int bytesOut = deflater.deflate(buffer);
+ if (bytesOut > 0) {
+ baos.write(buffer, 0, bytesOut);
+ } else {
+ bytesOut = deflater.deflate(buffer, 0, buffer.length,
Deflater.SYNC_FLUSH);
Review comment:
Also the java doc for SYNC_FLUSH says the following thing.
```
In the case of FULL_FLUSH or SYNC_FLUSH, if the return value is len, the
space available in output buffer b, this method should be invoked again with
the same flush parameter and more output space.
```
https://docs.oracle.com/javase/8/docs/api/java/util/zip/Deflater.html#deflate-byte:A-int-int-int-
@apurtell Do we need to change something regarding this comment ?
--
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:
[email protected]