Skip to content

Instantly share code, notes, and snippets.

@tavplubix
Created August 1, 2023 17:46
Show Gist options
  • Save tavplubix/b2c5d98c0995ff9e986ca6f95827d190 to your computer and use it in GitHub Desktop.
Save tavplubix/b2c5d98c0995ff9e986ca6f95827d190 to your computer and use it in GitHub Desktop.
create table q1 (n int) engine=ReplicatedMergeTree('/test/02829/{database}', '1') order by n;
create table q2 (n int) engine=ReplicatedMergeTree('/test/02829/{database}', '2') order by n;
create table q3 (n int) engine=ReplicatedMergeTree('/test/02829/{database}', '3') order by n;
create table q4 (n int) engine=ReplicatedMergeTree('/test/02829/{database}', '4') order by n;
set insert_quorum_parallel=0;
set insert_quorum=3;
set select_sequential_consistency=1;
system stop fetches q2;
system stop fetches q3;
-- run quorum insert asynchronously, so it will be in-progress
set http_receive_timeout=3;
insert into table function url('http://localhost:8123/?insert_quorum_parallel=0&insert_quorum=3&database=' || currentDatabase(), 'TSV', 's String') values ('insert into q1 select 1;'); -- { serverError 1000 }
-- Insert again just in case 3 seconds was not enough (it will be deduplicated if it was)
insert into q1 settings insert_quorum=0 values (1);
select 1, n from q1 settings select_sequential_consistency=0;
-- do not pull DROP_RANGE on q2, q3 and q4
system stop pulling replication log q2;
system stop pulling replication log q3;
system stop pulling replication log q4;
-- execute GET_PART on q2 (there's a chance it will be concurrent with the DROP_RANGE on q1)
system start fetches q2;
-- execute DROP_RANGE on q1
alter table q1 drop partition id 'all';
select 2, count() from q1;
-- execute GET_PART on q3
--system start fetches q2;
--system start fetches q3;
select sleepEachRow(1) as higher_probability_of_reproducing_the_issue format Null;
select 3, n from q4;
select 4, count() from q1;
drop table q1;
drop table q2;
drop table q3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment