Updated Branches: refs/heads/cassandra-2.0 08f2e9797 -> 47fcb05d4
Don't allow describe on CQL3 table in CLI ever patch by slebresne; reviewed by iamaleksey for CASSANDRA-5750 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/92fe8c89 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/92fe8c89 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/92fe8c89 Branch: refs/heads/cassandra-2.0 Commit: 92fe8c89614c91d5f6dd61ba6190df7c26783853 Parents: e01224e Author: Sylvain Lebresne <[email protected]> Authored: Thu Nov 21 09:57:18 2013 +0100 Committer: Sylvain Lebresne <[email protected]> Committed: Thu Nov 21 09:57:18 2013 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/cli/CliClient.java | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/92fe8c89/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index b3fa565..c012148 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,7 @@ 1.2.13 * Optimize FD phi calculation (CASSANDRA-6386) * Improve initial FD phi estimate when starting up (CASSANDRA-6385) + * Don't list CQL3 table in CLI describe even if named explicitely (CASSANDRA-5750) 1.2.12 http://git-wip-us.apache.org/repos/asf/cassandra/blob/92fe8c89/src/java/org/apache/cassandra/cli/CliClient.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cli/CliClient.java b/src/java/org/apache/cassandra/cli/CliClient.java index 2229207..29c5ef5 100644 --- a/src/java/org/apache/cassandra/cli/CliClient.java +++ b/src/java/org/apache/cassandra/cli/CliClient.java @@ -1163,8 +1163,10 @@ public class CliClient try { - // request correct cfDef from the server - CfDef cfDef = getCfDef(thriftClient.describe_keyspace(this.keySpace), cfName); + // request correct cfDef from the server (we let that call include CQL3 cf even though + // they can't be modified by thrift because the error message that will be thrown by + // system_update_column_family will be more useful) + CfDef cfDef = getCfDef(thriftClient.describe_keyspace(this.keySpace), cfName, true); if (cfDef == null) throw new RuntimeException("Column Family " + cfName + " was not found in the current keyspace."); @@ -2273,7 +2275,7 @@ public class CliClient "of the keyspaces first.", entityName)); CfDef inputCfDef = (inputKsDef == null) - ? getCfDef(currentKeySpace, entityName) + ? getCfDef(currentKeySpace, entityName, false) : null; // no need to lookup CfDef if we know that it was keyspace if (inputKsDef != null) @@ -2298,7 +2300,7 @@ public class CliClient } else { - sessionState.out.println("Sorry, no Keyspace nor ColumnFamily was found with name: " + entityName); + sessionState.out.println("Sorry, no Keyspace nor (non-CQL3) ColumnFamily was found with name: " + entityName + " (if this is a CQL3 table, you should use cqlsh instead)"); } } } @@ -2371,7 +2373,7 @@ public class CliClient private CfDef getCfDef(String keySpaceName, String columnFamilyName) { KsDef ksDef = keyspacesMap.get(keySpaceName); - CfDef cfDef = getCfDef(ksDef, columnFamilyName); + CfDef cfDef = getCfDef(ksDef, columnFamilyName, true); if (cfDef == null) throw new RuntimeException("No such column family: " + columnFamilyName); return cfDef; @@ -2387,7 +2389,7 @@ public class CliClient return getCfDef(this.keySpace, columnFamilyName); } - private CfDef getCfDef(KsDef keyspace, String columnFamilyName) + private CfDef getCfDef(KsDef keyspace, String columnFamilyName, boolean includeCQL3) { for (CfDef cfDef : keyspace.cf_defs) { @@ -2395,7 +2397,7 @@ public class CliClient return cfDef; } - return cql3KeyspacesMap.get(keyspace.name).get(columnFamilyName); + return includeCQL3 ? cql3KeyspacesMap.get(keyspace.name).get(columnFamilyName) : null; } /**
