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 608032b8e4ac..8437fef3bc23 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 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; } } @@ -269,9 +269,10 @@ protected abstract void initOutput(FileSystem fs, Path path, boolean overwritabl 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 42d9a1f15f53..44affaf734a0 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 @@ 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(); 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 b15c9dd958c3..a94449fe01e7 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 @@ 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();