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

kvserver: fix reproposals test with pipelined writes #113658

Merged
merged 4 commits into from
Nov 3, 2023

Conversation

pav-kv
Copy link
Collaborator

@pav-kv pav-kv commented Nov 2, 2023

Before this commit, the test was a no-op reporting 0 metrics. This is due to isOurCommand function which assumed that the key increment request is always the first request in BatchRequest. With pipelined writes, this is not true.

A typical request is:

QueryIntent ["00001-testing",/Min), Increment ["00001-testing",/Min)

In this commit, isOutCommand scans the BatchRequest to find the command.

Before:

observed 0 async write restarts, observed 0/0 injected aborts, 0 injected illegal lease applied indexes
commands reproposed (unchanged): 1
commands reproposed (new LAI): 0

After:

observed 69 async write restarts, observed 0/69 injected aborts, 366 injected illegal lease applied indexes
commands reproposed (unchanged): 1
commands reproposed (new LAI): 297

Fixes #106504
Touches #110551
Epic: none
Release note: none

Epic: none
Release note: none
Before this commit, the test was a no-op reporting 0 metrics. This is
due to isOurCommand function which assumed that the key increment
request is always the first request in BatchRequest. With pipelined
writes, this is not true.

A typical request is:
  QueryIntent ["00001-testing",/Min), Increment ["00001-testing",/Min)

In this commit, isOutCommand scans the BatchRequest to find the command.

Before:
```
observed 0 async write restarts, observed 0/0 injected aborts, 0 injected illegal lease applied indexes
commands reproposed (unchanged): 1
commands reproposed (new LAI): 0
```
After:
```
observed 69 async write restarts, observed 0/69 injected aborts, 366 injected illegal lease applied indexes
commands reproposed (unchanged): 1
commands reproposed (new LAI): 297
```

Epic: none
Release note: none
@pav-kv pav-kv requested a review from a team as a code owner November 2, 2023 10:37
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@pav-kv pav-kv added the backport-23.2.x Flags PRs that need to be backported to 23.2. label Nov 2, 2023
Copy link
Contributor

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

Nice find, thanks!

pkg/kv/kvserver/replica_raft_test.go Outdated Show resolved Hide resolved
pkg/kv/kvserver/replica_raft_test.go Show resolved Hide resolved
Epic: none
Release note: none
@pav-kv
Copy link
Collaborator Author

pav-kv commented Nov 3, 2023

bors r=erikgrinaker

@craig
Copy link
Contributor

craig bot commented Nov 3, 2023

Build succeeded:

@craig craig bot merged commit 08a253e into cockroachdb:master Nov 3, 2023
8 checks passed
@pav-kv pav-kv deleted the reproposal-testing branch November 6, 2023 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.2.x Flags PRs that need to be backported to 23.2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kvserver: add test to verify tryReproposeWithNewLeaseIndex behaviour
3 participants