Skip to content

Commit

Permalink
fix: update the execution sweep sql to resolve the exec deletion conf…
Browse files Browse the repository at this point in the history
…lict (#20603)

fix: update the execution sweep sql to resolve the exec deleteion conflict

Resolve the execution deleteion conflict when there are tasks still
referenced by the execution, remained execs can wait for next sweep
cycle.

Signed-off-by: chlins <chlins.zhang@gmail.com>
Co-authored-by: Wang Yan <wangyan@vmware.com>
  • Loading branch information
chlins and wy65701436 committed Jun 17, 2024
1 parent 793dc54 commit df4ab85
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pkg/task/sweep_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (sm *sweepManager) Clean(ctx context.Context, execIDs []int64) error {
return errors.Wrap(err, "failed to delete tasks")
}
// delete executions
sql = fmt.Sprintf("DELETE FROM execution WHERE id IN (%s)", orm.ParamPlaceholderForIn(len(params)))
sql = fmt.Sprintf("DELETE FROM execution WHERE id IN (%s) AND id NOT IN (SELECT DISTINCT execution_id FROM task)", orm.ParamPlaceholderForIn(len(params)))
_, err = ormer.Raw(sql, params...).Exec()
if err != nil {
return errors.Wrap(err, "failed to delete executions")
Expand Down

0 comments on commit df4ab85

Please sign in to comment.