HBASE-25053 WAL replay should ignore 0-length files (#2437)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
niuyulin 2020-11-05 00:21:31 +08:00 committed by stack
parent 770098128a
commit 3d8152b635
1 changed files with 7 additions and 0 deletions

View File

@ -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