HBASE-25994 Active WAL tailing fails when WAL value compression is enabled (#3377)
commit97f90e0be279be0a3c6901d22f1a2d199160bc52
authorAndrew Purtell <apurtell@apache.org>
Tue, 15 Jun 2021 00:16:31 +0000 (14 17:16 -0700)
committerGitHub <noreply@github.com>
Tue, 15 Jun 2021 00:16:31 +0000 (14 17:16 -0700)
tree4849daf50959d20c0c04c001dd239c5e71fd1188
parenta35ec994b94036fcd25acb1ea1738d8882ab587e
HBASE-25994 Active WAL tailing fails when WAL value compression is enabled (#3377)

Depending on which compression codec is used, a short read of the
compressed bytes can cause catastrophic errors that confuse the WAL reader.
This problem can manifest when the reader is actively tailing the WAL for
replication. To avoid these issues when WAL value compression is enabled,
BoundedDelegatingInputStream should assume enough bytes are available to
supply a reader up to its bound. This behavior is valid per the contract
of available(), which provides an _estimate_ of available bytes, and
equivalent to IOUtils.readFully but without requiring an intermediate
buffer.

Added TestReplicationCompressedWAL and TestReplicationValueCompressedWAL.
Without the WALCellCodec change TestReplicationValueCompressedWAL will
fail.

Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedDelegatingInputStream.java
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationCompressedWAL.java [new file with mode: 0644]
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationValueCompressedWAL.java [new file with mode: 0644]