-
Notifications
You must be signed in to change notification settings - Fork 137
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 concurrent workflow create bug by unique index #346
Conversation
Codecov Report
@@ Coverage Diff @@
## master #346 +/- ##
=======================================
Coverage 23.79% 23.79%
=======================================
Files 14 14
Lines 1244 1244
=======================================
Hits 296 296
Misses 928 928
Partials 20 20 Continue to review full report at Codecov.
|
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.
Can you squash the commits?
6a401d4
to
8274ad6
Compare
squashed the commits. |
639fb5e
to
1e9fc80
Compare
Signed-off-by: Ryan Li <[email protected]>
## Description After PR #346 merged, raise back isolation level from repeatable read to serializable. Also add create unique index ddl to tinkerbell-init.sql. ## How Has This Been Tested? - Manually ## How are existing users impacted? What migration steps/scripts do we need? - No ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
Description
When multiple process concurrently create workflow, the code to access workflow_worker_map is not concurrent safe. This PR fix this issue.
Why is this needed
During workflow creation, new rows may be add to table
workflow_worker_map
in the same transaction. The original design useINSERT ... SELECT
. This doesn't work concurrently with SERRIELIZABLE isolation.Fixes: #
INSERT ... ON CONFLICT DO NOTHING;
to avoid table lock.How Has This Been Tested?
Manually as #342.
How are existing users impacted? What migration steps/scripts do we need?
Checklist:
I have: