[feature](remote)Add alter storage policy (#15381)
* add alter storage policy * add alter storage policy * add alter storage policy
This commit is contained in:
@ -52,9 +52,11 @@ import org.apache.doris.catalog.OlapTable;
|
||||
import org.apache.doris.catalog.OlapTable.OlapTableState;
|
||||
import org.apache.doris.catalog.Partition;
|
||||
import org.apache.doris.catalog.PartitionInfo;
|
||||
import org.apache.doris.catalog.Replica;
|
||||
import org.apache.doris.catalog.ReplicaAllocation;
|
||||
import org.apache.doris.catalog.Table;
|
||||
import org.apache.doris.catalog.TableIf.TableType;
|
||||
import org.apache.doris.catalog.Tablet;
|
||||
import org.apache.doris.catalog.View;
|
||||
import org.apache.doris.common.AnalysisException;
|
||||
import org.apache.doris.common.DdlException;
|
||||
@ -187,8 +189,17 @@ public class Alter {
|
||||
if (currentAlterOps.checkTableStoragePolicy(alterClauses)) {
|
||||
String tableStoragePolicy = olapTable.getStoragePolicy();
|
||||
if (!tableStoragePolicy.equals("")) {
|
||||
throw new DdlException("Do not support alter table's storage policy , this table ["
|
||||
+ olapTable.getName() + "] has storage policy " + tableStoragePolicy);
|
||||
for (Partition partition : olapTable.getAllPartitions()) {
|
||||
for (Tablet tablet : partition.getBaseIndex().getTablets()) {
|
||||
for (Replica replica : tablet.getReplicas()) {
|
||||
if (replica.getRowCount() > 0 || replica.getDataSize() > 0) {
|
||||
throw new DdlException("Do not support alter table's storage policy , this table ["
|
||||
+ olapTable.getName() + "] has storage policy " + tableStoragePolicy
|
||||
+ ", the table need to be empty.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String currentStoragePolicy = currentAlterOps.getTableStoragePolicy(alterClauses);
|
||||
// check currentStoragePolicy resource exist.
|
||||
|
||||
Reference in New Issue
Block a user