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


##########
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) {
+          int remaining = rawReadInt(lowerIn);
+          assert remaining == 0;
+        }
       }
     }
 
+    private int rawReadInt(InputStream in) throws IOException {

Review Comment:
   I'm surprised commons-io or our own util code doesn't have something like 
this already.



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