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 efcd8ab8d148..a99244f82dfc 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 @@ -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; } } @@ -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. 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 de78c4160e47..3a61f6fa4225 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 @@ -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(); 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 42b5428212e7..bfa16c2bf7e9 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 @@ -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();