[improve](backup) Skip all backup/restore jobs if max allowd option is set to 0 (#30677)

If there are too many backup/restore jobs, it may cause OOM. This PR allows the user to skip all backup/restore jobs if max_backup_restore_job_num_per_db is set to 0.
This commit is contained in:
walter
2024-02-01 18:55:12 +08:00
committed by yiguolei
parent 203daba19d
commit c8b0840e6c

View File

@ -516,6 +516,12 @@ public class BackupHandler extends MasterDaemon implements Writable {
}
private void addBackupOrRestoreJob(long dbId, AbstractJob job) {
// If there are too many backup/restore jobs, it may cause OOM. If the job num option is set to 0,
// skip all backup/restore jobs.
if (Config.max_backup_restore_job_num_per_db <= 0) {
return;
}
jobLock.lock();
try {
Deque<AbstractJob> jobs = dbIdToBackupOrRestoreJobs.computeIfAbsent(dbId, k -> Lists.newLinkedList());