[fix](cooldown)Fix bug for storage policy in dynamic partition (#17665)

* fix bug for partition storage policy
This commit is contained in:
pengxiangyu
2023-03-13 14:13:55 +08:00
committed by GitHub
parent be5147c32e
commit ac944e2ac1

View File

@ -1404,6 +1404,9 @@ public class InternalCatalog implements CatalogIf<Database> {
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<Database> {
Set<Long> 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<Database> {
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<Database> {
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);
}