Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,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);
Expand Down
2 changes: 1 addition & 1 deletion regression-test/pipeline/p0/conf/be.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
80 changes: 80 additions & 0 deletions regression-test/suites/mtmv_p0/test_storage_medium_mtmv.groovy
Original file line number Diff line number Diff line change
@@ -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};"""
}