Anjaneya Gupta created KAFKA-20914:
--------------------------------------

             Summary: KafkaRaftClient does not clear append/fetch purgatories 
when a leader transitions to Resigned or Unattached
                 Key: KAFKA-20914
                 URL: https://issues.apache.org/jira/browse/KAFKA-20914
             Project: Kafka
          Issue Type: Improvement
            Reporter: Anjaneya Gupta


When a node stops being the leader, its parked requests can no longer be 
completed normally. It can't commit appends anymore, and held fetches should be 
failed so callers retry against the new leader. So both purgatories should be 
completed exceptionally when a leader loses leadership. onBecomeFollower does 
this, but the other two leader-exit paths do not i.e transitionToResigned does 
not clear it in appendPurgatory and transitionToUnattached does not clear it in 
both fetchPurgatory and appendPurgatory.


Impact: The pending futures eventually expire via request.timeout.ms. But until 
then, callers wait the full timeout for a failure that is already certain, and 
each pending append future keeps its CompletedBatch (and its backing 
ByteBuffer) in memory the whole time.

Fix: complete both purgatories exceptionally on every transition from leader to 
non-leader.



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

Reply via email to