-
Notifications
You must be signed in to change notification settings - Fork 593
HDDS-4926. Support start/stop for container balancer via command line #2278
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
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
4ec7f55
HDDS-4926. Support start/stop for container balancer via command line
f7cea16
add command line parameters
8a26e33
fix for checkstyle
5efb584
remove default value
a96c1ba
Merge remote-tracking branch 'origin/master' into bak
fff764b
update proto to add new parameters
4526b6a
add unit test for container balancer subcommand
558c0fc
add unit and acceptance test
45e79e4
fix unit test
d913cf4
triger CI for TestReportPublisher.testCRLStatusReportPublisher
2879fb8
Merge remote-tracking branch 'origin/master' into HDDS-4926
029cf09
Merge remote-tracking branch 'origin/master' into HDDS-4926
c4f2fc4
update
3cd3fae
make startContainerBalancer parameters optional
b575197
use lock instead of sychronized
e50cfc4
Update hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm…
11a93dd
update
040c4de
change maxSizeToMove to maxSizeToMoveInGB
26a6e54
remove default value for idleiteration
91e795c
change maxSizeToMoveInGB to MaxSizeToMoveInGB
a6260d4
fix unit text
b84dd23
use optional for container balancer start command
5b483ae
trigger CI
993bc31
trigger CI again
62f2b36
trigger CI again
81a657d
trigger CI again
6a04ed2
update
00e34f4
Merge remote-tracking branch 'origin/master' into HDDS-4926
50029a7
update
0199f26
update
44aa8b1
update
e7abf32
triger CI
e99c865
triger CI
b69c5c3
triger CI
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,8 @@ | |
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.RecommissionNodesResponseProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ReplicationManagerStatusRequestProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ReplicationManagerStatusResponseProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ContainerBalancerStatusRequestProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ContainerBalancerStatusResponseProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMCloseContainerRequestProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMDeleteContainerRequestProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMListContainerRequestProto; | ||
|
|
@@ -69,6 +71,9 @@ | |
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartMaintenanceNodesResponseProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartReplicationManagerRequestProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StopReplicationManagerRequestProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartContainerBalancerRequestProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartContainerBalancerResponseProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StopContainerBalancerRequestProto; | ||
| import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type; | ||
| import org.apache.hadoop.hdds.scm.DatanodeAdminError; | ||
| import org.apache.hadoop.hdds.scm.ScmInfo; | ||
|
|
@@ -91,6 +96,7 @@ | |
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
| import java.util.function.Consumer; | ||
| import static org.apache.hadoop.ozone.ClientVersions.CURRENT_VERSION; | ||
|
|
||
|
|
@@ -712,6 +718,73 @@ public boolean getReplicationManagerStatus() throws IOException { | |
|
|
||
| } | ||
|
|
||
| @Override | ||
| public boolean startContainerBalancer(Optional<Double> threshold, | ||
| Optional<Integer> idleiterations, | ||
| Optional<Integer> maxDatanodesToBalance, | ||
| Optional<Long> maxSizeToMoveInGB) throws IOException{ | ||
| StartContainerBalancerRequestProto.Builder builder = | ||
| StartContainerBalancerRequestProto.newBuilder(); | ||
| builder.setTraceID(TracingUtil.exportCurrentSpan()); | ||
|
|
||
| //make balancer configuration optional | ||
| if (threshold.isPresent()) { | ||
| double tsd = threshold.get(); | ||
| Preconditions.checkState(tsd >= 0.0D && tsd < 1.0D, | ||
| "threshold should to be specified in range [0.0, 1.0)."); | ||
| builder.setThreshold(tsd); | ||
| } | ||
| if (maxSizeToMoveInGB.isPresent()) { | ||
| long mstm = maxSizeToMoveInGB.get(); | ||
| Preconditions.checkState(mstm > 0, | ||
| "maxSizeToMoveInGB must be positive."); | ||
| builder.setMaxSizeToMoveInGB(mstm); | ||
| } | ||
| if (maxDatanodesToBalance.isPresent()) { | ||
| int mdtb = maxDatanodesToBalance.get(); | ||
| Preconditions.checkState(mdtb > 0, | ||
| "maxDatanodesToBalance must be positive."); | ||
| builder.setMaxDatanodesToBalance(mdtb); | ||
| } | ||
| if (idleiterations.isPresent()) { | ||
| int idi = idleiterations.get(); | ||
| Preconditions.checkState(idi > 0 || idi == -1, | ||
| "idleiterations must be positive or" + | ||
| " -1(infinitly run container balancer)."); | ||
| builder.setIdleiterations(idi); | ||
| } | ||
|
|
||
| StartContainerBalancerRequestProto request = builder.build(); | ||
| StartContainerBalancerResponseProto response = | ||
| submitRequest(Type.StartContainerBalancer, | ||
| builder1 -> builder1.setStartContainerBalancerRequest(request)) | ||
| .getStartContainerBalancerResponse(); | ||
| return response.getStart(); | ||
| } | ||
|
|
||
| @Override | ||
| public void stopContainerBalancer() throws IOException { | ||
|
|
||
| StopContainerBalancerRequestProto request = | ||
| StopContainerBalancerRequestProto.getDefaultInstance(); | ||
| submitRequest(Type.StopContainerBalancer, | ||
| builder -> builder.setStopContainerBalancerRequest(request)); | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public boolean getContainerBalancerStatus() throws IOException { | ||
|
|
||
| ContainerBalancerStatusRequestProto request = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems i have already used 4 black space indent here |
||
| ContainerBalancerStatusRequestProto.getDefaultInstance(); | ||
| ContainerBalancerStatusResponseProto response = | ||
| submitRequest(Type.GetContainerBalancerStatus, | ||
| builder -> builder.setContainerBalancerStatusRequest(request)) | ||
| .getContainerBalancerStatusResponse(); | ||
| return response.getIsRunning(); | ||
|
|
||
| } | ||
|
|
||
| /** | ||
| * Builds request for datanode usage information and receives response. | ||
| * | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Unnecessary blank line can be removed.
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 , will remove it
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.
Can we remove these extra head and tail black line?