release-22.1: sql/opt: propagate row-level locking mode to index, lookup, inverted, and zigzag joins#81348
Closed
nvb wants to merge 4 commits intocockroachdb:release-22.1from
Closed
release-22.1: sql/opt: propagate row-level locking mode to index, lookup, inverted, and zigzag joins#81348nvb wants to merge 4 commits intocockroachdb:release-22.1from
nvb wants to merge 4 commits intocockroachdb:release-22.1from
Conversation
This commit separates an unresolved row-level locking target from a new row-level locking properties struct. The former is used to represent a row-level locking clause that is then "resolved" to specific relational operators. Once attached to a specific operator, the locking mode no longer needs to include a target, so it makes sense to represent as a separate struct. This addresses Radu's comment from cockroachdb#60719.
…ted joins Fixes cockroachdb#56941. This commit updates the execbuilder to propagate row-level locking modes through transformations from standard Scan and Join operations to specialized IndexJoin, LookupJoin, and InvertedJoin operations. Release note (sql change): table scans performed as a part of index joins, lookup joins, and inverted joins now respect the row-level locking strength and wait policy specified by the optional FOR SHARE/UPDATE [NOWAIT] clause on SELECT statements.
This commit updates the execbuilder to propagate row-level locking modes through transformations from standard Scan and Join operations to ZigZagJoins, and allows for the use of zigzag joins when explicit row-level locking modes are in use. Release note (sql change): table scans performed as a part of zigzag joins now respect the row-level locking strength and wait policy specified by the optional FOR SHARE/UPDATE [NOWAIT] clause on SELECT statements.
This commit adds a new `pkg/sql/opt/xform/testdata/rules/select_for_update` test to `pkg/sql/opt/xform`'s TestRules test suite. This allows the select for update tests to use the `opt` directive to show joins, assert the use of specific rules, and assert the propagation of row-level locking modes into joins.
|
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
Member
yuzefovich
reviewed
May 17, 2022
Member
yuzefovich
left a comment
There was a problem hiding this comment.
Reviewed 27 of 27 files at r1, 19 of 19 files at r2, 15 of 15 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @michae2 and @nvanbenschoten)
pkg/sql/execinfrapb/processors_sql.proto line 492 at r3 (raw file):
// Indicates the row-level locking strength to be used by the scan. If set to // FOR_NONE, no row-level locking should be performed. repeated sqlbase.ScanLockingStrength locking_strengths = 1000 [(gogoproto.nullable) = false];
Did you mean to use such large numbers here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport:
Please see individual PRs for details.
Release justification: low-risk improvement to rare functionality.
/cc @cockroachdb/release