apoorvmittal10 commented on code in PR #22389: URL: https://github.com/apache/kafka/pull/22389#discussion_r3426803601
########## core/src/main/java/kafka/server/share/ReplicaManagerLogReader.java: ########## @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package kafka.server.share; + +import kafka.server.QuotaFactory; +import kafka.server.ReplicaManager; + +import org.apache.kafka.common.TopicIdPartition; +import org.apache.kafka.common.requests.FetchRequest; +import org.apache.kafka.server.share.LogReader; +import org.apache.kafka.server.storage.log.FetchParams; +import org.apache.kafka.storage.internals.log.LogReadResult; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.LinkedHashMap; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import scala.Tuple2; +import scala.collection.Seq; +import scala.jdk.javaapi.CollectionConverters; +import scala.runtime.BoxedUnit; + +/** + * Implementation of {@link LogReader} that reads records from the local log + * via {@link ReplicaManager#readFromLog}. + */ +public class ReplicaManagerLogReader implements LogReader { + + private static final Logger log = LoggerFactory.getLogger(ReplicaManagerLogReader.class); + + private final ReplicaManager replicaManager; + + public ReplicaManagerLogReader(ReplicaManager replicaManager) { Review Comment: I did but there are couple of things, the shim/interface is needed outside of core module for DLQStateManager to read messages from the log. Also I think we need to further enhance this interface to maybe have consolidated definitions for reading from tiered log as again the DLQStateManager shall need something in near future. We might need to further enhance the interface to work with CompletableFuture while making abstraction for reading data where internally the implementation decides to read from local log or tiered log. Making things common will clean up a lot code in DelayedShareFetch which is very complex today. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
