Skip to content

Commit 0e8cfdb

Browse files
authored
HBASE-28637 asyncwal should attempt to recover lease if close fails (#5962)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
1 parent 9bdee6d commit 0e8cfdb

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
import org.apache.hadoop.hbase.util.CommonFSUtils;
9797
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
9898
import org.apache.hadoop.hbase.util.Pair;
99+
import org.apache.hadoop.hbase.util.RecoverLeaseFSUtils;
99100
import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;
100101
import org.apache.hadoop.hbase.wal.WAL;
101102
import org.apache.hadoop.hbase.wal.WALEdit;
@@ -2022,13 +2023,22 @@ protected final void waitForSafePoint() {
20222023
}
20232024
}
20242025

2026+
private void recoverLease(FileSystem fs, Path p, Configuration conf) {
2027+
try {
2028+
RecoverLeaseFSUtils.recoverFileLease(fs, p, conf, null);
2029+
} catch (IOException ex) {
2030+
LOG.error("Unable to recover lease after several attempts. Give up.", ex);
2031+
}
2032+
}
2033+
20252034
protected final void closeWriter(W writer, Path path) {
20262035
inflightWALClosures.put(path.getName(), writer);
20272036
closeExecutor.execute(() -> {
20282037
try {
20292038
writer.close();
20302039
} catch (IOException e) {
2031-
LOG.warn("close old writer failed", e);
2040+
LOG.warn("close old writer failed.", e);
2041+
recoverLease(this.fs, path, conf);
20322042
} finally {
20332043
// call this even if the above close fails, as there is no other chance we can set closed to
20342044
// true, it will not cause big problems.

0 commit comments

Comments
 (0)