-
Notifications
You must be signed in to change notification settings - Fork 14.5k
KAFKA-18561: Remove withKip853Rpc and replace it with withRaftProtocol #18600
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
Hi @ahuang98 |
2d4e93d
to
aaaab78
Compare
c36f9bc
to
312c113
Compare
@jsancio You're ok with this? |
312c113
to
d943da8
Compare
A label of 'needs-attention' was automatically added to this PR in order to raise the |
b93875b
to
fabd9f6
Compare
A label of 'needs-attention' was automatically added to this PR in order to raise the |
4e56589
to
543467d
Compare
A label of 'needs-attention' was automatically added to this PR in order to raise the |
e135aed
to
826ba56
Compare
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.
With this change it's more obvious that KafkaRaftClientTest only covers KIP_853_PROTOCOL
and lower, I wonder if it would be worth doing one of the following
- have KafkaRaftClientTest test the whole range of RaftProtocols
- replace
KIP_853_PROTOCOL
withlatestProtocol()
which will pick the last enum constant in RaftProtocol, and KafkaRaftClientTest will always test the newest protocol - java doc / rename for KafkaRaftClientTest to indicate this only covers a subset of the raft protocols
@@ -2265,4 +2267,17 @@ public ByteBuffer buffer() { | |||
return data; | |||
} | |||
} | |||
|
|||
private boolean isSupport853(RaftProtocol raftProtocol) { |
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.
you can use RaftClientTestContext.isReconfigSupported()
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.
Thanks.
I don't notice that we have such a helper method.
private static final String KIP_595_PROTOCOL = "KIP_595_PROTOCOL"; | ||
private static final String KIP_853_PROTOCOL = "KIP_853_PROTOCOL"; |
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.
my slight pref would be to remove these and just use the strings directly in the EnumSource annotations
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.
suggestion should also be applied to KafkaRaftClientTest if you agree
@CsvSource({ "false,false", "false,true", "true,false", "true,true" }) | ||
public void testLeaderListenerNotified(boolean entireLog, boolean withKip853Rpc) throws Exception { | ||
@MethodSource("generateKip853TestMatrix") | ||
public void testLeaderListenerNotified(boolean entireLog, RaftProtocol raftProtocol) throws Exception { |
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.
I guess another option would be just renaming the second parameter to boolean isReconfigSupported
, potentially easier for readers to know at a glance that we're not testing the entire set of raftProtocols (rather than navigating to the method source definition)
(then we would do .withRaftProtocol(isReconfigSupported ? KIP_853_PROTOCOL : KIP_595_PROTOCOL)
which I understand is a bit bulkier)
ReplicaKey voter1 = replicaKey(localId + 1, withKip853Rpc); | ||
ReplicaKey voter2 = replicaKey(localId + 2, withKip853Rpc); | ||
ReplicaKey observer3 = replicaKey(localId + 3, withKip853Rpc); | ||
boolean support853 = isSupport853(raftProtocol); |
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.
nit: support853
-> reconfigSupported
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.
was this change applied everywhere? we should remove isSupport853() since it's a dupe of reconfigSupported()
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.
Hi @ahuang98
Sorry for inconvience. Previously, I had a finger issue when rebasing.
Now all comments should be applied. PTAL
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.
there was no inconvenience 😅 sorry to hear about your finger! I missed your update today and will review tomorrow morning
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.
Thank you 😆
Hi @jsancio Many thanks! |
JIRA: KAFKA-18561
Remove
withKip853Rpc
and replace it withwithRaftProtocol
and adjust the corresponding test.Committer Checklist (excluded from commit message)