Skip to content

Commit f61ac22

Browse files
sunhellyApache9
authored andcommitted
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 80f410e)
1 parent 7a02cbf commit f61ac22

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractProtobufLogWriter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public void init(FileSystem fs, Path path, Configuration conf, boolean overwrita
199199
}
200200
} catch (Exception e) {
201201
LOG.warn("Init output failed, path={}", path, e);
202-
closeOutput();
202+
closeOutputIfNecessary();
203203
throw e;
204204
}
205205
}
@@ -269,9 +269,10 @@ protected abstract void initOutput(FileSystem fs, Path path, boolean overwritabl
269269
throws IOException, StreamLacksCapabilityException;
270270

271271
/**
272-
* simply close the output, do not need to write trailer like the Writer.close
272+
* It is straight forward to close the output, do not need to write trailer like the Writer.close
273273
*/
274-
protected abstract void closeOutput();
274+
protected void closeOutputIfNecessary() {
275+
}
275276

276277
/**
277278
* return the file length after written.

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AsyncProtobufLogWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ protected void initOutput(FileSystem fs, Path path, boolean overwritable, int bu
195195
}
196196

197197
@Override
198-
protected void closeOutput() {
198+
protected void closeOutputIfNecessary() {
199199
if (this.output != null) {
200200
try {
201201
this.output.close();

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected void initOutput(FileSystem fs, Path path, boolean overwritable, int bu
118118
}
119119

120120
@Override
121-
protected void closeOutput() {
121+
protected void closeOutputIfNecessary() {
122122
if (this.output != null) {
123123
try {
124124
this.output.close();

0 commit comments

Comments
 (0)