[fix](catalog recycle bin) table partition meta is error if recover partition in some case (#31125)
This commit is contained in:
@ -799,10 +799,9 @@ public class CatalogRecycleBin extends MasterDaemon implements Writable {
|
||||
}
|
||||
|
||||
PartitionInfo partitionInfo = table.getPartitionInfo();
|
||||
Range<PartitionKey> recoverRange = recoverPartitionInfo.getRange();
|
||||
PartitionItem recoverItem = null;
|
||||
if (partitionInfo.getType() == PartitionType.RANGE) {
|
||||
recoverItem = new RangePartitionItem(recoverRange);
|
||||
recoverItem = new RangePartitionItem(recoverPartitionInfo.getRange());
|
||||
} else if (partitionInfo.getType() == PartitionType.LIST) {
|
||||
recoverItem = recoverPartitionInfo.getListPartitionItem();
|
||||
}
|
||||
@ -811,18 +810,18 @@ public class CatalogRecycleBin extends MasterDaemon implements Writable {
|
||||
throw new DdlException("Can not recover partition[" + partitionName + "]. Partition item conflict.");
|
||||
}
|
||||
|
||||
// recover partition
|
||||
// check if partition name exists
|
||||
Partition recoverPartition = recoverPartitionInfo.getPartition();
|
||||
Preconditions.checkState(recoverPartition.getName().equalsIgnoreCase(partitionName));
|
||||
if (!Strings.isNullOrEmpty(newPartitionName)) {
|
||||
if (table.checkPartitionNameExist(newPartitionName)) {
|
||||
throw new DdlException("Partition name[" + newPartitionName + "] is already used");
|
||||
}
|
||||
recoverPartition.setName(newPartitionName);
|
||||
}
|
||||
|
||||
// recover partition
|
||||
table.addPartition(recoverPartition);
|
||||
if (!Strings.isNullOrEmpty(newPartitionName)) {
|
||||
table.renamePartition(partitionName, newPartitionName);
|
||||
}
|
||||
|
||||
// recover partition info
|
||||
long partitionId = recoverPartition.getId();
|
||||
|
||||
Reference in New Issue
Block a user