Skip to content
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

move wrapTriggerRollback logic #2720

Merged
merged 5 commits into from
Oct 28, 2024
Merged

move wrapTriggerRollback logic #2720

merged 5 commits into from
Oct 28, 2024

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Oct 25, 2024

This PR removes the plan.TriggerRollback and plan.NoopTriggerRollback node and applies the triggerRollbackIter directly.
When there are multiple nested triggers (aka triggers that call other triggers), we used to have multiple nested trigger rollbacks with different savepoints. It turns out that was unnecessary and a single savepoint at the top of the iter tree is enough; when there's an error, it propagates back to the top, rollingback all changes.

@jycor jycor changed the title move wrapTriggerNodes move wrapTriggerRollback logic Oct 25, 2024
Copy link
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one minor comment for perf

@@ -33,6 +33,47 @@ type triggerRollbackIter struct {
savePointName string
}

func containsTrigger(node sql.Node) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good use case for query flags. When we build a trigger in planbuilder mark a trigger use, and then read that back instead of traversing the node.

@jycor jycor merged commit 2c6e3dd into main Oct 28, 2024
7 of 8 checks passed
@jycor jycor deleted the james/triggers branch October 28, 2024 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants