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: expose isolation level through kv.Txn API #100900

Merged

Conversation

nvanbenschoten
Copy link
Member

@nvanbenschoten nvanbenschoten commented Apr 7, 2023

Fixes #100130.

This commit exposes isolation levels through the kv.Txn API with the introduction of a new SetIsoLevel method. This method behaves similarly to SetUserPriority. Notably, the isolation must be set before any operations are performed on the transaction.

Release note: None

@nvanbenschoten nvanbenschoten requested review from a team as code owners April 7, 2023 03:42
@nvanbenschoten nvanbenschoten requested a review from a team April 7, 2023 03:42
@nvanbenschoten nvanbenschoten requested a review from a team as a code owner April 7, 2023 03:42
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 5 of 5 files at r1, 16 of 16 files at r2, 6 of 6 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball and @nvanbenschoten)


pkg/kv/kvclient/kvcoord/txn_coord_sender_test.go line 74 at r3 (raw file):

// TestTxnCoordSenderAssignsTxnKey verifies that a transaction is assigned a
// transaction record key corresponding to the first key it writes.

Do you think it's worth extending this test to check for locking reads as well? Doesn't have to be in this patch.

Fixes cockroachdb#100130.

This commit exposes isolation levels through the kv.Txn API with the
introduction of a new `SetIsoLevel` method. This method behaves
similarly to `SetUserPriority`. Notably, the isolation must be set
before any operations are performed on the transaction.

Release note: None
Copy link
Member Author

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

TFTR!

bors r=arulajmani

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @arulajmani and @DrewKimball)


pkg/kv/kvclient/kvcoord/txn_coord_sender_test.go line 74 at r3 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Do you think it's worth extending this test to check for locking reads as well? Doesn't have to be in this patch.

TestTxnHeartbeaterLoopStartedOnFirstLock is a better test that sits alongside TestTxnHeartbeaterSetsTransactionKey and exercises that case, so I don't think we need anything more here. This test here is already of limited utility. I'm reviving it mostly because it gives coverage of a setting and getting a few txn attributes.

@craig
Copy link
Contributor

craig bot commented Apr 7, 2023

Build failed:

@nvanbenschoten
Copy link
Member Author

Bors flaked on a timeout in TestConcurrentMigrationAttempts, which is unrelated. I pinged #100873 (comment) and am going to give this another spin.

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 7, 2023

Build succeeded:

@craig craig bot merged commit 6bf00e2 into cockroachdb:master Apr 7, 2023
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.

kv: expose isolation level through kv.Txn API
3 participants