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 fde14f0daf, reversing
changes made to f636dea879.
This commit is contained in:
Azat Khuzhin 2024-09-03 08:41:49 +02:00
parent 1f5082ee8a
commit 300d06b995
3 changed files with 0 additions and 38 deletions

View File

@ -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);
}

View File

@ -1,6 +0,0 @@
42
4242
424242
select 42 clickhouse.default-1.sql
select 4242 clickhouse.default-2.sql
select 424242\n foo

View File

@ -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"