jsancio commented on code in PR #19661: URL: https://github.com/apache/kafka/pull/19661#discussion_r2082111369
########## clients/src/main/java/org/apache/kafka/common/record/FileRecords.java: ########## @@ -121,10 +122,14 @@ public void readInto(ByteBuffer buffer, int position) throws IOException { } @Override - public Records slice(int position, int size) throws IOException { + public FileRecords slice(int position, int size) { int availableBytes = availableBytes(position, size); int startPosition = this.start + position; - return new FileRecords(file, channel, startPosition, startPosition + availableBytes, true); + try { + return new FileRecords(file, channel, startPosition, startPosition + availableBytes, true); + } catch (IOException e) { + throw new UncheckedIOException(e); Review Comment: > It seems the IOException is meaningless when the isSlice=true. Maybe we can have a new constructor of FileRecords which does not have IOException in the signature? Good catch. Fixed it. Let me know what you think of my solution. ########## clients/src/test/java/org/apache/kafka/common/record/MemoryRecordsTest.java: ########## @@ -1170,7 +1169,7 @@ public void testSliceEmptyRecords() { */ @ParameterizedTest @ArgumentsSource(MemoryRecordsArgumentsProvider.class) - public void testSliceForAlreadySlicedMemoryRecords(Args args) throws IOException { + public void testSliceForAlreadySlicedMemoryRecords(Args args) { Review Comment: Thanks! I searched the entire repo for casts to MemoryRecord and FileRecords and I think we got all of them. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org