You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/01/31 08:41:48 UTC
[GitHub] [ignite] timoninmaxim commented on a change in pull request #9779: IGNITE-16225 Read Repair control.sh command should have named params
timoninmaxim commented on a change in pull request #9779:
URL: https://github.com/apache/ignite/pull/9779#discussion_r795438387
##########
File path: modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/consistency/ConsistencyCommand.java
##########
@@ -43,6 +43,24 @@
*
*/
public class ConsistencyCommand extends AbstractCommand<Object> {
+ /** Cache. */
+ public static final String C = "-c";
Review comment:
As I can see, Ignite doesn't support shortened params for any commands in the control utility. Some operations use the full "--cache" param, but no one uses the "-c" param. Let's do it similarly.
##########
File path: modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/consistency/ConsistencyCommand.java
##########
@@ -132,10 +150,48 @@
cmd = of(argIter.nextArg("Expected consistency action."));
if (cmd == REPAIR) {
- String cacheName = argIter.nextArg("Expected cache name.");
- int part = argIter.nextNonNegativeIntArg("Expected partition.");
+ String cacheName = null;
+ int part = -1;
+ ReadRepairStrategy strategy = null;
+
+ while (argIter.hasNextArg()) {
+ String arg = argIter.peekNextArg();
+
+ if (C.equals(arg) || CACHE.equals(arg) ||
+ P.equals(arg) || PARTITION.equals(arg) ||
+ S.equals(arg) || STRATEGY.equals(arg)) {
+ arg = argIter.nextArg("Expected parameter key.");
+
+ switch (arg) {
+ case C:
+ case CACHE:
+ cacheName = argIter.nextArg("Expected cache name.");
+
+ break;
+
+ case P:
+ case PARTITION:
+ part = argIter.nextNonNegativeIntArg("Expected partition.");
+
+ break;
+
+ case S:
+ case STRATEGY:
+ strategy = ReadRepairStrategy.fromString(argIter.nextArg("Expected strategy."));
+
+ break;
+
+ default:
+ throw new IllegalArgumentException("Illegal argument: " + arg);
+ }
+ }
+ else
+ break;
+ }
- ReadRepairStrategy strategy = ReadRepairStrategy.fromString(argIter.nextArg("Expected strategy."));
+ assert cacheName != null;
Review comment:
Why assert? Let's throw a `IllegalArgumentException` here.
##########
File path: modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/consistency/ConsistencyCommand.java
##########
@@ -43,6 +43,24 @@
*
*/
public class ConsistencyCommand extends AbstractCommand<Object> {
+ /** Cache. */
+ public static final String C = "-c";
+
+ /** Cache. */
+ public static final String CACHE = "--cache";
Review comment:
Other commands uses enums for list of params. Let's do it in the same way.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org