Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public BaseDecoder(final InputStream in) {

@Override
public boolean advance() throws IOException {
int firstByte = in.read();
int firstByte = skipZeroLength(in);
if (firstByte == -1) {
return false;
} else {
Expand All @@ -72,6 +72,14 @@ public boolean advance() throws IOException {
return true;
}

public static int skipZeroLength(InputStream in) throws IOException {
int firstByte;
do {
firstByte = in.read();
} while (firstByte == 0);
return firstByte;
}

private void rethrowEofException(IOException ioEx) throws IOException {
boolean isEof = false;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.InputStream;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.hbase.codec.BaseDecoder;
import org.apache.hadoop.hbase.io.DelegatingInputStream;
import org.apache.hadoop.hbase.io.util.StreamUtils;
import org.apache.hadoop.hbase.util.Pair;
Expand Down Expand Up @@ -79,7 +80,7 @@ private IOException unwrapIPBE(IOException e) {
private ReadWALKeyResult readWALKey(long originalPosition) {
int firstByte;
try {
firstByte = delegatingInput.read();
firstByte = BaseDecoder.skipZeroLength(delegatingInput);
} catch (IOException e) {
LOG.warn("Failed to read wal key length first byte", e);
return KEY_ERROR_AND_RESET;
Expand Down