-
Notifications
You must be signed in to change notification settings - Fork 14.8k
KAFKA-16926: Optimize BeginQuorumEpoch heartbeat #20318
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
Changes from all commits
90ab0f0
7d13fb3
4b9d29d
9a61c33
beac7b4
07773c6
742a20a
d758963
8591807
bc0858a
26a3f94
43e868d
b7ba8d5
49c746c
c23bca4
810ae03
f67e5bd
13d08ad
aa6b599
e7f102a
8c26343
139a238
fb42219
c3b5e26
8f55408
8a8bffb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -188,6 +188,29 @@ public void resetBeginQuorumEpochTimer(long currentTimeMs) { | |
| beginQuorumEpochTimer.reset(beginQuorumEpochTimeoutMs); | ||
| } | ||
|
|
||
| /** | ||
| * Determines the set of replicas that should receive a {@code BeginQuorumEpoch} request | ||
| * based on the elapsed time since their last fetch. | ||
| * <p> | ||
| * For each remote voter (excluding the local node), if the time since the last | ||
| * fetch exceeds the configured {@code beginQuorumEpochTimeoutMs}, the replica | ||
| * is considered to need a new quorum epoch request. | ||
| * | ||
| * @param currentTimeMs the current system time in milliseconds | ||
| * @return an unmodifiable set of {@link ReplicaKey} objects representing replicas | ||
| * that need to receive a {@code BeginQuorumEpoch} request | ||
| */ | ||
| public Set<ReplicaKey> needToSendBeginQuorumRequests(long currentTimeMs) { | ||
TaiJuWu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return voterStates.values() | ||
| .stream() | ||
| .filter( | ||
| state -> state.replicaKey.id() != localVoterNode.voterKey().id() && | ||
| currentTimeMs - state.lastFetchTimestamp >= beginQuorumEpochTimeoutMs | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay. This algorithm works because the max fetch wait time is hardcoded to 500ms which is much smaller than
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Umm, but there is an issue which is the value of beginQuorumEpochTimeoutMs can be set from users. By the way, there is any reason we need to hardcode
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already have that requirement today. Meaning the the fetch timeout should be greater than 2 times the hard-coded max wait time. I think it is okay to keep it hard-coded for now since KRaft is only used for the cluster metadata partition. When we start using KRaft for more than one partition, like normal produce and consume, we need to fix this hardcoded fetch wait time.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If nobody can handle this, may I have chance to pick it up?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Perhaps we should change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The discussion in #18998 (comment) is similar regarding adding an new lower bound to the quorum-related configs. @TaiJuWu could you please open a JIRA and KIP for these? |
||
| ) | ||
| .map(ReplicaState::replicaKey) | ||
| .collect(Collectors.toUnmodifiableSet()); | ||
| } | ||
|
|
||
| /** | ||
| * Get the remaining time in milliseconds until the checkQuorumTimer expires. | ||
| * | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.