-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: add FOR UPDATE locking modes to EXPLAIN output #44790
sql: add FOR UPDATE locking modes to EXPLAIN output #44790
Conversation
Relates to cockroachdb#40205. This change adds FOR UPDATE locking mode information to the EXPLAIN output of scanNodes. This is useful for testing that locking modes are being correctly propagated when a FOR [KEY] UPDATE/SHARE locking clause is specified. It will be even more useful for testing that locking clauses are being implicitly applied to UPDATE, UPSERT, and DELETE statements when we start performing that implicit transformation to their underlying scans.
dd1a4b9
to
d8d26ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten and @RaduBerinde)
pkg/sql/walk.go, line 189 at r1 (raw file):
v.observer.attr(name, "limit", fmt.Sprintf("%d", n.hardLimit)) } if n.lockingStrength != sqlbase.ScanLockingStrength_FOR_NONE {
[nit] consider adding a utility function somewhere that converts uppercase to lowercase and _
to space and then use it with lockingStrength.String()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTR!
bors r+
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde)
pkg/sql/walk.go, line 189 at r1 (raw file):
Previously, RaduBerinde wrote…
[nit] consider adding a utility function somewhere that converts uppercase to lowercase and
_
to space and then use it withlockingStrength.String()
I looked into making this change but decided it didn't make things any cleaner. The name we print out here also isn't exactly the name of the enum (which were copied from pg), so we'd need to switch that over. For now, I'm just going to leave this as-is.
44790: sql: add FOR UPDATE locking modes to EXPLAIN output r=nvanbenschoten a=nvanbenschoten Relates to #40205. This change adds FOR UPDATE locking mode information to the EXPLAIN output of scanNodes. This is useful for testing that locking modes are being correctly propagated when a FOR [KEY] UPDATE/SHARE locking clause is specified. It will be even more useful for testing that locking clauses are being implicitly applied to UPDATE, UPSERT, and DELETE statements when we start performing that implicit transformation to their underlying scans. We currently reject both non-standard locking wait-policies, so we can't easily test that code. I'm open to suggestions to address that, but I also don't think it's a very big issue at the moment and I don't think it makes sense to hold off on making the change while we're already here. If/when we let non-standard locking wait policies through the optimizer, we'll be able to add similar tests for them. Co-authored-by: Nathan VanBenschoten <[email protected]>
Build succeeded |
Relates to #40205.
This change adds FOR UPDATE locking mode information to the EXPLAIN
output of scanNodes. This is useful for testing that locking modes are
being correctly propagated when a FOR [KEY] UPDATE/SHARE locking clause
is specified. It will be even more useful for testing that locking clauses
are being implicitly applied to UPDATE, UPSERT, and DELETE statements when
we start performing that implicit transformation to their underlying scans.
We currently reject both non-standard locking wait-policies, so we can't easily
test that code. I'm open to suggestions to address that, but I also don't think it's
a very big issue at the moment and I don't think it makes sense to hold off on making
the change while we're already here. If/when we let non-standard locking wait policies
through the optimizer, we'll be able to add similar tests for them.