HBASE-26680 Close and do not write trailer for the broken WAL writer(addendum) (#4405)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 80f410ec3f
)
This commit is contained in:
parent
3ce6e1afe7
commit
df9739979e
|
@ -173,7 +173,7 @@ public abstract class AbstractProtobufLogWriter {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Init output failed, path={}", path, e);
|
||||
closeOutput();
|
||||
closeOutputIfNecessary();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -242,9 +242,10 @@ public abstract class AbstractProtobufLogWriter {
|
|||
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.
|
||||
|
|
|
@ -193,7 +193,7 @@ public class AsyncProtobufLogWriter extends AbstractProtobufLogWriter
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void closeOutput() {
|
||||
protected void closeOutputIfNecessary() {
|
||||
if (this.output != null) {
|
||||
try {
|
||||
this.output.close();
|
||||
|
|
|
@ -116,7 +116,7 @@ public class ProtobufLogWriter extends AbstractProtobufLogWriter implements FSHL
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void closeOutput() {
|
||||
protected void closeOutputIfNecessary() {
|
||||
if (this.output != null) {
|
||||
try {
|
||||
this.output.close();
|
||||
|
|
Loading…
Reference in New Issue