From cb933a3d1974720ba14404b422ec39a66568136e Mon Sep 17 00:00:00 2001 From: Alexander Tokmakov Date: Fri, 3 Apr 2020 03:08:29 +0300 Subject: [PATCH] fix races in 01108_restart_replicas_rename_deadlock --- contrib/libcpuid/include/libcpuid/cpuid_main.c | 2 +- dbms/Common/getNumberOfPhysicalCPUCores.cpp | 1 - dbms/Interpreters/InterpreterSystemQuery.cpp | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/contrib/libcpuid/include/libcpuid/cpuid_main.c b/contrib/libcpuid/include/libcpuid/cpuid_main.c index 02a7cb7ad50..34457e297ca 100644 --- a/contrib/libcpuid/include/libcpuid/cpuid_main.c +++ b/contrib/libcpuid/include/libcpuid/cpuid_main.c @@ -38,7 +38,7 @@ /* Implementation: */ -static int _libcpiud_errno = ERR_OK; +_Thread_local int _libcpiud_errno = ERR_OK; int set_error(cpu_error_t err) { diff --git a/dbms/Common/getNumberOfPhysicalCPUCores.cpp b/dbms/Common/getNumberOfPhysicalCPUCores.cpp index 625c309bde5..32b70b76fbd 100644 --- a/dbms/Common/getNumberOfPhysicalCPUCores.cpp +++ b/dbms/Common/getNumberOfPhysicalCPUCores.cpp @@ -4,7 +4,6 @@ #include #if USE_CPUID # include -# include #elif USE_CPUINFO # include #endif diff --git a/dbms/Interpreters/InterpreterSystemQuery.cpp b/dbms/Interpreters/InterpreterSystemQuery.cpp index ff2001e4bc4..9a7d6ae7c5a 100644 --- a/dbms/Interpreters/InterpreterSystemQuery.cpp +++ b/dbms/Interpreters/InterpreterSystemQuery.cpp @@ -366,7 +366,7 @@ void InterpreterSystemQuery::restartReplicas(Context & system_context) for (auto iterator = database->getTablesIterator(system_context); iterator->isValid(); iterator->next()) { if (dynamic_cast(iterator->table().get())) - replica_names.emplace_back(iterator->table()->getStorageID()); + replica_names.emplace_back(StorageID{database->getDatabaseName(), iterator->name()}); } }