Skip to content

Commit f102dc0

Browse files
fix(s3stream): fix buffer release (AutoMQ#1716)
Signed-off-by: SSpirits <admin@lv5.moe>
1 parent bbbe14d commit f102dc0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

s3stream/src/main/java/com/automq/stream/s3/wal/impl/object/ObjectWALService.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,16 @@ public AppendResult append(TraceContext context, ByteBuf data, int crc) throws O
8686
long expectedWriteOffset = accumulator.append(recordSize, start -> WALUtil.generateRecord(data, crc, start), appendResultFuture);
8787

8888
return new AppendResultImpl(expectedWriteOffset, appendResultFuture);
89-
} catch (OverCapacityException e) {
90-
log.error("Append record to S3 WAL failed, due to accumulator is full.", e);
91-
throw new OverCapacityException("Append record to S3 WAL failed, due to accumulator is full: " + e.getMessage());
92-
} finally {
89+
} catch (Exception e) {
9390
// Make sure the data buffer is released.
9491
data.release();
92+
if (e instanceof OverCapacityException) {
93+
log.error("Append record to S3 WAL failed, due to accumulator is full.", e);
94+
throw new OverCapacityException("Append record to S3 WAL failed, due to accumulator is full: " + e.getMessage());
95+
} else {
96+
log.error("[Bug] Append record to S3 WAL failed, due unknown exception.", e);
97+
throw e;
98+
}
9599
}
96100
}
97101

0 commit comments

Comments
 (0)