-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
80848: sql: add SHOW COMMIT TIMESTAMP to retrieve a causality token r=ajwerner a=ajwerner Fixes #79591 Relates to #7945 Release note (sql change): A new sql statement `SHOW COMMIT TIMESTAMP` has been added. This statement can be used to retrieve the commit timestamp of the current explicit transaction, current multi-statement implicit transaction, or previous transaction. The statement may be used in a variety of settings to maximize its utility in the face of connection pooling. When used as a part of an explicit transaction, the statement implicitly commits the transaction internally before being able to return a causality token. This is similar to the `RELEASE cockroach_restart` behavior; after issuing this statement, commands to the transaction will be rejected until `COMMIT` is issued. When used as part of a multi-statement implicit transaction, the statement must be the final statement. If it occurs in the middle of a multi-statement implicit transaction, it will be rejected with an error. When sent as a stand-alone single-statement implicit transaction, it will return the commit timestamp of the previously committed transaction. If there was no transaction on the connection, or the previous transaction did not commit (either rolled back or encountered an error), the command will fail with an error code 25000 (`InvalidTransactionState`). The `SHOW COMMIT TIMESTAMP` statement is idempotent; it can be issued multiple times both inside of and after transactions and will return the same result. One rough edge is that the `cockroach sql` cli command will, by default, send statements on behalf of the user which will lead to repeated issuances of `SHOW COMMIT TIMESTAMP` from the CLI returning different values. If one disables syntax checking with `\set check_syntax=false` and one changes their prompt1 to not require a query, perhaps with `\set prompt1=%n@%M>;`, the command will become idempotent from the CLI. 91832: CODEOWNERS: updater importer to sql-exp r=rafiss a=dt Release note: none. Epic: none. 92338: util/stop: finish task span before Stop() returns r=andreimatei a=andreimatei Before this patch, a task's span was finished after the stopper considered the task to be finished. This was a problem for a test who wanted to assume that, once stopper.Stop() returns, all task spans are finished - which is a reasonable contract to expect. This patch reorders the span finish accordingly. Fixes #83886 Release note: None Epic: None Co-authored-by: Andrew Werner <[email protected]> Co-authored-by: David Taylor <[email protected]> Co-authored-by: Andrei Matei <[email protected]>
- Loading branch information
Showing
39 changed files
with
1,068 additions
and
79 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
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,2 @@ | ||
show_commit_timestamp_stmt ::= | ||
'SHOW' 'COMMIT' 'TIMESTAMP' |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
Oops, something went wrong.