mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 09:10:48 +00:00
Merge pull request #12727 from ClickHouse/add-test-for-alter-after-freeze
Add a test for ALTER after FREEZE
This commit is contained in:
commit
e7ec08615e
@ -0,0 +1,26 @@
|
||||
1 hello
|
||||
2 world
|
||||
all_1_1_0 0
|
||||
---
|
||||
all_1_1_0 1
|
||||
---
|
||||
1 goodbye
|
||||
2 world
|
||||
all_1_1_0 1
|
||||
all_1_1_0_2 0
|
||||
---
|
||||
1 goodbye
|
||||
2 world
|
||||
all_1_1_0 1
|
||||
all_1_1_0_2 0
|
||||
all_1_1_0_3 0
|
||||
---
|
||||
all_1_1_0 1
|
||||
all_1_1_0_2 0
|
||||
all_1_1_0_3 1
|
||||
---
|
||||
1 hello
|
||||
2 world
|
||||
all_1_1_0 1
|
||||
all_1_1_0_2 0
|
||||
all_1_1_0_3 1
|
@ -0,0 +1,35 @@
|
||||
-- In previous ClickHouse versions, parts were not 100% immutable and FREEZE may prevent subsequent ALTERs.
|
||||
-- It's not longer the case. Let's prove it.
|
||||
|
||||
DROP TABLE IF EXISTS t;
|
||||
CREATE TABLE t (k UInt64, s String) ENGINE = MergeTree ORDER BY k;
|
||||
INSERT INTO t VALUES (1, 'hello'), (2, 'world');
|
||||
|
||||
SELECT * FROM t;
|
||||
SELECT name, is_frozen FROM system.parts WHERE database = currentDatabase() AND table = 't';
|
||||
|
||||
SELECT '---';
|
||||
ALTER TABLE t FREEZE;
|
||||
SELECT name, is_frozen FROM system.parts WHERE database = currentDatabase() AND table = 't';
|
||||
|
||||
SELECT '---';
|
||||
SET mutations_sync = 1;
|
||||
ALTER TABLE t UPDATE s = 'goodbye' WHERE k = 1;
|
||||
SELECT * FROM t;
|
||||
SELECT name, is_frozen FROM system.parts WHERE database = currentDatabase() AND table = 't';
|
||||
|
||||
SELECT '---';
|
||||
ALTER TABLE t MODIFY COLUMN s Enum('goodbye' = 1, 'world' = 2);
|
||||
SELECT * FROM t;
|
||||
SELECT name, is_frozen FROM system.parts WHERE database = currentDatabase() AND table = 't';
|
||||
|
||||
SELECT '---';
|
||||
ALTER TABLE t FREEZE;
|
||||
SELECT name, is_frozen FROM system.parts WHERE database = currentDatabase() AND table = 't';
|
||||
|
||||
SELECT '---';
|
||||
ALTER TABLE t MODIFY COLUMN s Enum('hello' = 1, 'world' = 2);
|
||||
SELECT * FROM t;
|
||||
SELECT name, is_frozen FROM system.parts WHERE database = currentDatabase() AND table = 't';
|
||||
|
||||
DROP TABLE t;
|
Loading…
Reference in New Issue
Block a user