Description
The design purpose of the code is that only the leader broker can determine the preferred read-replica.
readFromLocalLog()
....
// If we are the leader, determine the preferred read-replica
val preferredReadReplica = clientMetadata.flatMap(
metadata => findPreferredReadReplica(partition, metadata, replicaId, fetchInfo.fetchOffset, fetchTimeMs))
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.
partition.leaderReplicaIdOpt.flatMap { leaderReplicaId => // Don't look up preferred for follower fetches via normal replication and if (Request.isValidBrokerId(replicaId)) None else {
Attachments
Issue Links
- links to