You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2019/05/31 08:06:10 UTC
[hbase] branch branch-2.2 updated: HBASE-22502 Purge the logs when
we reach the EOF for the last wal file when replication
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.2 by this push:
new 67f088f HBASE-22502 Purge the logs when we reach the EOF for the last wal file when replication
67f088f is described below
commit 67f088f594926cdfca378a983ac58b33c06cd4c8
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Thu May 30 15:20:30 2019 +0800
HBASE-22502 Purge the logs when we reach the EOF for the last wal file when replication
---
.../hbase/regionserver/wal/ProtobufLogReader.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogReader.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogReader.java
index 8e5eaaf..f2be93e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogReader.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogReader.java
@@ -344,7 +344,7 @@ public class ProtobufLogReader extends ReaderBase {
try {
int firstByte = this.inputStream.read();
if (firstByte == -1) {
- throw new EOFException("First byte is negative at offset " + originalPosition);
+ throw new EOFException();
}
size = CodedInputStream.readRawVarint32(firstByte, this.inputStream);
// available may be < 0 on local fs for instance. If so, can't depend on it.
@@ -412,15 +412,19 @@ public class ProtobufLogReader extends ReaderBase {
throw eof;
}
// If stuck at the same place and we got and exception, lets go back at the beginning.
- if (inputStream.getPos() == originalPosition && resetPosition) {
- LOG.warn("Encountered a malformed edit, seeking to the beginning of the WAL since "
- + "current position and original position match at {}", originalPosition);
- seekOnFs(0);
+ if (inputStream.getPos() == originalPosition) {
+ if (resetPosition) {
+ LOG.warn("Encountered a malformed edit, seeking to the beginning of the WAL since " +
+ "current position and original position match at {}", originalPosition);
+ seekOnFs(0);
+ } else {
+ LOG.info("Reached the end of file at position {}", originalPosition);
+ }
} else {
// Else restore our position to original location in hope that next time through we will
// read successfully.
- LOG.warn("Encountered a malformed edit, seeking back to last good position in file, "
- + "from {} to {}", inputStream.getPos(), originalPosition, eof);
+ LOG.warn("Encountered a malformed edit, seeking back to last good position in file, " +
+ "from {} to {}", inputStream.getPos(), originalPosition, eof);
seekOnFs(originalPosition);
}
return false;