mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 09:52:38 +00:00
40 lines
1.3 KiB
MySQL
40 lines
1.3 KiB
MySQL
|
-- Tags: no-replicated-database
|
||
|
-- Tag no-replicated-database: different number of replicas
|
||
|
|
||
|
create table rmt1 (n int) engine=ReplicatedMergeTree('/test/{database}/02438/', '1') order by tuple();
|
||
|
create table rmt2 (n int) engine=ReplicatedMergeTree('/test/{database}/02438/', '2') order by tuple();
|
||
|
|
||
|
system stop replicated sends rmt1;
|
||
|
system stop merges rmt2;
|
||
|
|
||
|
insert into rmt1 values (1);
|
||
|
insert into rmt1 values (2);
|
||
|
system sync replica rmt2 pull; -- does not wait
|
||
|
select type, new_part_name from system.replication_queue where database=currentDatabase() and table='rmt2';
|
||
|
select 1, n, _part from rmt1 order by n;
|
||
|
select 2, n, _part from rmt2 order by n;
|
||
|
|
||
|
set optimize_throw_if_noop = 1;
|
||
|
system sync replica rmt1 pull;
|
||
|
optimize table rmt1 final;
|
||
|
|
||
|
system start replicated sends rmt1;
|
||
|
system sync replica rmt2 lightweight; -- waits for fetches, not merges
|
||
|
select type, new_part_name from system.replication_queue where database=currentDatabase() and table='rmt2';
|
||
|
select 3, n, _part from rmt1 order by n;
|
||
|
select 4, n, _part from rmt2 order by n;
|
||
|
|
||
|
system start merges rmt2;
|
||
|
system sync replica rmt2;
|
||
|
|
||
|
insert into rmt2 values (3);
|
||
|
optimize table rmt2 final;
|
||
|
|
||
|
system sync replica rmt1 strict;
|
||
|
|
||
|
select 5, n, _part from rmt1 order by n;
|
||
|
select 6, n, _part from rmt2 order by n;
|
||
|
|
||
|
drop table rmt1;
|
||
|
drop table rmt2;
|