xvrl opened a new pull request, #24378:
URL: https://github.com/apache/kafka/pull/24378

   When no voter responds, KRaft observers busy-poll: `KafkaRaftClient.poll`
   returns a timeout of 0 on every iteration and the raft I/O thread spins
   until a leader answers. This happens in two states:
   
   - Follower: `maybeSendFetchToBestNode` bounds its backoff by
     `FollowerState.remainingFetchTimeMs`. Once the fetch timeout expires it
     stays at 0, since only a successful fetch resets it. Voters leave the
     follower state when the fetch timeout expires, but observers have not
     acted on its expiry since KAFKA-19354, so they keep returning 0.
   - Unattached: an observer that starts up unattached gets a finite election
     timeout from `QuorumState.initialize` (later transitions give observers
     `Long.MAX_VALUE`), and `pollUnattachedCommon` bounds the backoff by it.
     Observers never act on the election timeout, so once it expires they
     also return 0.
   
   Apply each bound only on the voter paths (`pollFollowerAsVoter`,
   `pollUnattachedAsVoter`), the only states that act on these timeouts.
   Observers now wait for the in-flight fetch or the bootstrap server backoff.
   
   Testing: `testObserverDoesNotBusyPollAfterFetchTimeout` and
   `testUnattachedObserverDoesNotBusyPollAfterElectionTimeout` check the poll
   timeout after the respective timeout expires with a fetch in flight; both
   fail with a poll timeout of 0 without this change.
   
   Co-Authored-By: Claude Opus 5.5 <[email protected]>
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to