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

Enable SQL Savepoints #5953

Closed
jseldess opened this issue Nov 26, 2019 · 2 comments · Fixed by #6675
Closed

Enable SQL Savepoints #5953

jseldess opened this issue Nov 26, 2019 · 2 comments · Fixed by #6675
Assignees
Milestone

Comments

@jseldess
Copy link
Contributor

jseldess commented Nov 26, 2019

Background: https://airtable.com/tblD3oZPLJgGhCmch/viw1DKmbKhg2MIECH/recxI0iMnCxdfpS2h

Description: This feature is KV supporting SQL's adding Savepoint syntax.

A Savepoint is a marker within a transaction that allows rolling back to a specific point in a transaction. At the moment, we use Savepoint keyword for rolling back only to the beginning of a transaction in a way that a client can begin again, helping users handle transaction retry errors.

The problem is CRDB's lack of compatibility with ORMs. For application developers depending on ORMs like Django, SQLAlchemy and Hibernate, this represents a significant barrier to adoption. More specifically, Savepoint support is required for passing third-party test suites.

Team: John Kendall, Andrew Kimball, Andrew Woods, Raphael 'kena' Poss, Andrei Matei, Bilal Akhtar

Github Tracking Issue: cockroachdb/cockroach#10735 cockroachdb/cockroach#16491 cockroachdb/sqlalchemy-cockroachdb#25 #5953

@rmloveland
Copy link
Contributor

Estimated scope of work:

  • Update SAVEPOINT docs to mention the support for nesting, add examples showing how
  • Search for other mentions of the "no nested transactions" limitation and see if / how to update them
  • Remove from known limitations page, if this is mentioned there

rmloveland added a commit that referenced this issue Feb 25, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of nested savepoints

- Update SAVEPOINT page to describe what makes up a "retry" savepoint,
  including its limitations

- Add a new SHOW SAVEPOINT STATUS statement page, and add it to the sidebar.
rmloveland added a commit that referenced this issue Feb 28, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "general" savepoints, in
  addition to the existing "retry" savepoints

- Add a new SHOW SAVEPOINT STATUS statement page, and add it to the
  sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "general", and update the example
rmloveland added a commit that referenced this issue Feb 28, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "general" savepoints, in
  addition to the existing "retry" savepoints

- Add a new SHOW SAVEPOINT STATUS statement page, and add it to the
  sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "general", and update the example
rmloveland added a commit that referenced this issue Feb 28, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "general" savepoints, in
  addition to the existing "retry" savepoints

- Add a new SHOW SAVEPOINT STATUS statement page, and add it to the
  sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "general", and update the example
rmloveland added a commit that referenced this issue Mar 4, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "generalized" aka "nested"
  savepoints adapted from the RFC, in addition to the existing "retry"
  savepoints info

- Add a new SHOW SAVEPOINT STATUS statement page, and add it to the
  sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "generalized", and update the example as well

- Update the ROLLBACK docs to mention rollbacks to savepoints more
  explicitly
rmloveland added a commit that referenced this issue Mar 12, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "generalized" aka "nested"
  savepoints adapted from the RFC, in addition to the existing "retry"
  savepoints info

- Add a new SHOW SAVEPOINT STATUS statement page (with syntax diagram),
  and add it to the sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "generalized", and update the example as well

- Update the ROLLBACK docs to mention rollbacks to savepoints more
  explicitly.  Also, update the diagram to reflect that
  'cockroach_restart' is no longer a special savepoint name.

- Update all 20.1 documentation to reflect that 'cockroach_restart' is
  no longer a special retry savepoint name, nor is it required.  As part
  of this, rename all savepoint examples using 'cockroach_restart' to
  use names like 'my_savepoint', etc.
@jseldess
Copy link
Contributor Author

jseldess commented Mar 19, 2020

@rmloveland, there are a bunch of savepoint-related updates in the next beta release notes. Pasting them here rather than opening distinct issues.

  • CockroachDB now collects separate sets of metrics for usage of SAVEPOINT: one set for regular SQL savepoints and one set for uses dedicated to CockroachDB's client-side transaction retry protocol. [#45566][#45566]
  • SQL savepoints are now supported. SAVEPOINT <foo>, RELEASE SAVEPOINT <foo>, and ROLLBACK TO SAVEPOINT <foo> now work. SHOW SAVEPOINT STATUS can be used to inspect the current stack of active savepoints. [#45566][#45566]
  • CockroachDB now provides preliminary support for SQL savepoints: the SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT statements. The support is limited in the following ways: (1) certain retry errors cannot be erased by ROLLBACK TO SAVEPOINT if the corresponding savepoint was not taken at the very begin of the transaction. (2) ROLLBACK TO SAVEPOINT cannot be used to cancel the effects of a DDL statement unless the savepoint was taken at the very begin of the transaction. [#45791][#45791]
  • CockroachDB supports a new statement SHOW SAVEPOINT STATUS which reveals the current stack of active savepoints. This can be used to teach savepoint usage. [#45791][#45791]

rmloveland added a commit that referenced this issue Mar 24, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "generalized" aka "nested"
  savepoints adapted from the RFC, in addition to the existing "retry"
  savepoints info

- Add a new SHOW SAVEPOINT STATUS statement page (with syntax diagram),
  and add it to the sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "generalized/nested" savepoints, and update the examples as well

- Update the ROLLBACK docs to mention rollbacks to savepoints more
  explicitly.  Also, update the diagram to reflect that
  'cockroach_restart' is no longer the only allowed savepoint name.

- Add information on how CockroachDB handles savepoints and locking
  vs. Postgres

- Add a new "sub-transactions" section to the 'Transactions' page,
  including descriptions of how COMMIT, ROLLBACK, RELEASE SAVEPOINT, and
  ROLLBACK TO SAVEPOINT relate to each other

- In general, draw distinctions in several places between "retry"
  savepoints and "nested" or "generalized" savepoints, since they are
  different
rmloveland added a commit that referenced this issue Mar 30, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "generalized" aka "nested"
  savepoints adapted from the RFC, in addition to the existing "retry"
  savepoints info

- Add a new SHOW SAVEPOINT STATUS statement page (with syntax diagram),
  and add it to the sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "generalized/nested" savepoints, and update the examples as well

- Update the ROLLBACK docs to mention rollbacks to savepoints more
  explicitly.  Also, update the diagram to reflect that
  'cockroach_restart' is no longer the only allowed savepoint name.

- Add information on how CockroachDB handles savepoints and locking
  vs. Postgres

- Add a new "sub-transactions" section to the 'Transactions' page,
  including descriptions of how COMMIT, ROLLBACK, RELEASE SAVEPOINT, and
  ROLLBACK TO SAVEPOINT relate to each other

- Draw distinctions in several places between "retry" savepoints and
  "nested" or "generalized" savepoints, since they are different

- Update mentions of savepoints on 'SQL Statements' and 'Postgres
  Compatibility' to note that they are supported now
rmloveland added a commit that referenced this issue Apr 1, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "generalized" aka "nested"
  savepoints adapted from the RFC, in addition to the existing "retry"
  savepoints info

- Add a new SHOW SAVEPOINT STATUS statement page (with syntax diagram),
  and add it to the sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "generalized/nested" savepoints, and update the examples as well

- Update the ROLLBACK docs to mention rollbacks to savepoints more
  explicitly.  Also, update the diagram to reflect that
  'cockroach_restart' is no longer the only allowed savepoint name.

- Add information on how CockroachDB handles savepoints and locking
  vs. Postgres

- Add a new "nested transactions" section to the 'Transactions' page,
  including descriptions of how COMMIT, ROLLBACK, RELEASE SAVEPOINT, and
  ROLLBACK TO SAVEPOINT relate to each other

- Draw distinctions in several places between "retry" savepoints and
  "nested" or "generalized" savepoints, since they are different

- Update mentions of savepoints on 'SQL Statements' and 'Postgres
  Compatibility' to note that they are supported now
rmloveland added a commit that referenced this issue Apr 6, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "generalized" aka "nested"
  savepoints adapted from the RFC, in addition to the existing "retry"
  savepoints info

- Add a new SHOW SAVEPOINT STATUS statement page (with syntax diagram),
  and add it to the sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "generalized/nested" savepoints, and update the examples as well

- Update the ROLLBACK docs to mention rollbacks to savepoints more
  explicitly.  Also, update the diagram to reflect that
  'cockroach_restart' is no longer the only allowed savepoint name.

- Add information on how CockroachDB handles savepoints and locking
  vs. Postgres

- Add a new "nested transactions" section to the 'Transactions' page,
  including descriptions of how COMMIT, ROLLBACK, RELEASE SAVEPOINT, and
  ROLLBACK TO SAVEPOINT relate to each other

- Draw distinctions in several places between "retry" savepoints and
  "nested" or "generalized" savepoints, since they are different

- Update mentions of savepoints on 'SQL Statements' and 'Postgres
  Compatibility' to note that they are supported now
rmloveland added a commit that referenced this issue Apr 16, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "generalized" aka "nested"
  savepoints adapted from the RFC, in addition to the existing "retry"
  savepoints info

- Add a new SHOW SAVEPOINT STATUS statement page (with syntax diagram),
  and add it to the sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "generalized/nested" savepoints, and update the examples as well

- Update the ROLLBACK docs to mention rollbacks to savepoints more
  explicitly.  Also, update the diagram to reflect that
  'cockroach_restart' is no longer the only allowed savepoint name.

- Add information on how CockroachDB handles savepoints and locking
  vs. Postgres

- Add a new "nested transactions" section to the 'Transactions' page,
  including descriptions of how COMMIT, ROLLBACK, RELEASE SAVEPOINT, and
  ROLLBACK TO SAVEPOINT relate to each other

- Draw distinctions in several places between "retry" savepoints and
  "nested" or "generalized" savepoints, since they are different

- Update mentions of savepoints on 'SQL Statements' and 'Postgres
  Compatibility' to note that they are supported now
rmloveland added a commit that referenced this issue Apr 23, 2020
Fixes #5953.

Summary of changes:

- Update SAVEPOINT page with more examples of "generalized" aka "nested"
  savepoints adapted from the RFC, in addition to the existing "retry"
  savepoints info

- Add a new SHOW SAVEPOINT STATUS statement page (with syntax diagram),
  and add it to the sidebar

- Update RELEASE SAVEPOINT docs to clarify "retry" savepoints
  vs. "generalized/nested" savepoints, and update the examples as well

- Update the ROLLBACK docs to mention rollbacks to savepoints more
  explicitly.  Also, update the diagram to reflect that
  'cockroach_restart' is no longer the only allowed savepoint name.

- Add information on how CockroachDB handles savepoints and locking
  vs. Postgres

- Add a new "nested transactions" section to the 'Transactions' page,
  including:

  - A brief description of why nested transactions are useful

  - A description of how COMMIT, ROLLBACK, RELEASE SAVEPOINT, and
    ROLLBACK TO SAVEPOINT relate to each other

- Draw distinctions in several places between "retry" savepoints and
  "nested" or "generalized" savepoints, since they are different

- Update mentions of savepoints on 'SQL Statements' and 'Postgres
  Compatibility' to note that they are supported now
rmloveland added a commit that referenced this issue Apr 24, 2020
Addresses some cleanup around #5953.

Summary of changes:

- Add 'new in v20.1' tags and appropriate verbiage to the following
  parts of the docs that were missed in some previous work in this area:

  - RELEASE SAVEPOINT
  - ROLLBACK
  - SAVEPOINT
  - 'SQL Statements'
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 a pull request may close this issue.

2 participants