Revert "HBASE-22917 Proc-WAL roll fails saying someone else has already created log (#544)"
This reverts commit 538a4c51ff
.
This commit is contained in:
parent
e1b4a2a895
commit
ea5c572963
|
@ -421,10 +421,9 @@ public class WALProcedureStore extends ProcedureStoreBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new state-log
|
// Create new state-log
|
||||||
long newFlushLogId = flushLogId + 1;
|
if (!rollWriter(flushLogId + 1)) {
|
||||||
if (!rollWriter(newFlushLogId)) {
|
|
||||||
// someone else has already created this log
|
// someone else has already created this log
|
||||||
LOG.debug("Someone else has already created log {}. Retrying.", newFlushLogId);
|
LOG.debug("Someone else has already created log {}. Retrying.", flushLogId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,9 +1042,8 @@ public class WALProcedureStore extends ProcedureStoreBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new state-log
|
// Create new state-log
|
||||||
long newFlushLogId = flushLogId + 1;
|
if (!rollWriter(flushLogId + 1)) {
|
||||||
if (!rollWriter(newFlushLogId)) {
|
LOG.warn("someone else has already created log {}", flushLogId);
|
||||||
LOG.warn("someone else has already created log {}", newFlushLogId);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1102,8 +1100,7 @@ public class WALProcedureStore extends ProcedureStoreBase {
|
||||||
startPos = newStream.getPos();
|
startPos = newStream.getPos();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
LOG.warn("Encountered exception writing header", ioe);
|
LOG.warn("Encountered exception writing header", ioe);
|
||||||
// Close and delete the incomplete file
|
newStream.close();
|
||||||
closeAndDeleteIncompleteFile(newStream, newLogFile);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,29 +1165,6 @@ public class WALProcedureStore extends ProcedureStoreBase {
|
||||||
stream = null;
|
stream = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeAndDeleteIncompleteFile(FSDataOutputStream newStream, Path newLogFile) {
|
|
||||||
// Close the FS
|
|
||||||
try {
|
|
||||||
newStream.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOG.error("Exception occured while closing the file {}", newLogFile, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete the incomplete file
|
|
||||||
try {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Log Files cleaner helpers
|
// Log Files cleaner helpers
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
Loading…
Reference in New Issue