mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Support setting up fail points in config
This commit is contained in:
parent
4fa9dcb326
commit
b9bb4af6be
@ -42,6 +42,7 @@
|
||||
#include <Common/Config/AbstractConfigurationComparison.h>
|
||||
#include <Common/assertProcessUserMatchesDataOwner.h>
|
||||
#include <Common/makeSocketAddress.h>
|
||||
#include <Common/FailPoint.h>
|
||||
#include <Server/waitServersToFinish.h>
|
||||
#include <Core/ServerUUID.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
@ -884,6 +885,8 @@ try
|
||||
}
|
||||
}
|
||||
|
||||
FailPointInjection::enableFromGlobalConfig(config());
|
||||
|
||||
int default_oom_score = 0;
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <Common/Exception.h>
|
||||
#include <Common/FailPoint.h>
|
||||
#include <Common/Config/ConfigHelper.h>
|
||||
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <chrono>
|
||||
@ -162,6 +163,21 @@ void FailPointInjection::wait(const String & fail_point_name)
|
||||
auto ptr = iter->second;
|
||||
ptr->wait();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void FailPointInjection::enableFromGlobalConfig(const Poco::Util::AbstractConfiguration & config)
|
||||
{
|
||||
String root_key = "fail_points_active";
|
||||
|
||||
Poco::Util::AbstractConfiguration::Keys tables_keys;
|
||||
config.keys(root_key, tables_keys);
|
||||
|
||||
for (const auto & table_key : tables_keys)
|
||||
{
|
||||
if (ConfigHelper::getBool(config, root_key + "." + table_key))
|
||||
FailPointInjection::enableFailPoint(table_key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <Common/Exception.h>
|
||||
#include <Core/Types.h>
|
||||
#include <Poco/Util/AbstractConfiguration.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
@ -46,6 +47,8 @@ public:
|
||||
|
||||
static void wait(const String & fail_point_name);
|
||||
|
||||
static void enableFromGlobalConfig(const Poco::Util::AbstractConfiguration & config);
|
||||
|
||||
private:
|
||||
static std::mutex mu;
|
||||
static std::unordered_map<String, std::shared_ptr<FailPointChannel>> fail_point_wait_channels;
|
||||
|
Loading…
Reference in New Issue
Block a user