ClickHouse/tests/queries/0_stateless/00953_zookeeper_suetin_deduplication_bug.sh

67 lines
2.3 KiB
Bash
Raw Normal View History

2019-06-06 15:28:02 +00:00
#!/usr/bin/env bash
set -e
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-06-06 15:28:02 +00:00
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS elog;"
$CLICKHOUSE_CLIENT --query="
CREATE TABLE elog (
date Date,
engine_id UInt32,
referrer String
)
2020-08-26 17:45:20 +00:00
ENGINE = ReplicatedMergeTree('/clickhouse/tables/test_00953/elog', 'test')
2019-06-06 15:28:02 +00:00
PARTITION BY date
ORDER BY (engine_id)
SETTINGS replicated_deduplication_window = 2, cleanup_delay_period=4, cleanup_delay_period_random_add=0;"
$CLICKHOUSE_CLIENT --query="INSERT INTO elog VALUES (toDate('2018-10-01'), 1, 'hello')"
sleep 1
$CLICKHOUSE_CLIENT --query="INSERT INTO elog VALUES (toDate('2018-10-01'), 2, 'hello')"
sleep 1
$CLICKHOUSE_CLIENT --query="INSERT INTO elog VALUES (toDate('2018-10-01'), 3, 'hello')"
$CLICKHOUSE_CLIENT --query="SELECT count(*) from elog" # 3 rows
2020-08-26 17:45:20 +00:00
count=$($CLICKHOUSE_CLIENT --query="SELECT COUNT(*) FROM system.zookeeper where path = '/clickhouse/tables/test_00953/elog/blocks'")
2019-06-06 15:28:02 +00:00
while [[ $count != 2 ]]
do
sleep 1
2020-08-26 17:45:20 +00:00
count=$($CLICKHOUSE_CLIENT --query="SELECT COUNT(*) FROM system.zookeeper where path = '/clickhouse/tables/test_00953/elog/blocks'")
2019-06-06 15:28:02 +00:00
done
$CLICKHOUSE_CLIENT --query="INSERT INTO elog VALUES (toDate('2018-10-01'), 1, 'hello')"
$CLICKHOUSE_CLIENT --query="SELECT count(*) from elog" # 4 rows
2020-08-26 17:45:20 +00:00
count=$($CLICKHOUSE_CLIENT --query="SELECT COUNT(*) FROM system.zookeeper where path = '/clickhouse/tables/test_00953/elog/blocks'")
2019-06-06 15:28:02 +00:00
while [[ $count != 2 ]]
do
sleep 1
2020-08-26 17:45:20 +00:00
count=$($CLICKHOUSE_CLIENT --query="SELECT COUNT(*) FROM system.zookeeper where path = '/clickhouse/tables/test_00953/elog/blocks'")
2019-06-06 15:28:02 +00:00
done
$CLICKHOUSE_CLIENT --query="INSERT INTO elog VALUES (toDate('2018-10-01'), 2, 'hello')"
$CLICKHOUSE_CLIENT --query="SELECT count(*) from elog" # 5 rows
2020-08-26 17:45:20 +00:00
count=$($CLICKHOUSE_CLIENT --query="SELECT COUNT(*) FROM system.zookeeper where path = '/clickhouse/tables/test_00953/elog/blocks'")
2019-06-06 15:28:02 +00:00
while [[ $count != 2 ]]
do
sleep 1
2020-08-26 17:45:20 +00:00
count=$($CLICKHOUSE_CLIENT --query="SELECT COUNT(*) FROM system.zookeeper where path = '/clickhouse/tables/test_00953/elog/blocks'")
2019-06-06 15:28:02 +00:00
done
$CLICKHOUSE_CLIENT --query="INSERT INTO elog VALUES (toDate('2018-10-01'), 2, 'hello')"
$CLICKHOUSE_CLIENT --query="SELECT count(*) from elog" # still 5 rows
$CLICKHOUSE_CLIENT -q "DROP TABLE elog"