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

kvclient: add a btree to store buffered writes #139963

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

arulajmani
Copy link
Collaborator

This patch introduces a btree to buffer writes on the txnWriteBuffer interceptor.

References #139053

Release note: None

@arulajmani arulajmani requested review from a team as code owners January 28, 2025 18:28
Copy link

blathers-crl bot commented Jan 28, 2025

Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I did not review the generated code.

pkg/kv/kvclient/kvcoord/txn_interceptor_pipeliner.go Outdated Show resolved Hide resolved
This patch introduces a btree to buffer writes on the txnWriteBuffer
interceptor.

References cockroachdb#139053

Release note: None
@arulajmani
Copy link
Collaborator Author

TFTR! I had to do some hacky stuff to calm down static check, but that should go away once the next PR is in.

bors r=stevendanna

@craig craig bot merged commit 05eaf5a into cockroachdb:master Jan 29, 2025
22 checks passed
craig bot pushed a commit that referenced this pull request Feb 7, 2025
140001: kvclient: buffer blind writes on the client r=stevendanna,yuzefovich a=arulajmani

First commit from  #139963.

----

This patch adds logic to buffer blind writes (Puts or Deletes) in the
txnWriteBuffer. Interceptors and layers above remain oblivious to the
txnWriteBuffer's decision to buffer any writes.

All buffered writes are flushed at commit time, in the same batch as
the EndTxn request. This flushing at commit time is also hidden from
interceptors above the txnWriteBuffer by stripping responses on the
return path.

The code structure here allows us to split a batch request into
different bits, where some portion is evaluated locally and the rest
is sent to the KV layer. It's written with a future where we split
read-write requests (e.g. CPuts) into separte read/write halves, where
the read portion needs to be evaluated at the leaseholder, but the write
needs to be buffered.

Closes #139053

Release note: None

Co-authored-by: Arul Ajmani <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants