This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 3e0082ced5b4cffffb79e05991162093b1893e43
Author: xueweizhang <zxw520bl...@163.com>
AuthorDate: Sat Apr 13 13:25:00 2024 +0800

    [feature](backup) ignore table that not support type when backup, and… 
(#33158)
    
    * [feature](backup) ignore table that not support type when backup, and not 
report exception
    
    Signed-off-by: nextdreamblue <zxw520bl...@163.com>
    
    * fix
    
    Signed-off-by: nextdreamblue <zxw520bl...@163.com>
    
    ---------
    
    Signed-off-by: nextdreamblue <zxw520bl...@163.com>
---
 .../src/main/java/org/apache/doris/common/Config.java       |  6 ++++++
 .../main/java/org/apache/doris/backup/BackupHandler.java    | 13 ++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java 
b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
index 9da0e0a45ea..8dff0e3f4db 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
@@ -1458,6 +1458,12 @@ public class Config extends ConfigBase {
     @ConfField(mutable = true, masterOnly = true)
     public static int max_backup_restore_job_num_per_db = 10;
 
+    /**
+     * whether to ignore table that not support type when backup, and not 
report exception.
+     */
+    @ConfField(mutable = true, masterOnly = true)
+    public static boolean ignore_backup_not_support_table_type = false;
+
     /**
      * Control the default max num of the instance for a user.
      */
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java 
b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java
index a4332e054cf..06874ce8311 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java
@@ -379,6 +379,7 @@ public class BackupHandler extends MasterDaemon implements 
Writable {
         // Check if backup objects are valid
         // This is just a pre-check to avoid most of invalid backup requests.
         // Also calculate the signature for incremental backup check.
+        List<TableRef> tblRefsNotSupport = Lists.newArrayList();
         for (TableRef tblRef : tblRefs) {
             String tblName = tblRef.getName().getTbl();
             Table tbl = db.getTableOrDdlException(tblName);
@@ -386,7 +387,15 @@ public class BackupHandler extends MasterDaemon implements 
Writable {
                 continue;
             }
             if (tbl.getType() != TableType.OLAP) {
-                ErrorReport.reportDdlException(ErrorCode.ERR_NOT_OLAP_TABLE, 
tblName);
+                if (Config.ignore_backup_not_support_table_type) {
+                    LOG.warn("Table '{}' is a {} table, can not backup and 
ignore it."
+                            + "Only OLAP(Doris)/ODBC/VIEW table can be backed 
up",
+                            tblName, tbl.getType().toString());
+                    tblRefsNotSupport.add(tblRef);
+                    continue;
+                } else {
+                    
ErrorReport.reportDdlException(ErrorCode.ERR_NOT_OLAP_TABLE, tblName);
+                }
             }
 
             OlapTable olapTbl = (OlapTable) tbl;
@@ -417,6 +426,8 @@ public class BackupHandler extends MasterDaemon implements 
Writable {
             }
         }
 
+        tblRefs.removeAll(tblRefsNotSupport);
+
         // Check if label already be used
         long repoId = -1;
         if (repository != null) {


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

Reply via email to