You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by xe...@apache.org on 2012/09/11 13:18:01 UTC
[2/2] git commit: fix assumption error in CLI when
updating/describing keyspace patch by Pavel Yaskevich;
reviewed by Dave Brosius for CASSANDRA-4322
fix assumption error in CLI when updating/describing keyspace
patch by Pavel Yaskevich; reviewed by Dave Brosius for CASSANDRA-4322
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/98708d81
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/98708d81
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/98708d81
Branch: refs/heads/trunk
Commit: 98708d817f8df91be4cfcba06c9523027fab881c
Parents: e172a9b
Author: Pavel Yaskevich <xe...@apache.org>
Authored: Sat Sep 8 21:57:46 2012 +0300
Committer: Pavel Yaskevich <xe...@apache.org>
Committed: Tue Sep 11 14:11:36 2012 +0300
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/cli/CliClient.java | 38 +++++++++++-----
2 files changed, 27 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/98708d81/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 246bc49..b6fe049 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,7 @@
1.1.6
* Improve IAuthority interface by introducing fine-grained
access permissions and grant/revoke commands (CASSANDRA-4490)
+ * fix assumption error in CLI when updating/describing keyspace (CASSANDRA-4322)
1.1.5
http://git-wip-us.apache.org/repos/asf/cassandra/blob/98708d81/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 8296253..d0fb543 100644
--- a/src/java/org/apache/cassandra/cli/CliClient.java
+++ b/src/java/org/apache/cassandra/cli/CliClient.java
@@ -1068,7 +1068,7 @@ public class CliClient
sessionState.out.println(mySchemaVersion);
validateSchemaIsSettled(mySchemaVersion);
keyspacesMap.remove(keyspaceName);
- getKSMetaData(keySpace);
+ getKSMetaData(keyspaceName);
}
catch (InvalidRequestException e)
{
@@ -1879,15 +1879,19 @@ public class CliClient
* Returns true if this.keySpace is set, false otherwise
* @return boolean
*/
- private boolean hasKeySpace()
+ private boolean hasKeySpace(boolean printError)
{
- if (keySpace == null)
- {
- sessionState.out.println("Not authenticated to a working keyspace.");
- return false;
- }
+ boolean hasKeyspace = keySpace != null;
- return true;
+ if (!hasKeyspace && printError)
+ sessionState.err.println("Not authorized to a working keyspace.");
+
+ return hasKeyspace;
+ }
+
+ private boolean hasKeySpace()
+ {
+ return hasKeySpace(true);
}
public String getKeySpace()
@@ -2142,9 +2146,19 @@ public class CliClient
return;
int argCount = statement.getChildCount();
-
- keyspacesMap.remove(keySpace);
- KsDef currentKeySpace = getKSMetaData(keySpace);
+
+ if (keySpace == null && argCount == 0)
+ {
+ sessionState.out.println("Authenticate to a Keyspace, before using `describe` or `describe <column_family>`");
+ return;
+ }
+
+ KsDef currentKeySpace = null;
+ if (keySpace != null)
+ {
+ keyspacesMap.remove(keySpace);
+ currentKeySpace = getKSMetaData(keySpace);
+ }
if (argCount > 1) // in case somebody changes Cli grammar
throw new RuntimeException("`describe` command take maximum one argument. See `help describe;`");
@@ -2996,7 +3010,7 @@ public class CliClient
public void replayAssumptions(String keyspace)
{
- if (!CliMain.isConnected() || !hasKeySpace())
+ if (!CliMain.isConnected() || !hasKeySpace(false))
return;
Map<String, Map<String, String>> cfAssumes = assumptions.get(keyspace);