[ https://issues.apache.org/jira/browse/KAFKA-13778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
zhaobo updated KAFKA-13778: --------------------------- Summary: Fetch from follower should never run the preferred read replica selection (was: Fix follower broker also always execute preferred read-replica selection) > Fetch from follower should never run the preferred read replica selection > ------------------------------------------------------------------------- > > Key: KAFKA-13778 > URL: https://issues.apache.org/jira/browse/KAFKA-13778 > Project: Kafka > Issue Type: Bug > Components: core > Affects Versions: 3.2.0 > Reporter: zhaobo > Assignee: zhaobo > Priority: Minor > > The design purpose of the code is that only the leader broker can determine > the preferred read-replica. > > {code:java} > readFromLocalLog() > .... > // If we are the leader, determine the preferred read-replica > val preferredReadReplica = clientMetadata.flatMap( > metadata => findPreferredReadReplica(partition, metadata, replicaId, > fetchInfo.fetchOffset, fetchTimeMs)) {code} > > But in fact, since the broker does not judge whether it is the leader or not, > the follower will also execute the preferred read-replica selection. > {code:java} > partition.leaderReplicaIdOpt.flatMap { leaderReplicaId => > // Don't look up preferred for follower fetches via normal replication and > if (Request.isValidBrokerId(replicaId)) > None > else { {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)