mirror of https://github.com/apache/cassandra
Fix cqlsh CAPTURE command to save query results without trace details when TRACING is ON
This patch also opportunistically fixes CAPTURE OFF. patch by Gottipati Gautam; reviewed by Stefan Miklosovic, Brad Schoening for CASSANDRA-19105
This commit is contained in:
parent
32d1335654
commit
510c20fec1
|
|
@ -1,4 +1,5 @@
|
|||
5.1
|
||||
* Fix cqlsh CAPTURE command to save query results without trace details when TRACING is ON (CASSANDRA-19105)
|
||||
* Optionally prevent tombstone purging during repair (CASSANDRA-20071)
|
||||
* Add post-filtering support for the IN operator in SAI queries (CASSANDRA-20025)
|
||||
* Don’t finish ongoing decommission and move operations during startup (CASSANDRA-20040)
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ cqlsh_source_cmd_syntax_rules = r'''
|
|||
'''
|
||||
|
||||
cqlsh_capture_cmd_syntax_rules = r'''
|
||||
<captureCommand> ::= "CAPTURE" ( fname=( <stringLiteral>) | "OFF" )?
|
||||
<captureCommand> ::= "CAPTURE" ( switch=( <stringLiteral> | "OFF" ) )?
|
||||
;
|
||||
'''
|
||||
|
||||
|
|
|
|||
|
|
@ -1524,7 +1524,8 @@ class Shell(cmd.Cmd):
|
|||
To inspect the current capture configuration, use CAPTURE with no
|
||||
arguments.
|
||||
"""
|
||||
fname = parsed.get_binding('fname')
|
||||
fname = parsed.get_binding('switch')
|
||||
|
||||
if fname is None:
|
||||
if self.shunted_query_out is not None:
|
||||
print("Currently capturing query output to %r." % (self.query_out.name,))
|
||||
|
|
|
|||
|
|
@ -38,6 +38,14 @@ def print_trace(shell, trace):
|
|||
"""
|
||||
Print an already populated cassandra.query.QueryTrace instance.
|
||||
"""
|
||||
temp_query = None
|
||||
temp_color = None
|
||||
if shell.shunted_query_out is not None:
|
||||
temp_query = shell.query_out
|
||||
shell.query_out = shell.shunted_query_out
|
||||
temp_color = shell.color
|
||||
shell.color = shell.shunted_color
|
||||
|
||||
rows = make_trace_rows(trace)
|
||||
if not rows:
|
||||
shell.printerr("No rows for session %s found." % (trace.trace_id,))
|
||||
|
|
@ -54,6 +62,10 @@ def print_trace(shell, trace):
|
|||
shell.print_formatted_result(formatted_names, formatted_values, with_header=True, tty=shell.tty)
|
||||
shell.writeresult('')
|
||||
|
||||
if temp_query is not None:
|
||||
shell.query_out = temp_query
|
||||
shell.color = temp_color
|
||||
|
||||
|
||||
def make_trace_rows(trace):
|
||||
if not trace.events:
|
||||
|
|
|
|||
Loading…
Reference in New Issue