Skip to content

Commit

Permalink
Add docs for "transaction deadline exceeded" error
Browse files Browse the repository at this point in the history
Fixes #4552.

Summary of changes:

- Update 'Common Errors' page with this retry error message, and
  recommend that the user add retries to their app.

- Also spruced up the txn restart section intro with some links to
  reference docs on how txns work in CockroachDB for the curious.
  • Loading branch information
rmloveland committed Apr 15, 2019
1 parent 693a85e commit 5a12ec5
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion v19.1/common-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@ To resolve this issue, use the [`cockroach cert client-create`](create-security-

Messages with the error code `40001` and the string `restart transaction` indicate that a transaction failed because it conflicted with another concurrent or recent transaction accessing the same data. The transaction needs to be retried by the client. See [client-side transaction retries](transactions.html#client-side-transaction-retries) for more details.

The sections below describe different types of transaction retry errors. Your application's retry logic does not need to distinguish between these types of errors; they are listed here for reference.
The sections below describe different types of transaction retry errors. **Your application's retry logic does not need to distinguish between these types of errors**; they are listed here for reference.

- [read within uncertainty interval](#read-within-uncertainty-interval)
- [transaction deadline exceeded](#transaction-deadline-exceeded)

{{site.data.alerts.callout_success}}
To understand how transactions work in CockroachDB, and why transaction retries are necessary to maintain serializable isolation in a distributed database, see:

- [Transaction Layer](architecture/transaction-layer.html)
- [Life of a Distributed Transaction](architecture/life-of-a-distributed-transaction.html)
{{site.data.alerts.end}}

### read within uncertainty interval

Expand All @@ -73,6 +81,12 @@ When errors like this occur, the application has the following options:
Uncertainty errors are a form of transaction conflict. For more information about transaction conflicts, see [Transaction conflicts](architecture/transaction-layer.html#transaction-conflicts).
{{site.data.alerts.end}}

### transaction deadline exceeded

<span class="version-tag">New in v19.1</span>: Errors which were previously reported to the client as opaque `TransactionStatusError`s are now transaction retry errors with the error message "transaction deadline exceeded" and error code `4001`. This error can occur when transactions are long-running (on the order of minutes) and are pushed in the transaction queue to maintain [serializable isolation](https://en.wikipedia.org/wiki/Isolation_(database_systems)#Serializable). The mechanics of this process are described in [Life of a Distributed Transaction](architecture/life-of-a-distributed-transaction.html).

When this error occurs, the application must retry the transaction. For more information about how to retry transactions, see [Transaction retries](transactions.html#transaction-retries).

<!-- ### write too old -->

<!-- ### async write failure -->
Expand Down

0 comments on commit 5a12ec5

Please sign in to comment.