mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 10:00:35 +00:00
ClangBuildAnalyzer reports cql3/cql_statement.hh as being one of the most expensive header files in the project - being included (mostly indirectly) in 129 source files, and costing a total of 844 CPU seconds of compilation. This patch is an attempt, only *partially* successful, to reduce the number of times that cql_statement.hh is included. It succeeds in lowering the number 129 to 99, but not less :-( One of the biggest difficulties in reducing it further is that query_processor.hh includes a lot of templated code, which needs stuff from cql_statement.hh. The solution should be to un-template the functions in query_processor.hh and move them from the header to a source file, but this is beyond the scope of this patch and query_processor.hh appears problematic in other respects as well. Unfortunately the compilation speedup by this patch is negligible (the `du -bc build/dev/**/*.o` metric shows less than 0.01% reduction). Beyond the fact that this patch only removes 30% of the inclusions of this header, it appears that most of the source files that no longer include cql_statement.hh after this patch, included anyway many of the other headers that cql_statement.hh included, so the saving is minimal. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #15212
77 lines
1.7 KiB
C++
77 lines
1.7 KiB
C++
|
|
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#ifndef SERVICE_QUERY_STATE_HH
|
|
#define SERVICE_QUERY_STATE_HH
|
|
|
|
#include "service/client_state.hh"
|
|
#include "tracing/tracing.hh"
|
|
#include "service_permit.hh"
|
|
|
|
namespace qos {
|
|
class service_level_controller;
|
|
}
|
|
namespace service {
|
|
|
|
class query_state final {
|
|
private:
|
|
client_state& _client_state;
|
|
tracing::trace_state_ptr _trace_state_ptr;
|
|
service_permit _permit;
|
|
|
|
public:
|
|
query_state(client_state& client_state, service_permit permit)
|
|
: _client_state(client_state)
|
|
, _trace_state_ptr(tracing::trace_state_ptr())
|
|
, _permit(std::move(permit))
|
|
{}
|
|
|
|
query_state(client_state& client_state, tracing::trace_state_ptr trace_state_ptr, service_permit permit)
|
|
: _client_state(client_state)
|
|
, _trace_state_ptr(std::move(trace_state_ptr))
|
|
, _permit(std::move(permit))
|
|
{ }
|
|
|
|
const tracing::trace_state_ptr& get_trace_state() const {
|
|
return _trace_state_ptr;
|
|
}
|
|
|
|
tracing::trace_state_ptr& get_trace_state() {
|
|
return _trace_state_ptr;
|
|
}
|
|
|
|
client_state& get_client_state() {
|
|
return _client_state;
|
|
}
|
|
|
|
const client_state& get_client_state() const {
|
|
return _client_state;
|
|
}
|
|
api::timestamp_type get_timestamp() {
|
|
return _client_state.get_timestamp();
|
|
}
|
|
|
|
service_permit get_permit() const& {
|
|
return _permit;
|
|
}
|
|
|
|
service_permit&& get_permit() && {
|
|
return std::move(_permit);
|
|
}
|
|
|
|
qos::service_level_controller& get_service_level_controller() const {
|
|
return _client_state.get_service_level_controller();
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|