mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
Normalize tag name to meet ClickHouse convention instead of boost
This commit is contained in:
parent
65a61e1c95
commit
7fdf3a0c2d
@ -103,7 +103,7 @@ void QueryLogMetric::startQuery(const String & query_id, TimePoint query_start_t
|
||||
queries.emplace(std::move(status));
|
||||
|
||||
// Wake up the sleeping thread only if the collection for this query needs to wake up sooner
|
||||
const auto & queries_by_next_collect_time = queries.get<by_next_collect_time>();
|
||||
const auto & queries_by_next_collect_time = queries.get<ByNextCollectTIme>();
|
||||
if (query_id == queries_by_next_collect_time.begin()->query_id)
|
||||
{
|
||||
std::unique_lock cv_lock(queries_cv_mutex);
|
||||
@ -114,7 +114,7 @@ void QueryLogMetric::startQuery(const String & query_id, TimePoint query_start_t
|
||||
void QueryLogMetric::finishQuery(const String & query_id)
|
||||
{
|
||||
std::lock_guard lock(queries_mutex);
|
||||
auto & queries_by_name = queries.get<by_query_id>();
|
||||
auto & queries_by_name = queries.get<ByQueryId>();
|
||||
queries_by_name.erase(query_id);
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ void QueryLogMetric::threadFunction()
|
||||
const auto current_time = std::chrono::system_clock::now();
|
||||
if (!queries.empty())
|
||||
{
|
||||
auto & queries_by_next_collect_time = queries.get<by_next_collect_time>();
|
||||
auto & queries_by_next_collect_time = queries.get<ByNextCollectTIme>();
|
||||
stepFunction(current_time);
|
||||
desired_timepoint = queries_by_next_collect_time.begin()->next_collect_time;
|
||||
}
|
||||
@ -184,7 +184,7 @@ void QueryLogMetric::stepFunction(TimePoint current_time)
|
||||
{
|
||||
static const auto & process_list = context->getProcessList();
|
||||
|
||||
auto & queries_by_next_collect_time = queries.get<by_next_collect_time>();
|
||||
auto & queries_by_next_collect_time = queries.get<ByNextCollectTIme>();
|
||||
for (const auto & query_status : queries_by_next_collect_time)
|
||||
{
|
||||
// The queries are already sorted by next_collect_time, so once we find a query with a next_collect_time
|
||||
|
@ -56,14 +56,14 @@ class QueryLogMetric : public PeriodicLog<QueryLogMetricElement>
|
||||
using PeriodicLog<QueryLogMetricElement>::PeriodicLog;
|
||||
|
||||
public:
|
||||
struct by_query_id{};
|
||||
struct by_next_collect_time{};
|
||||
struct ByQueryId{};
|
||||
struct ByNextCollectTime{};
|
||||
|
||||
using QuerySet = boost::multi_index_container<
|
||||
QueryLogMetricStatus,
|
||||
boost::multi_index::indexed_by<
|
||||
boost::multi_index::hashed_unique<boost::multi_index::tag<by_query_id>, boost::multi_index::member<QueryLogMetricStatus, String, &QueryLogMetricStatus::query_id>>,
|
||||
boost::multi_index::ordered_non_unique<boost::multi_index::tag<by_next_collect_time>, boost::multi_index::member<QueryLogMetricStatus, std::chrono::system_clock::time_point, &QueryLogMetricStatus::next_collect_time>>>>;
|
||||
boost::multi_index::hashed_unique<boost::multi_index::tag<ByQueryId>, boost::multi_index::member<QueryLogMetricStatus, String, &QueryLogMetricStatus::query_id>>,
|
||||
boost::multi_index::ordered_non_unique<boost::multi_index::tag<ByNextCollectTime>, boost::multi_index::member<QueryLogMetricStatus, std::chrono::system_clock::time_point, &QueryLogMetricStatus::next_collect_time>>>>;
|
||||
|
||||
// Both startQuery and finishQuery are called from the thread that executes the query
|
||||
void startQuery(const String & query_id, TimePoint query_start_time, UInt64 interval_milliseconds);
|
||||
|
Loading…
Reference in New Issue
Block a user