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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 6ac54e37ec6 [feature](backup) ignore table that not support type when 
backup, and not report exception (#44200)
6ac54e37ec6 is described below

commit 6ac54e37ec69f885821cf693b177bbccd36d5a98
Author: walter <[email protected]>
AuthorDate: Tue Nov 19 10:19:02 2024 +0800

    [feature](backup) ignore table that not support type when backup, and not 
report exception (#44200)
    
    Cherry-pick #33158
    
    Signed-off-by: nextdreamblue <[email protected]>
    Co-authored-by: xueweizhang <[email protected]>
---
 .../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 7fbb4745ac7..dd09db27d94 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
@@ -1490,6 +1490,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;
+
     /**
      * A internal config, to reduce the restore job size during serialization 
by compress.
      *
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 a3fd66692a2..3015e366c3e 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
@@ -335,6 +335,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);
@@ -342,7 +343,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;
@@ -373,6 +382,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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to