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) (apache#4405)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit 80f410e)
Change-Id: I76b3b174ba27b53a1e3d767878271e276b0d699e
  • Loading branch information
sunhelly authored and Stephen Wu committed Jun 28, 2022
1 parent 1fe4d1b commit 272443b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 272443b

Please sign in to comment.