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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 4ec7f892284 branch-3.0: [fix](backup) filter the staled task response 
by job id #47416 (#47444)
4ec7f892284 is described below

commit 4ec7f892284b70da387464a7859019496d6998a5
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Jan 31 10:23:22 2025 +0800

    branch-3.0: [fix](backup) filter the staled task response by job id #47416 
(#47444)
    
    Cherry-picked from #47416
    
    Co-authored-by: walter <maoch...@selectdb.com>
---
 .../org/apache/doris/backup/BackupHandler.java     | 28 ++++++++++++++++++----
 1 file changed, 23 insertions(+), 5 deletions(-)

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 12cf1d58ab6..a6217501987 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
@@ -743,12 +743,18 @@ public class BackupHandler extends MasterDaemon 
implements Writable {
 
     public boolean handleFinishedSnapshotTask(SnapshotTask task, 
TFinishTaskRequest request) {
         AbstractJob job = getCurrentJob(task.getDbId());
-
         if (job == null) {
             LOG.warn("failed to find backup or restore job for task: {}", 
task);
             // return true to remove this task from AgentTaskQueue
             return true;
         }
+
+        if (job.getJobId() != task.getJobId()) {
+            LOG.warn("invalid snapshot task: {}, job id: {}, task job id: {}", 
task, job.getJobId(), task.getJobId());
+            // return true to remove this task from AgentTaskQueue
+            return true;
+        }
+
         if (job instanceof BackupJob) {
             if (task.isRestoreTask()) {
                 LOG.warn("expect finding restore job, but get backup job {} 
for task: {}", job, task);
@@ -773,13 +779,13 @@ public class BackupHandler extends MasterDaemon 
implements Writable {
             LOG.info("invalid upload task: {}, no backup job is found. db id: 
{}", task, task.getDbId());
             return false;
         }
-        BackupJob restoreJob = (BackupJob) job;
-        if (restoreJob.getJobId() != task.getJobId() || restoreJob.getState() 
!= BackupJobState.UPLOADING) {
+        BackupJob backupJob = (BackupJob) job;
+        if (backupJob.getJobId() != task.getJobId() || backupJob.getState() != 
BackupJobState.UPLOADING) {
             LOG.info("invalid upload task: {}, job id: {}, job state: {}",
-                     task, restoreJob.getJobId(), 
restoreJob.getState().name());
+                     task, backupJob.getJobId(), backupJob.getState().name());
             return false;
         }
-        return restoreJob.finishSnapshotUploadTask(task, request);
+        return backupJob.finishSnapshotUploadTask(task, request);
     }
 
     public boolean handleDownloadSnapshotTask(DownloadTask task, 
TFinishTaskRequest request) {
@@ -790,6 +796,12 @@ public class BackupHandler extends MasterDaemon implements 
Writable {
             return true;
         }
 
+        if (job.getJobId() != task.getJobId()) {
+            LOG.warn("invalid download task: {}, job id: {}, task job id: {}", 
task, job.getJobId(), task.getJobId());
+            // return true to remove this task from AgentTaskQueue
+            return true;
+        }
+
         return ((RestoreJob) job).finishTabletDownloadTask(task, request);
     }
 
@@ -801,6 +813,12 @@ public class BackupHandler extends MasterDaemon implements 
Writable {
             return true;
         }
 
+        if (job.getJobId() != task.getJobId()) {
+            LOG.warn("invalid dir move task: {}, job id: {}, task job id: {}", 
task, job.getJobId(), task.getJobId());
+            // return true to remove this task from AgentTaskQueue
+            return true;
+        }
+
         return ((RestoreJob) job).finishDirMoveTask(task, request);
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to