|
96 | 96 | import org.apache.hadoop.hbase.util.CommonFSUtils; |
97 | 97 | import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; |
98 | 98 | import org.apache.hadoop.hbase.util.Pair; |
| 99 | +import org.apache.hadoop.hbase.util.RecoverLeaseFSUtils; |
99 | 100 | import org.apache.hadoop.hbase.wal.AbstractFSWALProvider; |
100 | 101 | import org.apache.hadoop.hbase.wal.WAL; |
101 | 102 | import org.apache.hadoop.hbase.wal.WALEdit; |
@@ -2022,13 +2023,22 @@ protected final void waitForSafePoint() { |
2022 | 2023 | } |
2023 | 2024 | } |
2024 | 2025 |
|
| 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 | + |
2025 | 2034 | protected final void closeWriter(W writer, Path path) { |
2026 | 2035 | inflightWALClosures.put(path.getName(), writer); |
2027 | 2036 | closeExecutor.execute(() -> { |
2028 | 2037 | try { |
2029 | 2038 | writer.close(); |
2030 | 2039 | } 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); |
2032 | 2042 | } finally { |
2033 | 2043 | // call this even if the above close fails, as there is no other chance we can set closed to |
2034 | 2044 | // true, it will not cause big problems. |
|
0 commit comments