-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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(core): Make execution and its data creation atomic #10276
fix(core): Make execution and its data creation atomic #10276
Conversation
Executions and their data are inserted in two separate insert statements. Before this PR, this wasn't done in a transaction, which could cause executions to be created without execution data. This caused issues like the one fixed in #9903.
packages/cli/src/databases/repositories/execution.repository.ts
Outdated
Show resolved
Hide resolved
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.
Thanks for making the changes. Left a couple of more comments.
if (executionId === undefined) { | ||
throw new ApplicationError('There was an issue assigning an execution id to the execution'); | ||
} |
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.
this check has never made sense. the only reason the types here suggest that executionId
could be missing is because we are reusing the variable. This code will never run, since if creating an execution fails, we'll have an unhandled 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.
Exactly. That's why I changed it to an assert
so it satisfies the type system
packages/cli/src/databases/repositories/execution.repository.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/databases/repositories/executionData.repository.ts
Outdated
Show resolved
Hide resolved
…d-its-data-in-atomic-transaction
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.
Thanks 💟
Test summaryRun details
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud |
✅ All Cypress E2E specs passed |
* master: refactor(core): Clean up event relays (no-changelog) (#10284) fix(editor): Fix execution retry button (#10275) feat(core): Show sub-node error on the logs pane. Open logs pane on sub-node error (#10248) refactor(core): Move instanceRole to InstanceSettings (no-changelog) (#10242) feat(core): Allow filtering executions and users by project in Public API (#10250) fix(core): Make execution and its data creation atomic (#10276) refactor(core): Mark schema env vars used by cloud hooks (no-changelog) (#10283) ci: Fix DB tests (no-changelog) (#10282) feat(core): Support create, delete, edit role for users in Public API (#10279) refactor(core): Decouple post workflow execute event from internal hooks (no-changelog) (#10280) feat(core): Allow transferring credentials in Public API (#10259) feat(core): Support create, read, update, delete projects in Public API (#10269) ci: Introduce lint rule `no-type-unsafe-event-emitter` (no-changelog) (#10254) fix(core): Surface enterprise trial error message (#10267) fix(editor): Enable moving resources only if team projects are available by the license (#10271) fix(core): Upgrade tournament to address some XSS vulnerabilities (#10277) # Conflicts: # packages/cli/src/Server.ts
Got released with |
Summary
Executions and their data are inserted in two separate insert statements. Before this PR, this wasn't done in a transaction, which could cause executions to be created without execution data. This caused issues like the one fixed in #9903.
Review / Merge checklist
release/backport
(if the PR is an urgent fix that needs to be backported)