Nodetool rebuild_index requires named indexes argument patch by Stunnicliffe reviewed by dbrosius for cassandra-7038
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/743d921a Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/743d921a Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/743d921a Branch: refs/heads/trunk Commit: 743d921ae8591545ff01022db9a41a84ef1edcd1 Parents: 2b89cf6 Author: Sam Tunnicliffe <s...@beobal.com> Authored: Tue Apr 22 01:46:31 2014 -0400 Committer: Dave Brosius <dbros...@mebigfatguy.com> Committed: Tue Apr 22 01:46:31 2014 -0400 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/tools/NodeTool.java | 15 ++++----------- 2 files changed, 5 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/743d921a/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 5d15eac..d94f13b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -46,6 +46,7 @@ * Fix AE when closing SSTable without releasing reference (CASSANDRA-7000) * Clean up IndexInfo on keyspace/table drops (CASSANDRA-6924) * Only snapshot relative SSTables when sequential repair (CASSANDRA-7024) + * Require nodetool rebuild_index to specify index names (CASSANDRA-7038) Merged from 2.0: * Put nodes in hibernate when join_ring is false (CASSANDRA-6961) * Allow compaction of system tables during startup (CASSANDRA-6913) http://git-wip-us.apache.org/repos/asf/cassandra/blob/743d921a/src/java/org/apache/cassandra/tools/NodeTool.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/tools/NodeTool.java b/src/java/org/apache/cassandra/tools/NodeTool.java index edcfec3..2c8d0c2 100644 --- a/src/java/org/apache/cassandra/tools/NodeTool.java +++ b/src/java/org/apache/cassandra/tools/NodeTool.java @@ -2130,24 +2130,17 @@ public class NodeTool } } - @Command(name = "rebuild_index", description = "A full rebuilds of native secondry index for a given column family") + @Command(name = "rebuild_index", description = "A full rebuild of native secondary indexes for a given column family") public static class RebuildIndex extends NodeToolCmd { - @Arguments(usage = "<keyspace> <cfname> [<indexName...>]", description = "The keyspace and column family name followed by an optional list of index names (IndexNameExample: Standard3.IdxName Standard3.IdxName1)") + @Arguments(usage = "<keyspace> <cfname> <indexName...>", description = "The keyspace and column family name followed by a list of index names (IndexNameExample: Standard3.IdxName Standard3.IdxName1)") List<String> args = new ArrayList<>(); @Override public void execute(NodeProbe probe) { - checkArgument(args.size() >= 2, "rebuild_index requires ks and cf args"); - - List<String> indexNames = new ArrayList<>(); - if (args.size() > 2) - { - indexNames.addAll(args.subList(2, args.size())); - } - - probe.rebuildIndex(args.get(0), args.get(1), toArray(indexNames, String.class)); + checkArgument(args.size() >= 3, "rebuild_index requires ks, cf and idx args"); + probe.rebuildIndex(args.get(0), args.get(1), toArray(args.subList(2, args.size()), String.class)); } }