apurtell commented on code in PR #5696:
URL: https://github.com/apache/hbase/pull/5696#discussion_r1500056258


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/CompressionContext.java:
##########
@@ -129,9 +130,25 @@ public void decompress(InputStream in, int inLength, 
byte[] outArray, int outOff
       } else {
         lowerIn.reset(in, inLength);
         IOUtils.readFully(compressedIn, outArray, outOffset, outLength);
+        // if the uncompressed size was larger than the configured buffer size 
for the codec,
+        // the BlockCompressorStream will have left an extra 4 bytes hanging. 
This represents a size
+        // for the next segment, and it should be 0. See HBASE-28390
+        if (lowerIn.available() == 4) {

Review Comment:
   This part is ugly but I don't have an alternative suggestion. At least we 
know both in the WAL read and HFile read cases we won't be contending with a 
short read, so available is going to be either 0 or 4 and otherwise we'd have 
had an EOFException thrown. 



##########
hbase-server/src/test/java/org/apache/hadoop/hbase/wal/CompressedWALTestBase.java:
##########
@@ -67,14 +71,36 @@ public class CompressedWALTestBase {
     Arrays.fill(VALUE, off, (off += 1597), (byte) 'Q');
   }
 
-  public void doTest(TableName tableName) throws Exception {
+  @Test

Review Comment:
   Thanks for cleaning this up and removing all the unneeded boilerplate.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to