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

sql: add SHOW COMMIT TIMESTAMP to retrieve a causality token #80848

Merged

Commits on Nov 21, 2022

  1. sql: add SHOW COMMIT TIMESTAMP to retrieve a causality token

    Fixes cockroachdb#79591
    
    Relates to cockroachdb#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`).
    ajwerner committed Nov 21, 2022
    Configuration menu
    Copy the full SHA
    2b86f13 View commit details
    Browse the repository at this point in the history