query_procesor: move raw_cql_statement to cql_statement
We'd like to log CQL statements inside batches, and they don't have prepared_statement object created for them.
This commit is contained in:
@@ -65,6 +65,9 @@ shared_ptr<const metadata> make_empty_metadata();
|
||||
class cql_statement {
|
||||
timeout_config_selector _timeout_config_selector;
|
||||
public:
|
||||
// CQL statement text
|
||||
sstring raw_cql_statement;
|
||||
|
||||
explicit cql_statement(timeout_config_selector timeout_selector) : _timeout_config_selector(timeout_selector) {}
|
||||
|
||||
virtual ~cql_statement()
|
||||
|
||||
@@ -618,7 +618,7 @@ query_processor::get_statement(const sstring_view& query, const service::client_
|
||||
}
|
||||
++_stats.prepare_invocations;
|
||||
auto p = statement->prepare(_db, _cql_stats);
|
||||
p->raw_cql_statement = sstring(query);
|
||||
p->statement->raw_cql_statement = sstring(query);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -679,7 +679,7 @@ statements::prepared_statement::checked_weak_ptr query_processor::prepare_intern
|
||||
auto& p = _internal_statements[query_string];
|
||||
if (p == nullptr) {
|
||||
auto np = parse_statement(query_string)->prepare(_db, _cql_stats);
|
||||
np->raw_cql_statement = query_string;
|
||||
np->statement->raw_cql_statement = query_string;
|
||||
np->statement->validate(_proxy, *_internal_state);
|
||||
p = std::move(np); // inserts it into map
|
||||
}
|
||||
@@ -821,7 +821,7 @@ query_processor::execute_internal(
|
||||
return execute_with_params(prepare_internal(query_string), cl, timeout_config, values);
|
||||
} else {
|
||||
auto p = parse_statement(query_string)->prepare(_db, _cql_stats);
|
||||
p->raw_cql_statement = query_string;
|
||||
p->statement->raw_cql_statement = query_string;
|
||||
p->statement->validate(_proxy, *_internal_state);
|
||||
auto checked_weak_ptr = p->checked_weak_from_this();
|
||||
return execute_with_params(std::move(checked_weak_ptr), cl, timeout_config, values).finally([p = std::move(p)] {});
|
||||
|
||||
@@ -68,7 +68,6 @@ public:
|
||||
typedef seastar::checked_ptr<weak_ptr<prepared_statement>> checked_weak_ptr;
|
||||
|
||||
public:
|
||||
sstring raw_cql_statement;
|
||||
const ::shared_ptr<cql_statement> statement;
|
||||
const std::vector<::shared_ptr<column_specification>> bound_names;
|
||||
std::vector<uint16_t> partition_key_bind_indices;
|
||||
|
||||
@@ -899,7 +899,7 @@ process_execute_internal(service::client_state& client_state, distributed<cql3::
|
||||
tracing::set_page_size(trace_state, options.get_page_size());
|
||||
tracing::set_consistency_level(trace_state, options.get_consistency());
|
||||
tracing::set_optional_serial_consistency_level(trace_state, options.get_serial_consistency());
|
||||
tracing::add_query(trace_state, prepared->raw_cql_statement);
|
||||
tracing::add_query(trace_state, prepared->statement->raw_cql_statement);
|
||||
tracing::add_prepared_statement(trace_state, prepared);
|
||||
|
||||
tracing::begin(trace_state, seastar::value_of([&id] { return seastar::format("Execute CQL3 prepared query [{}]", id); }),
|
||||
@@ -995,7 +995,7 @@ process_batch_internal(service::client_state& client_state, distributed<cql3::qu
|
||||
needs_authorization = pending_authorization_entries.emplace(std::move(cache_key), ps->checked_weak_from_this()).second;
|
||||
}
|
||||
if (init_trace) {
|
||||
tracing::add_query(trace_state, ps->raw_cql_statement);
|
||||
tracing::add_query(trace_state, ps->statement->raw_cql_statement);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user