freemandealer commented on code in PR #20739:
URL: https://github.com/apache/doris/pull/20739#discussion_r1263282926


##########
fe/fe-core/src/test/java/org/apache/doris/catalog/ModifyStorageMediumTest.java:
##########
@@ -0,0 +1,64 @@
+// 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.
+
+package org.apache.doris.catalog;
+
+import org.apache.doris.common.DdlException;
+import org.apache.doris.system.Backend;
+import org.apache.doris.system.SystemInfoService;
+import org.apache.doris.thrift.TStorageMedium;
+import org.apache.doris.utframe.TestWithFeService;
+
+import org.junit.jupiter.api.Assertions;
+
+import java.util.List;
+
+public class ModifyStorageMediumTest extends TestWithFeService {
+
+    @Override
+    protected void runBeforeAll() throws Exception {
+        SystemInfoService clusterInfo = Env.getCurrentEnv().getClusterInfo();
+        List<Backend> allBackends = clusterInfo.getAllBackends();
+        // set all backends' storage medium to SSD
+        for (Backend backend : allBackends) {
+            if (backend.hasPathHash()) {
+                backend.getDisks().values().stream()
+                        .peek(diskInfo -> 
diskInfo.setStorageMedium(TStorageMedium.SSD));
+            }
+        }
+    }
+
+    @Override
+    protected void runAfterAll() throws Exception {
+        Env.getCurrentEnv().clear();
+    }
+
+    public void modifyStorageMediumTest() throws Exception {

Review Comment:
   what does the name `modifyStorageMediumTest` come from? you seems not 
`modify` anything?



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -2960,4 +2958,54 @@ public long loadDb(DataInputStream dis, long checksum) 
throws IOException, DdlEx
     public ConcurrentHashMap<Long, Database> getIdToDb() {
         return new ConcurrentHashMap<>(idToDb);
     }
+
+    private void createPartitionWithIndicesElasticOnStorageMedium(String 
clusterName, long dbId, long tableId,
+            long baseIndexId, long partitionId, String partitionName, 
Map<Long, MaterializedIndexMeta> indexIdToMeta,
+            DistributionInfo distributionInfo, TStorageMedium storageMedium, 
ReplicaAllocation replicaAlloc,
+            Long versionInfo, Set<String> bfColumns, double bfFpp, Set<Long> 
tabletIdSet, List<Index> indexes,
+            boolean isInMemory, TStorageFormat storageFormat, TTabletType 
tabletType, TCompressionType compressionType,
+            DataSortInfo dataSortInfo, boolean enableUniqueKeyMergeOnWrite, 
String storagePolicy,
+            IdGeneratorBuffer idGeneratorBuffer, boolean 
disableAutoCompaction, boolean enableSingleReplicaCompaction,
+            boolean skipWriteIndexOnLoad, boolean storeRowColumn, boolean 
isDynamicSchema, BinlogConfig binlogConfig,
+            OlapTable olapTable, PartitionInfo partitionInfo, long bufferSize) 
throws DdlException {
+
+        try {
+            // create partition
+            Partition partition = createPartitionWithIndices(clusterName, 
dbId, tableId,
+                    baseIndexId, partitionId, partitionName, indexIdToMeta, 
distributionInfo, storageMedium,
+                    replicaAlloc, versionInfo, bfColumns, bfFpp, tabletIdSet, 
indexes, isInMemory, storageFormat,
+                    tabletType, compressionType, dataSortInfo, 
enableUniqueKeyMergeOnWrite, storagePolicy,
+                    idGeneratorBuffer, disableAutoCompaction, 
enableSingleReplicaCompaction, skipWriteIndexOnLoad,
+                    storeRowColumn, isDynamicSchema, binlogConfig);
+            olapTable.addPartition(partition);
+        } catch (DdlException e) {
+            // check whether set storage medium from data property

Review Comment:
   add comment here to tell we are using different medium because shortage on 
the original medium



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to