You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2020/11/04 16:22:46 UTC
[hbase] branch branch-2 updated: HBASE-25053 WAL replay should
ignore 0-length files (#2437)
This is an automated email from the ASF dual-hosted git repository.
stack pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new 3d8152b HBASE-25053 WAL replay should ignore 0-length files (#2437)
3d8152b is described below
commit 3d8152b635491c4b13883096abe023ee4f3c1af3
Author: niuyulin <ny...@163.com>
AuthorDate: Thu Nov 5 00:21:31 2020 +0800
HBASE-25053 WAL replay should ignore 0-length files (#2437)
Signed-off-by: Duo Zhang <zh...@apache.org>
Signed-off-by: Viraj Jasani <vj...@apache.org>
---
.../main/java/org/apache/hadoop/hbase/regionserver/HRegion.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index ec31017..3a08239 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -5323,6 +5323,11 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
recoveredEditsDir);
if (files != null) {
for (FileStatus file : files) {
+ // it is safe to trust the zero-length in this case because we've been through rename and
+ // lease recovery in the above.
+ if (isZeroLengthThenDelete(fs, file, file.getPath())) {
+ continue;
+ }
seqId =
Math.max(seqId, replayRecoveredEdits(file.getPath(), maxSeqIdInStores, reporter, fs));
}
@@ -6487,6 +6492,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
}
/**
+ * make sure have been through lease recovery before get file status, so the file length can be
+ * trusted.
* @param p File to check.
* @return True if file was zero-length (and if so, we'll delete it in here).
* @throws IOException