From 300d06b995dd45756a1bfe7eec1b4bb7b34d5f71 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 3 Sep 2024 08:41:49 +0200 Subject: [PATCH] Revert "Merge pull request #57191 from azat/client-log_comment-file" The problem with this patch is that it breaks readonly users. There are possible other ways to fix this, but it has other downsides: - readonly detection with getSetting - one extra query + code complexity, don't think that it worth it - add is_hint for each setting (like is_important) - this will blow the settings structure and requires protocol changes, and even though this could be useful in other places, i.e. play UI, not sure that this worth either So for now let's simply revert it. This reverts commit fde14f0daf8a37d95f8b0f59f084261346a86878, reversing changes made to f636dea8797e9e19cca3ccada213e15022b87ddb. --- src/Client/ClientBase.cpp | 8 ------- .../02930_client_file_log_comment.reference | 6 ----- .../02930_client_file_log_comment.sh | 24 ------------------- 3 files changed, 38 deletions(-) delete mode 100644 tests/queries/0_stateless/02930_client_file_log_comment.reference delete mode 100755 tests/queries/0_stateless/02930_client_file_log_comment.sh diff --git a/src/Client/ClientBase.cpp b/src/Client/ClientBase.cpp index e34e263beb5..008fcee6a83 100644 --- a/src/Client/ClientBase.cpp +++ b/src/Client/ClientBase.cpp @@ -2699,14 +2699,6 @@ bool ClientBase::processMultiQueryFromFile(const String & file_name) ReadBufferFromFile in(file_name); readStringUntilEOF(queries_from_file, in); - if (!getClientConfiguration().has("log_comment")) - { - Settings settings = client_context->getSettingsCopy(); - /// NOTE: cannot use even weakly_canonical() since it fails for /dev/stdin due to resolving of "pipe:[X]" - settings.log_comment = fs::absolute(fs::path(file_name)); - client_context->setSettings(settings); - } - return executeMultiQuery(queries_from_file); } diff --git a/tests/queries/0_stateless/02930_client_file_log_comment.reference b/tests/queries/0_stateless/02930_client_file_log_comment.reference deleted file mode 100644 index c380ac1d6fe..00000000000 --- a/tests/queries/0_stateless/02930_client_file_log_comment.reference +++ /dev/null @@ -1,6 +0,0 @@ -42 -4242 -424242 -select 42 clickhouse.default-1.sql -select 4242 clickhouse.default-2.sql -select 424242\n foo diff --git a/tests/queries/0_stateless/02930_client_file_log_comment.sh b/tests/queries/0_stateless/02930_client_file_log_comment.sh deleted file mode 100755 index 393bffcaf59..00000000000 --- a/tests/queries/0_stateless/02930_client_file_log_comment.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -# reset --log_comment, because the test has to set its own -CLICKHOUSE_LOG_COMMENT= -# shellcheck source=../shell_config.sh -. "$CUR_DIR"/../shell_config.sh - -file1="$CUR_DIR/clickhouse.${CLICKHOUSE_DATABASE}-1.sql" -echo -n 'select 42' >> "$file1" -file2="$CUR_DIR/clickhouse.${CLICKHOUSE_DATABASE}-2.sql" -echo -n 'select 4242' >> "$file2" - -$CLICKHOUSE_CLIENT --queries-file "$file1" "$file2" <<<'select 42' -$CLICKHOUSE_CLIENT --log_comment foo --queries-file /dev/stdin <<<'select 424242' - -$CLICKHOUSE_CLIENT -m -q " - system flush logs; - select query, log_comment from system.query_log where current_database = '$CLICKHOUSE_DATABASE' and event_date >= yesterday() and query = 'select 42' and type != 'QueryStart'; - select query, log_comment from system.query_log where current_database = '$CLICKHOUSE_DATABASE' and event_date >= yesterday() and query = 'select 4242' and type != 'QueryStart'; - select query, log_comment from system.query_log where current_database = '$CLICKHOUSE_DATABASE' and event_date >= yesterday() and query = 'select 424242\n' and type != 'QueryStart'; -" | sed "s#$CUR_DIR/##" - -rm "$file1" "$file2"