ClickHouse/tests/queries/0_stateless/01451_detach_drop_part.sql
Alexander Kuzmenkov 4879adb527 Avoid mixing output from parallel test runs.
Also mark some tests as sequential-only.
2021-01-20 08:27:42 +03:00

43 lines
1.0 KiB
SQL

DROP TABLE IF EXISTS mt_01451;
CREATE TABLE mt_01451 (v UInt8) ENGINE = MergeTree() order by tuple();
SYSTEM STOP MERGES mt_01451;
INSERT INTO mt_01451 VALUES (0);
INSERT INTO mt_01451 VALUES (1);
INSERT INTO mt_01451 VALUES (2);
SELECT v FROM mt_01451 ORDER BY v;
ALTER TABLE mt_01451 DETACH PART 'all_100_100_0'; -- { serverError 232 }
ALTER TABLE mt_01451 DETACH PART 'all_2_2_0';
SELECT v FROM mt_01451 ORDER BY v;
SELECT name FROM system.detached_parts WHERE table = 'mt_01451';
ALTER TABLE mt_01451 ATTACH PART 'all_2_2_0';
SELECT v FROM mt_01451 ORDER BY v;
SELECT name FROM system.detached_parts WHERE table = 'mt_01451';
SELECT '-- drop part --';
ALTER TABLE mt_01451 DROP PART 'all_4_4_0';
ALTER TABLE mt_01451 ATTACH PART 'all_4_4_0'; -- { serverError 233 }
SELECT v FROM mt_01451 ORDER BY v;
SELECT '-- resume merges --';
SYSTEM START MERGES mt_01451;
OPTIMIZE TABLE mt_01451 FINAL;
SELECT v FROM mt_01451 ORDER BY v;
SELECT name FROM system.parts WHERE table = 'mt_01451' AND active;
DROP TABLE mt_01451;