2021-11-29 20:09:55 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-12-01 06:21:11 +00:00
|
|
|
# Tags: no-parallel
|
2021-11-29 20:09:55 +00:00
|
|
|
|
|
|
|
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
# shellcheck source=../shell_config.sh
|
|
|
|
. "$CUR_DIR"/../shell_config.sh
|
|
|
|
|
|
|
|
# sync drain
|
|
|
|
for _ in {1..100}; do
|
|
|
|
prev=$(curl -d@- -sS "${CLICKHOUSE_URL}" <<<"select value from system.metrics where metric = 'SyncDrainedConnections'")
|
|
|
|
curl -d@- -sS "${CLICKHOUSE_URL}" <<<"select * from remote('127.{2,3}', view(select * from numbers(1e6))) limit 100 settings drain_timeout=-1 format Null"
|
|
|
|
now=$(curl -d@- -sS "${CLICKHOUSE_URL}" <<<"select value from system.metrics where metric = 'SyncDrainedConnections'")
|
|
|
|
if [[ "$prev" != $(( now-2 )) ]]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
echo "OK: sync drain"
|
|
|
|
break
|
|
|
|
done
|
|
|
|
|
|
|
|
# async drain
|
|
|
|
for _ in {1..100}; do
|
|
|
|
prev=$(curl -d@- -sS "${CLICKHOUSE_URL}" <<<"select value from system.metrics where metric = 'AsyncDrainedConnections'")
|
|
|
|
curl -d@- -sS "${CLICKHOUSE_URL}" <<<"select * from remote('127.{2,3}', view(select * from numbers(1e6))) limit 100 settings drain_timeout=10 format Null"
|
|
|
|
now=$(curl -d@- -sS "${CLICKHOUSE_URL}" <<<"select value from system.metrics where metric = 'AsyncDrainedConnections'")
|
|
|
|
if [[ "$prev" != $(( now-2 )) ]]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
echo "OK: async drain"
|
|
|
|
break
|
|
|
|
done
|