-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix workflow deletion #5793
Fix workflow deletion #5793
Conversation
g.Go(func() (e error) { | ||
defer func() { recoverPanic(recover(), &e) }() | ||
_, e = m.db.DeleteFromExecutions(ctx, &sqlplugin.ExecutionsFilter{ | ||
return m.txExecute(ctx, dbShardID, "DeleteWorkflowExecution", func(tx sqlplugin.Tx) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not only changing the order but also making this operation a transaction.
- Other transactional operations in this file are using
txExecuteShardLockedFn
. Should this also grab shard lock? - This transaction will perform deletions on multiple tables an will have to acquire corresponding locks at DB level. Compared to previous implementation the overall latency might be high which is OK for deletion case but do you think this has a chance to impact performance of other queries on those tables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It doesn't have to grab a shard lock, we're trying to delete a workflow passing the retention period. Whether it is deleted by the owner of the shard isn't important.
- For innodb with repeatable read isolation level, the delete acquires a next-key lock on every record it encounters. The deletion are either point deletion or range deletion that deleting all records within a range. So the impact performance of other queries on those tables should be low. (Only 1 workflow next to the deleted workflow could be impacted.) For innodb with read-committed isolation level and myrocksdb, there is no next-key lock or gap lock, only the records being deleted are locked. So there is no impact to other workflows.
Pull Request Test Coverage Report for Build 018e52a1-d0d6-4fee-958b-7552733219ddDetails
💛 - Coveralls |
Codecov Report
Additional details and impacted files
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
What changed?
Fix workflow deletion
Why?
To prevent garbage data from workflows which are supposed to be deleted.
Workflow execution should exist in order to execute the deletion task, so it must be the last one to be deleted.
How did you test it?
unit tests
Potential risks
Release notes
Documentation Changes