Skip to content

Commit

Permalink
fix: release FetchResults if failed to fetch
Browse files Browse the repository at this point in the history
Signed-off-by: Ning Yu <[email protected]>
  • Loading branch information
Chillax-0v0 committed Nov 22, 2024
1 parent 9d4d12b commit 5330d7a
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ private CompletableFuture<Records> readAll0(FetchContext context, long startOffs
}
List<FetchResult> results = new LinkedList<>();
return fetch0(context, nextFetchOffset, endOffset, maxSize, results)
.whenComplete((nil, e) -> {
if (e != null) {
results.forEach(FetchResult::free);
results.clear();
}
})
.thenApply(nil -> PooledMemoryRecords.of(baseOffset, results, context.readOptions().pooledBuf()));
}

Expand Down

0 comments on commit 5330d7a

Please sign in to comment.