Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.OlapTable.OlapTableState;
import org.apache.doris.catalog.Partition;
import org.apache.doris.catalog.Partition.PartitionState;
import org.apache.doris.catalog.Table;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.Pair;
Expand Down Expand Up @@ -139,11 +140,20 @@ public void parse(Database db, DataDescription dataDescription) throws DdlExcept
throw new DdlException("Unknown partition '" + pName
+ "' in table '" + olapTable.getName() + "'");
}
// partition which need load data
if (partition.getState() == PartitionState.RESTORE) {
throw new DdlException("Table [" + olapTable.getName()
+ "], Partition[" + partition.getName() + "] is under restore");
}
partitionIds.add(partition.getId());
}
}

if (olapTable.getState() == OlapTableState.RESTORE) {
boolean isPartitionRestoring = olapTable.getPartitions().stream().anyMatch(
partition -> partition.getState() == PartitionState.RESTORE
);
// restore table
if (!isPartitionRestoring && olapTable.getState() == OlapTableState.RESTORE) {
throw new DdlException("Table [" + olapTable.getName() + "] is under restore");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.MaterializedIndex;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.OlapTable.OlapTableState;
import org.apache.doris.catalog.Partition;
import org.apache.doris.catalog.Partition.PartitionState;
import org.apache.doris.catalog.PartitionInfo;
import org.apache.doris.catalog.PartitionType;
import org.apache.doris.catalog.Replica;
Expand Down Expand Up @@ -516,16 +518,24 @@ private void checkCommitStatus(List<Table> tableList, TransactionState transacti
continue;
}

if (tbl.getState() == OlapTable.OlapTableState.RESTORE) {
throw new LoadException("Table " + tbl.getName() + " is in restore process. "
+ "Can not load into it");
}

long partitionId = tabletMeta.getPartitionId();
if (tbl.getPartition(partitionId) == null) {
// this can happen when partitionId == -1 (tablet being dropping)
// or partition really not exist.
continue;
} else if (tbl.getPartition(partitionId).getState() == PartitionState.RESTORE) {
// partition in restore process which can not load data
throw new LoadException("Table [" + tbl.getName() + "], Partition ["
+ tbl.getPartition(partitionId).getName() + "] is in restore process. Can not load into it");
}

boolean isPartitionRestoring = tbl.getPartitions().stream().anyMatch(
partition -> partition.getState() == PartitionState.RESTORE
);
// restore table
if (!isPartitionRestoring && tbl.getState() == OlapTableState.RESTORE) {
throw new LoadException("Table " + tbl.getName() + " is in restore process. "
+ "Can not load into it");
}

if (!tableToPartition.containsKey(tableId)) {
Expand Down