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 ec31017e78c..3a08239c400 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