-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
KAFKA-16907: Fix RaftUtil's type complexity #16831
base: trunk
Are you sure you want to change the base?
Conversation
Will fix conflicts after 3.9 RC |
…Complexity issue caused by RaftUtils
d4b745c
to
b31643b
Compare
Hi @jsancio, |
Hi @chia7712 |
} | ||
} | ||
|
||
public static AddRaftVoterRequestData addVoterRequest( |
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.
VoteRequest, VoteResponse should be part of the VoteRPCs, but not addVoter, removeVoter, updateVoter. Perhaps we want a DynamicReconfigRpc class for those
@@ -288,7 +290,7 @@ private ApiMessage buildTestRequest(ApiKeys key) { | |||
return VoteRequest.singletonRequest(topicPartition, clusterId, leaderEpoch, leaderId, lastEpoch, 329); | |||
|
|||
case FETCH: | |||
FetchRequestData request = RaftUtil.singletonFetchRequest(topicPartition, topicId, fetchPartition -> | |||
FetchRequestData request = FetchRpc.singletonFetchRequest(topicPartition, topicId, fetchPartition -> |
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 wouldn't be upset having both Fetch and FetchSnapshot in the same class. But I guess same argument could be made for Begin and End Quorum (and I see how naming might get more difficult)
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.
Approach looks reasonable to me! Main request is that the dynamic reconfig related RPCs are broken out of VoteRPC
data.topics().get(0).topicName().equals(topicPartition.topic()) && | ||
data.topics().get(0).partitions().size() == 1 && | ||
data.topics().get(0).partitions().get(0).partitionIndex() == topicPartition.partition(); | ||
} | ||
|
||
public static boolean hasValidTopicPartition(BeginQuorumEpochResponseData data, TopicPartition topicPartition) { | ||
return data.topics().size() == 1 && | ||
data.topics().get(0).topicName().equals(topicPartition.topic()) && | ||
data.topics().get(0).partitions().size() == 1 && | ||
data.topics().get(0).partitions().get(0).partitionIndex() == topicPartition.partition(); |
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.
spacing looks off
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.
It seems like an issue of idea format config.
I have adjusted it.
TopicPartition topicPartition | ||
) { | ||
return new DescribeQuorumRequestData() | ||
.setTopics( |
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.
looks like these are all 8 vs 4 spaces
7b2740b
to
25bff77
Compare
.setLeaderEpoch(leaderEpoch) | ||
.setHighWatermark(highWatermark) | ||
.setCurrentVoters(toReplicaStates(apiVersion, leaderId, voters, currentTimeMs)) | ||
.setObservers(toReplicaStates(apiVersion, leaderId, observers, 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.
style nit: I know this was carried over from the old code, but maybe better to have each closing parenthesis on its own new line
(there are a few other spots in the PR which could use this too)
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 will take a look 😺
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.
other than style nit, looks good to me
@jsancio to help merge!
74df38e
to
25c6477
Compare
JIRA: KAFKA-16907
This PR aims to fix the
ClassDataAbstractionCoupling
andClassFanOutComplexity
issues inRaftUtils
.RaftUtils
will be split into several classes, each based on a specific RPC in the Raft consensus protocol.Committer Checklist (excluded from commit message)