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 526f2c2e295 branch-3.0: [fix](backup) make snapshot task with unique signature #48238 (#48291) 526f2c2e295 is described below commit 526f2c2e29572cc1980be7ec339173416df407fe Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Thu Feb 27 19:32:04 2025 +0800 branch-3.0: [fix](backup) make snapshot task with unique signature #48238 (#48291) Cherry-picked from #48238 Co-authored-by: walter <maoch...@selectdb.com> --- .../java/org/apache/doris/backup/BackupJob.java | 28 ++++++++++++---------- .../org/apache/doris/backup/BackupJobTest.java | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupJob.java b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupJob.java index de12670807f..2ab633a2f39 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupJob.java @@ -210,17 +210,19 @@ public class BackupJob extends AbstractJob implements GsonPostProcessable { } //clear old task - AgentTaskQueue.removeTaskOfType(TTaskType.MAKE_SNAPSHOT, task.getTabletId()); - unfinishedTaskIds.remove(task.getTabletId()); - taskProgress.remove(task.getTabletId()); - taskErrMsg.remove(task.getTabletId()); - - SnapshotTask newTask = new SnapshotTask(null, replica.getBackendIdWithoutException(), task.getTabletId(), + AgentTaskQueue.removeTaskOfType(TTaskType.MAKE_SNAPSHOT, task.getSignature()); + unfinishedTaskIds.remove(task.getSignature()); + taskProgress.remove(task.getSignature()); + taskErrMsg.remove(task.getSignature()); + + long signature = env.getNextId(); + long beId = replica.getBackendIdWithoutException(); + SnapshotTask newTask = new SnapshotTask(null, beId, signature, task.getJobId(), task.getDbId(), tbl.getId(), task.getPartitionId(), task.getIndexId(), task.getTabletId(), task.getVersion(), task.getSchemaHash(), timeoutMs, false /* not restore task */); - unfinishedTaskIds.put(tablet.getId(), replica.getBackendIdWithoutException()); + unfinishedTaskIds.put(signature, beId); //send task AgentBatchTask batchTask = new AgentBatchTask(newTask); @@ -277,9 +279,9 @@ public class BackupJob extends AbstractJob implements GsonPostProcessable { request.getSnapshotFiles()); snapshotInfos.put(task.getTabletId(), info); - taskProgress.remove(task.getTabletId()); - Long oldValue = unfinishedTaskIds.remove(task.getTabletId()); - taskErrMsg.remove(task.getTabletId()); + taskProgress.remove(task.getSignature()); + taskErrMsg.remove(task.getSignature()); + Long oldValue = unfinishedTaskIds.remove(task.getSignature()); if (LOG.isDebugEnabled()) { LOG.debug("get finished snapshot info: {}, unfinished tasks num: {}, remove result: {}. {}", info, unfinishedTaskIds.size(), (oldValue != null), this); @@ -637,13 +639,15 @@ public class BackupJob extends AbstractJob implements GsonPostProcessable { + ". visible version: " + visibleVersion); return; } - SnapshotTask task = new SnapshotTask(null, replica.getBackendIdWithoutException(), tablet.getId(), + long signature = env.getNextId(); + long beId = replica.getBackendIdWithoutException(); + SnapshotTask task = new SnapshotTask(null, beId, signature, jobId, dbId, olapTable.getId(), partition.getId(), index.getId(), tablet.getId(), visibleVersion, schemaHash, timeoutMs, false /* not restore task */); batchTask.addTask(task); - unfinishedTaskIds.put(tablet.getId(), replica.getBackendIdWithoutException()); + unfinishedTaskIds.put(signature, beId); } } diff --git a/fe/fe-core/src/test/java/org/apache/doris/backup/BackupJobTest.java b/fe/fe-core/src/test/java/org/apache/doris/backup/BackupJobTest.java index 1e22a6cb5af..cbee4a8bcec 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/backup/BackupJobTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/backup/BackupJobTest.java @@ -234,7 +234,7 @@ public class BackupJobTest { Assert.assertEquals(backupTbl.getSignature(BackupHandler.SIGNATURE_VERSION, partNames), ((OlapTable) db.getTableNullable(tblId)).getSignature(BackupHandler.SIGNATURE_VERSION, partNames)); Assert.assertEquals(1, AgentTaskQueue.getTaskNum()); - AgentTask task = AgentTaskQueue.getTask(backendId, TTaskType.MAKE_SNAPSHOT, tabletId); + AgentTask task = AgentTaskQueue.getTask(backendId, TTaskType.MAKE_SNAPSHOT, id.get() - 1); Assert.assertTrue(task instanceof SnapshotTask); SnapshotTask snapshotTask = (SnapshotTask) task; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org