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

opt: add enable_durable_locking_for_serializable session variable #107749

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

michae2
Copy link
Collaborator

@michae2 michae2 commented Jul 27, 2023

Follow-up from #105857

This commit ammends 6a3e43d to add a session variable to control whether guaranteed-durable locks are used under serializable isolation.

Informs: #100194

Epic: CRDB-25322

Release note (sql change): Add a new session variable, enable_durable_locking_for_serializable, which controls locking durability under serializable isolation. With this set to true, SELECT FOR UPDATE locks, SELECT FOR SHARED locks, and constraint check locks (e.g. locks acquired during foreign key checks if
enable_implicit_fk_locking_for_serializable is set to true) will be guaranteed-durable under serializable isolation, meaning they will always be held to transaction commit. (These locks are always guaranteed-durable under weaker isolation levels.)

By default, under serializable isolation these locks are best-effort rather than guaranteed-durable, meaning in some cases (e.g. leaseholder transfer, node loss, etc.) they could be released before transaction commit. Serializable isolation does not rely on locking for correctness, only using it to improve performance under contention, so this default is a deliberate choice to avoid the performance overhead of lock replication.

@michae2 michae2 requested a review from a team as a code owner July 27, 2023 20:08
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@DrewKimball DrewKimball 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 8 of 8 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten)

@DrewKimball
Copy link
Collaborator

You'll have to regenerate the information_schema, pg_catalog, and show_source logictests.

Follow-up from cockroachdb#105857

This commit ammends 6a3e43d to add a
session variable to control whether guaranteed-durable locks are used
under serializable isolation.

Informs: cockroachdb#100194

Epic: CRDB-25322

Release note (sql change): Add a new session variable,
`enable_durable_locking_for_serializable`, which controls locking
durability under serializable isolation. With this set to true, SELECT
FOR UPDATE locks, SELECT FOR SHARED locks, and constraint check locks
(e.g. locks acquired during foreign key checks if
`enable_implicit_fk_locking_for_serializable` is set to true) will be
guaranteed-durable under serializable isolation, meaning they will
always be held to transaction commit. (These locks are always
guaranteed-durable under weaker isolation levels.)

By default, under serializable isolation these locks are best-effort
rather than guaranteed-durable, meaning in some cases (e.g. leaseholder
transfer, node loss, etc.) they could be released before transaction
commit. Serializable isolation does not rely on locking for correctness,
only using it to improve performance under contention, so this default
is a deliberate choice to avoid the performance overhead of lock
replication.
@michae2
Copy link
Collaborator Author

michae2 commented Jul 27, 2023

Thanks!

bors r=DrewKimball

Copy link
Member

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

:lgtm:

Reviewed 8 of 8 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @michae2)

@craig
Copy link
Contributor

craig bot commented Jul 28, 2023

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jul 28, 2023

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jul 28, 2023

Build failed:

@michae2
Copy link
Collaborator Author

michae2 commented Jul 28, 2023

The failures seem unrelated, so I'll try again.

bors r=DrewKimball,nvanbenschoten

@craig
Copy link
Contributor

craig bot commented Jul 28, 2023

This PR was included in a batch that was canceled, it will be automatically retried

@craig craig bot merged commit 04c91a5 into cockroachdb:master Jul 28, 2023
@craig
Copy link
Contributor

craig bot commented Jul 28, 2023

Build succeeded:

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.

4 participants