From ac944e2ac1f8edc7adfdbc88645cfc6260fb7384 Mon Sep 17 00:00:00 2001 From: pengxiangyu Date: Mon, 13 Mar 2023 14:13:55 +0800 Subject: [PATCH] [fix](cooldown)Fix bug for storage policy in dynamic partition (#17665) * fix bug for partition storage policy --- .../org/apache/doris/datasource/InternalCatalog.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 4844be37df..456eee8cf2 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 @@ -1404,6 +1404,9 @@ public class InternalCatalog implements CatalogIf { properties.put(PropertyAnalyzer.PROPERTIES_DYNAMIC_SCHEMA, olapTable.isDynamicSchema().toString()); } + if (!properties.containsKey(PropertyAnalyzer.PROPERTIES_STORAGE_POLICY)) { + properties.put(PropertyAnalyzer.PROPERTIES_STORAGE_POLICY, olapTable.getStoragePolicy()); + } singlePartitionDesc.analyze(partitionInfo.getPartitionColumns().size(), properties); partitionInfo.createAndCheckPartitionItem(singlePartitionDesc, isTempPartition); @@ -1474,6 +1477,10 @@ public class InternalCatalog implements CatalogIf { Set tabletIdSet = new HashSet<>(); long bufferSize = 1 + totalReplicaNum + indexNum * bucketNum; IdGeneratorBuffer idGeneratorBuffer = Env.getCurrentEnv().getIdGeneratorBuffer(bufferSize); + String storagePolicy = olapTable.getStoragePolicy(); + if (!Strings.isNullOrEmpty(dataProperty.getStoragePolicy())) { + storagePolicy = dataProperty.getStoragePolicy(); + } try { long partitionId = idGeneratorBuffer.getNextId(); Partition partition = createPartitionWithIndices(db.getClusterName(), db.getId(), olapTable.getId(), @@ -1482,7 +1489,7 @@ public class InternalCatalog implements CatalogIf { singlePartitionDesc.getVersionInfo(), bfColumns, olapTable.getBfFpp(), tabletIdSet, olapTable.getCopiedIndexes(), singlePartitionDesc.isInMemory(), olapTable.getStorageFormat(), singlePartitionDesc.getTabletType(), olapTable.getCompressionType(), olapTable.getDataSortInfo(), - olapTable.getEnableUniqueKeyMergeOnWrite(), olapTable.getStoragePolicy(), idGeneratorBuffer, + olapTable.getEnableUniqueKeyMergeOnWrite(), storagePolicy, idGeneratorBuffer, olapTable.disableAutoCompaction(), olapTable.storeRowColumn(), olapTable.isDynamicSchema()); // check again @@ -2660,7 +2667,8 @@ public class InternalCatalog implements CatalogIf { copiedTbl.isInMemory(), copiedTbl.getStorageFormat(), copiedTbl.getPartitionInfo().getTabletType(oldPartitionId), copiedTbl.getCompressionType(), copiedTbl.getDataSortInfo(), copiedTbl.getEnableUniqueKeyMergeOnWrite(), - olapTable.getStoragePolicy(), idGeneratorBuffer, olapTable.disableAutoCompaction(), + olapTable.getPartitionInfo().getDataProperty(oldPartitionId).getStoragePolicy(), + idGeneratorBuffer, olapTable.disableAutoCompaction(), olapTable.storeRowColumn(), olapTable.isDynamicSchema()); newPartitions.add(newPartition); }