Added a test

This commit is contained in:
Alexey Milovidov 2020-06-12 23:24:17 +03:00
parent 52ac009754
commit 22dd47c13f
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,2 @@
2000 1999000
2000 1999000

View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
set -e
$CLICKHOUSE_CLIENT -n --query "
DROP TABLE IF EXISTS r0;
DROP TABLE IF EXISTS r1;
CREATE TABLE r0 (x UInt64) ENGINE = ReplicatedMergeTree('/test/table', 'r0') ORDER BY x SETTINGS min_bytes_for_wide_part = '10M';
CREATE TABLE r1 (x UInt64) ENGINE = ReplicatedMergeTree('/test/table', 'r1') ORDER BY x SETTINGS min_bytes_for_wide_part = '10M';
"
function thread()
{
REPLICA=$1
ITERATIONS=$2
$CLICKHOUSE_CLIENT --max_block_size 1 --min_insert_block_size_rows 0 --min_insert_block_size_bytes 0 --query "INSERT INTO r$REPLICA SELECT number * 2 + $REPLICA FROM numbers($ITERATIONS)"
}
thread 0 1000 &
thread 1 1000 &
wait
$CLICKHOUSE_CLIENT -n --query "
SYSTEM SYNC REPLICA r0;
SYSTEM SYNC REPLICA r1;
SELECT count(), sum(x) FROM r0;
SELECT count(), sum(x) FROM r1;
DROP TABLE r0;
DROP TABLE r1;
"