Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1532,6 +1532,15 @@ public class Config extends ConfigBase {
@ConfField(mutable = true, masterOnly = true)
public static int max_backup_restore_job_num_per_db = 10;

/**
* Control the max num of tablets per backup job involved.
*/
@ConfField(mutable = true, masterOnly = true, description = {
"用于控制每次 backup job 允许备份的 tablet 上限,以避免 OOM",
"Control the max num of tablets per backup job involved, to avoid OOM"
})
public static int max_backup_tablets_per_job = 300000;

/**
* whether to ignore table that not support type when backup, and not report exception.
*/
Expand Down
11 changes: 11 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/backup/BackupJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,17 @@ private void prepareAndSendSnapshotTask() {
}
}

// Limit the max num of tablets involved in a backup job, to avoid OOM.
if (unfinishedTaskIds.size() > Config.max_backup_tablets_per_job) {
String msg = String.format("the num involved tablets %d exceeds the limit %d, "
+ "which might cause the FE OOM, change config `max_backup_tablets_per_job` "
+ "to change this limitation",
unfinishedTaskIds.size(), Config.max_backup_tablets_per_job);
LOG.warn(msg);
status = new Status(ErrCode.COMMON_ERROR, msg);
return;
}

backupMeta = new BackupMeta(copiedTables, copiedResources);

// send tasks
Expand Down
Loading