print changed MergeTree settings on fail

This commit is contained in:
Anton Popov 2022-07-13 20:57:24 +00:00
parent 53bb42d9ba
commit 14a3c7b8cf
2 changed files with 19 additions and 14 deletions

View File

@ -1,3 +1,4 @@
#include <boost/algorithm/string/join.hpp>
#include <cstdlib>
#include <fcntl.h>
#include <map>
@ -458,24 +459,28 @@ void Client::connect()
// Prints changed settings to stderr. Useful for debugging fuzzing failures.
void Client::printChangedSettings() const
{
const auto & changes = global_context->getSettingsRef().changes();
auto print_changes = [](const auto & changes, std::string_view settings_name)
{
if (!changes.empty())
{
fmt::print(stderr, "Changed settings: ");
fmt::print(stderr, "Changed {}: ", settings_name);
for (size_t i = 0; i < changes.size(); ++i)
{
if (i)
{
fmt::print(stderr, ", ");
}
fmt::print(stderr, "{} = '{}'", changes[i].name, toString(changes[i].value));
}
fmt::print(stderr, "\n");
}
else
{
fmt::print(stderr, "No changed settings.\n");
fmt::print(stderr, "No changed {}.\n", settings_name);
}
};
print_changes(global_context->getSettingsRef().changes(), "settings");
print_changes(cmd_merge_tree_settings.changes(), "MergeTree settings");
}

View File

@ -2150,7 +2150,7 @@ void ClientBase::parseAndCheckOptions(OptionsDescription & options_description,
{
/// Add merge tree settings manually, because names of some settings
/// may clash. Query settings have higher priority and we just
/// skip ambigous merge tree settings.
/// skip ambiguous merge tree settings.
auto & main_options = options_description.main_description.value();
for (const auto & setting : cmd_merge_tree_settings.all())
{