HBASE-26680 Close and do not write trailer for the broken WAL writer(addendum) (#4405)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
ac8b51718f
commit
80f410ec3f
|
@ -199,7 +199,7 @@ public abstract class AbstractProtobufLogWriter {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("Init output failed, path={}", path, e);
|
LOG.warn("Init output failed, path={}", path, e);
|
||||||
closeOutput();
|
closeOutputIfNecessary();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,9 +269,10 @@ public abstract class AbstractProtobufLogWriter {
|
||||||
throws IOException, StreamLacksCapabilityException;
|
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.
|
* return the file length after written.
|
||||||
|
|
|
@ -195,7 +195,7 @@ public class AsyncProtobufLogWriter extends AbstractProtobufLogWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void closeOutput() {
|
protected void closeOutputIfNecessary() {
|
||||||
if (this.output != null) {
|
if (this.output != null) {
|
||||||
try {
|
try {
|
||||||
this.output.close();
|
this.output.close();
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class ProtobufLogWriter extends AbstractProtobufLogWriter implements FSHL
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void closeOutput() {
|
protected void closeOutputIfNecessary() {
|
||||||
if (this.output != null) {
|
if (this.output != null) {
|
||||||
try {
|
try {
|
||||||
this.output.close();
|
this.output.close();
|
||||||
|
|
Loading…
Reference in New Issue