Repository: cassandra Updated Branches: refs/heads/cassandra-2.1 f49df8c9b -> 92381fd26
Fix help message for stress counter_write patch by Benedict Elliott Smith; reviewed by Pavel Yaskevich for CASSANDRA-6824 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/92381fd2 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/92381fd2 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/92381fd2 Branch: refs/heads/cassandra-2.1 Commit: 92381fd26970f53a3f45454a036db20592a72f34 Parents: f49df8c Author: Pavel Yaskevich <[email protected]> Authored: Thu Mar 13 14:53:01 2014 -0700 Committer: Pavel Yaskevich <[email protected]> Committed: Thu Mar 13 14:56:52 2014 -0700 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/stress/StressAction.java | 10 +++--- .../cassandra/stress/settings/Command.java | 32 ++++++++++++-------- .../stress/settings/SettingsCommand.java | 8 +++-- .../cassandra/stress/settings/SettingsKey.java | 2 +- .../cassandra/stress/settings/SettingsMisc.java | 5 +-- .../cassandra/stress/settings/SettingsRate.java | 2 +- .../stress/settings/StressSettings.java | 2 +- 8 files changed, 38 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/92381fd2/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 6a44d80..4d9bc07 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -16,6 +16,7 @@ * Fix potentially repairing with wrong nodes (CASSANDRA-6808) * Change caching option syntax (CASSANDRA-6745) * Fix stress to do proper counter reads (CASSANDRA-6835) + * Fix help message for stress counter_write (CASSANDRA-6824) Merged from 2.0: * Fix leaking validator FH in StreamWriter (CASSANDRA-6832) * fix nodetool getsstables for blob PK (CASSANDRA-6803) http://git-wip-us.apache.org/repos/asf/cassandra/blob/92381fd2/tools/stress/src/org/apache/cassandra/stress/StressAction.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/StressAction.java b/tools/stress/src/org/apache/cassandra/stress/StressAction.java index e7cdd0b..07ba1d8 100644 --- a/tools/stress/src/org/apache/cassandra/stress/StressAction.java +++ b/tools/stress/src/org/apache/cassandra/stress/StressAction.java @@ -464,7 +464,7 @@ public class StressAction implements Runnable } - case COUNTERREAD: + case COUNTER_READ: switch(state.settings.mode.style) { case THRIFT: @@ -488,7 +488,7 @@ public class StressAction implements Runnable throw new UnsupportedOperationException(); } - case COUNTERWRITE: + case COUNTER_WRITE: switch(state.settings.mode.style) { case THRIFT: @@ -500,7 +500,7 @@ public class StressAction implements Runnable throw new UnsupportedOperationException(); } - case RANGESLICE: + case RANGE_SLICE: switch(state.settings.mode.style) { case THRIFT: @@ -512,7 +512,7 @@ public class StressAction implements Runnable throw new UnsupportedOperationException(); } - case IRANGESLICE: + case INDEXED_RANGE_SLICE: switch(state.settings.mode.style) { case THRIFT: @@ -524,7 +524,7 @@ public class StressAction implements Runnable throw new UnsupportedOperationException(); } - case READMULTI: + case READ_MULTI: switch(state.settings.mode.style) { case THRIFT: http://git-wip-us.apache.org/repos/asf/cassandra/blob/92381fd2/tools/stress/src/org/apache/cassandra/stress/settings/Command.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/Command.java b/tools/stress/src/org/apache/cassandra/stress/settings/Command.java index d0350ad..ac10014 100644 --- a/tools/stress/src/org/apache/cassandra/stress/settings/Command.java +++ b/tools/stress/src/org/apache/cassandra/stress/settings/Command.java @@ -21,8 +21,9 @@ package org.apache.cassandra.stress.settings; */ -import java.util.HashMap; -import java.util.Map; +import java.util.*; + +import com.google.common.collect.ImmutableList; public enum Command { @@ -40,25 +41,25 @@ public enum Command "Interleaving of any basic commands, with configurable ratio and distribution - the cluster must first be populated by a write test", CommandCategory.MIXED ), - RANGESLICE(false, "Standard1", "Super1", + RANGE_SLICE(false, "Standard1", "Super1", "Range slice queries - the cluster must first be populated by a write test", CommandCategory.MULTI ), - IRANGESLICE(false, "Standard1", "Super1", + INDEXED_RANGE_SLICE(false, "Standard1", "Super1", "Range slice queries through a secondary index. The cluster must first be populated by a write test, with indexing enabled.", CommandCategory.BASIC ), - READMULTI(false, "Standard1", "Super1", + READ_MULTI(false, "Standard1", "Super1", "multi_read", "Multiple concurrent reads fetching multiple rows at once. The cluster must first be populated by a write test.", CommandCategory.MULTI ), - COUNTERWRITE(true, "Counter1", "SuperCounter1", + COUNTER_WRITE(true, "Counter1", "SuperCounter1", "counter_add", "Multiple concurrent updates of counters.", CommandCategory.BASIC ), - COUNTERREAD(false, "Counter1", "SuperCounter1", + COUNTER_READ(false, "Counter1", "SuperCounter1", "counter_get", "Multiple concurrent reads of counters. The cluster must first be populated by a counterwrite test.", CommandCategory.BASIC @@ -76,9 +77,8 @@ public enum Command final Map<String, Command> lookup = new HashMap<>(); for (Command cmd : values()) { - lookup.put(cmd.toString().toLowerCase(), cmd); - if (cmd.extraName != null) - lookup.put(cmd.extraName, cmd); + for (String name : cmd.names) + lookup.put(name, cmd); } LOOKUP = lookup; } @@ -90,7 +90,7 @@ public enum Command public final boolean updates; public final CommandCategory category; - public final String extraName; + public final List<String> names; public final String description; public final String table; public final String supertable; @@ -106,7 +106,15 @@ public enum Command this.supertable = supertable; this.updates = updates; this.category = category; - this.extraName = extra; + List<String> names = new ArrayList<>(); + names.add(this.toString().toLowerCase()); + names.add(this.toString().replaceAll("_", "").toLowerCase()); + if (extra != null) + { + names.add(extra.toLowerCase()); + names.add(extra.replaceAll("_", "").toLowerCase()); + } + this.names = ImmutableList.copyOf(names); this.description = description; } http://git-wip-us.apache.org/repos/asf/cassandra/blob/92381fd2/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java index 71b30e4..b491707 100644 --- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java +++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java @@ -117,9 +117,13 @@ public class SettingsCommand implements Serializable { if (cmd.category == null) continue; - final String[] params = clArgs.remove(cmd.toString().toLowerCase()); - if (params != null) + + for (String name : cmd.names) { + final String[] params = clArgs.remove(name); + if (params == null) + continue; + switch (cmd.category) { case BASIC: http://git-wip-us.apache.org/repos/asf/cassandra/blob/92381fd2/tools/stress/src/org/apache/cassandra/stress/settings/SettingsKey.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsKey.java b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsKey.java index 9818d363..ab489be 100644 --- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsKey.java +++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsKey.java @@ -114,7 +114,7 @@ public class SettingsKey implements Serializable switch(command.type) { case WRITE: - case COUNTERWRITE: + case COUNTER_WRITE: return new SettingsKey(new PopulateOptions(defaultLimit)); default: return new SettingsKey(new DistributionOptions(defaultLimit)); http://git-wip-us.apache.org/repos/asf/cassandra/blob/92381fd2/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java index e47f85f..8a5975f 100644 --- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java +++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java @@ -117,7 +117,8 @@ public class SettingsMisc implements Serializable public static void printHelp() { - System.out.println("Usage: ./bin/cassandra-stress <command> [options]"); + System.out.println("Usage: cassandra-stress <command> [options]"); + System.out.println("Help usage: cassandra-stress help <command>"); System.out.println(); System.out.println("---Commands---"); for (Command cmd : Command.values()) @@ -160,7 +161,7 @@ public class SettingsMisc implements Serializable System.out.println("Usage: ./bin/cassandra-stress help <command|option>"); System.out.println("Commands:"); for (Command cmd : Command.values()) - System.out.println(" " + cmd.toString().toLowerCase() + (cmd.extraName != null ? ", " + cmd.extraName : "")); + System.out.println(" " + cmd.names.toString().replaceAll("\\[|\\]", "")); System.out.println("Options:"); for (CliOption op : CliOption.values()) System.out.println(" -" + op.toString().toLowerCase() + (op.extraName != null ? ", " + op.extraName : "")); http://git-wip-us.apache.org/repos/asf/cassandra/blob/92381fd2/tools/stress/src/org/apache/cassandra/stress/settings/SettingsRate.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsRate.java b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsRate.java index ad7e234..a91f073 100644 --- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsRate.java +++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsRate.java @@ -92,7 +92,7 @@ public class SettingsRate implements Serializable switch (command.type) { case WRITE: - case COUNTERWRITE: + case COUNTER_WRITE: if (command.count > 0) { ThreadOptions options = new ThreadOptions(); http://git-wip-us.apache.org/repos/asf/cassandra/blob/92381fd2/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java b/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java index 95ec75b..a1d68b4 100644 --- a/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java +++ b/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java @@ -165,7 +165,7 @@ public class StressSettings implements Serializable public void maybeCreateKeyspaces() { - if (command.type == Command.WRITE || command.type == Command.COUNTERWRITE) + if (command.type == Command.WRITE || command.type == Command.COUNTER_WRITE) schema.createKeySpaces(this); }
