-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
2a18c9a
commit 74493f1
Showing
7 changed files
with
243 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Set the `force_savepoint_restart` [session variable](set-vars.html#supported-variables) to `true` to enable using a custom name for the restart savepoint (for example, because you are using an ORM that wants to use its own names for savepoints). | ||
Set the `force_savepoint_restart` [session variable](set-vars.html#supported-variables) to `true` to enable using a custom name for the [retry savepoint](savepoint.html#savepoints-for-client-side-transaction-retries) (for example, because you are using an ORM that wants to use its own names for savepoints). | ||
|
||
Once this variable is set, the [`SAVEPOINT`](savepoint.html) statement will accept any name for the savepoint, not just `cockroach_restart`. This allows compatibility with existing code that uses a single savepoint per transaction as long as that savepoint occurs before any statements that access data stored in non-virtual tables. | ||
Once this variable is set, the [`SAVEPOINT`](savepoint.html) statement will accept any name for the retry savepoint, not just `cockroach_restart`. This allows compatibility with existing code that uses a single savepoint per transaction as long as that savepoint occurs before any statements that access data stored in non-virtual tables. | ||
|
||
{{site.data.alerts.callout_danger}} | ||
The `force_savepoint_restart` variable changes the semantics of CockroachDB savepoints so that `RELEASE SAVEPOINT <your-custom-name>` functions as a real commit. Note that the existence of this variable and its behavior does not change the fact that CockroachDB savepoints can only be used as a part of the transaction retry protocol. | ||
The `force_savepoint_restart` variable changes the semantics of CockroachDB savepoints so that `RELEASE SAVEPOINT <your-custom-name>` functions as a real commit. | ||
{{site.data.alerts.end}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
title: SHOW SAVEPOINT STATUS | ||
summary: The SHOW SAVEPOINT STATUS statement lists the active savepoints in the current transaction. | ||
toc: true | ||
--- | ||
|
||
The `SHOW SAVEPOINT STATUS` [statement](sql-statements.html) lists the active [savepoints](savepoint.html) in the current [transaction](transactions.html). | ||
|
||
## Required privileges | ||
|
||
No [privileges](authorization.html#assign-privileges) are required to create or show a savepoint. However, privileges are required for each statement within a transaction. | ||
|
||
## Response | ||
|
||
The following fields are returned for each savepoint. | ||
|
||
Field | Description | ||
------|------------ | ||
`savepoint_name` | The name of the savepoint. | ||
`is_restart_savepoint` | Whether the savepoint is [being used to implement client-side transaction retries](savepoint.html#savepoints-for-client-side-transaction-retries). | ||
|
||
## Example | ||
|
||
First, open a [transaction](transactions.html) and create a [savepoint](savepoint.html): | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
BEGIN; | ||
SAVEPOINT foo; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
SHOW SAVEPOINT STATUS; | ||
~~~ | ||
|
||
~~~ | ||
savepoint_name | is_restart_savepoint | ||
-----------------+----------------------- | ||
foo | false | ||
(1 row) | ||
~~~ | ||
|
||
Remove the savepoint from the transaction with [`RELEASE SAVEPOINT`](release-savepoint.html), and exit the transaction with [`COMMIT`](commit-transaction.html): | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
RELEASE SAVEPOINT foo; | ||
COMMIT; | ||
~~~ | ||
|
||
## See also | ||
|
||
- [`SAVEPOINT`](savepoint.html) | ||
- [`RELEASE SAVEPOINT`](release-savepoint.html) | ||
- [`ROLLBACK`](rollback-transaction.html) | ||
- [`BEGIN`](begin-transaction.html) | ||
- [`COMMIT`](commit-transaction.html) | ||
- [Transactions](transactions.html) |