[fix](storage_policy) fix cannot cancel a partition's storage policy (#35890)
This commit is contained in:
@ -779,6 +779,12 @@ public class Alter {
|
||||
// check currentStoragePolicy resource exist.
|
||||
Env.getCurrentEnv().getPolicyMgr().checkStoragePolicyExist(currentStoragePolicy);
|
||||
partitionInfo.setStoragePolicy(partition.getId(), currentStoragePolicy);
|
||||
} else {
|
||||
if (partition.getRemoteDataSize() > 0) {
|
||||
throw new AnalysisException(
|
||||
"Cannot cancel storage policy for partition which is already on code storage.");
|
||||
}
|
||||
partitionInfo.setStoragePolicy(partition.getId(), "");
|
||||
}
|
||||
|
||||
// 4.4 analyze new properties
|
||||
|
||||
@ -244,11 +244,9 @@ public class PropertyAnalyzer {
|
||||
} else if (key.equalsIgnoreCase(PROPERTIES_STORAGE_COOLDOWN_TIME)) {
|
||||
DateLiteral dateLiteral = new DateLiteral(value, ScalarType.getDefaultDateType(Type.DATETIME));
|
||||
cooldownTimestamp = dateLiteral.unixTimestamp(TimeUtils.getTimeZone());
|
||||
} else if (!hasStoragePolicy && key.equalsIgnoreCase(PROPERTIES_STORAGE_POLICY)) {
|
||||
if (!Strings.isNullOrEmpty(value)) {
|
||||
hasStoragePolicy = true;
|
||||
newStoragePolicy = value;
|
||||
}
|
||||
} else if (key.equalsIgnoreCase(PROPERTIES_STORAGE_POLICY)) {
|
||||
hasStoragePolicy = true;
|
||||
newStoragePolicy = value;
|
||||
}
|
||||
} // end for properties
|
||||
|
||||
@ -277,7 +275,7 @@ public class PropertyAnalyzer {
|
||||
cooldownTimestamp = DataProperty.MAX_COOLDOWN_TIME_MS;
|
||||
}
|
||||
|
||||
if (hasStoragePolicy) {
|
||||
if (hasStoragePolicy && !"".equals(newStoragePolicy)) {
|
||||
// check remote storage policy
|
||||
StoragePolicy checkedPolicy = StoragePolicy.ofCheck(newStoragePolicy);
|
||||
Policy policy = Env.getCurrentEnv().getPolicyMgr().getPolicy(checkedPolicy);
|
||||
|
||||
Reference in New Issue
Block a user