Skip to content

Commit

Permalink
fix(s3stream): fix buffer release (#1716)
Browse files Browse the repository at this point in the history
Signed-off-by: SSpirits <[email protected]>
  • Loading branch information
ShadowySpirits authored Aug 2, 2024
1 parent bbbe14d commit f102dc0
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,16 @@ public AppendResult append(TraceContext context, ByteBuf data, int crc) throws O
long expectedWriteOffset = accumulator.append(recordSize, start -> WALUtil.generateRecord(data, crc, start), appendResultFuture);

return new AppendResultImpl(expectedWriteOffset, appendResultFuture);
} catch (OverCapacityException e) {
log.error("Append record to S3 WAL failed, due to accumulator is full.", e);
throw new OverCapacityException("Append record to S3 WAL failed, due to accumulator is full: " + e.getMessage());
} finally {
} catch (Exception e) {
// Make sure the data buffer is released.
data.release();
if (e instanceof OverCapacityException) {
log.error("Append record to S3 WAL failed, due to accumulator is full.", e);
throw new OverCapacityException("Append record to S3 WAL failed, due to accumulator is full: " + e.getMessage());
} else {
log.error("[Bug] Append record to S3 WAL failed, due unknown exception.", e);
throw e;
}
}
}

Expand Down

0 comments on commit f102dc0

Please sign in to comment.