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

Remove disks endpoint using IntraBrokerDiskCapacityGoal #12

Merged

Conversation

ilievladiulian
Copy link

This PR changes the implementation of the remove disks endpoint to set disks to 0 capacity and to use IntraBrokerDiskCapacityGoal to move all replicas from a disk with 0 capacity.

- Extend IntraBrokerDiskCapacityGoal to allow moving all replicas from a 0 capacity disk
- Added new endpoint that removes disks by setting 0 capacity on them and optimizing the IntraBrokerDiskCapacityGoal
@amuraru
Copy link

amuraru commented Apr 18, 2023

@ilievladiulian do we also have a PR with the upstream project?

@ilievladiulian
Copy link
Author

@ilievladiulian do we also have a PR with the upstream project?

This PR addresses the comments in the upstream PR. Will also update the PR there.

Copy link

@alex-necula alex-necula left a comment

Choose a reason for hiding this comment

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

Looks good, I think this version is better since it reuses an existing goal. The only thing that should be confirmed is that the task is marked as "CompletedWithError" if the disk removal fails (koperator relies on this information)

- refactored for better readability
- throw exception if goal could not move all replicas from 0 capacity disks
@ilievladiulian
Copy link
Author

Added exception in case the goal could not move all replicas from deleted disks so that the task ends with CompletedWithError status.

@@ -244,12 +262,17 @@ public String name() {

/**
* Check whether the combined replica utilization is above the given disk capacity limits.
* If _shouldEmptyZeroCapacityDisks is true, the disk utilization is over limit only if it greater than 0.

Choose a reason for hiding this comment

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

Suggested change
* If _shouldEmptyZeroCapacityDisks is true, the disk utilization is over limit only if it greater than 0.
* If _shouldEmptyZeroCapacityDisks is true, the disk utilization is over limit only if it is greater than 0.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed typo in latest commit.

@@ -43,6 +43,7 @@ public class IntraBrokerDiskCapacityGoal extends AbstractGoal {
private static final Logger LOG = LoggerFactory.getLogger(IntraBrokerDiskCapacityGoal.class);
private static final int MIN_NUM_VALID_WINDOWS = 1;
private static final Resource RESOURCE = Resource.DISK;
private boolean _shouldEmptyZeroCapacityDisks = false;

Choose a reason for hiding this comment

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

Is this naming format specific to CC? Is it ok not to be thread safe?

Copy link
Author

Choose a reason for hiding this comment

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

This seems to be the naming convention in CC. I changed the field to be final.


public RemoveDisksRunnable(KafkaCruiseControl kafkaCruiseControl,
OperationFuture future,
RemoveDisksParameters parameters,
String uuid) {
super(kafkaCruiseControl, future, parameters, parameters.dryRun(), parameters.stopOngoingExecution(), parameters.skipHardGoalCheck(),
super(kafkaCruiseControl, future, parameters, parameters.dryRun(), parameters.stopOngoingExecution(), false,

Choose a reason for hiding this comment

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

Why is the param removal needed?

Copy link
Author

Choose a reason for hiding this comment

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

This was a parameter that was previously exposed in the API, although it was never used (and should not be needed for disk removal). There is no sense in skipping goal checking as this endpoint only uses one goal, the IntraBrokerDiskCapacityGoal.

Choose a reason for hiding this comment

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

👍

@ilievladiulian ilievladiulian merged commit fe0e7ac into adobe:master May 4, 2023
amuraru pushed a commit that referenced this pull request May 14, 2023
* Revert "Add endpoint to move all replicas from a disk to another disk of the same broker (#7)"

This reverts commit 8b203be.

* Added new endpoint to remove disks:
- Extend IntraBrokerDiskCapacityGoal to allow moving all replicas from a 0 capacity disk
- Added new endpoint that removes disks by setting 0 capacity on them and optimizing the IntraBrokerDiskCapacityGoal

* Additional fixes:
- refactored for better readability
- throw exception if goal could not move all replicas from 0 capacity disks

* Fix typo

* Changed class field to final
amuraru pushed a commit that referenced this pull request May 14, 2023
* Revert "Add endpoint to move all replicas from a disk to another disk of the same broker (#7)"

This reverts commit 8b203be.

* Added new endpoint to remove disks:
- Extend IntraBrokerDiskCapacityGoal to allow moving all replicas from a 0 capacity disk
- Added new endpoint that removes disks by setting 0 capacity on them and optimizing the IntraBrokerDiskCapacityGoal

* Additional fixes:
- refactored for better readability
- throw exception if goal could not move all replicas from 0 capacity disks

* Fix typo

* Changed class field to final
amuraru pushed a commit that referenced this pull request May 19, 2023
* Revert "Add endpoint to move all replicas from a disk to another disk of the same broker (#7)"

This reverts commit 8b203be.

* Added new endpoint to remove disks:
- Extend IntraBrokerDiskCapacityGoal to allow moving all replicas from a 0 capacity disk
- Added new endpoint that removes disks by setting 0 capacity on them and optimizing the IntraBrokerDiskCapacityGoal

* Additional fixes:
- refactored for better readability
- throw exception if goal could not move all replicas from 0 capacity disks

* Fix typo

* Changed class field to final
amuraru pushed a commit that referenced this pull request Jun 24, 2023
* Revert "Add endpoint to move all replicas from a disk to another disk of the same broker (#7)"

This reverts commit 8b203be.

* Added new endpoint to remove disks:
- Extend IntraBrokerDiskCapacityGoal to allow moving all replicas from a 0 capacity disk
- Added new endpoint that removes disks by setting 0 capacity on them and optimizing the IntraBrokerDiskCapacityGoal

* Additional fixes:
- refactored for better readability
- throw exception if goal could not move all replicas from 0 capacity disks

* Fix typo

* Changed class field to final
amuraru pushed a commit that referenced this pull request Jul 5, 2023
* Revert "Add endpoint to move all replicas from a disk to another disk of the same broker (#7)"

This reverts commit 8b203be.

* Added new endpoint to remove disks:
- Extend IntraBrokerDiskCapacityGoal to allow moving all replicas from a 0 capacity disk
- Added new endpoint that removes disks by setting 0 capacity on them and optimizing the IntraBrokerDiskCapacityGoal

* Additional fixes:
- refactored for better readability
- throw exception if goal could not move all replicas from 0 capacity disks

* Fix typo

* Changed class field to final
amuraru pushed a commit that referenced this pull request Jul 30, 2023
* Revert "Add endpoint to move all replicas from a disk to another disk of the same broker (#7)"

This reverts commit 8b203be.

* Added new endpoint to remove disks:
- Extend IntraBrokerDiskCapacityGoal to allow moving all replicas from a 0 capacity disk
- Added new endpoint that removes disks by setting 0 capacity on them and optimizing the IntraBrokerDiskCapacityGoal

* Additional fixes:
- refactored for better readability
- throw exception if goal could not move all replicas from 0 capacity disks

* Fix typo

* Changed class field to final
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.

4 participants