From 1b831ce62f30bced0143a7a5a24f457866fc363a Mon Sep 17 00:00:00 2001 From: congqixia Date: Tue, 24 Dec 2024 13:34:48 +0800 Subject: [PATCH] fix: Remove sync task after finished (#38681) Related to #38680 Signed-off-by: Congqi Xia --- internal/datanode/syncmgr/sync_manager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/datanode/syncmgr/sync_manager.go b/internal/datanode/syncmgr/sync_manager.go index 1443f50dfbda2..875157054fed8 100644 --- a/internal/datanode/syncmgr/sync_manager.go +++ b/internal/datanode/syncmgr/sync_manager.go @@ -119,6 +119,10 @@ func (mgr *syncManager) safeSubmitTask(task Task, callbacks ...func(error) error func (mgr *syncManager) submit(key int64, task Task, callbacks ...func(error) error) *conc.Future[struct{}] { handler := func(err error) error { + taskKey := fmt.Sprintf("%d-%d", task.SegmentID(), task.Checkpoint().GetTimestamp()) + defer func() { + mgr.tasks.Remove(taskKey) + }() if err == nil { return nil }