2018-11-28 19:09:17 +00:00
#!/usr/bin/env bash
set -e
CURDIR = $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " && pwd )
. $CURDIR /../shell_config.sh
2019-04-18 18:48:04 +00:00
${ CLICKHOUSE_CLIENT } --query= "DROP TABLE IF EXISTS test.mt_00763_2"
${ CLICKHOUSE_CLIENT } --query= "DROP TABLE IF EXISTS test.buffer_00763_2"
2018-11-28 19:09:17 +00:00
2019-04-18 18:48:04 +00:00
${ CLICKHOUSE_CLIENT } --query= "CREATE TABLE test.buffer_00763_2 (s String) ENGINE = Buffer(test, mt_00763_2, 1, 1, 1, 1, 1, 1, 1)"
2018-11-28 19:09:17 +00:00
function thread1( )
{
2019-04-18 18:48:04 +00:00
seq 1 500 | sed -r -e 's/.+/DROP TABLE IF EXISTS test.mt_00763_2; CREATE TABLE test.mt_00763_2 (s String) ENGINE = MergeTree ORDER BY s; INSERT INTO test.mt_00763_2 SELECT toString(number) FROM numbers(10);/' | ${ CLICKHOUSE_CLIENT } --multiquery --ignore-error || :
2018-11-28 19:09:17 +00:00
}
function thread2( )
{
2019-04-18 18:48:04 +00:00
seq 1 1000 | sed -r -e 's/.+/SELECT count() FROM test.buffer_00763_2;/' | ${ CLICKHOUSE_CLIENT } --multiquery --server_logs_file= '/dev/null' --ignore-error 2>& 1 | grep -vP '^0$|^10$|^Received exception|^Code: 60|^Code: 218'
2018-11-28 19:09:17 +00:00
}
thread1 &
thread2 &
wait
2019-04-18 18:48:04 +00:00
${ CLICKHOUSE_CLIENT } --query= "DROP TABLE test.mt_00763_2"
${ CLICKHOUSE_CLIENT } --query= "DROP TABLE test.buffer_00763_2"