satishd commented on a change in pull request #11058: URL: https://github.com/apache/kafka/pull/11058#discussion_r711987062
########## File path: storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/RemoteLogMetadataCache.java ########## @@ -161,53 +162,46 @@ public void updateRemoteLogSegmentMetadata(RemoteLogSegmentMetadataUpdate metada throw new IllegalArgumentException("metadataUpdate: " + metadataUpdate + " with state " + RemoteLogSegmentState.COPY_SEGMENT_STARTED + " can not be updated"); case COPY_SEGMENT_FINISHED: - handleSegmentWithCopySegmentFinishedState(metadataUpdate, existingMetadata); + handleSegmentWithCopySegmentFinishedState(existingMetadata.createWithUpdates(metadataUpdate)); break; case DELETE_SEGMENT_STARTED: - handleSegmentWithDeleteSegmentStartedState(metadataUpdate, existingMetadata); + handleSegmentWithDeleteSegmentStartedState(existingMetadata.createWithUpdates(metadataUpdate)); break; case DELETE_SEGMENT_FINISHED: - handleSegmentWithDeleteSegmentFinishedState(metadataUpdate, existingMetadata); + handleSegmentWithDeleteSegmentFinishedState(existingMetadata.createWithUpdates(metadataUpdate)); break; default: throw new IllegalArgumentException("Metadata with the state " + targetState + " is not supported"); } } - private void handleSegmentWithCopySegmentFinishedState(RemoteLogSegmentMetadataUpdate metadataUpdate, - RemoteLogSegmentMetadata existingMetadata) { - log.debug("Adding remote log segment metadata to leader epoch mappings with update: [{}]", metadataUpdate); - - doHandleSegmentStateTransitionForLeaderEpochs(existingMetadata, + private void handleSegmentWithCopySegmentFinishedState(RemoteLogSegmentMetadata remoteLogSegmentMetadata) { + doHandleSegmentStateTransitionForLeaderEpochs(remoteLogSegmentMetadata, RemoteLogLeaderEpochState::handleSegmentWithCopySegmentFinishedState); // Put the entry with the updated metadata. - idToSegmentMetadata.put(existingMetadata.remoteLogSegmentId(), - existingMetadata.createWithUpdates(metadataUpdate)); + idToSegmentMetadata.put(remoteLogSegmentMetadata.remoteLogSegmentId(), remoteLogSegmentMetadata); Review comment: `doHandleSegmentStateTransitionForLeaderEpochs` takes `RemoteLogLeaderEpochState.Action` and invokes it. Each action implementer does not need all the arguments. -- 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