-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Ability to move data between JBOD disks using Cruise Control #10644
Conversation
923b3a0
to
01ee408
Compare
/azp run regression |
Azure Pipelines successfully started running 1 pipeline(s). |
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 left some comments. But I'm not really an CC expert. So the CC related parts have to be reviewed by @ppatierno as the SME.
private List<Integer> volumeIds; | ||
private Map<String, Object> additionalProperties; | ||
|
||
@Description("Id of the broker which contains the disk from which you want to move the the partition replicas from") |
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.
Here and in the other doc comments -> I think we use ID in the docs. Id
is only the Java capitalization.
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.
Okay, I will correct it
@@ -31,6 +31,17 @@ public class KafkaRebalanceSpec extends Spec { | |||
private KafkaRebalanceMode mode = KafkaRebalanceMode.FULL; | |||
private List<Integer> brokers; | |||
|
|||
@Description("List of the brokers and the volumes corresponding to them whose replicas needs to be moved") |
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.
@Description("List of the brokers and the volumes corresponding to them whose replicas needs to be moved") | |
@Description("List of the brokers and the volumes corresponding to them whose replicas need to be moved") |
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.
Maybe tweak it a bit more:
@Description("List of brokers and their corresponding volumes from which replicas need to be moved.")
@Description("List of the brokers and the volumes corresponding to them whose replicas needs to be moved") | ||
public List<BrokerAndVolumeIds> getMoveReplicasOffVolumes() { | ||
return moveReplicasOffVolumes; | ||
} | ||
|
||
public void setMoveReplicasOffVolumes(List<BrokerAndVolumeIds> moveReplicasOffVolumes) { | ||
this.moveReplicasOffVolumes = moveReplicasOffVolumes; | ||
} | ||
|
||
private List<BrokerAndVolumeIds> moveReplicasOffVolumes; | ||
|
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.
Please keep the separation/order of the field declaration and the methods.
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.
+1
if (brokerAndVolumeIds != null && !brokerAndVolumeIds.isEmpty()) { | ||
((RemoveDisksOptions.RemoveDisksOptionsBuilder) rebalanceOptionsBuilder).withBrokersandVolumeIds(brokerAndVolumeIds); | ||
} else { | ||
throw new IllegalArgumentException("The brokers and volume id list is mandatory when using the " + mode.toValue() + " rebalancing mode"); |
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.
ID
in capital again
.../main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java
Show resolved
Hide resolved
api/src/main/java/io/strimzi/api/kafka/model/rebalance/KafkaRebalanceSpec.java
Outdated
Show resolved
Hide resolved
@Description("List of the brokers and the volumes corresponding to them whose replicas needs to be moved") | ||
public List<BrokerAndVolumeIds> getMoveReplicasOffVolumes() { | ||
return moveReplicasOffVolumes; | ||
} | ||
|
||
public void setMoveReplicasOffVolumes(List<BrokerAndVolumeIds> moveReplicasOffVolumes) { | ||
this.moveReplicasOffVolumes = moveReplicasOffVolumes; | ||
} | ||
|
||
private List<BrokerAndVolumeIds> moveReplicasOffVolumes; | ||
|
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.
+1
api/src/test/java/io/strimzi/api/kafka/model/rebalance/KafkaRebalanceCrdIT.java
Show resolved
Hide resolved
.../main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java
Outdated
Show resolved
Hide resolved
.../main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java
Outdated
Show resolved
Hide resolved
...ava/io/strimzi/operator/cluster/operator/resource/cruisecontrol/CruiseControlClientTest.java
Outdated
Show resolved
Hide resolved
...test/java/io/strimzi/operator/cluster/operator/resource/cruisecontrol/MockCruiseControl.java
Outdated
Show resolved
Hide resolved
...test/java/io/strimzi/operator/cluster/operator/resource/cruisecontrol/MockCruiseControl.java
Outdated
Show resolved
Hide resolved
...test/java/io/strimzi/operator/cluster/operator/resource/cruisecontrol/MockCruiseControl.java
Show resolved
Hide resolved
...c/test/java/io/strimzi/operator/cluster/operator/resource/cruisecontrol/PathBuilderTest.java
Outdated
Show resolved
Hide resolved
@ShubhamRwt I would rebase against main, because a refactoring around getting task status of rebalance was just merged. It would be better for you to have the code up to date while addressing comments on this PR. Thanks! |
Yep I am working on that @ppatierno, trying to address all the comments and rebase. After that I will test things in a cluster to be sure everything works |
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 made a few suggestions on the descriptions
api/src/main/java/io/strimzi/api/kafka/model/rebalance/BrokerAndVolumeIds.java
Outdated
Show resolved
Hide resolved
api/src/main/java/io/strimzi/api/kafka/model/rebalance/BrokerAndVolumeIds.java
Outdated
Show resolved
Hide resolved
@@ -31,6 +31,17 @@ public class KafkaRebalanceSpec extends Spec { | |||
private KafkaRebalanceMode mode = KafkaRebalanceMode.FULL; | |||
private List<Integer> brokers; | |||
|
|||
@Description("List of the brokers and the volumes corresponding to them whose replicas needs to be moved") |
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.
Maybe tweak it a bit more:
@Description("List of brokers and their corresponding volumes from which replicas need to be moved.")
.../main/java/io/strimzi/operator/cluster/operator/resource/cruisecontrol/CruiseControlApi.java
Outdated
Show resolved
Hide resolved
0b03a1e
to
f46d8f5
Compare
.../main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java
Outdated
Show resolved
Hide resolved
.../main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java
Outdated
Show resolved
Hide resolved
.../main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java
Outdated
Show resolved
Hide resolved
.../main/java/io/strimzi/operator/cluster/operator/resource/cruisecontrol/CruiseControlApi.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/io/strimzi/operator/cluster/operator/resource/cruisecontrol/PathBuilder.java
Outdated
Show resolved
Hide resolved
...ain/java/io/strimzi/operator/cluster/operator/resource/cruisecontrol/RemoveDisksOptions.java
Outdated
Show resolved
Hide resolved
...test/java/io/strimzi/operator/cluster/operator/resource/cruisecontrol/MockCruiseControl.java
Show resolved
Hide resolved
@ShubhamRwt could you rebase against main, I merged another PR fixing some reconciliation issues on KafkaRebalance (You got conflicts as well). |
6214287
to
f626564
Compare
.../main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java
Outdated
Show resolved
Hide resolved
.../test/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceStateMachineTest.java
Outdated
Show resolved
Hide resolved
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.
LGTM. Thanks!
@scholzj @PaulRMellor could you have another pass to check if Shubham addressed your comments as well? |
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 good.
I left a few suggestions around changing ID's to IDs to be consistent
if (brokerAndVolumeIds != null && !brokerAndVolumeIds.isEmpty()) { | ||
((RemoveDisksOptions.RemoveDisksOptionsBuilder) rebalanceOptionsBuilder).withBrokersandVolumeIds(brokerAndVolumeIds); | ||
} else { | ||
throw new IllegalArgumentException("The brokers and volume ID's list is mandatory when using the " + mode.toValue() + " rebalancing mode"); |
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.
throw new IllegalArgumentException("The brokers and volume ID's list is mandatory when using the " + mode.toValue() + " rebalancing mode"); | |
throw new IllegalArgumentException("The brokers and volume IDs list is mandatory when using the " + mode.toValue() + " rebalancing mode"); |
@@ -73,6 +75,23 @@ public PathBuilder withParameter(CruiseControlParameters param, List<String> val | |||
return this; | |||
} | |||
|
|||
/** | |||
* Converts the list of broker and volume ID's to a list of string |
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.
* Converts the list of broker and volume ID's to a list of string | |
* Converts the list of broker and volume IDs to a list of string |
* Rebalance options for removing disks from brokers within the Kafka cluster | ||
*/ | ||
public class RemoveDisksOptions extends AbstractRebalanceOptions { | ||
/** list with the ID's of the broker and volumes which will be used by remove-disks endpoint */ |
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.
/** list with the ID's of the broker and volumes which will be used by remove-disks endpoint */ | |
/** list with the IDs of the broker and volumes which will be used by remove-disks endpoint */ |
private final List<BrokerAndVolumeIds> brokerAndVolumeIds; | ||
|
||
/** | ||
* @return List of brokers and volume ID's which will be used by remove-disks endpoint |
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.
* @return List of brokers and volume ID's which will be used by remove-disks endpoint | |
* @return List of brokers and volume IDs which will be used by remove-disks endpoint |
} | ||
|
||
/** | ||
* List of broker and volume ID's to be used |
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.
* List of broker and volume ID's to be used | |
* List of broker and volume IDs to be used |
/** | ||
* List of broker and volume ID's to be used | ||
* | ||
* @param brokerAndVolumeIdsList List of broker and volume ID's |
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.
* @param brokerAndVolumeIdsList List of broker and volume ID's | |
* @param brokerAndVolumeIdsList List of broker and volume IDs |
import java.util.Map; | ||
|
||
/** | ||
* Configures the broker and Volume ID's for the remove-disks endpoint for Cruise Control |
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.
* Configures the broker and Volume ID's for the remove-disks endpoint for Cruise Control | |
* Configures the broker and Volume IDs for the remove-disks endpoint for Cruise Control |
@@ -8229,6 +8230,7 @@ spec: | |||
- full | |||
- add-brokers | |||
- remove-brokers | |||
- remove-disks |
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.
Why is this changing here? Has nothing to do with the Kafka CR. I would expect these to be using different types to not have unused fields.
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 think it's changing because the autorebalance related API class definition is using the same enum to get the modes (so also "full" is included even if not really supported) :-/ And when adding remove-disks, it's there as well.
The only solution I see is not using the enum for autorebalance but just a String and adding additional checks on the values, or just sticking with what we have.
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.
Or maybe better, adding a new KafkaAutoRebalanceMode
with just add-brokers and remove-brokers mode.
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.
Yeah, I think you can have a separate Enum with the values supported there.
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.
Ok then, I am going to open a trivial PR for this because it's unrelated to this PR. @ShubhamRwt you can then rebase and continue with this one.
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 opened this one for it #10744
|
||
@Description("ID of the broker that contains the disk from which you want to move the partition replicas.") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty("brokerId") |
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.
Is this needed?
|
||
@Description("IDs of the disks from which the partition replicas need to be moved.") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty("volumeIds") |
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.
Is this needed?
b30b09e
to
7f2960b
Compare
@scholzj Hi, can we run the pipeline tests in this? |
/azp run regression |
Azure Pipelines successfully started running 1 pipeline(s). |
The regression failure doesn't look related to this PR |
7f2960b
to
9e812eb
Compare
Ok, let's re-run it. |
/azp run regression |
Azure Pipelines successfully started running 1 pipeline(s). |
The test failing in the regression is passing for me locally even when I have rebased to the main branch. @see-quick Do you have any idea why it fails? |
Signed-off-by: ShubhamRwt <[email protected]>
Signed-off-by: ShubhamRwt <[email protected]>
Signed-off-by: ShubhamRwt <[email protected]>
Signed-off-by: ShubhamRwt <[email protected]>
Signed-off-by: ShubhamRwt <[email protected]>
Signed-off-by: ShubhamRwt <[email protected]>
Signed-off-by: ShubhamRwt <[email protected]>
Signed-off-by: ShubhamRwt <[email protected]>
9e812eb
to
158bd1f
Compare
Signed-off-by: ShubhamRwt <[email protected]>
@scholzj I have rebased the PR and made the minor fix. Do you have any other suggestions which I need to 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.
Thanks @ShubhamRwt. LGTM.
Type of change
This PR adds the ability to move data between two JBOD disks using Cruise Control. To do the same, we have introduced a new mode called
remove-disks
.You can use it like this:
Description
Please describe your pull request
Checklist
Please go through this checklist and make sure all applicable tasks have been done