From a5aecb6be35eef05f5dbb38ca8ac008f5e659bb2 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Fri, 8 Jul 2022 10:09:59 +0300 Subject: [PATCH] tests: cover fsync related options for ReplicatedMergeTree Signed-off-by: Azat Khuzhin --- ...eplicated_merge_tree_fsync_smoke.reference | 15 ++++ ...1643_replicated_merge_tree_fsync_smoke.sql | 86 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 tests/queries/0_stateless/01643_replicated_merge_tree_fsync_smoke.reference create mode 100644 tests/queries/0_stateless/01643_replicated_merge_tree_fsync_smoke.sql diff --git a/tests/queries/0_stateless/01643_replicated_merge_tree_fsync_smoke.reference b/tests/queries/0_stateless/01643_replicated_merge_tree_fsync_smoke.reference new file mode 100644 index 00000000000..613c455fc59 --- /dev/null +++ b/tests/queries/0_stateless/01643_replicated_merge_tree_fsync_smoke.reference @@ -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 diff --git a/tests/queries/0_stateless/01643_replicated_merge_tree_fsync_smoke.sql b/tests/queries/0_stateless/01643_replicated_merge_tree_fsync_smoke.sql new file mode 100644 index 00000000000..62f65406aab --- /dev/null +++ b/tests/queries/0_stateless/01643_replicated_merge_tree_fsync_smoke.sql @@ -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;