cockroachdb / cockroachdb/cockroach

kvclient: figure out the MVCC timestamp for the buffered write

Open
#144,166 0 comments 0 reactions 0 assignees View on GitHub
A-buffered-writes C-cleanup
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Currently, if the write is served from the buffer, it'll come back with an empty MVCC timestamp
```sql
create table t (k int primary key);
set kv_transaction_buffered_writes_enabled = true;
begin;
insert into t values (1);
-- returns 0.0000000000
select crdb_internal_mvcc_timestamp from t;
commit;
-- returns write timestamp
select crdb_internal_mvcc_timestamp from t;
```
We probably should synthesize the MVCC timestamp at _some_ point (either when adding to the buffer or when serving a read from the buffer). We should figure out where that happens on the KV server side and ensure that we don't break any invariants there.

Jira issue: CRDB-49263

Contributor guide

Open the contributing guide

Research direction

Start with the SQL reproduction using buffered writes, then trace the KV server-side path for writes served from the buffer. Determine whether the MVCC timestamp should be synthesized when buffering or when serving the read, while checking the relevant invariants. Done means the buffered read returns a correct MVCC timestamp without changing the post-commit timestamp behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.