mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Simplify ALTER TABLE ... DETACH|DROP PART tests
This commit is contained in:
parent
97d0b5ab23
commit
1007d26761
@ -10,3 +10,7 @@ all_2_2_0
|
||||
-- drop part --
|
||||
0
|
||||
2
|
||||
-- resume merges --
|
||||
0
|
||||
2
|
||||
all_1_3_1
|
||||
|
@ -1,31 +1,40 @@
|
||||
DROP TABLE IF EXISTS attach_01451_mt;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE attach_01451_mt (v UInt8) ENGINE = MergeTree() order by tuple();
|
||||
CREATE TABLE mt (v UInt8) ENGINE = MergeTree() order by tuple();
|
||||
SYSTEM STOP MERGES;
|
||||
|
||||
INSERT INTO attach_01451_mt VALUES (0);
|
||||
INSERT INTO attach_01451_mt VALUES (1);
|
||||
INSERT INTO attach_01451_mt VALUES (2);
|
||||
INSERT INTO mt VALUES (0);
|
||||
INSERT INTO mt VALUES (1);
|
||||
INSERT INTO mt VALUES (2);
|
||||
|
||||
SELECT v FROM attach_01451_mt ORDER BY v;
|
||||
SELECT v FROM mt ORDER BY v;
|
||||
|
||||
ALTER TABLE attach_01451_mt DETACH PART 'all_2_2_0';
|
||||
ALTER TABLE mt DETACH PART 'all_2_2_0';
|
||||
|
||||
SELECT v FROM attach_01451_mt ORDER BY v;
|
||||
SELECT v FROM mt ORDER BY v;
|
||||
|
||||
SELECT name FROM system.detached_parts WHERE table = 'attach_01451_mt';
|
||||
SELECT name FROM system.detached_parts WHERE table = 'mt';
|
||||
|
||||
ALTER TABLE attach_01451_mt ATTACH PART 'all_2_2_0';
|
||||
ALTER TABLE mt ATTACH PART 'all_2_2_0';
|
||||
|
||||
SELECT v FROM attach_01451_mt ORDER BY v;
|
||||
SELECT v FROM mt ORDER BY v;
|
||||
|
||||
SELECT name FROM system.detached_parts WHERE table = 'attach_01451_mt';
|
||||
SELECT name FROM system.detached_parts WHERE table = 'mt';
|
||||
|
||||
SELECT '-- drop part --';
|
||||
|
||||
ALTER TABLE attach_01451_mt DROP PART 'all_4_4_0';
|
||||
ALTER TABLE mt DROP PART 'all_4_4_0';
|
||||
|
||||
ALTER TABLE attach_01451_mt ATTACH PART 'all_4_4_0'; -- { serverError 233 }
|
||||
ALTER TABLE mt ATTACH PART 'all_4_4_0'; -- { serverError 233 }
|
||||
|
||||
SELECT v FROM attach_01451_mt ORDER BY v;
|
||||
SELECT v FROM mt ORDER BY v;
|
||||
|
||||
DROP TABLE attach_01451_mt;
|
||||
SELECT '-- resume merges --';
|
||||
SYSTEM START MERGES;
|
||||
OPTIMIZE TABLE mt FINAL;
|
||||
|
||||
SELECT v FROM mt ORDER BY v;
|
||||
|
||||
SELECT name FROM system.parts WHERE table = 'mt' AND active;
|
||||
|
||||
DROP TABLE mt;
|
||||
|
@ -0,0 +1,16 @@
|
||||
0
|
||||
1
|
||||
2
|
||||
0
|
||||
2
|
||||
all_1_1_0
|
||||
0
|
||||
1
|
||||
2
|
||||
-- drop part --
|
||||
0
|
||||
2
|
||||
-- resume merges --
|
||||
0
|
||||
2
|
||||
all_0_2_1
|
@ -0,0 +1,47 @@
|
||||
SET replication_alter_partitions_sync = 2;
|
||||
|
||||
DROP TABLE IF EXISTS replica1;
|
||||
DROP TABLE IF EXISTS replica2;
|
||||
|
||||
CREATE TABLE replica1 (v UInt8) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test/01451/attach', 'r1') order by tuple() settings max_replicated_merges_in_queue = 0;
|
||||
CREATE TABLE replica2 (v UInt8) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test/01451/attach', 'r2') order by tuple() settings max_replicated_merges_in_queue = 0;
|
||||
|
||||
INSERT INTO replica1 VALUES (0);
|
||||
INSERT INTO replica1 VALUES (1);
|
||||
INSERT INTO replica1 VALUES (2);
|
||||
|
||||
SELECT v FROM replica1 ORDER BY v;
|
||||
|
||||
SYSTEM SYNC REPLICA replica2;
|
||||
ALTER TABLE replica2 DETACH PART 'all_1_1_0';
|
||||
|
||||
SELECT v FROM replica1 ORDER BY v;
|
||||
|
||||
SELECT name FROM system.detached_parts WHERE table = 'replica2';
|
||||
|
||||
ALTER TABLE replica2 ATTACH PART 'all_1_1_0';
|
||||
|
||||
SYSTEM SYNC REPLICA replica1;
|
||||
SELECT v FROM replica1 ORDER BY v;
|
||||
|
||||
SELECT name FROM system.detached_parts WHERE table = 'replica2';
|
||||
|
||||
SELECT '-- drop part --';
|
||||
|
||||
ALTER TABLE replica1 DROP PART 'all_3_3_0';
|
||||
|
||||
ALTER TABLE replica1 ATTACH PART 'all_3_3_0'; -- { serverError 233 }
|
||||
|
||||
SELECT v FROM replica1 ORDER BY v;
|
||||
|
||||
SELECT '-- resume merges --';
|
||||
|
||||
ALTER TABLE replica1 MODIFY SETTING max_replicated_merges_in_queue = 1;
|
||||
OPTIMIZE TABLE replica1 FINAL;
|
||||
|
||||
SELECT v FROM replica1 ORDER BY v;
|
||||
|
||||
SELECT name FROM system.parts WHERE table = 'replica2' AND active;
|
||||
|
||||
DROP TABLE replica1;
|
||||
DROP TABLE replica2;
|
@ -1,9 +0,0 @@
|
||||
0
|
||||
1
|
||||
2
|
||||
0
|
||||
2
|
||||
all_1_1_0
|
||||
0
|
||||
1
|
||||
2
|
@ -1,30 +0,0 @@
|
||||
SET replication_alter_partitions_sync = 2;
|
||||
|
||||
DROP TABLE IF EXISTS attach_01451_r1;
|
||||
DROP TABLE IF EXISTS attach_01451_r2;
|
||||
|
||||
CREATE TABLE attach_01451_r1 (v UInt8) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test/01451/attach', 'r1') order by tuple() settings max_replicated_merges_in_queue = 0;
|
||||
CREATE TABLE attach_01451_r2 (v UInt8) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test/01451/attach', 'r2') order by tuple() settings max_replicated_merges_in_queue = 0;
|
||||
|
||||
INSERT INTO attach_01451_r1 VALUES (0);
|
||||
INSERT INTO attach_01451_r1 VALUES (1);
|
||||
INSERT INTO attach_01451_r1 VALUES (2);
|
||||
|
||||
SELECT v FROM attach_01451_r1 ORDER BY v;
|
||||
|
||||
SYSTEM SYNC REPLICA attach_01451_r2;
|
||||
ALTER TABLE attach_01451_r2 DETACH PART 'all_1_1_0';
|
||||
|
||||
SELECT v FROM attach_01451_r1 ORDER BY v;
|
||||
|
||||
SELECT name FROM system.detached_parts WHERE table = 'attach_01451_r2';
|
||||
|
||||
ALTER TABLE attach_01451_r2 ATTACH PART 'all_1_1_0';
|
||||
|
||||
SYSTEM SYNC REPLICA attach_01451_r1;
|
||||
SELECT v FROM attach_01451_r1 ORDER BY v;
|
||||
|
||||
SELECT name FROM system.detached_parts WHERE table = 'attach_01451_r2';
|
||||
|
||||
DROP TABLE attach_01451_r1;
|
||||
DROP TABLE attach_01451_r2;
|
@ -1,6 +0,0 @@
|
||||
0
|
||||
1
|
||||
2
|
||||
0
|
||||
2
|
||||
all_0_2_1
|
@ -1,25 +0,0 @@
|
||||
SET replication_alter_partitions_sync = 2;
|
||||
|
||||
DROP TABLE IF EXISTS attach_r1;
|
||||
DROP TABLE IF EXISTS attach_r2;
|
||||
|
||||
CREATE TABLE attach_r1 (v UInt8) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test/01452/attach', 'r1') order by tuple() settings max_replicated_merges_in_queue = 0;
|
||||
CREATE TABLE attach_r2 (v UInt8) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test/01452/attach', 'r2') order by tuple() settings max_replicated_merges_in_queue = 0;
|
||||
|
||||
INSERT INTO attach_r1 VALUES (0);
|
||||
INSERT INTO attach_r1 VALUES (1);
|
||||
INSERT INTO attach_r1 VALUES (2);
|
||||
|
||||
SELECT v FROM attach_r1 ORDER BY v;
|
||||
|
||||
ALTER TABLE attach_r2 DROP PART 'all_1_1_0';
|
||||
|
||||
SELECT v FROM attach_r1 ORDER BY v;
|
||||
|
||||
ALTER TABLE attach_r1 MODIFY SETTING max_replicated_merges_in_queue = 1;
|
||||
OPTIMIZE TABLE attach_r1 FINAL;
|
||||
|
||||
SELECT name FROM system.parts WHERE table = 'attach_r1' AND active;
|
||||
|
||||
DROP TABLE attach_r1;
|
||||
DROP TABLE attach_r2;
|
Loading…
Reference in New Issue
Block a user