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