2020-03-30 19:15:18 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
. $CURDIR/../shell_config.sh
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT -q "DROP DATABASE IF EXISTS test_01107"
|
2020-04-12 18:52:59 +00:00
|
|
|
$CLICKHOUSE_CLIENT --allow_experimental_database_atomic=1 -q "CREATE DATABASE test_01107 ENGINE=Atomic"
|
2020-03-30 19:15:18 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "CREATE TABLE test_01107.mt (n UInt64) ENGINE=MergeTree() ORDER BY tuple()"
|
|
|
|
|
2020-04-10 23:02:15 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "INSERT INTO test_01107.mt SELECT number + sleepEachRow(3) FROM numbers(5)" &
|
2020-03-30 19:15:18 +00:00
|
|
|
sleep 1
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT -q "DETACH TABLE test_01107.mt"
|
|
|
|
$CLICKHOUSE_CLIENT -q "ATTACH TABLE test_01107.mt" 2>&1 | grep -F "Code: 57" > /dev/null && echo "OK"
|
2020-04-10 23:02:15 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "DETACH DATABASE test_01107" 2>&1 | grep -F "Code: 219" > /dev/null && echo "OK"
|
2020-03-30 19:15:18 +00:00
|
|
|
|
2020-04-10 23:02:15 +00:00
|
|
|
wait
|
2020-03-30 19:15:18 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "ATTACH TABLE test_01107.mt"
|
|
|
|
$CLICKHOUSE_CLIENT -q "SELECT count(n), sum(n) FROM test_01107.mt"
|
2020-04-10 23:02:15 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "DETACH DATABASE test_01107"
|
2020-04-12 18:52:59 +00:00
|
|
|
$CLICKHOUSE_CLIENT --allow_experimental_database_atomic=1 -q "ATTACH DATABASE test_01107 ENGINE=Atomic"
|
2020-04-10 23:02:15 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "SELECT count(n), sum(n) FROM test_01107.mt"
|
2020-03-30 19:15:18 +00:00
|
|
|
|
2020-05-17 01:15:59 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "INSERT INTO test_01107.mt SELECT number + sleepEachRow(1) FROM numbers(5)" && echo "end" &
|
2020-04-11 15:38:41 +00:00
|
|
|
sleep 1
|
2020-05-17 01:15:59 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "DROP DATABASE test_01107" && sleep 1 && echo "dropped"
|
|
|
|
wait
|