saintstack commented on a change in pull request #544: HBASE-22917 Proc-WAL roll fails saying someone else has already created log URL: https://github.com/apache/hbase/pull/544#discussion_r324431017
########## File path: hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java ########## @@ -1100,7 +1100,25 @@ boolean rollWriter(long logId) throws IOException { startPos = newStream.getPos(); } catch (IOException ioe) { LOG.warn("Encountered exception writing header", ioe); - newStream.close(); + try { + newStream.close(); + } catch (IOException e) { + LOG.error("Exception occured while closing the file {}", newLogFile, e); + } + try { + // Delete the incomplete file + if (!fs.delete(newLogFile, false)) { + LOG.warn( + "Failed to delete the log file {}, increasing the log id by 1 for the next roll attempt", + newLogFile); + flushLogId++; + } + } catch (IOException e) { + LOG.warn("Exception occured while deleting the file {}", newLogFile, e); + flushLogId++; + LOG.info("Increased the log id to {}", flushLogId); + } + Review comment: And it looks like you have a good comeback on this concern above going by your response to Duo? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services