You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "nvharikrishna (via GitHub)" <gi...@apache.org> on 2024/02/14 09:52:16 UTC

[PR] CASSANDRA-19393 Added command to dump cluster metadata and grouped CMS commands into single group [cassandra]

nvharikrishna opened a new pull request, #3101:
URL: https://github.com/apache/cassandra/pull/3101

   Now the commands looks like something like this:
   
   ```
   nodetool cms describe
   nodetool cms reconfigure
   nodetool cms dump
   ```
   
   Running `nodetool cms` prints the following
   
   ```
   NAME
           nodetool cms - Manage cluster metadata
   
   SYNOPSIS
           nodetool cms
           nodetool [(-h <host> | --host <host>)] [(-pp | --print-port)]
                   [(-p <port> | --port <port>)]
                   [(-pwf <passwordFilePath> | --password-file <passwordFilePath>)]
                   [(-u <username> | --username <username>)]
                   [(-pw <password> | --password <password>)] cms describe
           nodetool [(-h <host> | --host <host>)] [(-pp | --print-port)]
                   [(-p <port> | --port <port>)]
                   [(-pwf <passwordFilePath> | --password-file <passwordFilePath>)]
                   [(-u <username> | --username <username>)]
                   [(-pw <password> | --password <password>)] cms dump
                   [(-e <Epoch> | --epoch <Epoch>)]
                   [(-te <Transform Epoch> | --transform-epoch <Transform Epoch>)]
                   [(-v <Version> | --version <Version>)]
           nodetool [(-h <host> | --host <host>)] [(-pp | --print-port)]
                   [(-p <port> | --port <port>)]
                   [(-pwf <passwordFilePath> | --password-file <passwordFilePath>)]
                   [(-u <username> | --username <username>)]
                   [(-pw <password> | --password <password>)] cms reconfigure
                   [(-r | --resume)] [(-c | --cancel)] [--status]
   
   OPTIONS
           -h <host>, --host <host>
               Node hostname or ip address
   
           -p <port>, --port <port>
               Remote jmx agent port number
   
           -pp, --print-port
               Operate in 4.0 mode with hosts disambiguated by port number
   
           -pw <password>, --password <password>
               Remote jmx agent password
   
           -pwf <passwordFilePath>, --password-file <passwordFilePath>
               Path to the JMX password file
   
           -u <username>, --username <username>
               Remote jmx agent username
   
   COMMANDS
           With no arguments, Display help information
   
           describe
               Describe the current Cluster Metadata Service
   
           reconfigure
               Reconfigure replication factor of CMS
   
               With --resume option, Whether or not a previously interrupted
               sequence should be resumed
   
               With --cancel option, Cancels any in progress CMS reconfiguration
   
               With --status option, Poll status of the reconfigurecms command. All
               other flags and arguments are ignored when this one is used.
   
           dump
               Dumps Cluster Metadata into a file
   
               With --epoch option, Epoch at which cluster metadata should be
               dumped
   
               With --transform-epoch option, The epoch to which the cluster meta
               data should be transformed before dumping
   
               With --version option, Searialization version
   ```
   
   The [CASSANDRA-19393](https://issues.apache.org/jira/browse/CASSANDRA-19393)
   
   


-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19393 Added command to dump cluster metadata and grouped CMS commands into single group [cassandra]

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3101:
URL: https://github.com/apache/cassandra/pull/3101#discussion_r1495659744


##########
src/java/org/apache/cassandra/tools/NodeTool.java:
##########
@@ -262,6 +263,13 @@ public int execute(String... args)
                .withCommand(RepairAdmin.SummarizePendingCmd.class)
                .withCommand(RepairAdmin.SummarizeRepairedCmd.class);
 
+        builder.withGroup(CMSCmdGroupHelp.CMS_CMD_GROUP_NAME)

Review Comment:
   I am not sure if we do not want to put all classes under "CMSAdmin" or something similar as it is done in `RepairAdmin` case but I am overall OK with this as well. I can not estimate if putting it all into one class is better than leaving it like this.



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19393 make all cms-related commands to be subcommands of nodetool cms [cassandra]

Posted by "nvharikrishna (via GitHub)" <gi...@apache.org>.
nvharikrishna commented on PR #3101:
URL: https://github.com/apache/cassandra/pull/3101#issuecomment-1998984841

   Chagnes merged as part of commit: https://github.com/apache/cassandra/commit/98ca5f8f1aab6659fdfd084bef38495bf50d35d6. Closing the pr.


-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19393 make all cms-related commands to be subcommands of nodetool cms [cassandra]

Posted by "nvharikrishna (via GitHub)" <gi...@apache.org>.
nvharikrishna closed pull request #3101: CASSANDRA-19393 make all cms-related commands to be subcommands of nodetool cms
URL: https://github.com/apache/cassandra/pull/3101


-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19393 Added command to dump cluster metadata and grouped CMS commands into single group [cassandra]

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3101:
URL: https://github.com/apache/cassandra/pull/3101#discussion_r1495665306


##########
src/java/org/apache/cassandra/tools/nodetool/clustermetadata/CMSCmdGroupHelp.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.tools.nodetool.clustermetadata;
+
+import io.airlift.airline.Help;
+import org.apache.cassandra.tools.INodeProbeFactory;
+import org.apache.cassandra.tools.NodeTool;
+import org.apache.cassandra.tools.Output;
+
+/**
+ * Help class for Cluster Metadata Service nodetool command group.
+ */
+public class CMSCmdGroupHelp extends Help implements NodeTool.NodeToolCmdRunnable

Review Comment:
   This will print help when `nodetool cms` is executed as it just expects some other subcommand to be specified. This is not the same as for the case of repair_admin, when `nodetool repair_admin` is executed, it will default to `ListCmd`. We might theoretically default to "cms describe" if only `nodetool cms` is run.
   
   I think that having `nodetool cms` to default to `nodetool cms describe` is sensible to do so we might rewrite this as it is done for repair case. Having to write `nodetool cms describe` every single time instead of `nodetool cms` seems like a drag ... 



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19393 Added command to dump cluster metadata and grouped CMS commands into single group [cassandra]

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3101:
URL: https://github.com/apache/cassandra/pull/3101#discussion_r1495652445


##########
src/java/org/apache/cassandra/tools/nodetool/clustermetadata/InitializeCMS.java:
##########
@@ -26,11 +26,12 @@
 import org.apache.cassandra.tools.NodeProbe;
 import org.apache.cassandra.tools.NodeTool;
 
-@Command(name = "initializecms", description = "Upgrade from gossip and initialize CMS")
+@Command(name = "initialize", description = "Upgrade from gossip and initialize CMS")
 public class InitializeCMS extends NodeTool.NodeToolCmd
 {
-    @Option(title = "ignored endpoints", name = {"-i", "--ignore"}, description = "Hosts to ignore due to them being down", required = false)

Review Comment:
   for a reviewer - this is marked as redundant (in IDEA, at least) because "required" is false by default. 



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19393 Added command to dump cluster metadata and grouped CMS commands into single group [cassandra]

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3101:
URL: https://github.com/apache/cassandra/pull/3101#discussion_r1495665306


##########
src/java/org/apache/cassandra/tools/nodetool/clustermetadata/CMSCmdGroupHelp.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.tools.nodetool.clustermetadata;
+
+import io.airlift.airline.Help;
+import org.apache.cassandra.tools.INodeProbeFactory;
+import org.apache.cassandra.tools.NodeTool;
+import org.apache.cassandra.tools.Output;
+
+/**
+ * Help class for Cluster Metadata Service nodetool command group.
+ */
+public class CMSCmdGroupHelp extends Help implements NodeTool.NodeToolCmdRunnable

Review Comment:
   This will print help when `nodetool cms` is executed as it just expects some other sub-command to be specified. This is not the same as for the case of repair_admin, when `nodetool repair_admin` is executed, it will default to `ListCmd`. We might theoretically default to `cms describe` if only `nodetool cms` is run.
   
   I think that having `nodetool cms` to default to `nodetool cms describe` is sensible to do so we might rewrite this as it is done for repair case. Having to write `nodetool cms describe` every single time instead of `nodetool cms` seems like a drag ... 



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19393 Added command to dump cluster metadata and grouped CMS commands into single group [cassandra]

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3101:
URL: https://github.com/apache/cassandra/pull/3101#discussion_r1495665306


##########
src/java/org/apache/cassandra/tools/nodetool/clustermetadata/CMSCmdGroupHelp.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.tools.nodetool.clustermetadata;
+
+import io.airlift.airline.Help;
+import org.apache.cassandra.tools.INodeProbeFactory;
+import org.apache.cassandra.tools.NodeTool;
+import org.apache.cassandra.tools.Output;
+
+/**
+ * Help class for Cluster Metadata Service nodetool command group.
+ */
+public class CMSCmdGroupHelp extends Help implements NodeTool.NodeToolCmdRunnable

Review Comment:
   This will print help when `nodetool cms` is executed as it just expects some other sub-command to be specified. This is not the same as for the case of repair_admin, when `nodetool repair_admin` is executed, it will default to `ListCmd`. We might theoretically default to `cms describe` if only `nodetool cms` is run.
   
   I think that having `nodetool cms` to default to `nodetool cms describe` is sensible to do so we might rewrite this as it is done for repair case. Having to write `nodetool cms describe` every single time instead of `nodetool cms` seems like a drag ... 
   
   If we do it like suggested we will get rid of this class and `NodetoolCmdRunnable` in `NodeTool` can stay package protected.



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19393 Added command to dump cluster metadata and grouped CMS commands into single group [cassandra]

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3101:
URL: https://github.com/apache/cassandra/pull/3101#discussion_r1495649302


##########
src/java/org/apache/cassandra/tools/nodetool/clustermetadata/DescribeCMS.java:
##########
@@ -16,29 +16,29 @@
  * limitations under the License.
  */
 
-package org.apache.cassandra.tools.nodetool;
+package org.apache.cassandra.tools.nodetool.clustermetadata;
 
 import java.util.Map;
 
 import io.airlift.airline.Command;
 import org.apache.cassandra.tools.NodeProbe;
 import org.apache.cassandra.tools.NodeTool;
 
-@Command(name = "describecms", description = "Describe the current Cluster Metadata Service")
+@Command(name = "describe", description = "Describe the current Cluster Metadata Service")
 public class DescribeCMS extends NodeTool.NodeToolCmd
 {
     @Override
     protected void execute(NodeProbe probe)
     {
         Map<String, String> info = probe.getCMSOperationsProxy().describeCMS();
-        System.out.printf("Cluster Metadata Service:%n");
-        System.out.printf("Members: %s%n", info.get("MEMBERS"));
-        System.out.printf("Is Member: %s%n", info.get("IS_MEMBER"));
-        System.out.printf("Service State: %s%n", info.get("SERVICE_STATE"));
-        System.out.printf("Is Migrating: %s%n", info.get("IS_MIGRATING"));
-        System.out.printf("Epoch: %s%n", info.get("EPOCH"));
-        System.out.printf("Local Pending Count: %s%n", info.get("LOCAL_PENDING"));
-        System.out.printf("Commits Paused: %s%n", info.get("COMMITS_PAUSED"));
-        System.out.printf("Replication factor: %s%n", info.get("REPLICATION_FACTOR"));
+        output.out.printf("Cluster Metadata Service:%n");

Review Comment:
   this is a good change, I think this enable us in the future to test the output in unit tests as it is not writing it to System.out but to probe's output 



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19393 Added command to dump cluster metadata and grouped CMS commands into single group [cassandra]

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3101:
URL: https://github.com/apache/cassandra/pull/3101#discussion_r1495649302


##########
src/java/org/apache/cassandra/tools/nodetool/clustermetadata/DescribeCMS.java:
##########
@@ -16,29 +16,29 @@
  * limitations under the License.
  */
 
-package org.apache.cassandra.tools.nodetool;
+package org.apache.cassandra.tools.nodetool.clustermetadata;
 
 import java.util.Map;
 
 import io.airlift.airline.Command;
 import org.apache.cassandra.tools.NodeProbe;
 import org.apache.cassandra.tools.NodeTool;
 
-@Command(name = "describecms", description = "Describe the current Cluster Metadata Service")
+@Command(name = "describe", description = "Describe the current Cluster Metadata Service")
 public class DescribeCMS extends NodeTool.NodeToolCmd
 {
     @Override
     protected void execute(NodeProbe probe)
     {
         Map<String, String> info = probe.getCMSOperationsProxy().describeCMS();
-        System.out.printf("Cluster Metadata Service:%n");
-        System.out.printf("Members: %s%n", info.get("MEMBERS"));
-        System.out.printf("Is Member: %s%n", info.get("IS_MEMBER"));
-        System.out.printf("Service State: %s%n", info.get("SERVICE_STATE"));
-        System.out.printf("Is Migrating: %s%n", info.get("IS_MIGRATING"));
-        System.out.printf("Epoch: %s%n", info.get("EPOCH"));
-        System.out.printf("Local Pending Count: %s%n", info.get("LOCAL_PENDING"));
-        System.out.printf("Commits Paused: %s%n", info.get("COMMITS_PAUSED"));
-        System.out.printf("Replication factor: %s%n", info.get("REPLICATION_FACTOR"));
+        output.out.printf("Cluster Metadata Service:%n");

Review Comment:
   this is a good change, I think this enable us in the future to test the output in unit tests as it is not writing it to System.out but to probe's output. All other nodetool commands avoid printing with System.out altogether as well so we close the gap. 



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19393 Added command to dump cluster metadata and grouped CMS commands into single group [cassandra]

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3101:
URL: https://github.com/apache/cassandra/pull/3101#discussion_r1495665306


##########
src/java/org/apache/cassandra/tools/nodetool/clustermetadata/CMSCmdGroupHelp.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.tools.nodetool.clustermetadata;
+
+import io.airlift.airline.Help;
+import org.apache.cassandra.tools.INodeProbeFactory;
+import org.apache.cassandra.tools.NodeTool;
+import org.apache.cassandra.tools.Output;
+
+/**
+ * Help class for Cluster Metadata Service nodetool command group.
+ */
+public class CMSCmdGroupHelp extends Help implements NodeTool.NodeToolCmdRunnable

Review Comment:
   I like this ... this will print help when `nodetool cms` is executed as it just expects some other subcommand to be specified. This is not the same as for the case of repair_admin, when `nodetool repair_admin` is executed, it will default to `ListCmd`. We might theoretically default to "cms describe" if only `nodetool cms` is run.



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org