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

Clarify transaction_timeout and idle_in_transaction_session_timeout #19330

Open
mgartner opened this issue Jan 30, 2025 · 0 comments
Open

Clarify transaction_timeout and idle_in_transaction_session_timeout #19330

mgartner opened this issue Jan 30, 2025 · 0 comments

Comments

@mgartner
Copy link
Contributor

mgartner commented Jan 30, 2025

The docs for transaction_timeout state:

Aborts an explicit transaction when it runs longer than the configured duration. Stored in milliseconds; can be expressed in milliseconds or as an INTERVAL.

This is misleading because, while it is true that the transaction automatically enters an "aborted" state, any locks that it acquired on previously mutated rows remain held, blocking concurrent mutations on the same rows. In other words, transaction_timeout is not a sufficient safeguard against a poorly behaving application that begins a transaction and never commits, aborts, or rolls-back.

I believe the idle_in_transaction_session_timeout setting is the correct safeguard to use in this case:

Automatically terminates sessions that are idle in a transaction past the specified threshold.

Some suggestions I have for making this more clear in the docs:

  1. The description of transaction_timeout should be clear that it is insufficient to safeguard against a txn that is never explicity committed, aborted, rolled-back, and it should mention the idle_in_transaction_session_timeout as an alternative.
  2. The description of idle_in_transaction_session_timeout should make it clear that it is a good safeguard to use. It should also be more explicit about how locks held by the txn are released when the connection is closed.

There is some more context in the release note in cockroachdb/cockroach#89033 that added transaction_timeout.

Jira issue: DOC-12189

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

No branches or pull requests

1 participant