mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-30 19:46:48 +00:00
Read query as fragmented string from the input stream in transport/server.cc, propagate it a such to query_processor::prepare() and also store it as such in cql3::cql_statement::raw_cql_statement. Unfortunately, the query still has to be linearized for parsing, as ANTLR -- although allows for custom InputStream implementation -- plays pointer arithmetics games with the pointers obtained from them, so fragmented input cannot be used. To amortize the cost of this linearization, the query string is linearized through utils::reusable_buffer. The parser can be invoked recursively, nested invokations linearize directly. Still, this patch limits the places where the query is linearized to the following: * Parsing * Audit * Logs and error messages So the normal query paths for queries that actually can get arbitrarily large (UPDATE and INSERT) should only linearize the query temporarily for parsing.
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
/*
|
|
* Copyright (C) 2026-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "bytes_ostream.hh"
|
|
#include "cql3/dialect.hh"
|
|
#include "service/client_state.hh"
|
|
#include "tracing/tracing.hh"
|
|
#include "cql3/query_options.hh"
|
|
#include "utils/chunked_string.hh"
|
|
|
|
namespace cql_transport {
|
|
|
|
struct forward_cql_execute_request {
|
|
bytes_ostream request_buffer;
|
|
uint8_t opcode;
|
|
uint8_t cql_version;
|
|
cql3::dialect dialect;
|
|
service::forwarded_client_state client_state;
|
|
std::optional<tracing::trace_info> trace_info;
|
|
cql3::computed_function_values cached_fn_calls;
|
|
};
|
|
|
|
enum class forward_cql_status : uint8_t {
|
|
success = 0,
|
|
error = 1,
|
|
prepared_not_found = 2,
|
|
redirect = 3,
|
|
};
|
|
|
|
struct forward_cql_execute_response {
|
|
forward_cql_status status;
|
|
bytes_ostream response_body;
|
|
uint8_t response_flags;
|
|
bytes prepared_id;
|
|
locator::host_id target_host;
|
|
unsigned target_shard;
|
|
std::optional<seastar::lowres_clock::time_point> timeout;
|
|
};
|
|
|
|
struct forward_cql_prepare_request {
|
|
utils::chunked_string query_string;
|
|
service::forwarded_client_state client_state;
|
|
std::optional<tracing::trace_info> trace_info;
|
|
cql3::dialect dialect;
|
|
};
|
|
|
|
}
|