-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: SAVEPOINT cockroach_restart
can be erroneously called after having run other SQL statements when using DistSQL
#15012
Comments
@andreimatei I think this has been fixed, correct? |
Incorrect, situation looks the same to me. |
Please note that some users currently require being able to make metadata requests against virtual tables before issuing the savepoint. Any solution to this should preserve this behavior. |
I don't think this is currently supported though. "Make metadata requests" requires KV operations, which in turn engages the retry logic. |
31971: sql: Allow restart savepoint to be renamed r=bobvawter a=bobvawter Currently, the only allowable savepoint names are those beginning with `cockroach_restart` which triggers a Cockroach-specific transaction-retry flow. This creates compatibility issues with certain integration scenarios (e.g. apps using Spring ORM) that can take advantage of restartable transactions, but which assume than an arbitrary savepoint identifier may be used. This patch introduces a new session variable `force_savepoint_restart` which allows the user to customize the savepoint name to any valid identifier, while always triggering a restartable transaction. Telemetry: * Unimplemented-feature error now includes reference to #10735. * `sql.force_savepoint_restart` event recorded when enabled. Resolves #30588 (customize `SAVEPOINT` name) Relates to #15012 (possible change for detecting "empty" transactions) Release note (sql change): Users can customize the auto-retry savepoint name used by the `SAVEPOINT` command by setting the `force_savepoint_restart` session variable. For example: `SET force_savepoint_restart=true; BEGIN; SAVEPOINT foo` will now function as desired. This session variable may also be supplied as part of a connection string to support existing code that assumes that arbitrary savepoint names may be used. Release note (sql change): The names supplied to a `SAVEPOINT` command are now properly treated as SQL identifiers. That is `SAVEPOINT foo` and `SAVEPOINT FOO` are now equivalent statements. Co-authored-by: Bob Vawter <bob@cockroachlabs.com>
@knz has this been fixed? |
yes correct I fixed that. thanks for noticing |
We enforce that SAVEPOINT is the first statement in a txn (or in a retry of a txn) by looking at
client.Txn.CommandCount()
. If the previous statements usedDistSQL
, thatCommandCount
is not necessarily updated.We should get rid of
CommandCount
and track the status of the txn exclusively at the sql level.The text was updated successfully, but these errors were encountered: