Skip to content

Commit

Permalink
process included config node once more if include happened [#MTRSADMI…
Browse files Browse the repository at this point in the history
…N-3894]
  • Loading branch information
Alexey Zatelepin committed Mar 30, 2018
1 parent ce23653 commit 5fdd50c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions dbms/src/Common/Config/ConfigProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ void ConfigProcessor::doIncludesRecursive(
/// Replace the original contents, not add to it.
bool replace = attributes->getNamedItem("replace");

bool included_something = false;

auto process_include = [&](const Node * include_attr, const std::function<const Node * (const std::string &)> & get_node, const char * error_msg)
{
std::string name = include_attr->getNodeValue();
Expand Down Expand Up @@ -316,6 +318,8 @@ void ConfigProcessor::doIncludesRecursive(
{
element->setAttributeNode(dynamic_cast<Attr *>(config->importNode(from_attrs->item(i), true)));
}

included_something = true;
}
};

Expand Down Expand Up @@ -348,11 +352,14 @@ void ConfigProcessor::doIncludesRecursive(
}
}

NodeListPtr children = node->childNodes();
Node * child = nullptr;
for (size_t i = 0; (child = children->item(i)); ++i)
if (included_something)
doIncludesRecursive(config, include_from, node, zk_node_cache, contributing_zk_paths);
else
{
doIncludesRecursive(config, include_from, child, zk_node_cache, contributing_zk_paths);
NodeListPtr children = node->childNodes();
Node * child = nullptr;
for (size_t i = 0; (child = children->item(i)); ++i)
doIncludesRecursive(config, include_from, child, zk_node_cache, contributing_zk_paths);
}
}

Expand Down

0 comments on commit 5fdd50c

Please sign in to comment.