Skip to content

Commit 6ac54e3

Browse files
w41ternextdreamblue
andauthoredNov 19, 2024
[feature](backup) ignore table that not support type when backup, and not report exception (#44200)
Cherry-pick #33158 Signed-off-by: nextdreamblue <zxw520blue1@163.com> Co-authored-by: xueweizhang <zxw520blue1@163.com>
1 parent 04bef05 commit 6ac54e3

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
 

‎fe/fe-common/src/main/java/org/apache/doris/common/Config.java

+6
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,12 @@ public class Config extends ConfigBase {
14901490
@ConfField(mutable = true, masterOnly = true)
14911491
public static int max_backup_restore_job_num_per_db = 10;
14921492

1493+
/*
1494+
* whether to ignore table that not support type when backup, and not report exception.
1495+
*/
1496+
@ConfField(mutable = true, masterOnly = true)
1497+
public static boolean ignore_backup_not_support_table_type = false;
1498+
14931499
/**
14941500
* A internal config, to reduce the restore job size during serialization by compress.
14951501
*

‎fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,23 @@ private void backup(Repository repository, Database db, BackupStmt stmt) throws
335335
// Check if backup objects are valid
336336
// This is just a pre-check to avoid most of invalid backup requests.
337337
// Also calculate the signature for incremental backup check.
338+
List<TableRef> tblRefsNotSupport = Lists.newArrayList();
338339
for (TableRef tblRef : tblRefs) {
339340
String tblName = tblRef.getName().getTbl();
340341
Table tbl = db.getTableOrDdlException(tblName);
341342
if (tbl.getType() == TableType.VIEW || tbl.getType() == TableType.ODBC) {
342343
continue;
343344
}
344345
if (tbl.getType() != TableType.OLAP) {
345-
ErrorReport.reportDdlException(ErrorCode.ERR_NOT_OLAP_TABLE, tblName);
346+
if (Config.ignore_backup_not_support_table_type) {
347+
LOG.warn("Table '{}' is a {} table, can not backup and ignore it."
348+
+ "Only OLAP(Doris)/ODBC/VIEW table can be backed up",
349+
tblName, tbl.getType().toString());
350+
tblRefsNotSupport.add(tblRef);
351+
continue;
352+
} else {
353+
ErrorReport.reportDdlException(ErrorCode.ERR_NOT_OLAP_TABLE, tblName);
354+
}
346355
}
347356

348357
OlapTable olapTbl = (OlapTable) tbl;
@@ -373,6 +382,8 @@ private void backup(Repository repository, Database db, BackupStmt stmt) throws
373382
}
374383
}
375384

385+
tblRefs.removeAll(tblRefsNotSupport);
386+
376387
// Check if label already be used
377388
long repoId = -1;
378389
if (repository != null) {

0 commit comments

Comments
 (0)
Please sign in to comment.