Merge pull request #55994 from Avogar/fix-bad-logs-level-in-local

Fix clickhouse-local exit on bad send_logs_level setting
This commit is contained in:
Kruglov Pavel 2023-11-16 14:49:23 +01:00 committed by GitHub
commit 413c3d1ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View File

@ -1797,7 +1797,12 @@ void ClientBase::processParsedSingleQuery(const String & full_query, const Strin
{
const auto * logs_level_field = set_query->changes.tryGet(std::string_view{"send_logs_level"});
if (logs_level_field)
updateLoggerLevel(logs_level_field->safeGet<String>());
{
auto logs_level = logs_level_field->safeGet<String>();
/// Check that setting value is correct before updating logger level.
SettingFieldLogsLevelTraits::fromString(logs_level);
updateLoggerLevel(logs_level);
}
}
if (const auto * create_user_query = parsed_query->as<ASTCreateUserQuery>())

View File

@ -0,0 +1,15 @@
#!/usr/bin/expect -f
log_user 0
set timeout 60
match_max 100000
spawn bash -c "clickhouse-local"
expect ":) "
send -- "SET send_logs_level = 't'\r"
expect "Exception on client:"
expect ":) "
send -- "exit\r"
expect eof