## Proposed changes cherry-pick from #38700 Issue Number: close #xxx <!--Describe your changes.--> --------- ## Proposed changes Issue Number: close #xxx <!--Describe your changes.--> Co-authored-by: garenshi <garenshi@tencent.com>
This commit is contained in:
@ -76,6 +76,7 @@ import org.apache.doris.thrift.TSortType;
|
||||
import org.apache.doris.thrift.TTabletType;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
@ -177,7 +178,19 @@ public class Alter {
|
||||
}
|
||||
// check currentStoragePolicy resource exist.
|
||||
Env.getCurrentEnv().getPolicyMgr().checkStoragePolicyExist(currentStoragePolicy);
|
||||
|
||||
boolean enableUniqueKeyMergeOnWrite;
|
||||
olapTable.readLock();
|
||||
try {
|
||||
enableUniqueKeyMergeOnWrite = olapTable.getEnableUniqueKeyMergeOnWrite();
|
||||
} finally {
|
||||
olapTable.readUnlock();
|
||||
}
|
||||
// must check here whether you can set the policy, otherwise there will be inconsistent metadata
|
||||
if (enableUniqueKeyMergeOnWrite && !Strings.isNullOrEmpty(currentStoragePolicy)) {
|
||||
throw new UserException(
|
||||
"Can not set UNIQUE KEY table that enables Merge-On-write"
|
||||
+ " with storage policy(" + currentStoragePolicy + ")");
|
||||
}
|
||||
olapTable.setStoragePolicy(currentStoragePolicy);
|
||||
needProcessOutsideTableLock = true;
|
||||
} else if (currentAlterOps.checkIsBeingSynced(alterClauses)) {
|
||||
|
||||
@ -2215,11 +2215,6 @@ public class SchemaChangeHandler extends AlterHandler {
|
||||
}
|
||||
}
|
||||
String storagePolicy = properties.get(PropertyAnalyzer.PROPERTIES_STORAGE_POLICY);
|
||||
if (enableUniqueKeyMergeOnWrite && !Strings.isNullOrEmpty(storagePolicy)) {
|
||||
throw new UserException(
|
||||
"Can not set UNIQUE KEY table that enables Merge-On-write" + " with storage policy(" + storagePolicy
|
||||
+ ")");
|
||||
}
|
||||
long storagePolicyId = storagePolicyNameToId(storagePolicy);
|
||||
|
||||
String compactionPolicy = properties.get(PropertyAnalyzer.PROPERTIES_COMPACTION_POLICY);
|
||||
|
||||
@ -5144,6 +5144,9 @@ public class Env {
|
||||
// storage policy re-use modify in memory
|
||||
Optional.ofNullable(tableProperty.getStoragePolicy()).filter(p -> !p.isEmpty())
|
||||
.ifPresent(p -> olapTable.getPartitionInfo().setStoragePolicy(partition.getId(), p));
|
||||
Optional.ofNullable(tableProperty.getStoragePolicy()).filter(p -> !p.isEmpty())
|
||||
.ifPresent(p -> olapTable.getPartitionInfo().getDataProperty(partition.getId())
|
||||
.setStoragePolicy(p));
|
||||
}
|
||||
break;
|
||||
case OperationType.OP_UPDATE_BINLOG_CONFIG:
|
||||
|
||||
Reference in New Issue
Block a user