Skip to content

Commit

Permalink
[feature](backup) ignore table that not support type when backup, and… (
Browse files Browse the repository at this point in the history
#33158)

* [feature](backup) ignore table that not support type when backup, and not report exception

Signed-off-by: nextdreamblue <[email protected]>

* fix

Signed-off-by: nextdreamblue <[email protected]>

---------

Signed-off-by: nextdreamblue <[email protected]>
  • Loading branch information
nextdreamblue authored and w41ter committed Nov 18, 2024
1 parent 04bef05 commit 11cbfda
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,23 @@ private void backup(Repository repository, Database db, BackupStmt stmt) throws
// 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);
if (tbl.getType() == TableType.VIEW || tbl.getType() == TableType.ODBC) {
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;
Expand Down Expand Up @@ -373,6 +382,8 @@ private void backup(Repository repository, Database db, BackupStmt stmt) throws
}
}

tblRefs.removeAll(tblRefsNotSupport);

// Check if label already be used
long repoId = -1;
if (repository != null) {
Expand Down

0 comments on commit 11cbfda

Please sign in to comment.