From 9cb75bac2867ea1ec4a0ebafcc8e4a50f42df6ac Mon Sep 17 00:00:00 2001 From: young scott Date: Fri, 13 Oct 2023 15:05:55 +0800 Subject: [PATCH] support for testing cubefs --- test_cubefs/stress/sql/case_3_5.sql | 4 ++-- test_cubefs/stress/sql/case_3_6.sql | 4 ++-- test_cubefs/stress/sql/mgbench1.sql | 5 +++-- test_cubefs/stress/sql/mgbench2.sql | 5 +++-- test_cubefs/stress/sql/mgbench3.sql | 5 +++-- test_cubefs/test_cubefs_for_mutation.py | 2 +- test_cubefs/test_cubefs_for_stress.py | 8 +++++--- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/test_cubefs/stress/sql/case_3_5.sql b/test_cubefs/stress/sql/case_3_5.sql index 7357f28bf883..40280106b420 100644 --- a/test_cubefs/stress/sql/case_3_5.sql +++ b/test_cubefs/stress/sql/case_3_5.sql @@ -1,4 +1,3 @@ -SET union_default_mode = 'DISTINCT'; WITH temperature AS ( SELECT dt, device_name, @@ -47,4 +46,5 @@ SELECT DISTINCT device_name, 'SUMMER' FROM temperature WHERE dt >= DATE '2019-06-01' - AND dt < DATE '2019-09-01'; \ No newline at end of file + AND dt < DATE '2019-09-01' +SETTINGS union_default_mode = 'DISTINCT'; \ No newline at end of file diff --git a/test_cubefs/stress/sql/case_3_6.sql b/test_cubefs/stress/sql/case_3_6.sql index 040df29da9f8..de92effd761c 100644 --- a/test_cubefs/stress/sql/case_3_6.sql +++ b/test_cubefs/stress/sql/case_3_6.sql @@ -1,4 +1,3 @@ -SET union_default_mode = 'DISTINCT'; SELECT yr, mo, SUM(coffee_hourly_avg) AS coffee_monthly_sum, @@ -38,4 +37,5 @@ FROM ( GROUP BY yr, mo ORDER BY yr, - mo; \ No newline at end of file + mo +SETTINGS union_default_mode = 'DISTINCT'; \ No newline at end of file diff --git a/test_cubefs/stress/sql/mgbench1.sql b/test_cubefs/stress/sql/mgbench1.sql index fbb54bd6d674..6f0b171f83c2 100644 --- a/test_cubefs/stress/sql/mgbench1.sql +++ b/test_cubefs/stress/sql/mgbench1.sql @@ -1,4 +1,4 @@ -CREATE TABLE if not exists mgbench.logs1 ( +CREATE TABLE if not exists mgbench.logs1 UUID '28f1c61c-2970-457a-bffe-454156ddcfea' ( log_time DateTime, machine_name LowCardinality(String), machine_group LowCardinality(String), @@ -22,4 +22,5 @@ CREATE TABLE if not exists mgbench.logs1 ( bytes_out Nullable(Float32) ) ENGINE = ReplicatedMergeTree('/tables/mgbench/logs1', '{replica}') -ORDER BY (machine_group, machine_name, log_time); \ No newline at end of file +ORDER BY (machine_group, machine_name, log_time) +SETTINGS storage_policy='cubefs_only'; \ No newline at end of file diff --git a/test_cubefs/stress/sql/mgbench2.sql b/test_cubefs/stress/sql/mgbench2.sql index ca4fc803e83d..81688fff3e4c 100644 --- a/test_cubefs/stress/sql/mgbench2.sql +++ b/test_cubefs/stress/sql/mgbench2.sql @@ -1,4 +1,4 @@ -CREATE TABLE if not exists mgbench.logs2 ( +CREATE TABLE if not exists mgbench.logs2 UUID '28f1c61c-2970-457a-bffe-454156ddcfeb'( log_time DateTime, client_ip IPv4, request String, @@ -6,4 +6,5 @@ CREATE TABLE if not exists mgbench.logs2 ( object_size UInt64 ) ENGINE = ReplicatedMergeTree('/tables/mgbench/logs2', '{replica}') -ORDER BY log_time; \ No newline at end of file +ORDER BY log_time +SETTINGS storage_policy='cubefs_only'; \ No newline at end of file diff --git a/test_cubefs/stress/sql/mgbench3.sql b/test_cubefs/stress/sql/mgbench3.sql index 384d6f979ecd..66d4a43daf66 100644 --- a/test_cubefs/stress/sql/mgbench3.sql +++ b/test_cubefs/stress/sql/mgbench3.sql @@ -1,4 +1,4 @@ -CREATE TABLE if not exists mgbench.logs3 ( +CREATE TABLE if not exists mgbench.logs3 UUID '28f1c61c-2970-457a-bffe-454156ddcfec' ( log_time DateTime64, device_id FixedString(15), device_name LowCardinality(String), @@ -9,4 +9,5 @@ CREATE TABLE if not exists mgbench.logs3 ( event_value Nullable(Float32) ) ENGINE = ReplicatedMergeTree('/tables/mgbench/logs3', '{replica}') -ORDER BY (event_type, log_time); \ No newline at end of file +ORDER BY (event_type, log_time) +SETTINGS storage_policy='cubefs_only'; \ No newline at end of file diff --git a/test_cubefs/test_cubefs_for_mutation.py b/test_cubefs/test_cubefs_for_mutation.py index 541b3b08c30c..3845154fbd19 100644 --- a/test_cubefs/test_cubefs_for_mutation.py +++ b/test_cubefs/test_cubefs_for_mutation.py @@ -209,4 +209,4 @@ def test_case5(self): if __name__=="__main__": pytest.main(['-v', '-n8' , '--dist=loadscope', 'test_cubefs_for_mutation.py']) - # pytest.main(['-s' , 'test_cubefs_for_mutation.py']) + #pytest.main(['-s' , 'test_cubefs_for_mutation.py']) diff --git a/test_cubefs/test_cubefs_for_stress.py b/test_cubefs/test_cubefs_for_stress.py index 9372c114d3df..3449956aa164 100644 --- a/test_cubefs/test_cubefs_for_stress.py +++ b/test_cubefs/test_cubefs_for_stress.py @@ -123,12 +123,14 @@ def run_task(self, file_name): result = super().executeSQLFile(super().client1(), file_name) end = time.time() print(f"耗时{end - start}秒") - with open(expect_file_name, 'crw') as f: - f.write(result) + # with open(expect_file_name, 'crw') as f: + # f.write(result) + print(result) def test_case1(self): cases = [] - for i in range(0, 1): + for i in range(0, 1000000000): + # for i in range(0, 1): cases.append("./stress/sql/case_1_1.sql") cases.append("./stress/sql/case_1_2.sql") cases.append("./stress/sql/case_1_3.sql")