Sort ConfigProcessor files before use [#CLICKHOUSE-3436, #METRIQA-1971]

This commit is contained in:
Alexey Vasiliev 2018-02-20 11:50:11 +03:00
parent d0bfa15525
commit 376f283b84
2 changed files with 8 additions and 4 deletions

View File

@ -3,6 +3,7 @@
#include <sys/utsname.h>
#include <cerrno>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <functional>
#include <Poco/DOM/Text.h>
@ -356,7 +357,7 @@ void ConfigProcessor::doIncludesRecursive(
ConfigProcessor::Files ConfigProcessor::getConfigMergeFiles(const std::string & config_path)
{
Files res;
Files files;
Poco::Path merge_dir_path(config_path);
merge_dir_path.setExtension("d");
@ -378,12 +379,14 @@ ConfigProcessor::Files ConfigProcessor::getConfigMergeFiles(const std::string &
Poco::File & file = *it;
if (file.isFile() && (endsWith(file.path(), ".xml") || endsWith(file.path(), ".conf")))
{
res.push_back(file.path());
files.push_back(file.path());
}
}
}
return res;
std::sort(files.begin(), files.end());
return files;
}
XMLDocumentPtr ConfigProcessor::processConfig(

View File

@ -2,6 +2,7 @@
#include <string>
#include <unordered_set>
#include <vector>
#include <Poco/DOM/Document.h>
#include <Poco/DOM/DOMParser.h>
@ -87,7 +88,7 @@ public:
void savePreprocessedConfig(const LoadedConfig & loaded_config);
public:
using Files = std::list<std::string>;
using Files = std::vector<std::string>;
static Files getConfigMergeFiles(const std::string & config_path);