Skip to content

HBASE-28875 FSHlog closewrite closeErrorCount should increment for initial catch exception #6278

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

Open
wants to merge 1 commit into
base: branch-2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -460,12 +460,12 @@ private void closeWriter(Writer writer, Path path, boolean syncCloseCall) throws
span.addEvent("writer closed");
} catch (IOException ioe) {
LOG.warn("close old writer failed.", ioe);
int errors = closeErrorCount.incrementAndGet();
try {
RecoverLeaseFSUtils.recoverFileLease(fs, path, conf, null);
} catch (IOException ex) {
LOG.error("Unable to recover lease after several attempts. Give up.", ex);

int errors = closeErrorCount.incrementAndGet();
boolean hasUnflushedEntries = isUnflushedEntries();
if (syncCloseCall && (hasUnflushedEntries || (errors > this.closeErrorsTolerated))) {
LOG.error("Close of WAL " + path + " failed. Cause=\"" + ioe.getMessage() + "\", errors="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public void run() {
/**
* Test for jira https://issues.apache.org/jira/browse/HBASE-28665
*/
public void testWALClosureFailureAndCleanup() throws IOException {
public void testWALClosureFailureAndCleanup() throws Exception {

class FailingWriter implements WALProvider.Writer {
@Override
Expand Down Expand Up @@ -380,6 +380,12 @@ public void close() throws IOException {
region.put(new Put(b).addColumn(b, b, b));
region.flush(true);
log.rollWriter();
TEST_UTIL.waitFor(30000, 500, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return log.walFile2Props.isEmpty();
}
});
assertEquals("WAL Files not cleaned ", 0, log.walFile2Props.size());
region.close();
}
Expand Down