chia7712 commented on code in PR #20087: URL: https://github.com/apache/kafka/pull/20087#discussion_r2241836356
########## storage/src/test/java/org/apache/kafka/tiered/storage/utils/LocalTieredStorageOutput.java: ########## @@ -92,13 +92,6 @@ private String des(Deserializer<?> de, ByteBuffer bytes) { return de.deserialize(currentTopic, Utils.toNullableArray(bytes)).toString(); } - private static class Tuple2<T1, T2> { - private final T1 t1; - private final T2 t2; - - Tuple2(T1 t1, T2 t2) { - this.t1 = t1; - this.t2 = t2; - } + private record Tuple2<T1, T2>(T1 t1, T2 t2) { Review Comment: this could be replaced by `Map.Entry` ########## storage/src/test/java/org/apache/kafka/tiered/storage/actions/ConsumeAction.java: ########## @@ -127,47 +127,27 @@ public void doExecute(TieredStorageTestContext context) throws InterruptedExcept // (B) Assessment of the interactions between the source broker and the second-tier storage. for (LocalTieredStorageEvent.EventType eventType : List.of(FETCH_SEGMENT, FETCH_OFFSET_INDEX, FETCH_TIME_INDEX, FETCH_TRANSACTION_INDEX)) { - Optional<LocalTieredStorageEvent> latestEvent; - switch (eventType) { - case FETCH_SEGMENT: - latestEvent = latestEventSoFar; - break; - case FETCH_OFFSET_INDEX: - latestEvent = latestOffsetIdxEventSoFar; - break; - case FETCH_TIME_INDEX: - latestEvent = latestTimeIdxEventSoFar; - break; - case FETCH_TRANSACTION_INDEX: - latestEvent = latestTxnIdxEventSoFar; - break; - default: - latestEvent = Optional.empty(); - } + Optional<LocalTieredStorageEvent> latestEvent = switch (eventType) { + case FETCH_SEGMENT -> latestEventSoFar; + case FETCH_OFFSET_INDEX -> latestOffsetIdxEventSoFar; + case FETCH_TIME_INDEX -> latestTimeIdxEventSoFar; + case FETCH_TRANSACTION_INDEX -> latestTxnIdxEventSoFar; + default -> Optional.empty(); + }; List<LocalTieredStorageEvent> events = history.getEvents(eventType, topicPartition); List<LocalTieredStorageEvent> eventsInScope = latestEvent .map(e -> events.stream().filter(event -> event.isAfter(e)).toList()) .orElse(events); - RemoteFetchCount remoteFetchCount = remoteFetchSpec.getRemoteFetchCount(); - RemoteFetchCount.FetchCountAndOp expectedCountAndOp; Review Comment: `FetchCountAndOp` could be rewritten as a `record` class -- 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