Fix TSan tests

This commit is contained in:
Ivan Lezhankin 2020-01-28 18:30:49 +03:00
parent eb5e577f14
commit 354ceeda80
2 changed files with 9 additions and 3 deletions

View File

@ -81,11 +81,11 @@ QueryProfilerBase<ProfilerImpl>::QueryProfilerBase(const Int32 thread_id, const
sev.sigev_notify = SIGEV_THREAD_ID; sev.sigev_notify = SIGEV_THREAD_ID;
sev.sigev_signo = pause_signal; sev.sigev_signo = pause_signal;
#if defined(__FreeBSD__) # if defined(__FreeBSD__)
sev._sigev_un._threadid = thread_id; sev._sigev_un._threadid = thread_id;
#else # else
sev._sigev_un._tid = thread_id; sev._sigev_un._tid = thread_id;
#endif # endif
if (timer_create(clock_type, &sev, &timer_id)) if (timer_create(clock_type, &sev, &timer_id))
throwFromErrno("Failed to create thread timer", ErrorCodes::CANNOT_CREATE_TIMER); throwFromErrno("Failed to create thread timer", ErrorCodes::CANNOT_CREATE_TIMER);

View File

@ -154,6 +154,11 @@ void ThreadStatus::finalizePerformanceCounters()
void ThreadStatus::initQueryProfiler() 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 /// query profilers are useless without trace collector
if (!global_context) if (!global_context)
return; return;
@ -169,6 +174,7 @@ void ThreadStatus::initQueryProfiler()
query_profiler_cpu = std::make_unique<QueryProfilerCpu>( query_profiler_cpu = std::make_unique<QueryProfilerCpu>(
/* thread_id */ os_thread_id, /* thread_id */ os_thread_id,
/* period */ static_cast<UInt32>(settings.query_profiler_cpu_time_period_ns)); /* period */ static_cast<UInt32>(settings.query_profiler_cpu_time_period_ns));
#endif
} }
void ThreadStatus::finalizeQueryProfiler() void ThreadStatus::finalizeQueryProfiler()