add a comment, rename a field

This commit is contained in:
Sema Checherinda 2023-03-17 11:59:44 +01:00
parent df9e247d67
commit e2af8f6ed6
3 changed files with 16 additions and 15 deletions

View File

@ -159,29 +159,29 @@ void ThreadStatus::attachInternalTextLogsQueue(const InternalTextLogsQueuePtr &
if (!thread_group)
throw Exception(ErrorCodes::LOGICAL_ERROR, "No thread group attached to the thread {}", thread_id);
shared_data.logs_queue_ptr = logs_queue;
shared_data.client_logs_level = logs_level;
local_data.logs_queue_ptr = logs_queue;
local_data.client_logs_level = logs_level;
thread_group->attachInternalTextLogsQueue(logs_queue, logs_level);
}
InternalTextLogsQueuePtr ThreadStatus::getInternalTextLogsQueue() const
{
return shared_data.logs_queue_ptr.lock();
return local_data.logs_queue_ptr.lock();
}
InternalProfileEventsQueuePtr ThreadStatus::getInternalProfileEventsQueue() const
{
return shared_data.profile_queue_ptr.lock();
return local_data.profile_queue_ptr.lock();
}
const String & ThreadStatus::getQueryForLog() const
{
return shared_data.query_for_logs;
return local_data.query_for_logs;
}
LogsLevel ThreadStatus::getClientLogsLevel() const
{
return shared_data.client_logs_level;
return local_data.client_logs_level;
}
void ThreadStatus::flushUntrackedMemory()

View File

@ -92,6 +92,7 @@ public:
SharedData getSharedData()
{
/// Critical section for making the copy of shared_data
std::lock_guard lock(mutex);
return shared_data;
}
@ -170,7 +171,7 @@ private:
using FatalErrorCallback = std::function<void()>;
FatalErrorCallback fatal_error_callback;
ThreadGroupStatus::SharedData shared_data;
ThreadGroupStatus::SharedData local_data;
bool performance_counters_finalized = false;

View File

@ -84,13 +84,13 @@ void ThreadGroupStatus::attachQueryForLog(const String & query_, UInt64 normaliz
void ThreadStatus::attachQueryForLog(const String & query_)
{
shared_data.query_for_logs = query_;
shared_data.normalized_query_hash = normalizedQueryHash<false>(query_);
local_data.query_for_logs = query_;
local_data.normalized_query_hash = normalizedQueryHash<false>(query_);
if (!thread_group)
throw Exception(ErrorCodes::LOGICAL_ERROR, "No thread group attached to the thread {}", thread_id);
thread_group->attachQueryForLog(shared_data.query_for_logs, shared_data.normalized_query_hash);
thread_group->attachQueryForLog(local_data.query_for_logs, local_data.normalized_query_hash);
}
void ThreadGroupStatus::attachInternalProfileEventsQueue(const InternalProfileEventsQueuePtr & profile_queue)
@ -104,7 +104,7 @@ void ThreadStatus::attachInternalProfileEventsQueue(const InternalProfileEventsQ
if (!thread_group)
throw Exception(ErrorCodes::LOGICAL_ERROR, "No thread group attached to the thread {}", thread_id);
shared_data.profile_queue_ptr = profile_queue;
local_data.profile_queue_ptr = profile_queue;
thread_group->attachInternalProfileEventsQueue(profile_queue);
}
@ -167,7 +167,7 @@ void ThreadStatus::attachToGroupImpl(const ThreadGroupStatusPtr & thread_group_)
fatal_error_callback = thread_group->fatal_error_callback;
shared_data = thread_group->getSharedData();
local_data = thread_group->getSharedData();
applyQuerySettings();
initPerformanceCounters();
@ -196,7 +196,7 @@ void ThreadStatus::detachFromGroup()
query_id_from_query_context.clear();
query_context.reset();
shared_data = {};
local_data = {};
fatal_error_callback = {};
@ -447,8 +447,8 @@ void ThreadStatus::logToQueryThreadLog(QueryThreadLog & thread_log, const String
if (thread_group)
{
elem.master_thread_id = thread_group->master_thread_id;
elem.query = shared_data.query_for_logs;
elem.normalized_query_hash = shared_data.normalized_query_hash;
elem.query = local_data.query_for_logs;
elem.normalized_query_hash = local_data.normalized_query_hash;
}
auto query_context_ptr = query_context.lock();