Skip to content

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

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.

3 participants