-
Notifications
You must be signed in to change notification settings - Fork 14.4k
KAFKA-19354: KRaft observer should fetch from leader after rediscovery #19854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
|
||
context.pollUntilRequest(); | ||
fetchRequest = context.assertSentFetchRequest(); | ||
assertEquals(leaderId, fetchRequest.destination().id()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check would fail without the fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahuang98, the tests didn't execute because the code has a compilation error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that voters can never rediscover the leader from the bootstrap server? Or this doesn't impact voter because they transition to prospective and back to follower which resets the fetch timer?
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java
Outdated
Show resolved
Hide resolved
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java
Outdated
Show resolved
Hide resolved
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java
Outdated
Show resolved
Hide resolved
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java
Outdated
Show resolved
Hide resolved
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java
Outdated
Show resolved
Hide resolved
Thanks for the review Jose
Yes, this doesn't impact voters because prospectives which have a leaderId would transition back to follower (and refreshed fetch timeout) |
} else if (leaderId.isPresent()) { | ||
if (quorum.isFollowerObserver()) { | ||
// This allows observers to resume fetching from leader after discovering the leader | ||
// transitionToFollower(epoch, leaderId.getAsInt(), leaderEndpoints, currentTimeMs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternative solution, needing allowance for follower to follower transition for observers only
Observers may get stuck fetching from bootstrap servers even on discovery of a leader from a fetch response.
This allows observers to start fetching from the leader again by reseting their fetch timeout on discovery of a leader from a fetch response. (Observers fetch from bootstrap servers once their fetch timeout expires)
testObserverSendDiscoveryFetchAfterFetchTimeoutAndResumesFetchingFromLeader
demonstrates the issue that observers will get stuck fetching from random bootstrap servers after fetch timeout (fails without the change)
testUnattachedWithLeaderCanBecomeFollowerAfterFindingLeader
showsvoters are not susceptible to getting stuck fetching from bootstrap servers