mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Merge pull request #8837 from ClickHouse/query-profiler-workaround-google-cloud-runner
Added workaround for Google Cloud Run
This commit is contained in:
commit
994192080d
@ -141,7 +141,15 @@ QueryProfilerBase<ProfilerImpl>::QueryProfilerBase(const Int32 thread_id, const
|
||||
sev._sigev_un._tid = thread_id;
|
||||
#endif
|
||||
if (timer_create(clock_type, &sev, &timer_id))
|
||||
{
|
||||
/// In Google Cloud Run, the function "timer_create" is implemented incorrectly as of 2020-01-25.
|
||||
/// https://mybranch.dev/posts/clickhouse-on-cloud-run/
|
||||
if (errno == 0)
|
||||
throw Exception("Failed to create thread timer. The function 'timer_create' returned non-zero but didn't set errno. This is bug in your OS.",
|
||||
ErrorCodes::CANNOT_CREATE_TIMER);
|
||||
|
||||
throwFromErrno("Failed to create thread timer", ErrorCodes::CANNOT_CREATE_TIMER);
|
||||
}
|
||||
|
||||
/// Randomize offset as uniform random value from 0 to period - 1.
|
||||
/// It will allow to sample short queries even if timer period is large.
|
||||
|
@ -160,6 +160,8 @@ void ThreadStatus::initQueryProfiler()
|
||||
|
||||
const auto & settings = query_context->getSettingsRef();
|
||||
|
||||
try
|
||||
{
|
||||
if (settings.query_profiler_real_time_period_ns > 0)
|
||||
query_profiler_real = std::make_unique<QueryProfilerReal>(
|
||||
/* thread_id */ os_thread_id,
|
||||
@ -170,6 +172,12 @@ void ThreadStatus::initQueryProfiler()
|
||||
/* thread_id */ os_thread_id,
|
||||
/* period */ static_cast<UInt32>(settings.query_profiler_cpu_time_period_ns));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
/// QueryProfiler is optional.
|
||||
tryLogCurrentException("ThreadStatus", "Cannot initialize QueryProfiler");
|
||||
}
|
||||
}
|
||||
|
||||
void ThreadStatus::finalizeQueryProfiler()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user