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

kv/kvprober: use single batch in write probe #80007

Merged

Conversation

nvanbenschoten
Copy link
Member

This commit adjusts proberOpsImpl.Write to issue its Put, Del, and
EndTxn in a single Batch. This has a few positive effects:

  1. it avoids writing intents
  2. it requires a single pass through Raft
  3. it avoids a pipeline stall after the Put goes through async consensus
  4. it avoids async cleanup work after the txn commits

It's not strictly necessary that we Put before we Del the key, because a
Del is blind and leaves a tombstone even when the key is not live, but
this is not guaranteed by the API, so we avoid depending on a subtlety
of the implementation.

This commit adjusts `proberOpsImpl.Write` to issue its `Put`, `Del`, and
`EndTxn` in a single `Batch`. This has a few positive effects:
1. it avoids writing intents
2. it requires a single pass through Raft
3. it avoids a pipeline stall after the Put goes through async consensus
4. it avoids async cleanup work after the txn commits

It's not strictly necessary that we Put before we Del the key, because a
Del is blind and leaves a tombstone even when the key is not live, but
this is not guaranteed by the API, so we avoid depending on a subtlety
of the implementation.
@nvanbenschoten nvanbenschoten requested a review from a team as a code owner April 15, 2022 19:25
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@joshimhoff joshimhoff left a comment

Choose a reason for hiding this comment

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

Lovely! Can't wait to roll this out to prod and see a nice drop in fleet-wide kvprober write latency.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @tbg)

@nvanbenschoten
Copy link
Member Author

TFTRs!

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 18, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Apr 18, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Apr 18, 2022

Build succeeded:

@craig craig bot merged commit b34f42d into cockroachdb:master Apr 18, 2022
@nvanbenschoten nvanbenschoten deleted the nvanbenschoten/kvproberBatch branch April 20, 2022 02:50
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.

4 participants