mirror of https://github.com/apache/cassandra
cqlsh: force CL.ONE for tracing and system.schema* queries;
patch by Aleksey Yeschenko, reviewed by Jonathan Ellis for CASSANDRA-5070
This commit is contained in:
parent
706612e300
commit
63902c6d82
|
|
@ -6,6 +6,7 @@ Merged from 1.1:
|
|||
* Fix ALTER TABLE overriding compression options with defaults
|
||||
(CASSANDRA-4996, CASSANDRA-5066)
|
||||
* Fix SimpleAuthorizer example (CASSANDRA-5072)
|
||||
* cqlsh: force CL.ONE for tracing and system.schema* queries (CASSANDRA-5070)
|
||||
|
||||
|
||||
1.2-rc1
|
||||
|
|
|
|||
12
bin/cqlsh
12
bin/cqlsh
|
|
@ -743,7 +743,9 @@ class Shell(cmd.Cmd):
|
|||
else:
|
||||
cf_q = """select "columnfamily" from system.schema_columnfamilies
|
||||
where "keyspace"=:ks"""
|
||||
self.cursor.execute(cf_q, {'ks': self.cql_unprotect_name(ksname)})
|
||||
self.cursor.execute(cf_q,
|
||||
{'ks': self.cql_unprotect_name(ksname)},
|
||||
consistency_level='ONE')
|
||||
return [str(row[0]) for row in self.cursor.fetchall()]
|
||||
|
||||
def get_columnfamily_layout(self, ksname, cfname):
|
||||
|
|
@ -759,11 +761,15 @@ class Shell(cmd.Cmd):
|
|||
where "keyspace"=:ks and "columnfamily"=:cf"""
|
||||
col_q = """select * from system.schema_columns
|
||||
where "keyspace"=:ks and "columnfamily"=:cf"""
|
||||
self.cursor.execute(cf_q, {'ks': ksname, 'cf': cfname})
|
||||
self.cursor.execute(cf_q,
|
||||
{'ks': ksname, 'cf': cfname},
|
||||
consistency_level='ONE')
|
||||
layout = self.fetchdict()
|
||||
if layout is None:
|
||||
raise ColumnFamilyNotFound("Column family %r not found" % cfname)
|
||||
self.cursor.execute(col_q, {'ks': ksname, 'cf': cfname})
|
||||
self.cursor.execute(col_q,
|
||||
{'ks': ksname, 'cf': cfname},
|
||||
consistency_level='ONE')
|
||||
cols = self.fetchdict_all()
|
||||
return cql3handling.CqlTableDef.from_layout(layout, cols)
|
||||
|
||||
|
|
|
|||
|
|
@ -40,12 +40,14 @@ def print_trace_session(shell, cursor, session_id):
|
|||
def fetch_trace_session(cursor, session_id):
|
||||
cursor.execute("SELECT request, coordinator, started_at, duration "
|
||||
"FROM %s.%s "
|
||||
"WHERE session_id = '%s'" % (TRACING_KS, SESSIONS_CF, session_id))
|
||||
"WHERE session_id = '%s'" % (TRACING_KS, SESSIONS_CF, session_id),
|
||||
consistency_level='ONE')
|
||||
(request, coordinator, started_at, duration) = cursor.fetchone()
|
||||
|
||||
cursor.execute("SELECT activity, event_id, source, source_elapsed "
|
||||
"FROM %s.%s "
|
||||
"WHERE session_id = '%s'" % (TRACING_KS, EVENTS_CF, session_id))
|
||||
"WHERE session_id = '%s'" % (TRACING_KS, EVENTS_CF, session_id),
|
||||
consistency_level='ONE')
|
||||
events = cursor.fetchall()
|
||||
|
||||
rows = []
|
||||
|
|
|
|||
Loading…
Reference in New Issue