You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/08/12 17:07:21 UTC
[1/2] git commit: cqlsh: add DESCRIBE FULL SCHEMA variant
Updated Branches:
refs/heads/cassandra-2.0 cfadbb8b5 -> b87270b39
cqlsh: add DESCRIBE FULL SCHEMA variant
patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for
CASSANDRA-5880
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/09a4dc05
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/09a4dc05
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/09a4dc05
Branch: refs/heads/cassandra-2.0
Commit: 09a4dc055237185c0bcb9a5b3855b85ef0861fb2
Parents: 703bd68
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Mon Aug 12 17:06:14 2013 +0200
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Mon Aug 12 17:06:14 2013 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
NEWS.txt | 2 ++
bin/cqlsh | 27 +++++++++++++++------------
pylib/cqlshlib/test/test_cqlsh_output.py | 2 +-
4 files changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/09a4dc05/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 396459b..5b6d62c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,7 @@
* fix CAS contention timeout (CASSANDRA-5830)
* fix HsHa to respect max frame size (CASSANDRA-4573)
* Fix (some) 2i on composite components omissions (CASSANDRA-5851)
+ * cqlsh: add DESCRIBE FULL SCHEMA variant (CASSANDRA-5880)
Merged from 1.2:
* Correctly validate sparse composite cells in scrub (CASSANDRA-5855)
* Add KeyCacheHitRate metric to CF metrics (CASSANDRA-5868)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/09a4dc05/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index b807973..c608e03 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -70,6 +70,8 @@ Operations
- A new hints created metric is tracked per target, replacing countPendingHints
- After performance testing for CASSANDRA-5727, the default LCS filesize
has been changed from 5MB to 160MB.
+ - cqlsh DESCRIBE SCHEMA no longer outputs the schema of system_* keyspaces;
+ use DESCRIBE FULL SCHEMA if you need the schema of system_* keyspaces.
Features
--------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/09a4dc05/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 5343a47..0f51c7f 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -178,7 +178,7 @@ else:
debug_completion = bool(os.environ.get('CQLSH_DEBUG_COMPLETION', '') == 'YES')
-SYSTEM_KEYSPACES = ('system', 'system_traces')
+SYSTEM_KEYSPACES = ('system', 'system_traces', 'system_auth')
# we want the cql parser to understand our cqlsh-specific commands too
my_commands_ending_with_newline = (
@@ -227,7 +227,7 @@ cqlsh_extra_syntax_rules = r'''
| "KEYSPACE" ksname=<keyspaceName>?
| ( "COLUMNFAMILY" | "TABLE" ) cf=<columnFamilyName>
| ( "COLUMNFAMILIES" | "TABLES" )
- | "SCHEMA"
+ | "FULL"? "SCHEMA"
| "CLUSTER" )
;
@@ -635,7 +635,7 @@ class Shell(cmd.Cmd):
return self.make_hacktastic_thrift_call('describe_version')
def get_ring(self):
- if self.current_keyspace is None or self.current_keyspace in SYSTEM_KEYSPACES:
+ if self.current_keyspace is None or self.current_keyspace == 'system':
raise NoKeyspaceError("Ring view requires a current non-system keyspace")
return self.make_hacktastic_thrift_call('describe_ring', self.current_keyspace)
@@ -1235,18 +1235,19 @@ class Shell(cmd.Cmd):
snitch = trim_if_present(self.get_snitch(), 'org.apache.cassandra.locator.')
print 'Snitch: %s\n' % snitch
if self.current_keyspace is not None \
- and self.current_keyspace not in SYSTEM_KEYSPACES:
+ and self.current_keyspace != 'system':
print "Range ownership:"
ring = self.get_ring()
for entry in ring:
print ' %39s [%s]' % (entry.start_token, ', '.join(entry.endpoints))
print
- def describe_schema(self):
+ def describe_schema(self, include_system=False):
print
for k in self.get_keyspaces():
- self.print_recreate_keyspace(k, sys.stdout)
- print
+ if include_system or not k.name in SYSTEM_KEYSPACES:
+ self.print_recreate_keyspace(k, sys.stdout)
+ print
def do_describe(self, parsed):
"""
@@ -1289,11 +1290,11 @@ class Shell(cmd.Cmd):
connected to a non-system keyspace, also shows endpoint-range
ownership information for the Cassandra ring.
- DESCRIBE SCHEMA
+ DESCRIBE [FULL] SCHEMA
- Output CQL commands that could be used to recreate the entire schema.
- Works as though "DESCRIBE KEYSPACE k" was invoked for each keyspace
- k.
+ Output CQL commands that could be used to recreate the entire (non-system) schema.
+ Works as though "DESCRIBE KEYSPACE k" was invoked for each non-system keyspace
+ k. Use DESCRIBE FULL SCHEMA to include the system keyspaces.
"""
what = parsed.matched[1][1].lower()
if what == 'keyspaces':
@@ -1315,7 +1316,9 @@ class Shell(cmd.Cmd):
elif what == 'cluster':
self.describe_cluster()
elif what == 'schema':
- self.describe_schema()
+ self.describe_schema(False)
+ elif what == 'full' and parsed.matched[2][1].lower() == 'schema':
+ self.describe_schema(True)
do_desc = do_describe
def do_copy(self, parsed):
http://git-wip-us.apache.org/repos/asf/cassandra/blob/09a4dc05/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 11ad949..f89127d 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -761,7 +761,7 @@ class TestCqlshOutput(BaseTestCase):
def test_describe_schema_output(self):
with testrun_cqlsh(tty=True) as c:
for semicolon in ('', ';'):
- output = c.cmd_and_response('desc schema' + semicolon)
+ output = c.cmd_and_response('desc full schema' + semicolon)
self.assertNoHasColors(output)
self.assertRegexpMatches(output, '^\nCREATE KEYSPACE')
self.assertIn("\nCREATE KEYSPACE system WITH replication = {\n 'class': 'LocalStrategy'\n};\n",
[2/2] git commit: Merge branch 'cassandra-2.0.0' into cassandra-2.0
Posted by al...@apache.org.
Merge branch 'cassandra-2.0.0' into cassandra-2.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b87270b3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b87270b3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b87270b3
Branch: refs/heads/cassandra-2.0
Commit: b87270b3915887720677e4f20eea21b79a32c811
Parents: cfadbb8 09a4dc0
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Mon Aug 12 17:07:12 2013 +0200
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Mon Aug 12 17:07:12 2013 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
NEWS.txt | 2 ++
bin/cqlsh | 27 +++++++++++++++------------
pylib/cqlshlib/test/test_cqlsh_output.py | 2 +-
4 files changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b87270b3/CHANGES.txt
----------------------------------------------------------------------