Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-28637 asyncwal should attempt to recover lease if close fails #5962

Merged
merged 3 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2022,13 +2022,17 @@ protected final void waitForSafePoint() {
}
}

protected void recoverLease(FileSystem fs, Path p, Configuration conf) {
}

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
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.io.asyncfs.AsyncFSOutput;
import org.apache.hadoop.hbase.io.asyncfs.monitor.StreamSlowMonitor;
import org.apache.hadoop.hbase.util.RecoverLeaseFSUtils;
import org.apache.hadoop.hbase.wal.AsyncFSWALProvider;
import org.apache.hadoop.hbase.wal.WALProvider.AsyncWriter;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
Expand Down Expand Up @@ -208,4 +209,14 @@ protected AsyncWriter createCombinedWriter(AsyncWriter localWriter, AsyncWriter
// put remote writer first as usually it will cost more time to finish, so we write to it first
return CombinedAsyncWriter.create(remoteWriter, localWriter);
}

@Override
protected void recoverLease(FileSystem fs, Path p, Configuration conf) {
try {
RecoverLeaseFSUtils.recoverFileLease(fs, p, conf, null);
} catch (IOException ex) {
LOG.warn("Unable to recover lease after several attempts. Give up.", ex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

throw new RuntimeException(ex);
}
}
}