2019-09-19 21:20:58 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-09-12 12:35:27 +00:00
|
|
|
# Tags: replica, no-parallel
|
2019-09-19 21:20:58 +00:00
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-12-28 11:46:53 +00:00
|
|
|
# shellcheck source=../shell_config.sh
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2019-09-19 21:20:58 +00:00
|
|
|
|
|
|
|
R1=table_1013_1
|
|
|
|
R2=table_1013_2
|
|
|
|
|
|
|
|
${CLICKHOUSE_CLIENT} -n -q "
|
|
|
|
DROP TABLE IF EXISTS $R1;
|
|
|
|
DROP TABLE IF EXISTS $R2;
|
|
|
|
|
2021-03-15 04:51:28 +00:00
|
|
|
CREATE TABLE $R1 (x UInt32) ENGINE ReplicatedMergeTree('/clickhouse/tables/$CLICKHOUSE_TEST_ZOOKEEPER_PREFIX/table_1013', 'r1') ORDER BY x;
|
|
|
|
CREATE TABLE $R2 (x UInt32) ENGINE ReplicatedMergeTree('/clickhouse/tables/$CLICKHOUSE_TEST_ZOOKEEPER_PREFIX/table_1013', 'r2') ORDER BY x;
|
2019-09-19 21:20:58 +00:00
|
|
|
|
|
|
|
SYSTEM STOP FETCHES $R2;
|
|
|
|
INSERT INTO $R1 VALUES (1)
|
|
|
|
"
|
|
|
|
|
2020-08-01 13:25:59 +00:00
|
|
|
timeout 10s ${CLICKHOUSE_CLIENT} -n -q "
|
2019-09-19 21:20:58 +00:00
|
|
|
SET receive_timeout=1;
|
|
|
|
SYSTEM SYNC REPLICA $R2
|
2020-08-01 00:59:00 +00:00
|
|
|
" 2>&1 | grep -F -q "Code: 159. DB::Exception" && echo 'OK' || echo 'Failed!'
|
2019-09-19 21:20:58 +00:00
|
|
|
|
|
|
|
# By dropping tables all related SYNC REPLICA queries would be terminated as well
|
|
|
|
${CLICKHOUSE_CLIENT} -n -q "
|
|
|
|
DROP TABLE IF EXISTS $R2;
|
|
|
|
DROP TABLE IF EXISTS $R1;
|
|
|
|
"
|