Skip to content

kv: expose isolation level through kv.Txn API#100900

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/txnAPIIsoLevel
Apr 7, 2023
Merged

kv: expose isolation level through kv.Txn API#100900
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/txnAPIIsoLevel

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb 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

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

This change is Reviewable

@nvb nvb force-pushed the nvanbenschoten/txnAPIIsoLevel branch from b3a576c to d6a530e Compare April 7, 2023 15:43
Copy link
Copy Markdown
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
@nvb nvb force-pushed the nvanbenschoten/txnAPIIsoLevel branch from d6a530e to 2e83183 Compare April 7, 2023 20:00
Copy link
Copy Markdown
Contributor Author

@nvb nvb 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
Copy Markdown
Contributor

craig bot commented Apr 7, 2023

Build failed:

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Apr 7, 2023

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
Copy Markdown
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