junrao commented on code in PR #13535: URL: https://github.com/apache/kafka/pull/13535#discussion_r1195723455
########## core/src/main/scala/kafka/server/ReplicaManager.scala: ########## @@ -1175,49 +1216,101 @@ class ReplicaManager(val config: KafkaConfig, fetchPartitionStatus += (topicIdPartition -> FetchPartitionStatus(logOffsetMetadata, partitionData)) }) } - val delayedFetch = new DelayedFetch( - params = params, - fetchPartitionStatus = fetchPartitionStatus, - replicaManager = this, - quota = quota, - responseCallback = responseCallback - ) - - // create a list of (topic, partition) pairs to use as keys for this delayed fetch operation - val delayedFetchKeys = fetchPartitionStatus.map { case (tp, _) => TopicPartitionOperationKey(tp) } - - // try to complete the request immediately, otherwise put it into the purgatory; - // this is because while the delayed fetch operation is being created, new requests - // may arrive and hence make this operation completable. - delayedFetchPurgatory.tryCompleteElseWatch(delayedFetch, delayedFetchKeys) + + if (remoteFetchInfo.isPresent) { + val key = new TopicPartitionOperationKey(remoteFetchInfo.get.topicPartition.topic(), remoteFetchInfo.get.topicPartition.partition()) Review Comment: `fetchMessages` is getting a bit large now. Would it be better to put the logic in the `if` part to a separate method? ########## core/src/main/scala/kafka/server/ReplicaManager.scala: ########## @@ -1288,17 +1373,46 @@ class ReplicaManager(val config: KafkaConfig, _: FencedLeaderEpochException | _: ReplicaNotAvailableException | _: KafkaStorageException | - _: OffsetOutOfRangeException | _: InconsistentTopicIdException) => - LogReadResult(info = new FetchDataInfo(LogOffsetMetadata.UNKNOWN_OFFSET_METADATA, MemoryRecords.EMPTY), - divergingEpoch = None, - highWatermark = UnifiedLog.UnknownOffset, - leaderLogStartOffset = UnifiedLog.UnknownOffset, - leaderLogEndOffset = UnifiedLog.UnknownOffset, - followerLogStartOffset = UnifiedLog.UnknownOffset, - fetchTimeMs = -1L, - lastStableOffset = None, - exception = Some(e)) + createLogReadResult(e) + case e: OffsetOutOfRangeException => + // In case of offset out of range errors, check for remote log manager for non-compacted topics Review Comment: The logic for handling OffsetOutOfRangeException is getting a bit large now. Would it be better to put that into a separate method? -- 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