From 6a9aa9a637d1d598451127e4da069f438d3517ac Mon Sep 17 00:00:00 2001 From: zhangdong <493738387@qq.com> Date: Wed, 29 May 2024 18:25:40 +0800 Subject: [PATCH 1/3] 1 --- .../java/org/apache/doris/datasource/InternalCatalog.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java index d562fd62a1bbbe..abc76dbc37607e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java @@ -1557,6 +1557,13 @@ public void addPartition(Database db, String tableName, AddPartitionClause addPa if (!properties.containsKey(PropertyAnalyzer.PROPERTIES_STORAGE_POLICY)) { properties.put(PropertyAnalyzer.PROPERTIES_STORAGE_POLICY, olapTable.getStoragePolicy()); } + if (!properties.containsKey(PropertyAnalyzer.PROPERTIES_STORAGE_MEDIUM)) { + TStorageMedium tableStorageMedium = olapTable.getStorageMedium(); + if (tableStorageMedium != null) { + properties.put(PropertyAnalyzer.PROPERTIES_STORAGE_MEDIUM, + tableStorageMedium.name().toLowerCase()); + } + } singlePartitionDesc.analyze(partitionInfo.getPartitionColumns().size(), properties); partitionInfo.createAndCheckPartitionItem(singlePartitionDesc, isTempPartition); From 3d04f25879b49eed6321c25f6b8833550bef1085 Mon Sep 17 00:00:00 2001 From: zhangdong <493738387@qq.com> Date: Thu, 30 May 2024 14:42:01 +0800 Subject: [PATCH 2/3] 1 --- .../mtmv_p0/test_storage_medium_mtmv.groovy | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 regression-test/suites/mtmv_p0/test_storage_medium_mtmv.groovy diff --git a/regression-test/suites/mtmv_p0/test_storage_medium_mtmv.groovy b/regression-test/suites/mtmv_p0/test_storage_medium_mtmv.groovy new file mode 100644 index 00000000000000..947ee72b08d302 --- /dev/null +++ b/regression-test/suites/mtmv_p0/test_storage_medium_mtmv.groovy @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import org.junit.Assert; + +suite("test_storage_medium_mtmv","mtmv") { + String suiteName = "test_storage_medium_mtmv" + String tableName = "${suiteName}_table" + String mvName = "${suiteName}_mv" + sql """drop table if exists `${tableName}`""" + sql """drop materialized view if exists ${mvName};""" + + sql """ + CREATE TABLE ${tableName} + ( + k2 TINYINT, + k3 INT not null + ) + COMMENT "my first table" + PARTITION BY LIST(`k3`) + ( + PARTITION `p1` VALUES IN ('1'), + PARTITION `p2` VALUES IN ('2'), + PARTITION `p3` VALUES IN ('3') + ) + DISTRIBUTED BY HASH(k2) BUCKETS 2 + PROPERTIES ( + "replication_num" = "1" + ); + """ + sql """ + CREATE MATERIALIZED VIEW ${mvName} + BUILD DEFERRED REFRESH AUTO ON MANUAL + partition by(`k3`) + DISTRIBUTED BY RANDOM BUCKETS 2 + PROPERTIES ( + 'replication_num' = '1', + 'storage_medium' = 'SSD' + ) + AS + SELECT * from ${tableName}; + """ + + // test init + def res = sql """show partitions from ${mvName}""" + logger.info("res: " + res.toString()) + assertTrue(res.toString().contains("SSD")) + assertFalse(res.toString().contains("HDD")) + + sql """ + insert into ${tableName} values(1,1),(2,2),(3,3); + """ + sql """ + REFRESH MATERIALIZED VIEW ${mvName} AUTO + """ + waitingMTMVTaskFinishedByMvName(mvName) + + // test after refresh + res = sql """show partitions from ${mvName}""" + logger.info("res: " + res.toString()) + assertTrue(res.toString().contains("SSD")) + assertFalse(res.toString().contains("HDD")) + + sql """drop table if exists `${tableName}`""" + sql """drop materialized view if exists ${mvName};""" +} From 26339d2c090e1465beb0529e503fa2d0c4a49e78 Mon Sep 17 00:00:00 2001 From: zhangdong <493738387@qq.com> Date: Thu, 30 May 2024 17:51:14 +0800 Subject: [PATCH 3/3] 1 --- regression-test/pipeline/p0/conf/be.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regression-test/pipeline/p0/conf/be.conf b/regression-test/pipeline/p0/conf/be.conf index 474c30a05de471..b96aeac7ccb542 100644 --- a/regression-test/pipeline/p0/conf/be.conf +++ b/regression-test/pipeline/p0/conf/be.conf @@ -47,7 +47,7 @@ max_garbage_sweep_interval=180 log_buffer_level = -1 enable_stream_load_record = true -storage_root_path=/mnt/ssd01/cluster_storage/doris.SSD/P0/cluster1 +storage_root_path=/mnt/ssd01/cluster_storage/doris.SSD/P0/cluster1;/mnt/ssd01/cluster_storage/doris.SSD disable_auto_compaction=true priority_networks=172.19.0.0/24 enable_fuzzy_mode=true