From 354ceeda800d876f399fd276af4382391b113877 Mon Sep 17 00:00:00 2001 From: Ivan Lezhankin Date: Tue, 28 Jan 2020 18:30:49 +0300 Subject: [PATCH] Fix TSan tests --- dbms/src/Common/QueryProfiler.cpp | 6 +++--- dbms/src/Interpreters/ThreadStatusExt.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dbms/src/Common/QueryProfiler.cpp b/dbms/src/Common/QueryProfiler.cpp index 7ef61f3c52a..5b09f5c3f8e 100644 --- a/dbms/src/Common/QueryProfiler.cpp +++ b/dbms/src/Common/QueryProfiler.cpp @@ -81,11 +81,11 @@ QueryProfilerBase::QueryProfilerBase(const Int32 thread_id, const sev.sigev_notify = SIGEV_THREAD_ID; sev.sigev_signo = pause_signal; -#if defined(__FreeBSD__) +# if defined(__FreeBSD__) sev._sigev_un._threadid = thread_id; -#else +# else sev._sigev_un._tid = thread_id; -#endif +# endif if (timer_create(clock_type, &sev, &timer_id)) throwFromErrno("Failed to create thread timer", ErrorCodes::CANNOT_CREATE_TIMER); diff --git a/dbms/src/Interpreters/ThreadStatusExt.cpp b/dbms/src/Interpreters/ThreadStatusExt.cpp index 8b2c49c60ea..2b2d987d2f9 100644 --- a/dbms/src/Interpreters/ThreadStatusExt.cpp +++ b/dbms/src/Interpreters/ThreadStatusExt.cpp @@ -154,6 +154,11 @@ void ThreadStatus::finalizePerformanceCounters() void ThreadStatus::initQueryProfiler() { +#if !defined(USE_PHDR_CACHE) + /// FIXME: query profiler won't work without PHDR cache. + /// Refactor code for a better detection without macros. + return; +#else /// query profilers are useless without trace collector if (!global_context) return; @@ -169,6 +174,7 @@ void ThreadStatus::initQueryProfiler() query_profiler_cpu = std::make_unique( /* thread_id */ os_thread_id, /* period */ static_cast(settings.query_profiler_cpu_time_period_ns)); +#endif } void ThreadStatus::finalizeQueryProfiler()