mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
tracing: make sure keyspace and table names are available to static constructors
Static constructors (specifically for the `system_keyspaces` global variable) need their dependencies to be already constructed when their own construction begins. Because tracing uses seastar::sstring, which is not constexpr, we must change it to std::string_view (which is). Change the type and perform the required adjustments. The definition is moved to the header file for simplicity.
This commit is contained in:
@@ -115,7 +115,7 @@ future<> table_helper::insert(cql3::query_processor& qp, service::query_state& q
|
||||
}).discard_result();
|
||||
}
|
||||
|
||||
future<> table_helper::setup_keyspace(cql3::query_processor& qp, const sstring& keyspace_name, sstring replication_factor, service::query_state& qs, std::vector<table_helper*> tables) {
|
||||
future<> table_helper::setup_keyspace(cql3::query_processor& qp, std::string_view keyspace_name, sstring replication_factor, service::query_state& qs, std::vector<table_helper*> tables) {
|
||||
if (this_shard_id() == 0) {
|
||||
size_t n = tables.size();
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
@@ -123,7 +123,7 @@ future<> table_helper::setup_keyspace(cql3::query_processor& qp, const sstring&
|
||||
throw std::invalid_argument("setup_keyspace called with table_helper for different keyspace");
|
||||
}
|
||||
}
|
||||
return seastar::async([&qp, &keyspace_name, replication_factor, &qs, tables] {
|
||||
return seastar::async([&qp, keyspace_name, replication_factor, &qs, tables] {
|
||||
data_dictionary::database db = qp.db();
|
||||
|
||||
// Create a keyspace
|
||||
|
||||
@@ -52,9 +52,9 @@ private:
|
||||
bool _is_fallback_stmt = false;
|
||||
|
||||
public:
|
||||
table_helper(sstring keyspace, sstring name, sstring create_cql, sstring insert_cql, std::optional<sstring> insert_cql_fallback = std::nullopt)
|
||||
: _keyspace(std::move(keyspace))
|
||||
, _name(std::move(name))
|
||||
table_helper(std::string_view keyspace, std::string_view name, sstring create_cql, sstring insert_cql, std::optional<sstring> insert_cql_fallback = std::nullopt)
|
||||
: _keyspace(keyspace)
|
||||
, _name(name)
|
||||
, _create_cql(std::move(create_cql))
|
||||
, _insert_cql(std::move(insert_cql))
|
||||
, _insert_cql_fallback(std::move(insert_cql_fallback)) {}
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
|
||||
future<> insert(cql3::query_processor& qp, service::query_state& qs, noncopyable_function<cql3::query_options ()> opt_maker);
|
||||
|
||||
static future<> setup_keyspace(cql3::query_processor& qp, const sstring& keyspace_name, sstring replication_factor, service::query_state& qs, std::vector<table_helper*> tables);
|
||||
static future<> setup_keyspace(cql3::query_processor& qp, std::string_view keyspace_name, sstring replication_factor, service::query_state& qs, std::vector<table_helper*> tables);
|
||||
|
||||
/**
|
||||
* Makes a monotonically increasing value in 100ns ("nanos") based on the given time
|
||||
|
||||
@@ -57,14 +57,6 @@ using namespace std::chrono_literals;
|
||||
|
||||
static logging::logger tlogger("trace_keyspace_helper");
|
||||
|
||||
const sstring trace_keyspace_helper::KEYSPACE_NAME("system_traces");
|
||||
const sstring trace_keyspace_helper::SESSIONS("sessions");
|
||||
const sstring trace_keyspace_helper::SESSIONS_TIME_IDX("sessions_time_idx");
|
||||
const sstring trace_keyspace_helper::EVENTS("events");
|
||||
|
||||
const sstring trace_keyspace_helper::NODE_SLOW_QUERY_LOG("node_slow_log");
|
||||
const sstring trace_keyspace_helper::NODE_SLOW_QUERY_LOG_TIME_IDX("node_slow_log_time_idx");
|
||||
|
||||
static service::client_state& tracing_client_state() {
|
||||
static timeout_config tracing_db_timeout_config {
|
||||
5s, 5s, 5s, 5s, 5s, 5s, 5s,
|
||||
|
||||
@@ -51,15 +51,14 @@ namespace tracing {
|
||||
|
||||
class trace_keyspace_helper final : public i_tracing_backend_helper {
|
||||
public:
|
||||
static const sstring KEYSPACE_NAME;
|
||||
static const sstring SESSIONS;
|
||||
static const sstring SESSIONS_TIME_IDX;
|
||||
static const sstring EVENTS;
|
||||
static constexpr std::string_view KEYSPACE_NAME = "system_traces";
|
||||
static constexpr std::string_view SESSIONS = "sessions";
|
||||
static constexpr std::string_view SESSIONS_TIME_IDX = "sessions_time_idx";
|
||||
static constexpr std::string_view EVENTS = "events";
|
||||
|
||||
// Performance related tables
|
||||
static const sstring NODE_SLOW_QUERY_LOG;
|
||||
static const sstring NODE_SLOW_QUERY_LOG_TIME_IDX;
|
||||
|
||||
static constexpr std::string_view NODE_SLOW_QUERY_LOG = "node_slow_log";
|
||||
static constexpr std::string_view NODE_SLOW_QUERY_LOG_TIME_IDX = "node_slow_log_time_idx";
|
||||
private:
|
||||
static constexpr int bad_column_family_message_period = 10000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user