mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Fixed error: loading "preprocessed" files if dictionary/model config was specified with glob [#CLICKHOUSE-3501].
This commit is contained in:
parent
ca38cf198c
commit
9cc424b4b5
@ -13,6 +13,9 @@
|
||||
#include <Common/ZooKeeper/ZooKeeperNodeCache.h>
|
||||
#include <Common/StringUtils.h>
|
||||
|
||||
#define PREPROCESSED_SUFFIX "-preprocessed"
|
||||
|
||||
|
||||
using namespace Poco::XML;
|
||||
|
||||
|
||||
@ -38,10 +41,16 @@ static std::string numberFromHost(const std::string & s)
|
||||
static std::string preprocessedConfigPath(const std::string & path)
|
||||
{
|
||||
Poco::Path preprocessed_path(path);
|
||||
preprocessed_path.setBaseName(preprocessed_path.getBaseName() + "-preprocessed");
|
||||
preprocessed_path.setBaseName(preprocessed_path.getBaseName() + PREPROCESSED_SUFFIX);
|
||||
return preprocessed_path.toString();
|
||||
}
|
||||
|
||||
bool ConfigProcessor::isPreprocessedFile(const std::string & path)
|
||||
{
|
||||
return endsWith(Poco::Path(path).getBaseName(), PREPROCESSED_SUFFIX);
|
||||
}
|
||||
|
||||
|
||||
ConfigProcessor::ConfigProcessor(
|
||||
const std::string & path_,
|
||||
bool throw_on_bad_incl_,
|
||||
|
@ -91,6 +91,9 @@ public:
|
||||
|
||||
static Files getConfigMergeFiles(const std::string & config_path);
|
||||
|
||||
/// Is the file named as result of config preprocessing, not as original files.
|
||||
static bool isPreprocessedFile(const std::string & config_path);
|
||||
|
||||
private:
|
||||
const std::string path;
|
||||
const std::string preprocessed_path;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <Interpreters/ExternalLoaderConfigRepository.h>
|
||||
|
||||
#include <Common/StringUtils.h>
|
||||
#include <Common/ConfigProcessor.h>
|
||||
#include <Common/getMultipleKeysFromConfig.h>
|
||||
|
||||
@ -7,6 +8,7 @@
|
||||
#include <Poco/File.h>
|
||||
#include <Poco/Path.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -36,6 +38,14 @@ ExternalLoaderConfigRepository::Files ExternalLoaderConfigRepository::list(
|
||||
Poco::Glob::glob(pattern, files, 0);
|
||||
}
|
||||
|
||||
for (Files::iterator it = files.begin(); it != files.end();)
|
||||
{
|
||||
if (ConfigProcessor::isPreprocessedFile(*it))
|
||||
files.erase(it++);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user