ClickHouse/tests/queries/0_stateless/02438_sync_replica_lightweight.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.4 KiB
MySQL
Raw Normal View History

2023-03-27 23:39:36 +00:00
-- 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;
2023-03-31 14:09:00 +00:00
set insert_keeper_fault_injection_probability=0;
2023-03-27 23:39:36 +00:00
insert into rmt1 values (1);
insert into rmt1 values (2);
system sync replica rmt2 pull; -- does not wait
2023-03-31 14:09:00 +00:00
select type, new_part_name from system.replication_queue where database=currentDatabase() and table='rmt2' order by new_part_name;
2023-03-27 23:39:36 +00:00
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
2023-03-31 14:09:00 +00:00
select type, new_part_name from system.replication_queue where database=currentDatabase() and table='rmt2' order by new_part_name;
2023-03-27 23:39:36 +00:00
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);
2023-03-31 14:09:00 +00:00
system sync replica rmt2 pull;
2023-03-27 23:39:36 +00:00
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;