Skip to content

Commit

Permalink
HBASE-28637 asyncwal should attempt to recover lease if close fails (a…
Browse files Browse the repository at this point in the history
…pache#5962)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 0e8cfdb)
  • Loading branch information
jojochuang committed Jun 12, 2024
1 parent cc5f447 commit b881296
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
import org.apache.hadoop.hbase.util.CommonFSUtils;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.util.RecoverLeaseFSUtils;
import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;
import org.apache.hadoop.hbase.wal.WAL;
import org.apache.hadoop.hbase.wal.WALEdit;
Expand Down Expand Up @@ -2022,13 +2023,22 @@ protected final void waitForSafePoint() {
}
}

private void recoverLease(FileSystem fs, Path p, Configuration conf) {
try {
RecoverLeaseFSUtils.recoverFileLease(fs, p, conf, null);
} catch (IOException ex) {
LOG.error("Unable to recover lease after several attempts. Give up.", ex);
}
}

protected final void closeWriter(W writer, Path path) {
inflightWALClosures.put(path.getName(), writer);
closeExecutor.execute(() -> {
try {
writer.close();
} catch (IOException e) {
LOG.warn("close old writer failed", e);
LOG.warn("close old writer failed.", e);
recoverLease(this.fs, path, conf);
} finally {
// call this even if the above close fails, as there is no other chance we can set closed to
// true, it will not cause big problems.
Expand Down

0 comments on commit b881296

Please sign in to comment.