[bugfix](DDL) Fix the bug of incorrect partition policy setting (#25021)

This commit is contained in:
AlexYue
2023-10-09 11:28:48 +08:00
committed by GitHub
parent 0f59f49768
commit e4100b4ebd
2 changed files with 47 additions and 5 deletions

View File

@ -2520,10 +2520,13 @@ public class InternalCatalog implements CatalogIf<Database> {
"Can not create UNIQUE KEY table that enables Merge-On-write"
+ " with storage policy(" + partionStoragePolicy + ")");
}
if (!partionStoragePolicy.equals("")) {
storagePolicy = partionStoragePolicy;
// The table's storage policy has higher priority than partition's policy,
// so we'll directly use table's policy when it's set. Otherwise we use the
// partition's policy
if (!storagePolicy.isEmpty()) {
partionStoragePolicy = storagePolicy;
}
Env.getCurrentEnv().getPolicyMgr().checkStoragePolicyExist(storagePolicy);
Env.getCurrentEnv().getPolicyMgr().checkStoragePolicyExist(partionStoragePolicy);
Partition partition = createPartitionWithIndices(db.getClusterName(), db.getId(),
olapTable.getId(), olapTable.getName(), olapTable.getBaseIndexId(), entry.getValue(),
@ -2531,8 +2534,8 @@ public class InternalCatalog implements CatalogIf<Database> {
dataProperty.getStorageMedium(), partitionInfo.getReplicaAllocation(entry.getValue()),
versionInfo, bfColumns, bfFpp, tabletIdSet, olapTable.getCopiedIndexes(), isInMemory,
storageFormat, partitionInfo.getTabletType(entry.getValue()), compressionType,
olapTable.getDataSortInfo(), olapTable.getEnableUniqueKeyMergeOnWrite(), storagePolicy,
idGeneratorBuffer, olapTable.disableAutoCompaction(),
olapTable.getDataSortInfo(), olapTable.getEnableUniqueKeyMergeOnWrite(),
partionStoragePolicy, idGeneratorBuffer, olapTable.disableAutoCompaction(),
olapTable.enableSingleReplicaCompaction(), skipWriteIndexOnLoad,
olapTable.getCompactionPolicy(), olapTable.getTimeSeriesCompactionGoalSizeMbytes(),
olapTable.getTimeSeriesCompactionFileCountThreshold(),
@ -2540,6 +2543,8 @@ public class InternalCatalog implements CatalogIf<Database> {
storeRowColumn, binlogConfigForTask,
dataProperty.isStorageMediumSpecified());
olapTable.addPartition(partition);
olapTable.getPartitionInfo().getDataProperty(partition.getId())
.setStoragePolicy(partionStoragePolicy);
}
} else {
throw new DdlException("Unsupported partition method: " + partitionInfo.getType().name());