ClickHouse/tests/queries/0_stateless/01560_optimize_on_insert_zookeeper.sql

39 lines
1.3 KiB
MySQL
Raw Normal View History

2021-09-12 12:35:27 +00:00
-- Tags: zookeeper, no-parallel
2021-03-15 09:01:26 +00:00
DROP TABLE IF EXISTS empty1;
DROP TABLE IF EXISTS empty2;
SELECT 'Check creating empty parts';
CREATE TABLE empty1 (key UInt32, val UInt32, date Datetime)
ENGINE=ReplicatedSummingMergeTree('/clickhouse/01560_optimize_on_insert', '1', val)
PARTITION BY date ORDER BY key;
CREATE TABLE empty2 (key UInt32, val UInt32, date Datetime)
ENGINE=ReplicatedSummingMergeTree('/clickhouse/01560_optimize_on_insert', '2', val)
PARTITION BY date ORDER BY key;
INSERT INTO empty2 VALUES (1, 1, '2020-01-01'), (1, 1, '2020-01-01'), (1, -2, '2020-01-01');
SYSTEM SYNC REPLICA empty1;
SELECT * FROM empty1 ORDER BY key;
SELECT * FROM empty2 ORDER BY key;
SELECT table, partition, active FROM system.parts where table = 'empty1' and database=currentDatabase() and active = 1;
SELECT table, partition, active FROM system.parts where table = 'empty2' and database=currentDatabase() and active = 1;
DETACH table empty1;
DETACH table empty2;
ATTACH table empty1;
ATTACH table empty2;
SELECT * FROM empty1 ORDER BY key;
SELECT * FROM empty2 ORDER BY key;
SELECT table, partition, active FROM system.parts where table = 'empty1' and database=currentDatabase() and active = 1;
SELECT table, partition, active FROM system.parts where table = 'empty2' and database=currentDatabase() and active = 1;
DROP TABLE IF EXISTS empty1;
DROP TABLE IF EXISTS empty2;