-
Notifications
You must be signed in to change notification settings - Fork 8
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
Reconsider use of savepoints in transactions #2125
Comments
It looks like we only support savepoints currently but don't actually rely on them. The only place where we create a new savepoint is in |
After reading a bit more on savepoints, I can't find a reason we wouldn't be able to get rid of our savepoints usage and just rely on |
// Begin starts a pseudo nested transaction implemented with a savepoint.
func (tx *dbTx) Begin(ctx context.Context) (Tx, error) {
if tx.closed {
return nil, ErrTxClosed
}
tx.savepointNum++
_, err := tx.conn.Exec(ctx, "savepoint sp_"+strconv.FormatInt(tx.savepointNum, 10))
if err != nil {
return nil, err
}
return &dbSimulatedNestedTx{tx: tx, savepointNum: tx.savepointNum}, nil
} |
While fiddling with partner project's transaction code to allow nested "transactions" we noticed that FTL is using savepoints, and it wasn't clear if we actually need to. Do we ever need to rollback a bit but then continue the transaction?
@moe:
Used in FTL here: https://github.com/TBD54566975/ftl/blob/edbbf12d57ac2642cf5abf343f2f5a60a4785174/backend/controller/sql/conn.go#L51-L79
The text was updated successfully, but these errors were encountered: