mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-26 19:50:51 +00:00
check settings constraints in setProfile(...)
This commit is contained in:
parent
5fbfc1935c
commit
21c3fc0e16
@ -157,23 +157,7 @@ bool SettingsConstraints::checkImpl(const Settings & current_settings, SettingCh
|
|||||||
const String & setting_name = change.name;
|
const String & setting_name = change.name;
|
||||||
|
|
||||||
if (setting_name == "profile")
|
if (setting_name == "profile")
|
||||||
{
|
|
||||||
/// TODO Check profile settings in Context::setProfile(...), not here. It will be backward incompatible.
|
|
||||||
const String & profile_name = change.value.safeGet<String>();
|
|
||||||
const auto & profile_settings_changes = manager->getProfileSettings(profile_name);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
/// NOTE We cannot use CLAMP_ON_VIOLATION here, because we cannot modify elements of profile_settings_changes
|
|
||||||
for (auto change_copy : *profile_settings_changes)
|
|
||||||
checkImpl(current_settings, change_copy, THROW_ON_VIOLATION);
|
|
||||||
}
|
|
||||||
catch (Exception & e)
|
|
||||||
{
|
|
||||||
e.addMessage(", while trying to set settings profile {}", profile_name);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
bool cannot_cast;
|
bool cannot_cast;
|
||||||
auto cast_value = [&](const Field & x) -> Field
|
auto cast_value = [&](const Field & x) -> Field
|
||||||
|
@ -849,7 +849,17 @@ std::optional<QuotaUsage> Context::getQuotaUsage() const
|
|||||||
|
|
||||||
void Context::setProfile(const String & profile_name)
|
void Context::setProfile(const String & profile_name)
|
||||||
{
|
{
|
||||||
applySettingsChanges(*getAccessControlManager().getProfileSettings(profile_name));
|
SettingsChanges profile_settings_changes = *getAccessControlManager().getProfileSettings(profile_name);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
checkSettingsConstraints(profile_settings_changes);
|
||||||
|
}
|
||||||
|
catch (Exception & e)
|
||||||
|
{
|
||||||
|
e.addMessage(", while trying to set settings profile {}", profile_name);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
applySettingsChanges(profile_settings_changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user