-
Notifications
You must be signed in to change notification settings - Fork 483
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
HDDS-10742. Add option to close all pipelines #6577
HDDS-10742. Add option to close all pipelines #6577
Conversation
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 @Montura for the patch.
...tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/CloseAllPipelinesSubcommand.java
Outdated
Show resolved
Hide resolved
...tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/CloseAllPipelinesSubcommand.java
Outdated
Show resolved
Hide resolved
...dds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/ListPipelinesSubcommand.java
Outdated
Show resolved
Hide resolved
...tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/CloseAllPipelinesSubcommand.java
Outdated
Show resolved
Hide resolved
...tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/CloseAllPipelinesSubcommand.java
Outdated
Show resolved
Hide resolved
…PipelineSubcommand. Extract filter options to mixin class.
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 @Montura for updating the patch.
...dds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/ClosePipelineSubcommand.java
Outdated
Show resolved
Hide resolved
...dds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/ClosePipelineSubcommand.java
Outdated
Show resolved
Hide resolved
...-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/FilterPipelineOptions.java
Show resolved
Hide resolved
...-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/FilterPipelineOptions.java
Show resolved
Hide resolved
…oseAll option. Fix command execution: close one by id or all pipelines. Add javadoc and license
fd56fc3
to
c549d33
Compare
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.
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.
Overall LGTM, just a few minor things:
- A command like
ozone admin pipeline close --replication=EC 1
will close pipeline 1 even if it is a Ratis pipeline.- It would be good to disallow the pipeline filter options when ID is specified, but I'm not sure how easy that is to do with pico CLI.
- This is a minor details so if it's not easy to do it is ok as is.
- It would be nice to print out how many pipeline close commands were sent when the command finishes. Maybe a message like
Sending close command for 5 pipelines
or something like that.
|
I realized, @errose28 means that you call Maybe a message like
|
...dds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/ClosePipelineSubcommand.java
Outdated
Show resolved
Hide resolved
404c82a
to
c9e59a7
Compare
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 for the continued updates @Montura.
@@ -51,7 +51,7 @@ public class ClosePipelineSubcommand extends ScmSubcommand { | |||
public void execute(ScmClient scmClient) throws IOException { | |||
if (!Strings.isNullOrEmpty(closeOption.pipelineId)) { | |||
if (filterOptions.getReplicationFilter().isPresent()) { | |||
System.out.println("When close pipeline by ID filters are ignored."); | |||
System.err.println("Replication filters can only be used with --all"); |
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.
Sorry if the last comment was not clear. We should also fail the command here instead of closing the pipeline anyways since the user did something invalid. We can probably throw IllegalArgumentException
like FilterPipelineOptions#getReplicationFilter
does.
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.
@errose28, let's sync :)
- We can log an error and don't close pipeline (
if/else
block): I have to fix current behaviour withelse
block.
if (filterOptions.getReplicationFilter().isPresent()) {
System.err.println("Replication filters can only be used with --all");
} else {
scmClient.closePipeline(...);
}
- We can log an error and throw and exception (
if block
), likeorg.apache.hadoop.hdds.scm.cli.cert.InfoSubcommand
does: I have to fix current behaviour withthrow
an exception.
if (filterOptions.getReplicationFilter().isPresent()) {
System.err.println("Replication filters can only be used with --all");
throw new IllegalArgumentException("Replication filters can only be used with --all");
}
scmClient.closePipeline(...);
- We can just throw and exception (
if block
), likeorg.apache.hadoop.hdds.scm.cli.pipeline.ListPipelineSubcommand
does : I have to fix current behaviour withthrow
an execption instead of log toSystem.err
.
if (filterOptions.getReplicationFilter().isPresent()) {
throw new IllegalArgumentException("Replication filters can only be used with --all");
}
scmClient.closePipeline(...);
What is the best one (or what do you expect) ?
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.
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 just tried all three of these to double check and option 3 is what we want. There is logic farther up to print just the message to stderr and not the stack trace. Option 2 will print the message twice. Option 1 will exit 0 when it should exit nonzero.
Just looking at the example you provided I think cert.InfoSubcommand might print the message twice as well, but I did not try it out.
Hi @Montura apologies for the delay. It's late night here currently but I will check this out tomorrow. Thanks for outlining the options. |
Just tried out the suggestions. Once this is done I think we are good to merge 👍 |
Done! |
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 for the updates @Montura. I just retriggered the unrelated recon test failure and once its green we can merge.
What changes were proposed in this pull request?
For now ozone CLI allows to get pipelines list or close pipeline by PipelineId.
Suggested a new option
--all
for ClosePipelineSubcommand to close all pipelines (or some filtered pipeline subset):ScmClient
CLOSED
pipelines (to close onlyOPEN
andALLOCATED
)REPLICATION
orREPLICATION_TYPE
orREPLICATION_FACTOR
(as in ListPipelinesSubcommand done)What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10742
How was this patch tested?
This subcommand triggers ClosePipelineSubcommand that is already tested.