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 GitHub
parent 4bd9ee43a4
commit 0e71d6192a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -5372,6 +5372,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));
}
@ -6536,6 +6541,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