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: use execution timestamps for verified when available #88550

Merged
merged 1 commit into from
Sep 26, 2022

Conversation

tbg
Copy link
Member

@tbg tbg commented Sep 23, 2022

Now that "most" operations save their execution timestamps, use them
for verification.

This has the undesirable side effect of failing the entire test suite,
which didn't bother specifying timestamps for most operations.

Now they are required, and need to be present, at least for all
mutations.

I took the opportunity to also clean up the test helpers a bit,
so now we don't have to pass an error when it's not required.

The big remaining caveat is that units that return with an ambiguous
result don't necessarily have a commit timestamp. I think this is only
an implementation detail. We could ensure that AmbiguousResultError
always contains the one possible commit timestamp. This should work
since TxnCoordSender is always local to kvnemesis, and so there's
no "fallible" component between the two.

This would result in a significant simplification of kvnemesis, since
as is when there are ambiguous deletions, we have to materialize them
but cannot assign them a timestamp. This complicates various code paths
and to be honest I'm not even sure what exactly we verify and how it all
works when there are such "half-materialized" writes. I would rather do
away with the concept altogether. Clearly we also won't be able to
simplify the verification to simply use commit order if there are
operations that don't have a timestamp, which is another reason to keep
pushing on this.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tbg tbg force-pushed the kvnemesis-use-exec-ts branch from 22df830 to 0da53fb Compare September 26, 2022 09:55
@tbg tbg marked this pull request as ready for review September 26, 2022 11:05
@tbg tbg requested a review from a team as a code owner September 26, 2022 11:05
@tbg tbg force-pushed the kvnemesis-use-exec-ts branch from 0da53fb to b02b03c Compare September 26, 2022 11:05
@tbg tbg requested review from erikgrinaker and a team September 26, 2022 11:05
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.

We could ensure that AmbiguousResultError always contains the one possible commit timestamp. This should work since TxnCoordSender is always local to kvnemesis, and so there's no "fallible" component between the two.

+1. Will we have to extend AmbiguousResultError with a special case for this, or can we have some test-only side channel in TxnCoordSender that we can use to obtain this in a clearer way?

pkg/kv/kvnemesis/validator.go Outdated Show resolved Hide resolved
Now that "most" operations save their execution timestamps, use them
for verification.

This has the undesirable side effect of failing the entire test suite,
which didn't bother specifying timestamps for most operations.

Now they are required, and need to be present, at least for all
mutations.

I took the opportunity to also clean up the test helpers a bit,
so now we don't have to pass an `error` when it's not required.

The big remaining caveat is that units that return with an ambiguous
result don't necessarily have a commit timestamp. I *think* this is only
an implementation detail. We *could* ensure that `AmbiguousResultError`
always contains the one possible commit timestamp. This should work
since `TxnCoordSender` is always local to `kvnemesis`, and so there's
no "fallible" component between the two.

This would result in a significant simplification of `kvnemesis`, since
as is when there are ambiguous deletions, we have to materialize them
but cannot assign them a timestamp. This complicates various code paths
and to be honest I'm not even sure what exactly we verify and how it all
works when there are such "half-materialized" writes. I would rather do
away with the concept altogether. Clearly we also won't be able to
simplify the verification to simply use commit order if there are
operations that don't have a timestamp, which is another reason to keep
pushing on this.

Release note: None
@tbg
Copy link
Member Author

tbg commented Sep 26, 2022

bors r=erikgrinaker

@tbg tbg force-pushed the kvnemesis-use-exec-ts branch from b02b03c to 09043a3 Compare September 26, 2022 13:16
@craig
Copy link
Contributor

craig bot commented Sep 26, 2022

Canceled.

@tbg
Copy link
Member Author

tbg commented Sep 26, 2022

bors r=erikgrinaker

@craig
Copy link
Contributor

craig bot commented Sep 26, 2022

Build succeeded:

@craig craig bot merged commit beb40b5 into cockroachdb:master Sep 26, 2022
@tbg tbg deleted the kvnemesis-use-exec-ts branch September 29, 2022 07:40
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