Montura commented on code in PR #6577:
URL: https://github.com/apache/ozone/pull/6577#discussion_r1587316937


##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/ClosePipelineSubcommand.java:
##########
@@ -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");

Review Comment:
   @errose28, let's sync :)
   
   1. We can log an error and don't close pipeline (`if/else` block): I have to 
fix current behaviour with `else` block.
   ```
   if (filterOptions.getReplicationFilter().isPresent()) {
     System.err.println("Replication filters can only be used with --all");
   } else {
     scmClient.closePipeline(...);
   }
   ```
   2. We can log an error and throw and exception (`if block`), like 
`org.apache.hadoop.hdds.scm.cli.cert.InfoSubcommand` 
[does](https://github.com/apache/ozone/blob/master/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/cert/InfoSubcommand.java#L59):
 I have to fix current behaviour with `throw` 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(...);
   ```
   3. We can just throw and exception (`if block`), like 
`org.apache.hadoop.hdds.scm.cli.pipeline.ListPipelineSubcommand` 
[does](https://github.com/apache/ozone/blob/master/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/ListPipelinesSubcommand.java#L110)
 : I have to fix current behaviour with `throw` an execption instead of log to 
`System.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) ? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to