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
76 lines
1.6 KiB
C++
76 lines
1.6 KiB
C++
/*
|
|
* Copyright (C) 2017-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <chrono>
|
|
#include <string_view>
|
|
|
|
#include <seastar/core/future.hh>
|
|
#include <seastar/core/abort_source.hh>
|
|
#include <seastar/util/noncopyable_function.hh>
|
|
#include <seastar/core/seastar.hh>
|
|
#include <seastar/core/resource.hh>
|
|
#include <seastar/core/sstring.hh>
|
|
#include <seastar/core/smp.hh>
|
|
|
|
#include "log.hh"
|
|
#include "seastarx.hh"
|
|
#include "utils/exponential_backoff_retry.hh"
|
|
|
|
using namespace std::chrono_literals;
|
|
|
|
namespace replica {
|
|
class database;
|
|
}
|
|
|
|
namespace service {
|
|
class migration_manager;
|
|
class query_state;
|
|
}
|
|
|
|
namespace cql3 {
|
|
class query_processor;
|
|
}
|
|
|
|
namespace auth {
|
|
|
|
namespace meta {
|
|
|
|
constexpr std::string_view DEFAULT_SUPERUSER_NAME("cassandra");
|
|
extern constinit const std::string_view AUTH_KS;
|
|
extern constinit const std::string_view USERS_CF;
|
|
extern constinit const std::string_view AUTH_PACKAGE_NAME;
|
|
|
|
}
|
|
|
|
template <class Task>
|
|
future<> once_among_shards(Task&& f) {
|
|
if (this_shard_id() == 0u) {
|
|
return f();
|
|
}
|
|
|
|
return make_ready_future<>();
|
|
}
|
|
|
|
// Func must support being invoked more than once.
|
|
future<> do_after_system_ready(seastar::abort_source& as, seastar::noncopyable_function<future<>()> func);
|
|
|
|
future<> create_metadata_table_if_missing(
|
|
std::string_view table_name,
|
|
cql3::query_processor&,
|
|
std::string_view cql,
|
|
::service::migration_manager&) noexcept;
|
|
|
|
///
|
|
/// Time-outs for internal, non-local CQL queries.
|
|
///
|
|
::service::query_state& internal_distributed_query_state() noexcept;
|
|
|
|
}
|