Skip to content

Commit

Permalink
fix to replicate entity lost when pause the task
Browse files Browse the repository at this point in the history
Signed-off-by: SimFG <bang.fu@zilliz.com>
  • Loading branch information
SimFG committed Nov 28, 2024
1 parent 4bc59b9 commit 7a3ca02
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/cdc_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1228,9 +1228,13 @@ func (e *MetaCDC) pauseTaskWithReason(taskID, reason string, currentStates []met
if replicateEntity, ok := e.replicateEntityMap.data[uKey]; ok {
if quitFunc, ok := replicateEntity.taskQuitFuncs.GetAndRemove(taskID); ok {
quitFunc()
replicateEntity.refCnt.Dec()
}
if replicateEntity.refCnt.Load() == 0 {
replicateEntity.entityQuitFunc()
delete(e.replicateEntityMap.data, uKey)
}
}
delete(e.replicateEntityMap.data, uKey)
e.replicateEntityMap.Unlock()
return err
}
Expand Down Expand Up @@ -1284,9 +1288,9 @@ func (e *MetaCDC) delete(taskID string) error {
}
if replicateEntity.refCnt.Load() == 0 {
replicateEntity.entityQuitFunc()
delete(e.replicateEntityMap.data, uKey)
}
}
delete(e.replicateEntityMap.data, uKey)
e.replicateEntityMap.Unlock()

return err
Expand Down

0 comments on commit 7a3ca02

Please sign in to comment.