Skip to content

Commit

Permalink
HBASE-26680 Close and do not write trailer for the broken WAL writer(…
Browse files Browse the repository at this point in the history
…addendum) (#4405)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 80f410e)
  • Loading branch information
sunhelly authored and Apache9 committed Jun 2, 2022
1 parent 3ce6e1a commit df97399
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -173,7 +173,7 @@ public void init(FileSystem fs, Path path, Configuration conf, boolean overwrita
}
} catch (Exception e) {
LOG.warn("Init output failed, path={}", path, e);
closeOutput();
closeOutputIfNecessary();
throw e;
}
}
@@ -242,9 +242,10 @@ protected abstract void initOutput(FileSystem fs, Path path, boolean overwritabl
short replication, long blockSize) throws IOException, StreamLacksCapabilityException;

/**
* simply close the output, do not need to write trailer like the Writer.close
* It is straight forward to close the output, do not need to write trailer like the Writer.close
*/
protected abstract void closeOutput();
protected void closeOutputIfNecessary() {
}

/**
* return the file length after written.
Original file line number Diff line number Diff line change
@@ -193,7 +193,7 @@ protected void initOutput(FileSystem fs, Path path, boolean overwritable, int bu
}

@Override
protected void closeOutput() {
protected void closeOutputIfNecessary() {
if (this.output != null) {
try {
this.output.close();
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ protected void initOutput(FileSystem fs, Path path, boolean overwritable, int bu
}

@Override
protected void closeOutput() {
protected void closeOutputIfNecessary() {
if (this.output != null) {
try {
this.output.close();

0 comments on commit df97399

Please sign in to comment.