You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2015/10/30 14:53:19 UTC
[1/3] cassandra git commit: Revert "Update cqlsh driver for new
driver execution API"
Repository: cassandra
Updated Branches:
refs/heads/trunk e39454873 -> cad3a2d51
Revert "Update cqlsh driver for new driver execution API"
This reverts commit acf67d559c5c25f1ec1a6070c2d91777dd3420b4.
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0fbf7159
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0fbf7159
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0fbf7159
Branch: refs/heads/trunk
Commit: 0fbf715916b48a8e8abad5911e2697791b49f824
Parents: acf67d5
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Oct 30 14:51:26 2015 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Oct 30 14:51:26 2015 +0100
----------------------------------------------------------------------
bin/cqlsh.py | 69 ++++++++++---------
lib/cassandra-driver-internal-only-2.7.2.zip | Bin 0 -> 229600 bytes
...iver-internal-only-3.0.0a2.post0-95c6008.zip | Bin 233564 -> 0 bytes
3 files changed, 38 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0fbf7159/bin/cqlsh.py
----------------------------------------------------------------------
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 17bddd3..09da020 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -111,13 +111,13 @@ except ImportError, e:
'Error: %s\n' % (sys.executable, sys.path, e))
from cassandra.auth import PlainTextAuthProvider
-from cassandra.cluster import Cluster
+from cassandra.cluster import Cluster, PagedResult
from cassandra.metadata import (ColumnMetadata, KeyspaceMetadata,
TableMetadata, protect_name, protect_names,
protect_value)
from cassandra.policies import WhiteListRoundRobinPolicy
from cassandra.protocol import QueryMessage, ResultMessage
-from cassandra.query import SimpleStatement, ordered_dict_factory, TraceUnavailable
+from cassandra.query import SimpleStatement, ordered_dict_factory
# cqlsh should run correctly when run out of a Cassandra source tree,
# out of an unpacked Cassandra tarball, and after a proper package install.
@@ -675,7 +675,6 @@ class Shell(cmd.Cmd):
self.session.default_timeout = client_timeout
self.session.row_factory = ordered_dict_factory
- self.session.default_consistency_level = cassandra.ConsistencyLevel.ONE
self.get_connection_versions()
self.current_keyspace = keyspace
@@ -1122,8 +1121,8 @@ class Shell(cmd.Cmd):
def do_use(self, parsed):
ksname = parsed.get_binding('ksname')
- success, _ = self.perform_simple_statement(SimpleStatement(parsed.extract_orig()))
- if success:
+ result, future = self.perform_simple_statement(SimpleStatement(parsed.extract_orig()))
+ if result:
if ksname[0] == '"' and ksname[-1] == '"':
self.current_keyspace = self.cql_unprotect_name(ksname)
else:
@@ -1140,7 +1139,7 @@ class Shell(cmd.Cmd):
def perform_statement(self, statement):
stmt = SimpleStatement(statement, consistency_level=self.consistency_level, serial_consistency_level=self.serial_consistency_level, fetch_size=self.page_size if self.use_paging else None)
- success, future = self.perform_simple_statement(stmt)
+ result, future = self.perform_simple_statement(stmt)
if future:
if future.warnings:
@@ -1148,17 +1147,19 @@ class Shell(cmd.Cmd):
if self.tracing_enabled:
try:
- for trace in future.get_all_query_traces(self.max_trace_wait):
+ trace = future.get_query_trace(self.max_trace_wait)
+ if trace:
print_trace(self, trace)
- except TraceUnavailable:
- msg = "Statement trace did not complete within %d seconds; trace data may be incomplete." % (self.session.max_trace_wait,)
- self.writeresult(msg, color=RED)
- for trace_id in future.get_query_trace_ids():
- self.show_session(trace_id)
+ elif stmt.trace_id:
+ self.writeresult("This statement trace may be incomplete", color=RED)
+ self.show_session(stmt.trace_id)
+ else:
+ msg = "Statement trace did not complete within %d seconds" % (self.session.max_trace_wait)
+ self.writeresult(msg, color=RED)
except Exception, err:
self.printerr("Unable to fetch query trace: %s" % (str(err),))
- return success
+ return result
def parse_for_table_meta(self, query_string):
try:
@@ -1176,7 +1177,7 @@ class Shell(cmd.Cmd):
while True:
try:
future = self.session.execute_async(statement, trace=self.tracing_enabled)
- result = future.result()
+ rows = future.result(self.session.default_timeout)
break
except cassandra.OperationTimedOut, err:
self.refresh_schema_metadata_best_effort()
@@ -1191,36 +1192,42 @@ class Shell(cmd.Cmd):
return False, None
if statement.query_string[:6].lower() == 'select':
- self.print_result(result, self.parse_for_table_meta(statement.query_string))
+ self.print_result(rows, self.parse_for_table_meta(statement.query_string))
elif statement.query_string.lower().startswith("list users") or statement.query_string.lower().startswith("list roles"):
- self.print_result(result, self.get_table_meta('system_auth', 'roles'))
+ self.print_result(rows, self.get_table_meta('system_auth', 'roles'))
elif statement.query_string.lower().startswith("list"):
- self.print_result(result, self.get_table_meta('system_auth', 'role_permissions'))
- elif result:
+ self.print_result(rows, self.get_table_meta('system_auth', 'role_permissions'))
+ elif rows:
# CAS INSERT/UPDATE
self.writeresult("")
- self.print_static_result(list(result), self.parse_for_table_meta(statement.query_string))
+ self.print_static_result(rows, self.parse_for_table_meta(statement.query_string))
self.flush_output()
return True, future
- def print_result(self, result, table_meta):
+ def print_result(self, rows, table_meta):
self.decoding_errors = []
self.writeresult("")
- if result.has_more_pages and self.tty:
+ if isinstance(rows, PagedResult) and self.tty:
num_rows = 0
while True:
- page = result.current_rows
- if page:
- num_rows += len(page)
- self.print_static_result(page, table_meta)
- if result.has_more_pages:
- raw_input("---MORE---")
- result.fetch_next_page()
- else:
+ page = list(rows.current_response)
+ if not page:
+ break
+ num_rows += len(page)
+ self.print_static_result(page, table_meta)
+ if not rows.response_future.has_more_pages:
break
+ raw_input("---MORE---")
+
+ rows.response_future.start_fetching_next_page()
+ result = rows.response_future.result()
+ if rows.response_future.has_more_pages:
+ rows.current_response = result.current_response
+ else:
+ rows.current_response = iter(result)
else:
- rows = list(result)
+ rows = list(rows or [])
num_rows = len(rows)
self.print_static_result(rows, table_meta)
self.writeresult("(%d rows)" % num_rows)
@@ -2328,7 +2335,7 @@ class ImportProcess(multiprocessing.Process):
cqltypes = [table_meta.columns[name].typestring for name in self.columns]
pk_indexes = [self.columns.index(col.name) for col in table_meta.primary_key]
query = 'INSERT INTO %s.%s (%s) VALUES (%%s)' % (
- protect_name(table_meta.keyspace_name),
+ protect_name(table_meta.keyspace.name),
protect_name(table_meta.name),
', '.join(protect_names(self.columns)))
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0fbf7159/lib/cassandra-driver-internal-only-2.7.2.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-2.7.2.zip b/lib/cassandra-driver-internal-only-2.7.2.zip
new file mode 100644
index 0000000..f2e75f1
Binary files /dev/null and b/lib/cassandra-driver-internal-only-2.7.2.zip differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0fbf7159/lib/cassandra-driver-internal-only-3.0.0a2.post0-95c6008.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0a2.post0-95c6008.zip b/lib/cassandra-driver-internal-only-3.0.0a2.post0-95c6008.zip
deleted file mode 100644
index da7fa0d..0000000
Binary files a/lib/cassandra-driver-internal-only-3.0.0a2.post0-95c6008.zip and /dev/null differ
[3/3] cassandra git commit: Merge branch 'cassandra-3.0' into trunk
Posted by sl...@apache.org.
Merge branch 'cassandra-3.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/cad3a2d5
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cad3a2d5
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cad3a2d5
Branch: refs/heads/trunk
Commit: cad3a2d51f082f150508a6df9e1e3d1d8abf8075
Parents: e394548 f27cc7e
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Oct 30 14:53:10 2015 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Oct 30 14:53:10 2015 +0100
----------------------------------------------------------------------
bin/cqlsh.py | 69 ++++++++++---------
lib/cassandra-driver-internal-only-2.7.2.zip | Bin 0 -> 229600 bytes
...iver-internal-only-3.0.0a2.post0-95c6008.zip | Bin 233564 -> 0 bytes
3 files changed, 38 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
[2/3] cassandra git commit: Merge branch 'cassandra-2.2' into
cassandra-3.0
Posted by sl...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f27cc7ef
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f27cc7ef
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f27cc7ef
Branch: refs/heads/trunk
Commit: f27cc7ef3cd8448b6e29b3c8e6b5ae08050e6e2f
Parents: df7c658 0fbf715
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Oct 30 14:52:53 2015 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Oct 30 14:52:53 2015 +0100
----------------------------------------------------------------------
bin/cqlsh.py | 69 ++++++++++---------
lib/cassandra-driver-internal-only-2.7.2.zip | Bin 0 -> 229600 bytes
...iver-internal-only-3.0.0a2.post0-95c6008.zip | Bin 233564 -> 0 bytes
3 files changed, 38 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/f27cc7ef/bin/cqlsh.py
----------------------------------------------------------------------
diff --cc bin/cqlsh.py
index 725f6e9,09da020..e092d44
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@@ -1180,24 -1159,9 +1181,24 @@@ class Shell(cmd.Cmd)
except Exception, err:
self.printerr("Unable to fetch query trace: %s" % (str(err),))
- return success
+ return result
- def parse_for_table_meta(self, query_string):
+ def parse_for_select_meta(self, query_string):
+ try:
+ parsed = cqlruleset.cql_parse(query_string)[1]
+ except IndexError:
+ return None
+ ks = self.cql_unprotect_name(parsed.get_binding('ksname', None))
+ name = self.cql_unprotect_name(parsed.get_binding('cfname', None))
+ try:
+ return self.get_table_meta(ks, name)
+ except ColumnFamilyNotFound:
+ try:
+ return self.get_view_meta(ks, name)
+ except MaterializedViewNotFound:
+ raise ObjectNotFound("%r not found in keyspace %r" % (name, ks))
+
+ def parse_for_update_meta(self, query_string):
try:
parsed = cqlruleset.cql_parse(query_string)[1]
except IndexError:
@@@ -1228,15 -1192,15 +1229,15 @@@
return False, None
if statement.query_string[:6].lower() == 'select':
- self.print_result(result, self.parse_for_select_meta(statement.query_string))
- self.print_result(rows, self.parse_for_table_meta(statement.query_string))
++ self.print_result(rows, self.parse_for_select_meta(statement.query_string))
elif statement.query_string.lower().startswith("list users") or statement.query_string.lower().startswith("list roles"):
- self.print_result(result, self.get_table_meta('system_auth', 'roles'))
+ self.print_result(rows, self.get_table_meta('system_auth', 'roles'))
elif statement.query_string.lower().startswith("list"):
- self.print_result(result, self.get_table_meta('system_auth', 'role_permissions'))
- elif result:
+ self.print_result(rows, self.get_table_meta('system_auth', 'role_permissions'))
+ elif rows:
# CAS INSERT/UPDATE
self.writeresult("")
- self.print_static_result(list(result), self.parse_for_update_meta(statement.query_string))
- self.print_static_result(rows, self.parse_for_table_meta(statement.query_string))
++ self.print_static_result(rows, self.parse_for_update_meta(statement.query_string))
self.flush_output()
return True, future