mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Merge pull request #7523 from ClickHouse/fix-thread-context-attach
Disable context replacement for internal queries
This commit is contained in:
commit
883c868b36
@ -104,12 +104,11 @@ void ThreadStatus::attachQuery(const ThreadGroupStatusPtr & thread_group_, bool
|
||||
}
|
||||
|
||||
if (query_context)
|
||||
{
|
||||
query_id = query_context->getCurrentQueryId();
|
||||
|
||||
#if defined(__linux__)
|
||||
/// Set "nice" value if required.
|
||||
if (query_context)
|
||||
{
|
||||
/// Set "nice" value if required.
|
||||
Int32 new_os_thread_priority = query_context->getSettingsRef().os_thread_priority;
|
||||
if (new_os_thread_priority && hasLinuxCapability(CAP_SYS_NICE))
|
||||
{
|
||||
@ -120,8 +119,8 @@ void ThreadStatus::attachQuery(const ThreadGroupStatusPtr & thread_group_, bool
|
||||
|
||||
os_thread_priority = new_os_thread_priority;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
initPerformanceCounters();
|
||||
initQueryProfiler();
|
||||
|
@ -192,8 +192,13 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
|
||||
{
|
||||
time_t current_time = time(nullptr);
|
||||
|
||||
context.makeQueryContext();
|
||||
CurrentThread::attachQueryContext(context);
|
||||
/// If we already executing query and it requires to execute internal query, than
|
||||
/// don't replace thread context with given (it can be temporary). Otherwise, attach context to thread.
|
||||
if (!internal)
|
||||
{
|
||||
context.makeQueryContext();
|
||||
CurrentThread::attachQueryContext(context);
|
||||
}
|
||||
|
||||
const Settings & settings = context.getSettingsRef();
|
||||
|
||||
|
@ -21,7 +21,7 @@ void executeQuery(
|
||||
Context & context, /// DB, tables, data types, storage engines, functions, aggregate functions...
|
||||
std::function<void(const String &)> set_content_type, /// If non-empty callback is passed, it will be called with the Content-Type of the result.
|
||||
std::function<void(const String &)> set_query_id /// If non-empty callback is passed, it will be called with the query id.
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
/// More low-level function for server-to-server interaction.
|
||||
@ -45,7 +45,7 @@ BlockIO executeQuery(
|
||||
QueryProcessingStage::Enum stage = QueryProcessingStage::Complete, /// To which stage the query must be executed.
|
||||
bool may_have_embedded_data = false, /// If insert query may have embedded data
|
||||
bool allow_processors = true /// If can use processors pipeline
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
QueryPipeline executeQueryWithProcessors(
|
||||
|
Loading…
Reference in New Issue
Block a user