cockroachdb / cockroachdb/cockroach

kvcoord/kvserver: pre-emptive refresh not possible for some buffered writes transactions.

Open
#146,732 1 comment 0 reactions 0 assignees View on GitHub
A-buffered-writes branch-master C-bug T-kv
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Describe the problem**

In a transaction with write buffering enabled, many writes are replaced with a locking read and the write is buffered until it can be flushed during EndTxn.

Unlike a write, however, the locking Get requests we use in this case do not apply the timestamp cache. As a result read-write conflicts are not detected until we do flush the Put as part of the final EndTxn batch.

This has at least two possible problems:

1. Detecting the need to move the WriteTimestamp late means that on commit we evaluate all of the writes, evaluate the endtxn, return an error to the coord sender, do the refresh anyway and then retry the final batch. This seems like it would be substantially more expensive than doing the refresh straightaway.

2. Our observability surfaces around transaction conflicts are well-integrated into the pre-emptive refresh path but not the "refresh on failed endtxn" path.

(2) should probably be solved in general as it doesn't just impact buffered writes transactions. For (1) we've previously discussed allowing the client to somehow indicate that a locking get should apply the timestamp cache.

Jira issue: CRDB-50683

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.