diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractProtobufLogWriter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractProtobufLogWriter.java index 608032b8e4a..8437fef3bc2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractProtobufLogWriter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractProtobufLogWriter.java @@ -199,7 +199,7 @@ public abstract class AbstractProtobufLogWriter { } } catch (Exception e) { LOG.warn("Init output failed, path={}", path, e); - closeOutput(); + closeOutputIfNecessary(); throw e; } } @@ -269,9 +269,10 @@ public abstract class AbstractProtobufLogWriter { 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. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AsyncProtobufLogWriter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AsyncProtobufLogWriter.java index 42d9a1f15f5..44affaf734a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AsyncProtobufLogWriter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AsyncProtobufLogWriter.java @@ -195,7 +195,7 @@ public class AsyncProtobufLogWriter extends AbstractProtobufLogWriter } @Override - protected void closeOutput() { + protected void closeOutputIfNecessary() { if (this.output != null) { try { this.output.close(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java index b15c9dd958c..a94449fe01e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java @@ -127,7 +127,7 @@ public class ProtobufLogWriter extends AbstractProtobufLogWriter implements FSHL } @Override - protected void closeOutput() { + protected void closeOutputIfNecessary() { if (this.output != null) { try { this.output.close();