mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 12:14:18 +00:00
Revert last patch
This commit is contained in:
parent
034891ad80
commit
e7be32d6d2
@ -673,7 +673,9 @@ XMLDocumentPtr ConfigProcessor::processConfig(
|
||||
zkutil::ZooKeeperNodeCache * zk_node_cache,
|
||||
const zkutil::EventPtr & zk_changed_event)
|
||||
{
|
||||
LOG_DEBUG(log, "Processing configuration file '{}'.", path);
|
||||
const bool write_logs = is_config_changed;
|
||||
if (write_logs)
|
||||
LOG_DEBUG(log, "Processing configuration file '{}'.", path);
|
||||
|
||||
XMLDocumentPtr config;
|
||||
|
||||
@ -686,7 +688,8 @@ XMLDocumentPtr ConfigProcessor::processConfig(
|
||||
/// When we can use a config embedded in the binary.
|
||||
if (auto it = embedded_configs.find(path); it != embedded_configs.end())
|
||||
{
|
||||
LOG_DEBUG(log, "There is no file '{}', will use embedded config.", path);
|
||||
if (write_logs)
|
||||
LOG_DEBUG(log, "There is no file '{}', will use embedded config.", path);
|
||||
config = dom_parser.parseMemory(it->second.data(), it->second.size());
|
||||
}
|
||||
else
|
||||
@ -700,7 +703,8 @@ XMLDocumentPtr ConfigProcessor::processConfig(
|
||||
{
|
||||
try
|
||||
{
|
||||
LOG_DEBUG(log, "Merging configuration file '{}'.", merge_file);
|
||||
if (write_logs)
|
||||
LOG_DEBUG(log, "Merging configuration file '{}'.", merge_file);
|
||||
|
||||
XMLDocumentPtr with;
|
||||
with = parseConfig(merge_file);
|
||||
|
@ -121,6 +121,7 @@ public:
|
||||
|
||||
static inline const auto SUBSTITUTION_ATTRS = {"incl", "from_zk", "from_env"};
|
||||
|
||||
bool is_config_changed = true;
|
||||
private:
|
||||
const std::string path;
|
||||
std::string preprocessed_path;
|
||||
|
@ -116,40 +116,37 @@ std::optional<ConfigProcessor::LoadedConfig> ConfigReloader::reloadIfNewer(bool
|
||||
ConfigProcessor config_processor(config_path);
|
||||
ConfigProcessor::LoadedConfig loaded_config;
|
||||
|
||||
if (new_files.isDifferOrNewerThan(files))
|
||||
config_processor.is_config_changed = new_files.isDifferOrNewerThan(files);
|
||||
|
||||
LOG_DEBUG(log, "Loading config '{}'", config_path);
|
||||
|
||||
try
|
||||
{
|
||||
LOG_DEBUG(log, "Loading config '{}'", config_path);
|
||||
|
||||
try
|
||||
{
|
||||
loaded_config = config_processor.loadConfig(/* allow_zk_includes = */ true);
|
||||
if (loaded_config.has_zk_includes)
|
||||
loaded_config = config_processor.loadConfigWithZooKeeperIncludes(
|
||||
zk_node_cache, zk_changed_event, fallback_to_preprocessed);
|
||||
}
|
||||
catch (const Coordination::Exception & e)
|
||||
{
|
||||
if (Coordination::isHardwareError(e.code))
|
||||
need_reload_from_zk = true;
|
||||
|
||||
if (throw_on_error)
|
||||
throw;
|
||||
|
||||
tryLogCurrentException(log, "ZooKeeper error when loading config from '" + config_path + "'");
|
||||
return std::nullopt;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (throw_on_error)
|
||||
throw;
|
||||
|
||||
tryLogCurrentException(log, "Error loading config from '" + config_path + "'");
|
||||
return std::nullopt;
|
||||
}
|
||||
config_processor.savePreprocessedConfig(loaded_config, preprocessed_dir);
|
||||
loaded_config = config_processor.loadConfig(/* allow_zk_includes = */ true);
|
||||
if (loaded_config.has_zk_includes)
|
||||
loaded_config = config_processor.loadConfigWithZooKeeperIncludes(
|
||||
zk_node_cache, zk_changed_event, fallback_to_preprocessed);
|
||||
}
|
||||
else
|
||||
LOG_DEBUG(log, "Skipped config loading '{}', as it wasn't changed", config_path);
|
||||
catch (const Coordination::Exception & e)
|
||||
{
|
||||
if (Coordination::isHardwareError(e.code))
|
||||
need_reload_from_zk = true;
|
||||
|
||||
if (throw_on_error)
|
||||
throw;
|
||||
|
||||
tryLogCurrentException(log, "ZooKeeper error when loading config from '" + config_path + "'");
|
||||
return std::nullopt;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (throw_on_error)
|
||||
throw;
|
||||
|
||||
tryLogCurrentException(log, "Error loading config from '" + config_path + "'");
|
||||
return std::nullopt;
|
||||
}
|
||||
config_processor.savePreprocessedConfig(loaded_config, preprocessed_dir);
|
||||
|
||||
/** We should remember last modification time if and only if config was successfully loaded
|
||||
* Otherwise a race condition could occur during config files update:
|
||||
|
Loading…
Reference in New Issue
Block a user