Skip to content

concurrency: non-locking reads of RC txns ignore exclusive locks#106316

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
arulajmani:rc-ignore-exclusive-non-locking-reads
Jul 24, 2023
Merged

concurrency: non-locking reads of RC txns ignore exclusive locks#106316
craig[bot] merged 2 commits intocockroachdb:masterfrom
arulajmani:rc-ignore-exclusive-non-locking-reads

Conversation

@arulajmani
Copy link
Copy Markdown
Collaborator

@arulajmani arulajmani commented Jul 6, 2023

Non-locking reads issued by transactions that can tolerate write-skew
do not block on exclusive locks after this patch.

Resolves #94729

Release note: None

@arulajmani arulajmani requested a review from nvb July 6, 2023 17:50
@arulajmani arulajmani requested a review from a team as a code owner July 6, 2023 17:50
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@arulajmani
Copy link
Copy Markdown
Collaborator Author

@nvanbenschoten feel free to hold off on the review until we've landed the other PRs; I just wanted to get this out before addressing comments on those ones.

@arulajmani arulajmani changed the title concurrency: non-locking reads ignore of RC txns ignore exclusive locks concurrency: non-locking reads of RC txns ignore exclusive locks Jul 6, 2023
@arulajmani arulajmani force-pushed the rc-ignore-exclusive-non-locking-reads branch from a613893 to 3a174e2 Compare July 21, 2023 21:10
@arulajmani
Copy link
Copy Markdown
Collaborator Author

@nvanbenschoten this should be good for a look now!

Copy link
Copy Markdown
Contributor

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

:lgtm:

Reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @arulajmani)


pkg/kv/kvserver/concurrency/testdata/lock_table/read_committed line 7 at r1 (raw file):

----

new-txn txn=txn2 ts=10,1 epoch=0 iso=read-committed

Want to call this file isolation_level and make this txn snapshot iso?


pkg/kv/kvserver/concurrency/testdata/lock_table/read_committed line 15 at r1 (raw file):

# ------------------------------------------------------------------------------
# Test that non-locking reads from RC transactions do not block on exclusive
# exclusive locks held by other RC/Serializable transactions.

"exclusive exclusive"


pkg/kv/kvserver/concurrency/testdata/lock_table/read_committed line 88 at r1 (raw file):

num=1
 lock: "a"
  holder: txn: 00000000-0000-0000-0000-000000000002 epoch: 0, ts: 10.000000000,1, info: repl

Should we include the isolation level in this output? Maybe at least for non-SSI lock holders?


pkg/kv/kvserver/concurrency/lock_table_test.go line 731 at r1 (raw file):

}

func ScanIsoLevel(t *testing.T, d *datadriven.TestData) isolation.Level {

nit: don't split ScanLockStrength from scanLockStrength.

Non-locking reads issued by transactions that can tolerate write-skew
do not block on exclusive locks after this patch.

Resolves cockroachdb#94729

Release note: None
Now that we've got multiple isolation levels in the system, let's print
the lock holder's isolation level when formatting it. The line count
here is entirely test churn.

Epic: none

Release note: None
@arulajmani arulajmani force-pushed the rc-ignore-exclusive-non-locking-reads branch from 3a174e2 to f3d2a83 Compare July 24, 2023 20:19
Copy link
Copy Markdown
Collaborator Author

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

TFTR!

bors r=nvanbenschoten

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


pkg/kv/kvserver/concurrency/lock_table_test.go line 731 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

nit: don't split ScanLockStrength from scanLockStrength.

Did you mean getStrength? If so, done.


pkg/kv/kvserver/concurrency/testdata/lock_table/read_committed line 7 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Want to call this file isolation_level and make this txn snapshot iso?

Good call. I changed the file name and extended these tests to cover snapshot transactions as well. It was a bit more involved than changing the isolation level of this transaction, but the test coverage is much better now.


pkg/kv/kvserver/concurrency/testdata/lock_table/read_committed line 88 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Should we include the isolation level in this output? Maybe at least for non-SSI lock holders?

That's a good call. I ended up including isolation level information for all transactions, not just SI and RC; there's quite some test churn, but IMO it's trivial, so no point special casing. It's the second commit that I tacked on this PR.

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 24, 2023

Build succeeded:

@craig craig bot merged commit eb0a104 into cockroachdb:master Jul 24, 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: non-locking reads ignore exclusive locks

3 participants