diff --git a/table_helper.cc b/table_helper.cc index b3594bd107..7859db1771 100644 --- a/table_helper.cc +++ b/table_helper.cc @@ -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 tables) { +future<> table_helper::setup_keyspace(cql3::query_processor& qp, std::string_view keyspace_name, sstring replication_factor, service::query_state& qs, std::vector 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 diff --git a/table_helper.hh b/table_helper.hh index ca5023b413..b584dfcedf 100644 --- a/table_helper.hh +++ b/table_helper.hh @@ -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 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 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 opt_maker); - static future<> setup_keyspace(cql3::query_processor& qp, const sstring& keyspace_name, sstring replication_factor, service::query_state& qs, std::vector tables); + static future<> setup_keyspace(cql3::query_processor& qp, std::string_view keyspace_name, sstring replication_factor, service::query_state& qs, std::vector tables); /** * Makes a monotonically increasing value in 100ns ("nanos") based on the given time diff --git a/tracing/trace_keyspace_helper.cc b/tracing/trace_keyspace_helper.cc index 4794a0daa3..f496cd904e 100644 --- a/tracing/trace_keyspace_helper.cc +++ b/tracing/trace_keyspace_helper.cc @@ -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, diff --git a/tracing/trace_keyspace_helper.hh b/tracing/trace_keyspace_helper.hh index 3ec2b2ea99..10012d7557 100644 --- a/tracing/trace_keyspace_helper.hh +++ b/tracing/trace_keyspace_helper.hh @@ -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;