Skip to content

Commit

Permalink
Fix for issue cockroachdb#4666
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiwanee committed Sep 14, 2020
1 parent 53bfb5f commit ceb9063
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 32 deletions.
12 changes: 4 additions & 8 deletions v19.1/architecture/life-of-a-distributed-transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,10 @@ If an operation encounters a write intent for a key, it attempts to "resolve" th

- `COMMITTED`, this operation converts the write intent to a regular key-value pair, and then proceeds as if it had read that value instead of a write intent.
- `ABORTED`, this operation discards the write intent and reads the next-most-recent value from RocksDB.
- `PENDING`, the new transaction attempts to "push" the write intent's transaction by moving that transaction's timestamp forward (i.e., ahead of this transaction's timestamp); however, this only succeeds if the write intent's transaction has become inactive.

If the push succeeds, the operation continues.

If this push fails (which is the majority of the time), this transaction goes into the [`TxnWaitQueue`](https://www.cockroachlabs.com/docs/stable/architecture/transaction-layer.html#txnwaitqueue) on this node. The incoming transaction can only continue once the blocking transaction completes (i.e., commits or aborts).
- _Missing_, the resolver consults the write intent's timestamp. If it was created within the transaction liveness threshold, it treats the transaction record as exhibiting the `PENDING` behavior, with the addition of tracking the push in the range's timestamp cache, which will inform the transaction that its timestamp was pushed once the transaction record gets created.

If the write intent is older than the transaction liveness threshold, the resolution exhibits the `ABORTED` behavior.
- `PENDING`, the new transaction attempts to "push" the write intent's transaction by moving that transaction's timestamp forward (i.e., ahead of this transaction's timestamp); however, this only succeeds if the write intent's transaction has become inactive.
- If the push succeeds, the operation continues.
- If this push fails (which is the majority of the time), this transaction goes into the [`TxnWaitQueue`](https:www.cockroachlabs.com/docs/stable/architecture/transaction-layer.html#txnwaitqueue) on this node. The incoming transaction can only continue once the blocking transaction completes (i.e., commits or aborts).
- `MISSING`, the resolver consults the write intent's timestamp. If it was created within the transaction liveness threshold, it treats the transaction record as exhibiting the `PENDING` behavior, with the addition of tracking the push in the range's timestamp cache, which will inform the transaction that its timestamp was pushed once the transaction record gets created.If the write intent is older than the transaction liveness threshold, the resolution exhibits the `ABORTED` behavior.

Note that transaction records might be missing because we've avoided writing the record until the transaction commits. For more information, see [Transaction Layer: Transaction records](transaction-layer.html#transaction-records).

Expand Down
13 changes: 5 additions & 8 deletions v19.2/architecture/life-of-a-distributed-transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,18 @@ If an operation encounters a write intent for a key, it attempts to "resolve" th

- `COMMITTED`, this operation converts the write intent to a regular key-value pair, and then proceeds as if it had read that value instead of a write intent.
- `ABORTED`, this operation discards the write intent and reads the next-most-recent value from RocksDB.
- `PENDING`, the new transaction attempts to "push" the write intent's transaction by moving that transaction's timestamp forward (i.e., ahead of this transaction's timestamp); however, this only succeeds if the write intent's transaction has become inactive.

If the push succeeds, the operation continues.

If this push fails (which is the majority of the time), this transaction goes into the [`TxnWaitQueue`](https://www.cockroachlabs.com/docs/stable/architecture/transaction-layer.html#txnwaitqueue) on this node. The incoming transaction can only continue once the blocking transaction completes (i.e., commits or aborts).
- _Missing_, the resolver consults the write intent's timestamp. If it was created within the transaction liveness threshold, it treats the transaction record as exhibiting the `PENDING` behavior, with the addition of tracking the push in the range's timestamp cache, which will inform the transaction that its timestamp was pushed once the transaction record gets created.

If the write intent is older than the transaction liveness threshold, the resolution exhibits the `ABORTED` behavior.
- `PENDING`, the new transaction attempts to "push" the write intent's transaction by moving that transaction's timestamp forward (i.e., ahead of this transaction's timestamp); however, this only succeeds if the write intent's transaction has become inactive.
- If the push succeeds, the operation continues.
- If this push fails (which is the majority of the time), this transaction goes into the [`TxnWaitQueue`](https:www.cockroachlabs.com/docs/stable/architecture/transaction-layer.html#txnwaitqueue) on this node. The incoming transaction can only continue once the blocking transaction completes (i.e., commits or aborts).
- `MISSING`, the resolver consults the write intent's timestamp. If it was created within the transaction liveness threshold, it treats the transaction record as exhibiting the `PENDING` behavior, with the addition of tracking the push in the range's timestamp cache, which will inform the transaction that its timestamp was pushed once the transaction record gets created.If the write intent is older than the transaction liveness threshold, the resolution exhibits the `ABORTED` behavior.

Note that transaction records might be missing because we've avoided writing the record until the transaction commits. For more information, see [Transaction Layer: Transaction records](transaction-layer.html#transaction-records).

Check out our architecture documentation for more information about [CockroachDB's transactional model](transaction-layer.html).

#### Read Operations


If the read doesn't encounter a write intent and the key-value operation is meant to serve a read, it can simply use the value it read from the leaseholder's instance of RocksDB. This works because the leaseholder had to be part of the Raft consensus group for any writes to complete, meaning it must have the most up-to-date version of the range's data.

The leaseholder aggregates all read responses into a `BatchResponse` that will get returned to the gateway node's `DistSender`.
Expand Down
12 changes: 4 additions & 8 deletions v20.1/architecture/life-of-a-distributed-transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,10 @@ If an operation encounters a write intent for a key, it attempts to "resolve" th

- `COMMITTED`, this operation converts the write intent to a regular key-value pair, and then proceeds as if it had read that value instead of a write intent.
- `ABORTED`, this operation discards the write intent and reads the next-most-recent value from RocksDB.
- `PENDING`, the new transaction attempts to "push" the write intent's transaction by moving that transaction's timestamp forward (i.e., ahead of this transaction's timestamp); however, this only succeeds if the write intent's transaction has become inactive.

If the push succeeds, the operation continues.

If this push fails (which is the majority of the time), this transaction goes into the [`TxnWaitQueue`](https://www.cockroachlabs.com/docs/stable/architecture/transaction-layer.html#txnwaitqueue) on this node. The incoming transaction can only continue once the blocking transaction completes (i.e., commits or aborts).
- _Missing_, the resolver consults the write intent's timestamp. If it was created within the transaction liveness threshold, it treats the transaction record as exhibiting the `PENDING` behavior, with the addition of tracking the push in the range's timestamp cache, which will inform the transaction that its timestamp was pushed once the transaction record gets created.

If the write intent is older than the transaction liveness threshold, the resolution exhibits the `ABORTED` behavior.
- `PENDING`, the new transaction attempts to "push" the write intent's transaction by moving that transaction's timestamp forward (i.e., ahead of this transaction's timestamp); however, this only succeeds if the write intent's transaction has become inactive.
- If the push succeeds, the operation continues.
- If this push fails (which is the majority of the time), this transaction goes into the [`TxnWaitQueue`](https:www.cockroachlabs.com/docs/stable/architecture/transaction-layer.html#txnwaitqueue) on this node. The incoming transaction can only continue once the blocking transaction completes (i.e., commits or aborts).
- `MISSING`, the resolver consults the write intent's timestamp. If it was created within the transaction liveness threshold, it treats the transaction record as exhibiting the `PENDING` behavior, with the addition of tracking the push in the range's timestamp cache, which will inform the transaction that its timestamp was pushed once the transaction record gets created.If the write intent is older than the transaction liveness threshold, the resolution exhibits the `ABORTED` behavior.

Note that transaction records might be missing because we've avoided writing the record until the transaction commits. For more information, see [Transaction Layer: Transaction records](transaction-layer.html#transaction-records).

Expand Down
12 changes: 4 additions & 8 deletions v20.2/architecture/life-of-a-distributed-transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,10 @@ If an operation encounters a write intent for a key, it attempts to "resolve" th

- `COMMITTED`, this operation converts the write intent to a regular key-value pair, and then proceeds as if it had read that value instead of a write intent.
- `ABORTED`, this operation discards the write intent and reads the next-most-recent value from RocksDB.
- `PENDING`, the new transaction attempts to "push" the write intent's transaction by moving that transaction's timestamp forward (i.e., ahead of this transaction's timestamp); however, this only succeeds if the write intent's transaction has become inactive.

If the push succeeds, the operation continues.

If this push fails (which is the majority of the time), this transaction goes into the [`TxnWaitQueue`](https://www.cockroachlabs.com/docs/stable/architecture/transaction-layer.html#txnwaitqueue) on this node. The incoming transaction can only continue once the blocking transaction completes (i.e., commits or aborts).
- _Missing_, the resolver consults the write intent's timestamp. If it was created within the transaction liveness threshold, it treats the transaction record as exhibiting the `PENDING` behavior, with the addition of tracking the push in the range's timestamp cache, which will inform the transaction that its timestamp was pushed once the transaction record gets created.

If the write intent is older than the transaction liveness threshold, the resolution exhibits the `ABORTED` behavior.
- `PENDING`, the new transaction attempts to "push" the write intent's transaction by moving that transaction's timestamp forward (i.e., ahead of this transaction's timestamp); however, this only succeeds if the write intent's transaction has become inactive.
- If the push succeeds, the operation continues.
- If this push fails (which is the majority of the time), this transaction goes into the [`TxnWaitQueue`](https:www.cockroachlabs.com/docs/stable/architecture/transaction-layer.html#txnwaitqueue) on this node. The incoming transaction can only continue once the blocking transaction completes (i.e., commits or aborts).
- `MISSING`, the resolver consults the write intent's timestamp. If it was created within the transaction liveness threshold, it treats the transaction record as exhibiting the `PENDING` behavior, with the addition of tracking the push in the range's timestamp cache, which will inform the transaction that its timestamp was pushed once the transaction record gets created.If the write intent is older than the transaction liveness threshold, the resolution exhibits the `ABORTED` behavior.

Note that transaction records might be missing because we've avoided writing the record until the transaction commits. For more information, see [Transaction Layer: Transaction records](transaction-layer.html#transaction-records).

Expand Down

0 comments on commit ceb9063

Please sign in to comment.