You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2013/10/15 18:20:06 UTC
[1/6] git commit: Add ability to list specific KS/CF combinations in
nodetool cfstats Patch by Lyuben Todorov,
reviewed by brandonwilliams for CASSANDRA-4191
Updated Branches:
refs/heads/cassandra-1.2 6165840f1 -> 8dcdce4e9
refs/heads/cassandra-2.0 6bd71a5e5 -> bd45c4c59
refs/heads/trunk d143206dc -> 0c34fa8e9
Add ability to list specific KS/CF combinations in nodetool cfstats
Patch by Lyuben Todorov, reviewed by brandonwilliams for CASSANDRA-4191
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8dcdce4e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8dcdce4e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8dcdce4e
Branch: refs/heads/cassandra-1.2
Commit: 8dcdce4e904d419e821aa80a9d21f61ef8803911
Parents: 6165840
Author: Brandon Williams <br...@apache.org>
Authored: Tue Oct 15 11:09:11 2013 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Oct 15 11:09:11 2013 -0500
----------------------------------------------------------------------
CHANGES.txt | 3 +
.../org/apache/cassandra/tools/NodeCmd.java | 102 +++++++++++++++++--
.../apache/cassandra/tools/NodeToolHelp.yaml | 4 +-
3 files changed, 101 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8dcdce4e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 046ecfb..2dbadc4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,6 @@
+1.2.12
+ * Add ability to list specific KS/CF combinations in nodetool cfstats (CASSANDRA-4191)
+
1.2.11
* Limit CQL prepared statement cache by size instead of count (CASSANDRA-6107)
* Tracing should log write failure rather than raw exceptions (CASSANDRA-6133)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8dcdce4e/src/java/org/apache/cassandra/tools/NodeCmd.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeCmd.java b/src/java/org/apache/cassandra/tools/NodeCmd.java
index 86f9eef..7e0bf67 100644
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@ -72,6 +72,7 @@ public class NodeCmd
private static final Pair<String, String> END_TOKEN_OPT = Pair.create("et", "end-token");
private static final Pair<String, String> UPGRADE_ALL_SSTABLE_OPT = Pair.create("a", "include-all-sstables");
private static final Pair<String, String> NO_SNAPSHOT = Pair.create("ns", "no-snapshot");
+ private static final Pair<String, String> CFSTATS_IGNORE_OPT = Pair.create("i", "ignore");
private static final String DEFAULT_HOST = "127.0.0.1";
private static final int DEFAULT_PORT = 7199;
@@ -96,6 +97,7 @@ public class NodeCmd
options.addOption(END_TOKEN_OPT, true, "token at which repair range ends");
options.addOption(UPGRADE_ALL_SSTABLE_OPT, false, "includes sstables that are already on the most recent version during upgradesstables");
options.addOption(NO_SNAPSHOT, false, "disables snapshot creation for scrub");
+ options.addOption(CFSTATS_IGNORE_OPT, false, "ignore the supplied list of keyspace.columnfamiles in statistics");
}
public NodeCmd(NodeProbe probe)
@@ -803,8 +805,9 @@ public class NodeCmd
}
}
- public void printColumnFamilyStats(PrintStream outs)
+ public void printColumnFamilyStats(PrintStream outs, boolean ignoreMode, String [] filterList)
{
+ OptionFilter filter = new OptionFilter(ignoreMode, filterList);
Map <String, List <ColumnFamilyStoreMBean>> cfstoreMap = new HashMap <String, List <ColumnFamilyStoreMBean>>();
// get a list of column family stores
@@ -816,18 +819,22 @@ public class NodeCmd
String tableName = entry.getKey();
ColumnFamilyStoreMBean cfsProxy = entry.getValue();
- if (!cfstoreMap.containsKey(tableName))
+ if (!cfstoreMap.containsKey(tableName) && filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
{
List<ColumnFamilyStoreMBean> columnFamilies = new ArrayList<ColumnFamilyStoreMBean>();
columnFamilies.add(cfsProxy);
cfstoreMap.put(tableName, columnFamilies);
}
- else
+ else if (filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
{
cfstoreMap.get(tableName).add(cfsProxy);
}
}
+ // make sure all specified kss and cfs exist
+ filter.verifyKeyspaces(probe.getKeyspaces());
+ filter.verifyColumnFamilies();
+
// print out the table statistics
for (Entry<String, List<ColumnFamilyStoreMBean>> entry : cfstoreMap.entrySet())
{
@@ -1140,7 +1147,11 @@ public class NodeCmd
break;
case INFO : nodeCmd.printInfo(System.out, cmd); break;
- case CFSTATS : nodeCmd.printColumnFamilyStats(System.out); break;
+ case CFSTATS :
+ boolean ignoreMode = cmd.hasOption(CFSTATS_IGNORE_OPT.left);
+ if (arguments.length > 0) { nodeCmd.printColumnFamilyStats(System.out, ignoreMode, arguments); }
+ else { nodeCmd.printColumnFamilyStats(System.out, false, null); }
+ break;
case TPSTATS : nodeCmd.printThreadPoolStats(System.out); break;
case VERSION : nodeCmd.printReleaseVersion(System.out); break;
case COMPACTIONSTATS : nodeCmd.printCompactionStats(System.out); break;
@@ -1163,8 +1174,7 @@ public class NodeCmd
case STATUS :
- if (arguments.length > 0) nodeCmd.printClusterStatus(System.out, arguments[0]);
- else nodeCmd.printClusterStatus(System.out, null);
+ nodeCmd.printClusterStatus(System.out, arguments[0]);
break;
case DECOMMISSION :
@@ -1555,6 +1565,86 @@ public class NodeCmd
}
}
+ /**
+ * Used for filtering keyspaces and columnfamilies to be displayed using the cfstats command.
+ */
+ private static class OptionFilter
+ {
+ private Map<String, List<String>> filter = new HashMap<String, List<String>>();
+ private Map<String, List<String>> verifier = new HashMap<String, List<String>>();
+ private String [] filterList;
+ private boolean ignoreMode;
+
+ public OptionFilter(boolean ignoreMode, String... filterList)
+ {
+ this.filterList = filterList;
+ this.ignoreMode = ignoreMode;
+
+ if(filterList == null)
+ return;
+
+ for(String s : filterList)
+ {
+ String [] keyValues = s.split("\\.", 2);
+
+ // build the map that stores the ks' and cfs to use
+ if(!filter.containsKey(keyValues[0]))
+ {
+ filter.put(keyValues[0], new ArrayList<String>());
+ verifier.put(keyValues[0], new ArrayList<String>());
+
+ if(keyValues.length == 2)
+ {
+ filter.get(keyValues[0]).add(keyValues[1]);
+ verifier.get(keyValues[0]).add(keyValues[1]);
+ }
+ }
+ else
+ {
+ if(keyValues.length == 2)
+ {
+ filter.get(keyValues[0]).add(keyValues[1]);
+ verifier.get(keyValues[0]).add(keyValues[1]);
+ }
+ }
+ }
+ }
+
+ public boolean isColumnFamilyIncluded(String keyspace, String columnFamily)
+ {
+ // supplying empty params list is treated as wanting to display all kss & cfs
+ if(filterList == null)
+ return !ignoreMode;
+
+ List<String> cfs = filter.get(keyspace);
+
+ // no such keyspace is in the map
+ if (cfs == null)
+ return ignoreMode;
+ // only a keyspace with no cfs was supplied
+ // so ignore or include (based on the flag) every column family in specified keyspace
+ else if (cfs.size() == 0)
+ return !ignoreMode;
+
+ // keyspace exists, and it contains specific cfs
+ verifier.get(keyspace).remove(columnFamily);
+ return ignoreMode ^ cfs.contains(columnFamily);
+ }
+
+ public void verifyKeyspaces(List<String> keyspaces)
+ {
+ for(String ks : verifier.keySet())
+ if(!keyspaces.contains(ks))
+ throw new RuntimeException("Unknown keyspace: " + ks);
+ }
+
+ public void verifyColumnFamilies()
+ {
+ for(String ks : filter.keySet())
+ if(verifier.get(ks).size() > 0)
+ throw new RuntimeException("Unknown column families: " + verifier.get(ks).toString() + " in keyspace: " + ks);
+ }
+ }
private static class ToolOptions extends Options
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8dcdce4e/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
----------------------------------------------------------------------
diff --git a/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml b/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
index 318aeed..8fe0519 100644
--- a/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
+++ b/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
@@ -28,9 +28,9 @@ commands:
- name: status
help: |
Print cluster information (state, load, IDs, ...)
- - name: cfstats
+ - name: cfstats [keyspace].[cfname] ...
help: |
- Print statistics on column families
+ Print statistics on column families. Use the -i flag to ignore the list of column families and display the remaining cfs.
- name: version
help: |
Print cassandra version
[2/6] git commit: Add ability to list specific KS/CF combinations in
nodetool cfstats Patch by Lyuben Todorov,
reviewed by brandonwilliams for CASSANDRA-4191
Posted by br...@apache.org.
Add ability to list specific KS/CF combinations in nodetool cfstats
Patch by Lyuben Todorov, reviewed by brandonwilliams for CASSANDRA-4191
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8dcdce4e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8dcdce4e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8dcdce4e
Branch: refs/heads/cassandra-2.0
Commit: 8dcdce4e904d419e821aa80a9d21f61ef8803911
Parents: 6165840
Author: Brandon Williams <br...@apache.org>
Authored: Tue Oct 15 11:09:11 2013 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Oct 15 11:09:11 2013 -0500
----------------------------------------------------------------------
CHANGES.txt | 3 +
.../org/apache/cassandra/tools/NodeCmd.java | 102 +++++++++++++++++--
.../apache/cassandra/tools/NodeToolHelp.yaml | 4 +-
3 files changed, 101 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8dcdce4e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 046ecfb..2dbadc4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,6 @@
+1.2.12
+ * Add ability to list specific KS/CF combinations in nodetool cfstats (CASSANDRA-4191)
+
1.2.11
* Limit CQL prepared statement cache by size instead of count (CASSANDRA-6107)
* Tracing should log write failure rather than raw exceptions (CASSANDRA-6133)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8dcdce4e/src/java/org/apache/cassandra/tools/NodeCmd.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeCmd.java b/src/java/org/apache/cassandra/tools/NodeCmd.java
index 86f9eef..7e0bf67 100644
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@ -72,6 +72,7 @@ public class NodeCmd
private static final Pair<String, String> END_TOKEN_OPT = Pair.create("et", "end-token");
private static final Pair<String, String> UPGRADE_ALL_SSTABLE_OPT = Pair.create("a", "include-all-sstables");
private static final Pair<String, String> NO_SNAPSHOT = Pair.create("ns", "no-snapshot");
+ private static final Pair<String, String> CFSTATS_IGNORE_OPT = Pair.create("i", "ignore");
private static final String DEFAULT_HOST = "127.0.0.1";
private static final int DEFAULT_PORT = 7199;
@@ -96,6 +97,7 @@ public class NodeCmd
options.addOption(END_TOKEN_OPT, true, "token at which repair range ends");
options.addOption(UPGRADE_ALL_SSTABLE_OPT, false, "includes sstables that are already on the most recent version during upgradesstables");
options.addOption(NO_SNAPSHOT, false, "disables snapshot creation for scrub");
+ options.addOption(CFSTATS_IGNORE_OPT, false, "ignore the supplied list of keyspace.columnfamiles in statistics");
}
public NodeCmd(NodeProbe probe)
@@ -803,8 +805,9 @@ public class NodeCmd
}
}
- public void printColumnFamilyStats(PrintStream outs)
+ public void printColumnFamilyStats(PrintStream outs, boolean ignoreMode, String [] filterList)
{
+ OptionFilter filter = new OptionFilter(ignoreMode, filterList);
Map <String, List <ColumnFamilyStoreMBean>> cfstoreMap = new HashMap <String, List <ColumnFamilyStoreMBean>>();
// get a list of column family stores
@@ -816,18 +819,22 @@ public class NodeCmd
String tableName = entry.getKey();
ColumnFamilyStoreMBean cfsProxy = entry.getValue();
- if (!cfstoreMap.containsKey(tableName))
+ if (!cfstoreMap.containsKey(tableName) && filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
{
List<ColumnFamilyStoreMBean> columnFamilies = new ArrayList<ColumnFamilyStoreMBean>();
columnFamilies.add(cfsProxy);
cfstoreMap.put(tableName, columnFamilies);
}
- else
+ else if (filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
{
cfstoreMap.get(tableName).add(cfsProxy);
}
}
+ // make sure all specified kss and cfs exist
+ filter.verifyKeyspaces(probe.getKeyspaces());
+ filter.verifyColumnFamilies();
+
// print out the table statistics
for (Entry<String, List<ColumnFamilyStoreMBean>> entry : cfstoreMap.entrySet())
{
@@ -1140,7 +1147,11 @@ public class NodeCmd
break;
case INFO : nodeCmd.printInfo(System.out, cmd); break;
- case CFSTATS : nodeCmd.printColumnFamilyStats(System.out); break;
+ case CFSTATS :
+ boolean ignoreMode = cmd.hasOption(CFSTATS_IGNORE_OPT.left);
+ if (arguments.length > 0) { nodeCmd.printColumnFamilyStats(System.out, ignoreMode, arguments); }
+ else { nodeCmd.printColumnFamilyStats(System.out, false, null); }
+ break;
case TPSTATS : nodeCmd.printThreadPoolStats(System.out); break;
case VERSION : nodeCmd.printReleaseVersion(System.out); break;
case COMPACTIONSTATS : nodeCmd.printCompactionStats(System.out); break;
@@ -1163,8 +1174,7 @@ public class NodeCmd
case STATUS :
- if (arguments.length > 0) nodeCmd.printClusterStatus(System.out, arguments[0]);
- else nodeCmd.printClusterStatus(System.out, null);
+ nodeCmd.printClusterStatus(System.out, arguments[0]);
break;
case DECOMMISSION :
@@ -1555,6 +1565,86 @@ public class NodeCmd
}
}
+ /**
+ * Used for filtering keyspaces and columnfamilies to be displayed using the cfstats command.
+ */
+ private static class OptionFilter
+ {
+ private Map<String, List<String>> filter = new HashMap<String, List<String>>();
+ private Map<String, List<String>> verifier = new HashMap<String, List<String>>();
+ private String [] filterList;
+ private boolean ignoreMode;
+
+ public OptionFilter(boolean ignoreMode, String... filterList)
+ {
+ this.filterList = filterList;
+ this.ignoreMode = ignoreMode;
+
+ if(filterList == null)
+ return;
+
+ for(String s : filterList)
+ {
+ String [] keyValues = s.split("\\.", 2);
+
+ // build the map that stores the ks' and cfs to use
+ if(!filter.containsKey(keyValues[0]))
+ {
+ filter.put(keyValues[0], new ArrayList<String>());
+ verifier.put(keyValues[0], new ArrayList<String>());
+
+ if(keyValues.length == 2)
+ {
+ filter.get(keyValues[0]).add(keyValues[1]);
+ verifier.get(keyValues[0]).add(keyValues[1]);
+ }
+ }
+ else
+ {
+ if(keyValues.length == 2)
+ {
+ filter.get(keyValues[0]).add(keyValues[1]);
+ verifier.get(keyValues[0]).add(keyValues[1]);
+ }
+ }
+ }
+ }
+
+ public boolean isColumnFamilyIncluded(String keyspace, String columnFamily)
+ {
+ // supplying empty params list is treated as wanting to display all kss & cfs
+ if(filterList == null)
+ return !ignoreMode;
+
+ List<String> cfs = filter.get(keyspace);
+
+ // no such keyspace is in the map
+ if (cfs == null)
+ return ignoreMode;
+ // only a keyspace with no cfs was supplied
+ // so ignore or include (based on the flag) every column family in specified keyspace
+ else if (cfs.size() == 0)
+ return !ignoreMode;
+
+ // keyspace exists, and it contains specific cfs
+ verifier.get(keyspace).remove(columnFamily);
+ return ignoreMode ^ cfs.contains(columnFamily);
+ }
+
+ public void verifyKeyspaces(List<String> keyspaces)
+ {
+ for(String ks : verifier.keySet())
+ if(!keyspaces.contains(ks))
+ throw new RuntimeException("Unknown keyspace: " + ks);
+ }
+
+ public void verifyColumnFamilies()
+ {
+ for(String ks : filter.keySet())
+ if(verifier.get(ks).size() > 0)
+ throw new RuntimeException("Unknown column families: " + verifier.get(ks).toString() + " in keyspace: " + ks);
+ }
+ }
private static class ToolOptions extends Options
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8dcdce4e/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
----------------------------------------------------------------------
diff --git a/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml b/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
index 318aeed..8fe0519 100644
--- a/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
+++ b/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
@@ -28,9 +28,9 @@ commands:
- name: status
help: |
Print cluster information (state, load, IDs, ...)
- - name: cfstats
+ - name: cfstats [keyspace].[cfname] ...
help: |
- Print statistics on column families
+ Print statistics on column families. Use the -i flag to ignore the list of column families and display the remaining cfs.
- name: version
help: |
Print cassandra version
[4/6] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0
Posted by br...@apache.org.
Merge branch 'cassandra-1.2' into cassandra-2.0
Conflicts:
CHANGES.txt
src/java/org/apache/cassandra/tools/NodeCmd.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bd45c4c5
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bd45c4c5
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/bd45c4c5
Branch: refs/heads/trunk
Commit: bd45c4c590e49d2b2692bcb71a2ab60a49f2a5a2
Parents: 6bd71a5 8dcdce4
Author: Brandon Williams <br...@apache.org>
Authored: Tue Oct 15 11:18:19 2013 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Oct 15 11:18:19 2013 -0500
----------------------------------------------------------------------
CHANGES.txt | 3 +
.../org/apache/cassandra/tools/NodeCmd.java | 104 +++++++++++++++++--
.../apache/cassandra/tools/NodeToolHelp.yaml | 4 +-
3 files changed, 102 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/bd45c4c5/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 0459bfa,2dbadc4..6fab83b
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,28 -1,7 +1,31 @@@
-1.2.12
+2.0.2
+ * Fix FileCacheService regressions (CASSANDRA-6149)
+ * Never return WriteTimeout for CL.ANY (CASSANDRA-6032)
+ * Fix race conditions in bulk loader (CASSANDRA-6129)
+ * Add configurable metrics reporting (CASSANDRA-4430)
+ * drop queries exceeding a configurable number of tombstones (CASSANDRA-6117)
+ * Track and persist sstable read activity (CASSANDRA-5515)
+ * Fixes for speculative retry (CASSANDRA-5932)
+ * Improve memory usage of metadata min/max column names (CASSANDRA-6077)
+ * Fix thrift validation refusing row markers on CQL3 tables (CASSANDRA-6081)
+ * Fix insertion of collections with CAS (CASSANDRA-6069)
+ * Correctly send metadata on SELECT COUNT (CASSANDRA-6080)
+ * Track clients' remote addresses in ClientState (CASSANDRA-6070)
+ * Create snapshot dir if it does not exist when migrating
+ leveled manifest (CASSANDRA-6093)
+ * make sequential nodetool repair the default (CASSANDRA-5950)
+ * Add more hooks for compaction strategy implementations (CASSANDRA-6111)
+ * Fix potential NPE on composite 2ndary indexes (CASSANDRA-6098)
+ * Delete can potentially be skipped in batch (CASSANDRA-6115)
+ * Allow alter keyspace on system_traces (CASSANDRA-6016)
+ * Disallow empty column names in cql (CASSANDRA-6136)
+ * Use Java7 file-handling APIs and fix file moving on Windows (CASSANDRA-5383)
+ * Save compaction history to system keyspace (CASSANDRA-5078)
+ * Fix NPE if StorageService.getOperationMode() is executed before full startup (CASSANDRA-6166)
+Merged from 1.2:
+ * Add ability to list specific KS/CF combinations in nodetool cfstats (CASSANDRA-4191)
+
+ 1.2.11
* Limit CQL prepared statement cache by size instead of count (CASSANDRA-6107)
* Tracing should log write failure rather than raw exceptions (CASSANDRA-6133)
* lock access to TM.endpointToHostIdMap (CASSANDRA-6103)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/bd45c4c5/src/java/org/apache/cassandra/tools/NodeCmd.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/NodeCmd.java
index 011d823,7e0bf67..05f46f9
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@@ -790,33 -816,37 +793,37 @@@ public class NodeCm
while (cfamilies.hasNext())
{
Entry<String, ColumnFamilyStoreMBean> entry = cfamilies.next();
- String tableName = entry.getKey();
+ String keyspaceName = entry.getKey();
ColumnFamilyStoreMBean cfsProxy = entry.getValue();
- if (!cfstoreMap.containsKey(keyspaceName))
- if (!cfstoreMap.containsKey(tableName) && filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
++ if (!cfstoreMap.containsKey(keyspaceName) && filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
{
List<ColumnFamilyStoreMBean> columnFamilies = new ArrayList<ColumnFamilyStoreMBean>();
columnFamilies.add(cfsProxy);
- cfstoreMap.put(tableName, columnFamilies);
+ cfstoreMap.put(keyspaceName, columnFamilies);
}
- else
+ else if (filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
{
- cfstoreMap.get(tableName).add(cfsProxy);
+ cfstoreMap.get(keyspaceName).add(cfsProxy);
}
}
- // print out the keyspace statistics
+ // make sure all specified kss and cfs exist
+ filter.verifyKeyspaces(probe.getKeyspaces());
+ filter.verifyColumnFamilies();
+
+ // print out the table statistics
for (Entry<String, List<ColumnFamilyStoreMBean>> entry : cfstoreMap.entrySet())
{
- String tableName = entry.getKey();
+ String keyspaceName = entry.getKey();
List<ColumnFamilyStoreMBean> columnFamilies = entry.getValue();
- long tableReadCount = 0;
- long tableWriteCount = 0;
- int tablePendingTasks = 0;
- double tableTotalReadTime = 0.0f;
- double tableTotalWriteTime = 0.0f;
+ long keyspaceReadCount = 0;
+ long keyspaceWriteCount = 0;
+ int keyspacePendingTasks = 0;
+ double keyspaceTotalReadTime = 0.0f;
+ double keyspaceTotalWriteTime = 0.0f;
- outs.println("Keyspace: " + tableName);
+ outs.println("Keyspace: " + keyspaceName);
for (ColumnFamilyStoreMBean cfstore : columnFamilies)
{
long writeCount = cfstore.getWriteCount();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/bd45c4c5/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
----------------------------------------------------------------------
[6/6] git commit: Merge branch 'cassandra-2.0' into trunk
Posted by br...@apache.org.
Merge branch 'cassandra-2.0' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0c34fa8e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0c34fa8e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0c34fa8e
Branch: refs/heads/trunk
Commit: 0c34fa8e9750a64e82e5fd392a0be48c2f84e9e1
Parents: d143206 bd45c4c
Author: Brandon Williams <br...@apache.org>
Authored: Tue Oct 15 11:18:31 2013 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Oct 15 11:18:31 2013 -0500
----------------------------------------------------------------------
CHANGES.txt | 3 +
.../org/apache/cassandra/tools/NodeCmd.java | 104 +++++++++++++++++--
.../apache/cassandra/tools/NodeToolHelp.yaml | 4 +-
3 files changed, 102 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c34fa8e/CHANGES.txt
----------------------------------------------------------------------
[5/6] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0
Posted by br...@apache.org.
Merge branch 'cassandra-1.2' into cassandra-2.0
Conflicts:
CHANGES.txt
src/java/org/apache/cassandra/tools/NodeCmd.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bd45c4c5
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bd45c4c5
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/bd45c4c5
Branch: refs/heads/cassandra-2.0
Commit: bd45c4c590e49d2b2692bcb71a2ab60a49f2a5a2
Parents: 6bd71a5 8dcdce4
Author: Brandon Williams <br...@apache.org>
Authored: Tue Oct 15 11:18:19 2013 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Oct 15 11:18:19 2013 -0500
----------------------------------------------------------------------
CHANGES.txt | 3 +
.../org/apache/cassandra/tools/NodeCmd.java | 104 +++++++++++++++++--
.../apache/cassandra/tools/NodeToolHelp.yaml | 4 +-
3 files changed, 102 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/bd45c4c5/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 0459bfa,2dbadc4..6fab83b
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,28 -1,7 +1,31 @@@
-1.2.12
+2.0.2
+ * Fix FileCacheService regressions (CASSANDRA-6149)
+ * Never return WriteTimeout for CL.ANY (CASSANDRA-6032)
+ * Fix race conditions in bulk loader (CASSANDRA-6129)
+ * Add configurable metrics reporting (CASSANDRA-4430)
+ * drop queries exceeding a configurable number of tombstones (CASSANDRA-6117)
+ * Track and persist sstable read activity (CASSANDRA-5515)
+ * Fixes for speculative retry (CASSANDRA-5932)
+ * Improve memory usage of metadata min/max column names (CASSANDRA-6077)
+ * Fix thrift validation refusing row markers on CQL3 tables (CASSANDRA-6081)
+ * Fix insertion of collections with CAS (CASSANDRA-6069)
+ * Correctly send metadata on SELECT COUNT (CASSANDRA-6080)
+ * Track clients' remote addresses in ClientState (CASSANDRA-6070)
+ * Create snapshot dir if it does not exist when migrating
+ leveled manifest (CASSANDRA-6093)
+ * make sequential nodetool repair the default (CASSANDRA-5950)
+ * Add more hooks for compaction strategy implementations (CASSANDRA-6111)
+ * Fix potential NPE on composite 2ndary indexes (CASSANDRA-6098)
+ * Delete can potentially be skipped in batch (CASSANDRA-6115)
+ * Allow alter keyspace on system_traces (CASSANDRA-6016)
+ * Disallow empty column names in cql (CASSANDRA-6136)
+ * Use Java7 file-handling APIs and fix file moving on Windows (CASSANDRA-5383)
+ * Save compaction history to system keyspace (CASSANDRA-5078)
+ * Fix NPE if StorageService.getOperationMode() is executed before full startup (CASSANDRA-6166)
+Merged from 1.2:
+ * Add ability to list specific KS/CF combinations in nodetool cfstats (CASSANDRA-4191)
+
+ 1.2.11
* Limit CQL prepared statement cache by size instead of count (CASSANDRA-6107)
* Tracing should log write failure rather than raw exceptions (CASSANDRA-6133)
* lock access to TM.endpointToHostIdMap (CASSANDRA-6103)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/bd45c4c5/src/java/org/apache/cassandra/tools/NodeCmd.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/NodeCmd.java
index 011d823,7e0bf67..05f46f9
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@@ -790,33 -816,37 +793,37 @@@ public class NodeCm
while (cfamilies.hasNext())
{
Entry<String, ColumnFamilyStoreMBean> entry = cfamilies.next();
- String tableName = entry.getKey();
+ String keyspaceName = entry.getKey();
ColumnFamilyStoreMBean cfsProxy = entry.getValue();
- if (!cfstoreMap.containsKey(keyspaceName))
- if (!cfstoreMap.containsKey(tableName) && filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
++ if (!cfstoreMap.containsKey(keyspaceName) && filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
{
List<ColumnFamilyStoreMBean> columnFamilies = new ArrayList<ColumnFamilyStoreMBean>();
columnFamilies.add(cfsProxy);
- cfstoreMap.put(tableName, columnFamilies);
+ cfstoreMap.put(keyspaceName, columnFamilies);
}
- else
+ else if (filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
{
- cfstoreMap.get(tableName).add(cfsProxy);
+ cfstoreMap.get(keyspaceName).add(cfsProxy);
}
}
- // print out the keyspace statistics
+ // make sure all specified kss and cfs exist
+ filter.verifyKeyspaces(probe.getKeyspaces());
+ filter.verifyColumnFamilies();
+
+ // print out the table statistics
for (Entry<String, List<ColumnFamilyStoreMBean>> entry : cfstoreMap.entrySet())
{
- String tableName = entry.getKey();
+ String keyspaceName = entry.getKey();
List<ColumnFamilyStoreMBean> columnFamilies = entry.getValue();
- long tableReadCount = 0;
- long tableWriteCount = 0;
- int tablePendingTasks = 0;
- double tableTotalReadTime = 0.0f;
- double tableTotalWriteTime = 0.0f;
+ long keyspaceReadCount = 0;
+ long keyspaceWriteCount = 0;
+ int keyspacePendingTasks = 0;
+ double keyspaceTotalReadTime = 0.0f;
+ double keyspaceTotalWriteTime = 0.0f;
- outs.println("Keyspace: " + tableName);
+ outs.println("Keyspace: " + keyspaceName);
for (ColumnFamilyStoreMBean cfstore : columnFamilies)
{
long writeCount = cfstore.getWriteCount();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/bd45c4c5/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
----------------------------------------------------------------------
[3/6] git commit: Add ability to list specific KS/CF combinations in
nodetool cfstats Patch by Lyuben Todorov,
reviewed by brandonwilliams for CASSANDRA-4191
Posted by br...@apache.org.
Add ability to list specific KS/CF combinations in nodetool cfstats
Patch by Lyuben Todorov, reviewed by brandonwilliams for CASSANDRA-4191
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8dcdce4e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8dcdce4e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8dcdce4e
Branch: refs/heads/trunk
Commit: 8dcdce4e904d419e821aa80a9d21f61ef8803911
Parents: 6165840
Author: Brandon Williams <br...@apache.org>
Authored: Tue Oct 15 11:09:11 2013 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Oct 15 11:09:11 2013 -0500
----------------------------------------------------------------------
CHANGES.txt | 3 +
.../org/apache/cassandra/tools/NodeCmd.java | 102 +++++++++++++++++--
.../apache/cassandra/tools/NodeToolHelp.yaml | 4 +-
3 files changed, 101 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8dcdce4e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 046ecfb..2dbadc4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,6 @@
+1.2.12
+ * Add ability to list specific KS/CF combinations in nodetool cfstats (CASSANDRA-4191)
+
1.2.11
* Limit CQL prepared statement cache by size instead of count (CASSANDRA-6107)
* Tracing should log write failure rather than raw exceptions (CASSANDRA-6133)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8dcdce4e/src/java/org/apache/cassandra/tools/NodeCmd.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeCmd.java b/src/java/org/apache/cassandra/tools/NodeCmd.java
index 86f9eef..7e0bf67 100644
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@ -72,6 +72,7 @@ public class NodeCmd
private static final Pair<String, String> END_TOKEN_OPT = Pair.create("et", "end-token");
private static final Pair<String, String> UPGRADE_ALL_SSTABLE_OPT = Pair.create("a", "include-all-sstables");
private static final Pair<String, String> NO_SNAPSHOT = Pair.create("ns", "no-snapshot");
+ private static final Pair<String, String> CFSTATS_IGNORE_OPT = Pair.create("i", "ignore");
private static final String DEFAULT_HOST = "127.0.0.1";
private static final int DEFAULT_PORT = 7199;
@@ -96,6 +97,7 @@ public class NodeCmd
options.addOption(END_TOKEN_OPT, true, "token at which repair range ends");
options.addOption(UPGRADE_ALL_SSTABLE_OPT, false, "includes sstables that are already on the most recent version during upgradesstables");
options.addOption(NO_SNAPSHOT, false, "disables snapshot creation for scrub");
+ options.addOption(CFSTATS_IGNORE_OPT, false, "ignore the supplied list of keyspace.columnfamiles in statistics");
}
public NodeCmd(NodeProbe probe)
@@ -803,8 +805,9 @@ public class NodeCmd
}
}
- public void printColumnFamilyStats(PrintStream outs)
+ public void printColumnFamilyStats(PrintStream outs, boolean ignoreMode, String [] filterList)
{
+ OptionFilter filter = new OptionFilter(ignoreMode, filterList);
Map <String, List <ColumnFamilyStoreMBean>> cfstoreMap = new HashMap <String, List <ColumnFamilyStoreMBean>>();
// get a list of column family stores
@@ -816,18 +819,22 @@ public class NodeCmd
String tableName = entry.getKey();
ColumnFamilyStoreMBean cfsProxy = entry.getValue();
- if (!cfstoreMap.containsKey(tableName))
+ if (!cfstoreMap.containsKey(tableName) && filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
{
List<ColumnFamilyStoreMBean> columnFamilies = new ArrayList<ColumnFamilyStoreMBean>();
columnFamilies.add(cfsProxy);
cfstoreMap.put(tableName, columnFamilies);
}
- else
+ else if (filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName()))
{
cfstoreMap.get(tableName).add(cfsProxy);
}
}
+ // make sure all specified kss and cfs exist
+ filter.verifyKeyspaces(probe.getKeyspaces());
+ filter.verifyColumnFamilies();
+
// print out the table statistics
for (Entry<String, List<ColumnFamilyStoreMBean>> entry : cfstoreMap.entrySet())
{
@@ -1140,7 +1147,11 @@ public class NodeCmd
break;
case INFO : nodeCmd.printInfo(System.out, cmd); break;
- case CFSTATS : nodeCmd.printColumnFamilyStats(System.out); break;
+ case CFSTATS :
+ boolean ignoreMode = cmd.hasOption(CFSTATS_IGNORE_OPT.left);
+ if (arguments.length > 0) { nodeCmd.printColumnFamilyStats(System.out, ignoreMode, arguments); }
+ else { nodeCmd.printColumnFamilyStats(System.out, false, null); }
+ break;
case TPSTATS : nodeCmd.printThreadPoolStats(System.out); break;
case VERSION : nodeCmd.printReleaseVersion(System.out); break;
case COMPACTIONSTATS : nodeCmd.printCompactionStats(System.out); break;
@@ -1163,8 +1174,7 @@ public class NodeCmd
case STATUS :
- if (arguments.length > 0) nodeCmd.printClusterStatus(System.out, arguments[0]);
- else nodeCmd.printClusterStatus(System.out, null);
+ nodeCmd.printClusterStatus(System.out, arguments[0]);
break;
case DECOMMISSION :
@@ -1555,6 +1565,86 @@ public class NodeCmd
}
}
+ /**
+ * Used for filtering keyspaces and columnfamilies to be displayed using the cfstats command.
+ */
+ private static class OptionFilter
+ {
+ private Map<String, List<String>> filter = new HashMap<String, List<String>>();
+ private Map<String, List<String>> verifier = new HashMap<String, List<String>>();
+ private String [] filterList;
+ private boolean ignoreMode;
+
+ public OptionFilter(boolean ignoreMode, String... filterList)
+ {
+ this.filterList = filterList;
+ this.ignoreMode = ignoreMode;
+
+ if(filterList == null)
+ return;
+
+ for(String s : filterList)
+ {
+ String [] keyValues = s.split("\\.", 2);
+
+ // build the map that stores the ks' and cfs to use
+ if(!filter.containsKey(keyValues[0]))
+ {
+ filter.put(keyValues[0], new ArrayList<String>());
+ verifier.put(keyValues[0], new ArrayList<String>());
+
+ if(keyValues.length == 2)
+ {
+ filter.get(keyValues[0]).add(keyValues[1]);
+ verifier.get(keyValues[0]).add(keyValues[1]);
+ }
+ }
+ else
+ {
+ if(keyValues.length == 2)
+ {
+ filter.get(keyValues[0]).add(keyValues[1]);
+ verifier.get(keyValues[0]).add(keyValues[1]);
+ }
+ }
+ }
+ }
+
+ public boolean isColumnFamilyIncluded(String keyspace, String columnFamily)
+ {
+ // supplying empty params list is treated as wanting to display all kss & cfs
+ if(filterList == null)
+ return !ignoreMode;
+
+ List<String> cfs = filter.get(keyspace);
+
+ // no such keyspace is in the map
+ if (cfs == null)
+ return ignoreMode;
+ // only a keyspace with no cfs was supplied
+ // so ignore or include (based on the flag) every column family in specified keyspace
+ else if (cfs.size() == 0)
+ return !ignoreMode;
+
+ // keyspace exists, and it contains specific cfs
+ verifier.get(keyspace).remove(columnFamily);
+ return ignoreMode ^ cfs.contains(columnFamily);
+ }
+
+ public void verifyKeyspaces(List<String> keyspaces)
+ {
+ for(String ks : verifier.keySet())
+ if(!keyspaces.contains(ks))
+ throw new RuntimeException("Unknown keyspace: " + ks);
+ }
+
+ public void verifyColumnFamilies()
+ {
+ for(String ks : filter.keySet())
+ if(verifier.get(ks).size() > 0)
+ throw new RuntimeException("Unknown column families: " + verifier.get(ks).toString() + " in keyspace: " + ks);
+ }
+ }
private static class ToolOptions extends Options
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8dcdce4e/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
----------------------------------------------------------------------
diff --git a/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml b/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
index 318aeed..8fe0519 100644
--- a/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
+++ b/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
@@ -28,9 +28,9 @@ commands:
- name: status
help: |
Print cluster information (state, load, IDs, ...)
- - name: cfstats
+ - name: cfstats [keyspace].[cfname] ...
help: |
- Print statistics on column families
+ Print statistics on column families. Use the -i flag to ignore the list of column families and display the remaining cfs.
- name: version
help: |
Print cassandra version