Skip to content

Commit

Permalink
Merge pull request #51138 from ClickHouse/print-changed-settings
Browse files Browse the repository at this point in the history
Print changed settings on fatal errors
  • Loading branch information
alexey-milovidov committed Jun 19, 2023
2 parents f54333b + dcd4cfa commit f955834
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 65 deletions.
2 changes: 1 addition & 1 deletion src/Access/ContextAccess.cpp
Expand Up @@ -333,7 +333,7 @@ void ContextAccess::calculateAccessRights() const
boost::algorithm::join(roles_info->getCurrentRolesNames(), ", "),
boost::algorithm::join(roles_info->getEnabledRolesNames(), ", "));
}
LOG_TRACE(trace_log, "Settings: readonly={}, allow_ddl={}, allow_introspection_functions={}", params.readonly, params.allow_ddl, params.allow_introspection);
LOG_TRACE(trace_log, "Settings: readonly = {}, allow_ddl = {}, allow_introspection_functions = {}", params.readonly, params.allow_ddl, params.allow_introspection);
LOG_TRACE(trace_log, "List of all grants: {}", access->toString());
LOG_TRACE(trace_log, "List of all grants including implicit: {}", access_with_implicit->toString());
}
Expand Down
16 changes: 10 additions & 6 deletions src/Core/BaseSettings.h
Expand Up @@ -2,6 +2,8 @@

#include <Core/SettingsFields.h>
#include <Common/SettingsChanges.h>
#include <Common/FieldVisitorToString.h>
#include <IO/Operators.h>
#include <base/range.h>
#include <boost/blank.hpp>
#include <unordered_map>
Expand Down Expand Up @@ -547,14 +549,16 @@ void BaseSettings<TTraits>::read(ReadBuffer & in, SettingsWriteFormat format)
template <typename TTraits>
String BaseSettings<TTraits>::toString() const
{
String res;
for (const auto & field : *this)
WriteBufferFromOwnString out;
bool first = true;
for (const auto & setting : *this)
{
if (!res.empty())
res += ", ";
res += field.getName() + " = " + field.getValueString();
if (!first)
out << ", ";
out << setting.getName() << " = " << applyVisitor(FieldVisitorToString(), setting.getValue());
first = false;
}
return res;
return out.str();
}

template <typename TTraits>
Expand Down

0 comments on commit f955834

Please sign in to comment.