simplify test

This commit is contained in:
Alexander Tokmakov 2020-10-02 22:34:37 +03:00
parent c3e9317d32
commit bd790f399f
2 changed files with 20 additions and 46 deletions

View File

@ -1,29 +1,14 @@
1
2
44
33
3
4
default mt 0 0_1_1_0 2
default mt 3 3_2_2_0 1
default mt 4 4_3_3_0 1
default rmt 0 0_0_0_0 2
3
4
default mt 0 0_1_1_0 2
default mt 3 3_2_2_0 1
default mt 4 4_3_3_0 1
default rmt 0 0_2_2_0 2
3
4
1 1
2 2
3
4
default mt 0 0_1_1_0 2
default mt 3 3_2_2_0 1
default mt 4 4_3_3_0 1
default rmt 0 0_6_6_0 2
default rmt 0000000000 DROP COLUMN s 2020-10-02 17:46:31 ['0'] [3] ['0_0_5_4294967295'] 1 1 1970-01-01 03:00:00
3 3
4 4
mt 0 0_1_1_0 2
rmt 0 0_0_0_0 2
1 1
2 2
mt 0 0_1_1_0 2
rmt 0 0_3_3_0 2
0000000000 UPDATE s = concat(\'s\', toString(n)) WHERE 1 [] 0 1
0000000001 DROP COLUMN s [] 0 1
3
4

View File

@ -1,39 +1,28 @@
drop table if exists mt;
drop table if exists rmt;
create table mt (n UInt64, s String) engine = MergeTree partition by intDiv(n, 10) order by n;
insert into mt values (3, '3'), (4, '4');
create table mt (`n` UInt64) engine = MergeTree partition by intDiv(n, 10) order by n;
create table rmt (n UInt64, s String) engine = ReplicatedMergeTree('/clickhouse/test_01149/rmt', 'r1') partition by intDiv(n, 10) order by n;
insert into rmt values (1,'1'), (2, '2');
insert into mt values (3), (4), (33), (44);
create table rmt (`n` UInt64) engine = ReplicatedMergeTree('/clickhouse/test_01149/rmt1', 'r1') partition by intDiv(n, 10) order by n;
insert into rmt values (1), (2);
select * from rmt;
select * from mt;
select table, partition_id, name, rows from system.parts where database=currentDatabase() and table in ('mt', 'rmt') order by table, name;
select database, table, partition_id, name, rows from system.parts where database=currentDatabase() and table in ('mt', 'rmt') order by table, name;
alter table rmt replace partition '0' from mt;
select * from rmt;
select database, table, partition_id, name, rows from system.parts where database=currentDatabase() and table in ('mt', 'rmt') order by table, name;
alter table rmt add column s String;
alter table rmt drop column s;
select * from rmt;
alter table rmt add column s String;
insert into rmt values (1, '1'), (2, '2');
alter table mt add column s String;
alter table rmt update s = 's'||toString(n) where 1; -- increment mutation version
select * from rmt;
alter table rmt replace partition '0' from mt; -- (probably) removes parts incorrectly
select database, table, partition_id, name, rows from system.parts where database=currentDatabase() and table in ('mt', 'rmt') order by table, name;
--system restart replica rmt; -- workaround
select table, partition_id, name, rows from system.parts where database=currentDatabase() and table in ('mt', 'rmt') order by table, name;
alter table rmt drop column s; -- hangs waiting for mutation of removed parts
-- see parts_to_do
select * from system.mutations where database=currentDatabase() and table='rmt';
select mutation_id, command, parts_to_do_names, parts_to_do, is_done from system.mutations where database=currentDatabase() and table='rmt';
select * from rmt;
drop table mt;