diff --git a/cql3/query_processor.cc b/cql3/query_processor.cc index 980e13a2bc..53a6059763 100644 --- a/cql3/query_processor.cc +++ b/cql3/query_processor.cc @@ -273,11 +273,11 @@ query_processor::process(const sstring_view& query_string, service::query_state& log.trace("process: \"{}\"", query_string); tracing::trace(query_state.get_trace_state(), "Parsing a statement"); auto p = get_statement(query_string, query_state.get_client_state()); - options.prepare(p->bound_names); auto cql_statement = p->statement; if (cql_statement->get_bound_terms() != options.get_values_count()) { throw exceptions::invalid_request_exception("Invalid amount of bind variables"); } + options.prepare(p->bound_names); warn(unimplemented::cause::METRICS); #if 0 diff --git a/transport/server.cc b/transport/server.cc index 2d66f3c874..ccb2bf08c3 100644 --- a/transport/server.cc +++ b/transport/server.cc @@ -853,7 +853,6 @@ future cql_server::connection::process_execute(uint16_t stream, r } auto& options = *q_state->options; auto skip_metadata = options.skip_metadata(); - options.prepare(prepared->bound_names); tracing::set_page_size(client_state.get_trace_state(), options.get_page_size()); tracing::set_consistency_level(client_state.get_trace_state(), options.get_consistency()); @@ -870,6 +869,9 @@ future cql_server::connection::process_execute(uint16_t stream, r tracing::trace(query_state.get_trace_state(), "Invalid amount of bind variables: expected {:d} received {:d}", stmt->get_bound_terms(), options.get_values_count()); throw exceptions::invalid_request_exception("Invalid amount of bind variables"); } + + options.prepare(prepared->bound_names); + tracing::trace(query_state.get_trace_state(), "Processing a statement"); return _server._query_processor.local().process_statement_prepared(std::move(prepared), std::move(cache_key), query_state, options, needs_authorization).then([this, stream, &query_state, skip_metadata] (auto msg) { tracing::trace(query_state.get_trace_state(), "Done processing - preparing a result");