Skip to content

Commit 78e3d83

Browse files
saintstackJenkins
authored andcommitted
Revert "HBASE-22917 Proc-WAL roll fails saying someone else has already created log (apache#544)"
This reverts commit e005b49. (cherry picked from commit f11bd06) Change-Id: I3e2f3b82ec11e13ea74d691528db2de312cb5b76
1 parent 1e37066 commit 78e3d83

File tree

1 file changed

+5
-31
lines changed

1 file changed

+5
-31
lines changed

hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,9 @@ public void recoverLease() throws IOException {
421421
}
422422

423423
// Create new state-log
424-
long newFlushLogId = flushLogId + 1;
425-
if (!rollWriter(newFlushLogId)) {
424+
if (!rollWriter(flushLogId + 1)) {
426425
// someone else has already created this log
427-
LOG.debug("Someone else has already created log {}. Retrying.", newFlushLogId);
426+
LOG.debug("Someone else has already created log {}. Retrying.", flushLogId);
428427
continue;
429428
}
430429

@@ -1043,9 +1042,8 @@ private boolean rollWriter() throws IOException {
10431042
}
10441043

10451044
// Create new state-log
1046-
long newFlushLogId = flushLogId + 1;
1047-
if (!rollWriter(newFlushLogId)) {
1048-
LOG.warn("someone else has already created log {}", newFlushLogId);
1045+
if (!rollWriter(flushLogId + 1)) {
1046+
LOG.warn("someone else has already created log {}", flushLogId);
10491047
return false;
10501048
}
10511049

@@ -1102,8 +1100,7 @@ boolean rollWriter(long logId) throws IOException {
11021100
startPos = newStream.getPos();
11031101
} catch (IOException ioe) {
11041102
LOG.warn("Encountered exception writing header", ioe);
1105-
// Close and delete the incomplete file
1106-
closeAndDeleteIncompleteFile(newStream, newLogFile);
1103+
newStream.close();
11071104
return false;
11081105
}
11091106

@@ -1168,29 +1165,6 @@ private void closeCurrentLogStream(boolean abort) {
11681165
stream = null;
11691166
}
11701167

1171-
private void closeAndDeleteIncompleteFile(FSDataOutputStream newStream, Path newLogFile) {
1172-
// Close the FS
1173-
try {
1174-
newStream.close();
1175-
} catch (IOException e) {
1176-
LOG.error("Exception occured while closing the file {}", newLogFile, e);
1177-
}
1178-
1179-
// Delete the incomplete file
1180-
try {
1181-
if (!fs.delete(newLogFile, false)) {
1182-
LOG.warn(
1183-
"Failed to delete the log file {}, increasing the log id by 1 for the next roll attempt",
1184-
newLogFile);
1185-
flushLogId++;
1186-
}
1187-
} catch (IOException e) {
1188-
LOG.warn("Exception occured while deleting the file {}", newLogFile, e);
1189-
flushLogId++;
1190-
LOG.info("Increased the log id to {}", flushLogId);
1191-
}
1192-
}
1193-
11941168
// ==========================================================================
11951169
// Log Files cleaner helpers
11961170
// ==========================================================================

0 commit comments

Comments
 (0)