-
Notifications
You must be signed in to change notification settings - Fork 67
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
sqliteutil.Save does not rollback properly after SQLITE_INTERRUPT #21
Comments
You're absolutely right that ROLLBACK should run after interrupt. Tricky! This probably needs more API surface in the sqlite package. Let me see what I can come up with. |
One idea is to
Where
( I don't have a precise idea of how costly |
I think an
|
LGTM - it sorta bothers me that (Also maybe cache the closed chan in a package-level variable if make()-ing it isn't zero-cost and that doesn't have terrible consequences down the line?) |
Turns out an |
This issue was opened under the faulty assumption that SAVEPOINTs always need to be rolled back and released after a SQLITE_INTERRUPT occurs. But there are times when the SAVEPOINTs are automatically rolled back. This introduced a different subtle bug described in #73 |
This is a sister issue to #20
When a long-running query gets interrupted (because the context is cancelled), then we reach this code:
https://github.com/crawshaw/sqlite/blob/master/sqliteutil/savepoint.go#L76-L93
The problem here is that none of those
Exec
statements will actually get executed if we've been interrupted.They'll all stop either in
conn.prepare()
(if the statement isn't cached yet), or inconn.Step()
- the point is none of that rollback SQL will run.This is where my
ForceReset()
approach from #20 doesn't really work. We also need toForceExec()
, etc.Perhaps a better solution would be to have a facility for temporarily disabling
interrupted
checks.The text was updated successfully, but these errors were encountered: