tests: cover fsync related options for ReplicatedMergeTree

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2022-07-08 10:09:59 +03:00
parent 1cf01bb959
commit a5aecb6be3
2 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,15 @@
default
1
compact fsync_after_insert
1
compact fsync_after_insert,fsync_part_directory
1
wide fsync_after_insert
1
wide fsync_after_insert,fsync_part_directory
1
memory in_memory_parts_insert_sync
1
wide fsync_part_directory,vertical
1
2

View File

@ -0,0 +1,86 @@
-- Tags: no-parallel
-- no-parallel -- for flaky check and to avoid "Removing leftovers from table" (for other tables)
set database_atomic_wait_for_drop_and_detach_synchronously=1;
drop table if exists rep_fsync_r1;
drop table if exists rep_fsync_r2;
select 'default';
create table rep_fsync_r1 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r1') order by key;
create table rep_fsync_r2 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r2') order by key;
insert into rep_fsync_r1 values (1);
system sync replica rep_fsync_r2;
select * from rep_fsync_r2;
optimize table rep_fsync_r1 final;
system sync replica rep_fsync_r2;
drop table rep_fsync_r1;
drop table rep_fsync_r2;
select 'compact fsync_after_insert';
create table rep_fsync_r1 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r1') order by key settings min_rows_for_wide_part=2, fsync_after_insert=1;
create table rep_fsync_r2 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r2') order by key settings min_rows_for_wide_part=2, fsync_after_insert=1;
insert into rep_fsync_r1 values (1);
system sync replica rep_fsync_r2;
select * from rep_fsync_r2;
optimize table rep_fsync_r1 final;
system sync replica rep_fsync_r2;
drop table rep_fsync_r1;
drop table rep_fsync_r2;
select 'compact fsync_after_insert,fsync_part_directory';
create table rep_fsync_r1 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r1') order by key settings min_rows_for_wide_part=2, fsync_after_insert=1, fsync_part_directory=1;
create table rep_fsync_r2 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r2') order by key settings min_rows_for_wide_part=2, fsync_after_insert=1, fsync_part_directory=1;
insert into rep_fsync_r1 values (1);
system sync replica rep_fsync_r2;
select * from rep_fsync_r2;
optimize table rep_fsync_r1 final;
system sync replica rep_fsync_r2;
drop table rep_fsync_r1;
drop table rep_fsync_r2;
select 'wide fsync_after_insert';
create table rep_fsync_r1 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r1') order by key settings min_bytes_for_wide_part=0, fsync_after_insert=1;
create table rep_fsync_r2 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r2') order by key settings min_bytes_for_wide_part=0, fsync_after_insert=1;
insert into rep_fsync_r1 values (1);
system sync replica rep_fsync_r2;
select * from rep_fsync_r2;
optimize table rep_fsync_r1 final;
system sync replica rep_fsync_r2;
drop table rep_fsync_r1;
drop table rep_fsync_r2;
select 'wide fsync_after_insert,fsync_part_directory';
create table rep_fsync_r1 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r1') order by key settings min_bytes_for_wide_part=0, fsync_after_insert=1, fsync_part_directory=1;
create table rep_fsync_r2 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r2') order by key settings min_bytes_for_wide_part=0, fsync_after_insert=1, fsync_part_directory=1;
insert into rep_fsync_r1 values (1);
system sync replica rep_fsync_r2;
select * from rep_fsync_r2;
optimize table rep_fsync_r1 final;
system sync replica rep_fsync_r2;
drop table rep_fsync_r1;
drop table rep_fsync_r2;
select 'memory in_memory_parts_insert_sync';
create table rep_fsync_r1 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r1') order by key settings min_rows_for_compact_part=2, in_memory_parts_insert_sync=1, fsync_after_insert=1, fsync_part_directory=1;
create table rep_fsync_r2 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r2') order by key settings min_rows_for_compact_part=2, in_memory_parts_insert_sync=1, fsync_after_insert=1, fsync_part_directory=1;
insert into rep_fsync_r1 values (1);
system sync replica rep_fsync_r2;
select * from rep_fsync_r2;
optimize table rep_fsync_r1 final;
system sync replica rep_fsync_r2;
drop table rep_fsync_r1;
drop table rep_fsync_r2;
select 'wide fsync_part_directory,vertical';
create table rep_fsync_r1 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r1') order by key settings min_bytes_for_wide_part=0, fsync_part_directory=1, enable_vertical_merge_algorithm=1, vertical_merge_algorithm_min_rows_to_activate=0, vertical_merge_algorithm_min_columns_to_activate=0;
create table rep_fsync_r2 (key Int) engine=ReplicatedMergeTree('/clickhouse/tables/{database}/rep_fsync', 'r2') order by key settings min_bytes_for_wide_part=0, fsync_part_directory=1, enable_vertical_merge_algorithm=1, vertical_merge_algorithm_min_rows_to_activate=0, vertical_merge_algorithm_min_columns_to_activate=0;
insert into rep_fsync_r1 values (1);
insert into rep_fsync_r2 values (2);
system sync replica rep_fsync_r2;
select * from rep_fsync_r2 order by key;
-- vertical merge does not supports deduplicate, hence no FINAL
optimize table rep_fsync_r1;
system sync replica rep_fsync_r2;
drop table rep_fsync_r1;
drop table rep_fsync_r2;