dbms: added test [#METR-19399].

This commit is contained in:
Alexey Milovidov 2016-01-30 05:50:14 +03:00
parent a0e7a59ab1
commit f9268b6ccb
2 changed files with 171 additions and 0 deletions

View File

@ -0,0 +1,169 @@
DROP TABLE IF EXISTS test.r1;
DROP TABLE IF EXISTS test.r2;
CREATE TABLE test.r1 (d Date DEFAULT '2016-01-01', x UInt64) ENGINE = ReplicatedMergeTree('/clickhouse/tables/01/r/', 'r1', d, x, 111);
SET max_block_size = 1;
INSERT INTO test.r1 (x) SELECT number + 1000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 2000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 3000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 4000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 5000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 6000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 7000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 8000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 9000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 10000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 11000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 12000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 13000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 14000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 15000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 16000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 17000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 18000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 19000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 20000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 21000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 22000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 23000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 24000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 25000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 26000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 27000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 28000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 29000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 30000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 31000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 32000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 33000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 34000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 35000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 36000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 37000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 38000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 39000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 40000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 41000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 42000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 43000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 44000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 45000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 46000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 47000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 48000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 49000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 50000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 51000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 52000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 53000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 54000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 55000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 56000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 57000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 58000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 59000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 60000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 61000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 62000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 63000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 64000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 65000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 66000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 67000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 68000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 69000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
INSERT INTO test.r1 (x) SELECT number + 70000 AS x FROM system.numbers LIMIT 10;
ALTER TABLE test.r1 DETACH PARTITION 201601;
SELECT count() FROM test.r1;
CREATE TABLE test.r2 (d Date DEFAULT '2016-01-01', x UInt64) ENGINE = ReplicatedMergeTree('/clickhouse/tables/01/r/', 'r2', d, x, 111);
SELECT count() FROM test.r2;
SET replication_alter_partitions_sync = 2;
ALTER TABLE test.r1 ATTACH PARTITION 201601;
SELECT count() FROM test.r1;
SELECT count() FROM test.r2;
DROP TABLE test.r1;
DROP TABLE test.r2;