Mmuzaf commented on code in PR #2497: URL: https://github.com/apache/cassandra/pull/2497#discussion_r2200643001
########## src/java/org/apache/cassandra/tools/nodetool/SSTableRepairedSet.java: ########## @@ -23,41 +23,48 @@ import java.util.Arrays; import java.util.List; - -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; -import io.airlift.airline.Option; import org.apache.cassandra.exceptions.InvalidRequestException; import org.apache.cassandra.tools.NodeProbe; -import org.apache.cassandra.tools.NodeTool; +import picocli.CommandLine.Command; +import picocli.CommandLine.Option; +import picocli.CommandLine.Parameters; + +import static org.apache.cassandra.tools.nodetool.CommandUtils.parseOptionalKeyspaceNonLocal; +import static org.apache.cassandra.tools.nodetool.CommandUtils.parseOptionalTables; /** * Provides a way to set the repaired state of SSTables without any downtime through nodetool. */ @Command(name = "sstablerepairedset", description = "Set the repaired state of SSTables for given keyspace/tables") -public class SSTableRepairedSet extends NodeTool.NodeToolCmd +public class SSTableRepairedSet extends AbstractCommand { - @Arguments(usage = "[<keyspace> <table...>]", description = "Optional keyspace followed by zero or more tables") protected List<String> args = new ArrayList<>(); - @Option(title = "really-set", - name = { "--really-set" }, - description = "Really set the repaired state of SSTables. If not set, only print SSTables that would be affected.") + @Parameters(index = "0", description = "Keyspace to set the repaired state of SSTables. If not provided, all keyspaces are used.") + public String keyspace; + + @Parameters(index = "1..*", description = "Tables to set the repaired state of SSTables. If not provided, all tables in the keyspace are used.") + public String[] tables; + + @Option(paramLabel = "really_set", + names = { "--really-set" }, + description = "Really set the repaired state of SSTables. If not set, only print SSTables that would be affected.") protected boolean reallySet = false; - @Option(title = "is-repaired", - name = { "--is-repaired" }, - description = "Set SSTables to repaired state.") + @Option(paramLabel = "is_repaired", + names = { "--is-repaired" }, + description = "Set SSTables to repaired state.") protected boolean isRepaired = false; - @Option(title = "is-unrepaired", - name = { "--is-unrepaired" }, - description = "Set SSTables to unrepaired state.") + @Option(paramLabel = "is_unrepaired", + names = { "--is-unrepaired" }, + description = "Set SSTables to unrepaired state.") protected boolean isUnrepaired = false; @Override public void execute(NodeProbe probe) { + args = args.isEmpty() ? CommandUtils.concatArgs(keyspace, tables) : args; Review Comment: The `SSTableRepairedSetTest` is designed so that each test case modifies `arg` to perform checks. Therefore, we must either keep this change in the production code (within the command) or rewrite the test to match the actual production code. The latter requires more changes. For the sake of minimizing code changes, I chose the former. -- 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-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org