Skip to content
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 @@ -393,6 +393,8 @@ protected void doReplaceWriter(Path oldPath, Path newPath, Writer nextWriter) th
inflightWALClosures.remove(oldPath.getName());
if (!isUnflushedEntries()) {
markClosedAndClean(oldPath);
} else {
LOG.debug("WAL has unflushed entries path: " + oldPath);

Choose a reason for hiding this comment

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

Should you add some metrics to track this event? Is this PR about adding logs to help debugging? is there more to the fix?

}
}
} else {
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 IOException, InterruptedException {

class FailingWriter implements WALProvider.Writer {
@Override
Expand Down Expand Up @@ -375,12 +375,15 @@ public void close() throws IOException {
region.put(new Put(b).addColumn(b, b, b));
log.rollWriter();
}
assertEquals(2, log.getClosedErrorCount());
region.put(new Put(b).addColumn(b, b, b));
region.put(new Put(b).addColumn(b, b, b));
region.flush(true);
log.highestUnsyncedTxid = log.highestSyncedTxid.get() + 100;
assertTrue("WAL has unflushed entries ", log.getUnflushedEntriesCount() > 0);
log.rollWriter();
assertEquals("WAL Files not cleaned ", 0, log.walFile2Props.size());
assertEquals("WAL Files not cleaned ", 3, log.walFile2Props.size());
region.flush(true);
log.markClosedAndClean(log.walFile2Props.firstKey());
assertEquals("WAL Files not cleaned ", 1, log.walFile2Props.size());
region.close();
}
}
Expand Down