diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufWALTailingReader.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufWALTailingReader.java index 62091acdd1db..6319ff296d66 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufWALTailingReader.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufWALTailingReader.java @@ -79,7 +79,9 @@ private IOException unwrapIPBE(IOException e) { private ReadWALKeyResult readWALKey(long originalPosition) { int firstByte; try { - firstByte = delegatingInput.read(); + do { + firstByte = delegatingInput.read(); + } while (firstByte == 0); } catch (IOException e) { LOG.warn("Failed to read wal key length first byte", e); return KEY_ERROR_AND_RESET; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java index 84709cbc58dd..149b423ccb76 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java @@ -288,6 +288,11 @@ public CompressedKvDecoder(InputStream in, CompressionContext compression) { @Override protected Cell parseCell() throws IOException { + int firstByte = in.read(); + while (firstByte == 0) { + firstByte = in.read(); + } + ((PBIS) in).unread(firstByte); int keylength = StreamUtils.readRawVarint32(in); int vlength = StreamUtils.readRawVarint32(in); int tagsLength = StreamUtils.readRawVarint32(in);