morningman commented on a change in pull request #8245:
URL: https://github.com/apache/incubator-doris/pull/8245#discussion_r815304759



##########
File path: fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java
##########
@@ -469,6 +470,16 @@ private void checkAndPrepareMeta() {
                 }
 
                 olapTbl.setState(OlapTableState.RESTORE);
+                // set restore status for partitions
+                BackupOlapTableInfo tblInfo = 
jobInfo.backupOlapTableObjects.get(tableName);
+                for (Map.Entry<String, BackupPartitionInfo> partitionEntry : 
tblInfo.partitions.entrySet()) {
+                    String partitionName = partitionEntry.getKey();
+                    Partition partition = olapTbl.getPartition(partitionName);
+                    if (partition == null) {
+                        continue;
+                    }
+                    partition.setState(PartitionState.RESTORE);

Review comment:
       you also need to modify `replayCheckAndPrepareMeta()` method.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
##########
@@ -585,7 +587,17 @@ public TableRef resolveTableRef(TableRef tableRef) throws 
AnalysisException {
 
         if (table.getType() == TableType.OLAP && (((OlapTable) 
table).getState() == OlapTableState.RESTORE
                 || ((OlapTable) table).getState() == 
OlapTableState.RESTORE_WITH_LOAD)) {
-            ErrorReport.reportAnalysisException(ErrorCode.ERR_BAD_TABLE_STATE, 
"RESTORING");
+            Boolean isNotRestoring = ((OlapTable) 
table).getPartitions().stream().filter(
+                    partition -> partition.getState() == PartitionState.RESTORE
+            ).collect(Collectors.toList()).isEmpty();
+
+            if(!isNotRestoring){
+                // if doing restore with partitions, the status check push 
down to OlapScanNode::computePartitionInfo to
+                // support query that partitions is not restoring.
+            }else {

Review comment:
       ```suggestion
               } else {
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to