2018-09-05 16:50:26 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Get all server logs
|
|
|
|
export CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL="trace"
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2018-09-05 16:50:26 +00:00
|
|
|
|
2019-03-20 20:04:49 +00:00
|
|
|
cur_name=$(basename "${BASH_SOURCE[0]}")
|
|
|
|
server_logs_file="${CLICKHOUSE_TMP}/${cur_name}_server.logs"
|
2019-02-21 09:21:20 +00:00
|
|
|
|
2018-09-05 16:50:26 +00:00
|
|
|
server_logs="--server_logs_file=$server_logs_file"
|
|
|
|
rm -f "$server_logs_file"
|
|
|
|
|
|
|
|
settings="$server_logs --log_queries=1 --log_query_threads=1 --log_profile_events=1 --log_query_settings=1"
|
|
|
|
|
|
|
|
|
|
|
|
# Check that logs from remote servers are passed from client
|
|
|
|
|
|
|
|
# SELECT
|
2020-08-01 00:40:56 +00:00
|
|
|
true > "$server_logs_file"
|
2020-08-01 00:56:32 +00:00
|
|
|
$CLICKHOUSE_CLIENT "$settings" -q "SELECT 1 FROM system.one FORMAT Null"
|
2020-08-01 01:20:22 +00:00
|
|
|
lines_one_server=$(cat "$server_logs_file" | wc -l)
|
2018-09-05 16:50:26 +00:00
|
|
|
|
2020-08-01 00:40:56 +00:00
|
|
|
true > "$server_logs_file"
|
2020-08-01 00:56:32 +00:00
|
|
|
$CLICKHOUSE_CLIENT "$settings" -q "SELECT 1 FROM remote('127.0.0.2,127.0.0.3', system, one) FORMAT Null"
|
2020-08-01 01:20:22 +00:00
|
|
|
lines_two_servers=$(cat "$server_logs_file" | wc -l)
|
2018-09-05 16:50:26 +00:00
|
|
|
|
|
|
|
(( $lines_two_servers >= 2 * $lines_one_server )) || echo "Fail: $lines_two_servers $lines_one_server"
|
|
|
|
|
|
|
|
# INSERT
|
2020-08-01 00:56:32 +00:00
|
|
|
$CLICKHOUSE_CLIENT "$settings" -q "DROP TABLE IF EXISTS null_00634_1"
|
|
|
|
$CLICKHOUSE_CLIENT "$settings" -q "CREATE TABLE null_00634_1 (i Int8) ENGINE = Null"
|
2018-09-05 16:50:26 +00:00
|
|
|
|
2020-08-01 00:40:56 +00:00
|
|
|
true > "$server_logs_file"
|
2020-08-01 00:56:32 +00:00
|
|
|
$CLICKHOUSE_CLIENT "$settings" -q "INSERT INTO null_00634_1 VALUES (0)"
|
2020-08-01 01:20:22 +00:00
|
|
|
lines_one_server=$(cat "$server_logs_file" | wc -l)
|
2018-09-05 16:50:26 +00:00
|
|
|
|
2020-08-01 00:40:56 +00:00
|
|
|
true > "$server_logs_file"
|
2020-08-01 00:56:32 +00:00
|
|
|
$CLICKHOUSE_CLIENT "$settings" -q "INSERT INTO TABLE FUNCTION remote('127.0.0.2', '${CLICKHOUSE_DATABASE}', 'null_00634_1') VALUES (0)"
|
2020-08-01 01:20:22 +00:00
|
|
|
lines_two_servers=$(cat "$server_logs_file" | wc -l)
|
2018-09-05 16:50:26 +00:00
|
|
|
|
2020-08-01 00:56:32 +00:00
|
|
|
$CLICKHOUSE_CLIENT "$settings" -q "DROP TABLE IF EXISTS null_00634_1"
|
2018-09-05 16:50:26 +00:00
|
|
|
(( $lines_two_servers > $lines_one_server )) || echo "Fail: $lines_two_servers $lines_one_server"
|
|
|
|
|
|
|
|
|
|
|
|
# Clean
|
|
|
|
rm "$server_logs_file"
|