From 791a1422de075e82d18f3be9f5ec284f684e1246 Mon Sep 17 00:00:00 2001 From: alesapin Date: Wed, 31 Oct 2018 12:24:58 +0300 Subject: [PATCH 1/3] Enable merge with DIRECT_IO when summary size of participating parts more than 10GB --- dbms/src/Storages/MergeTree/MergeTreeSettings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/src/Storages/MergeTree/MergeTreeSettings.h b/dbms/src/Storages/MergeTree/MergeTreeSettings.h index 9a4d9c0e9c2..f7fa9bf6703 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeSettings.h +++ b/dbms/src/Storages/MergeTree/MergeTreeSettings.h @@ -149,7 +149,7 @@ struct MergeTreeSettings M(SettingUInt64, finished_mutations_to_keep, 100) \ \ /** Minimal amount of bytes to enable O_DIRECT in merge (0 - disabled) */ \ - M(SettingUInt64, min_merge_bytes_to_use_direct_io, 0) + M(SettingUInt64, min_merge_bytes_to_use_direct_io, 10ULL * 1024 * 1024 * 1024) /// Settings that should not change after the creation of a table. #define APPLY_FOR_IMMUTABLE_MERGE_TREE_SETTINGS(M) \ From 252109f314b7b37d5432c4243ad8f357cf16d2f5 Mon Sep 17 00:00:00 2001 From: alesapin Date: Wed, 31 Oct 2018 14:45:53 +0300 Subject: [PATCH 2/3] Add test with O_DIRECT merge --- .../00750_merge_tree_merge_with_o_direct.reference | 3 +++ .../00750_merge_tree_merge_with_o_direct.sql | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.reference create mode 100644 dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.sql diff --git a/dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.reference b/dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.reference new file mode 100644 index 00000000000..77a14d12483 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.reference @@ -0,0 +1,3 @@ +2018-10-31 05:05:00 0 +2018-10-31 06:06:00 10 +2018-10-28 10:00:00 20 diff --git a/dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.sql b/dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.sql new file mode 100644 index 00000000000..f058199bcca --- /dev/null +++ b/dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.sql @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS test.sample_merge_tree; + +CREATE TABLE test.sample_merge_tree (dt DateTime, x UInt64) ENGINE = MergeTree PARTITION BY toYYYYMMDD(dt) ORDER BY x SETTINGS min_merge_bytes_to_use_direct_io=1, index_granularity = 8192; + +INSERT INTO test.sample_merge_tree VALUES (toDateTime('2018-10-31 05:05:00'), 0), (toDateTime('2018-10-31 06:06:00'), 10), (toDateTime('2018-10-28 10:00:00'), 20); + +OPTIMIZE TABLE test.sample_merge_tree FINAL; + +SELECT * FROM test.sample_merge_tree; + +DROP TABLE IF EXISTS test.sample_merge_tree; From 5e487608d27c83c8003b8c54d2e883e1f1abe858 Mon Sep 17 00:00:00 2001 From: alesapin Date: Wed, 31 Oct 2018 15:49:50 +0300 Subject: [PATCH 3/3] Strict order in select --- .../0_stateless/00750_merge_tree_merge_with_o_direct.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.sql b/dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.sql index f058199bcca..5957ec3f50f 100644 --- a/dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.sql +++ b/dbms/tests/queries/0_stateless/00750_merge_tree_merge_with_o_direct.sql @@ -6,6 +6,6 @@ INSERT INTO test.sample_merge_tree VALUES (toDateTime('2018-10-31 05:05:00'), 0) OPTIMIZE TABLE test.sample_merge_tree FINAL; -SELECT * FROM test.sample_merge_tree; +SELECT * FROM test.sample_merge_tree ORDER BY x; DROP TABLE IF EXISTS test.sample_merge_tree;