Skip to content
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

Add a new endpoint to support dynamically increasing topic's replication factor. #710

Merged
merged 6 commits into from
May 21, 2019

Conversation

kidkun
Copy link

@kidkun kidkun commented May 15, 2019

patch for feature request 590.

Copy link
Collaborator

@efeg efeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! -- added some comments.

@@ -411,6 +418,12 @@ private void demoteBroker(HttpServletRequest request, HttpServletResponse respon
request, response);
}

private void updateTopicConfiguration(HttpServletRequest request, HttpServletResponse response, Supplier<UpdateTopicConfigurationParameters> paramSupplier)
throws IOException, ExecutionException, InterruptedException {
asyncRequest(paramSupplier, parameters -> (uuid -> _asyncKafkaCruiseControl.updateTopicConfiguration(parameters, uuid)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you clarify why we choose to make this endpoint async?
(Currently we only make the endpoints that need generating a cluster model async)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two reasons

  1. Executor needs a UUID when we submit a task to it, using current syncRequest, we cannot get UUID
  2. in the follow-up patch, we plan to generate cluster mode and consider goals to generate proposal.

List<String> racks = new ArrayList<>(brokersByRack.keySet());
int[] cursors = new int[racks.size()];
int rackCursor = 0;
for (PartitionInfo partitionInfo : cluster.partitionsForTopic(topic)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: For ease of readability and avoid repetition (in if and else parts), is it possible to move this logic to separate smaller functions?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it is hard to extract the common logic since the only common logic is to check no offline replica and initialize local variable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to move the relevant content of the loop to a smaller function -- e.g. something like (potentially with more/less parameters):

private Set<ExecutionProposal> updateReplicationFactorFor(PartitionInfo partitionInfo, short replicationFactor) {...}

This helps parsing the logic easier and makes it more modular.

Copy link
Collaborator

@efeg efeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a couple comments -- otherwise LGTM!

List<String> racks = new ArrayList<>(brokersByRack.keySet());
int[] cursors = new int[racks.size()];
int rackCursor = 0;
for (PartitionInfo partitionInfo : cluster.partitionsForTopic(topic)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to move the relevant content of the loop to a smaller function -- e.g. something like (potentially with more/less parameters):

private Set<ExecutionProposal> updateReplicationFactorFor(PartitionInfo partitionInfo, short replicationFactor) {...}

This helps parsing the logic easier and makes it more modular.

* There are two scenarios that rack awareness property is not guaranteed.
* <ul>
* <li> If metadata does not have rack information about brokers, then it is only guaranteed that new replicas are
* added to brokers which currently do not host any replicas of partition.</li>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely not critical -- just fyi, but feel free to skip this: https://www.grammarly.com/blog/comma-before-which/

@kidkun kidkun merged commit d4638c5 into linkedin:master May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants