Skip to content

Commit

Permalink
HBASE-25053 WAL replay should ignore 0-length files (#2437)
Browse files Browse the repository at this point in the history
Signed-off-by: Duo Zhang <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>
  • Loading branch information
nyl3532016 committed Nov 27, 2021
1 parent 7a8483b commit f76d6bc
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4771,6 +4771,11 @@ long replayRecoveredEditsIfAny(Map<byte[], Long> maxSeqIdInStores,
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));
}
Expand Down Expand Up @@ -5935,6 +5940,8 @@ protected void restoreEdit(HStore s, Cell cell, MemStoreSizing memstoreAccountin
}

/**
* 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
Expand Down

0 comments on commit f76d6bc

Please sign in to comment.