Jeff Kim created KAFKA-14380:
--------------------------------

             Summary: consumer should refresh preferred read replica on 
metadata update
                 Key: KAFKA-14380
                 URL: https://issues.apache.org/jira/browse/KAFKA-14380
             Project: Kafka
          Issue Type: Bug
            Reporter: Jeff Kim
            Assignee: Jeff Kim


The consumer (fetcher) clears the preferred read replica only on two conditions:
 # the consumer receives an OFFSET_OUT_OF_RANGE error
 # the follower does not exist in the client's metadata (i.e., offline)
 # preferred read replica value expires (5 minutes)

For other errors, it will continue to reach to the possibly unavailable 
follower and only after 5 minutes will it clear preferred read replica and go 
back to the leader.

A specific example is when a partition is reassigned. the consumer will get 
NOT_LEADER_OR_FOLLOWER which triggers a metadata update but the preferred read 
replica will not be refreshed as the follower is still online. it will continue 
to reach out to the old follower until the preferred read replica expires.

the consumer can instead clear its preferred read replica whenever it updates 
its metadata. so when the consumer receives NOT_LEADER_OR_FOLLOWER in the 
scenario above it can find the new preferred read replica by fetching from the 
leader without waiting for the old value to expire.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to