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

sql: remove sql.defaults.optimizer_use_not_visible_indexes.enabled #86634

Merged
merged 2 commits into from
Aug 25, 2022

Conversation

michae2
Copy link
Collaborator

@michae2 michae2 commented Aug 23, 2022

sql: remove sql.defaults.optimizer_use_not_visible_indexes.enabled

In 22.2 the use of cluster settings for session setting defaults is
deprecated, but I forgot this when reviewing #86033. Remove the
unreleased default cluster setting we added.

Release note: None

sql: add more session variables to statement bundles

Add some missing session variables to statement diagnostic bundles. This
isn't quite everything, but it's better than what we had before.

Release note: None


Release justification: low-risk bug fix.

@michae2 michae2 requested review from rafiss, rytaft, wenyihu6 and a team August 23, 2022 05:10
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@mgartner mgartner 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 6 of 6 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @michae2, @rafiss, @rytaft, and @wenyihu6)


-- commits line 11 at r1:
I don't think a release note is necessary because the setting is not included in any releases.


pkg/sql/exec_util.go line 402 at r1 (raw file):

var optUseNotVisibleIndexesClusterMode = settings.RegisterBoolSetting(
	settings.TenantWritable,
	"sql.defaults.optimizer_use_not_visible_indexes.enabled",

Looks like the check added in #80575 isn't stern enough. Maybe we should add something like this to pkg/settings/registry.go:

// WARNING: Nevertincrease this constant.
const maxSQLDefaults = 48;

func init() {
    if len(sqlDefaultSettings) > maxSQLDefaults {
        panic("new sql.defaults cluster settings are not needed now that `ALTER ROLE ... SET` syntax is supported")
    }
}

Copy link
Contributor

@wenyihu6 wenyihu6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first commit :lgtm: Thanks for fixing this!!

Reviewed all commit messages.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @michae2, @rafiss, and @rytaft)

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the change! let's not have a release note on this commit. a user reading the notes won't be able to make sense of it, since we never released a CRDB version that includes this cluster setting

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @mgartner and @rytaft)


pkg/sql/exec_util.go line 402 at r1 (raw file):

Previously, mgartner (Marcus Gartner) wrote…

Looks like the check added in #80575 isn't stern enough. Maybe we should add something like this to pkg/settings/registry.go:

// WARNING: Nevertincrease this constant.
const maxSQLDefaults = 48;

func init() {
    if len(sqlDefaultSettings) > maxSQLDefaults {
        panic("new sql.defaults cluster settings are not needed now that `ALTER ROLE ... SET` syntax is supported")
    }
}

i don't quite understand why the existing check didn't work. do you know?

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @mgartner and @rytaft)


pkg/sql/exec_util.go line 402 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

i don't quite understand why the existing check didn't work. do you know?

using a constant for maxSQLDefaults could have an issue if a setting is retired and reduces the "expected" size of the allowed settings list

@wenyihu6
Copy link
Contributor

pkg/sql/exec_util.go line 402 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

using a constant for maxSQLDefaults could have an issue if a setting is retired and reduces the "expected" size of the allowed settings list

That was my bad. I was following the existing pattern for other session variables and didn't realize that this has been deprecated. The commit got around the check by adding the session variable to this map. Any session variables added to this map doesn't throw an error

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @mgartner, @rytaft, and @wenyihu6)


pkg/sql/exec_util.go line 402 at r1 (raw file):

Previously, wenyihu6 (Wenyi Hu) wrote…

That was my bad. I was following the existing pattern for other session variables and didn't realize that this has been deprecated. The commit got around the check by adding the session variable to this map. Any session variables added to this map doesn't throw an error

no problem. then perhaps we can make the error message more clear so that someone else doesn't do the same thing.

@wenyihu6
Copy link
Contributor

pkg/sql/exec_util.go line 402 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

no problem. then perhaps we can make the error message more clear so that someone else doesn't do the same thing.

Adding comments on top of this map can also be useful.

Copy link
Collaborator Author

@michae2 michae2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTRs!

Removed the release note (instead I left a comment on cockroachdb/docs#14819).

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 2 stale) (waiting on @mgartner, @rafiss, @rytaft, and @wenyihu6)


-- commits line 11 at r1:

Previously, mgartner (Marcus Gartner) wrote…

I don't think a release note is necessary because the setting is not included in any releases.

Done.


pkg/sql/exec_util.go line 402 at r1 (raw file):

Previously, wenyihu6 (Wenyi Hu) wrote…

Adding comments on top of this map can also be useful.

I tried making the error message more clear, and added some comments.

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 6 files at r1, 2 of 5 files at r3, 4 of 4 files at r4, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 2 stale) (waiting on @mgartner, @rafiss, @rytaft, and @wenyihu6)

@michae2
Copy link
Collaborator Author

michae2 commented Aug 23, 2022

bors r=mgartner,wenyihu6,rafiss

@craig
Copy link
Contributor

craig bot commented Aug 23, 2022

Build failed (retrying...):

@michae2
Copy link
Collaborator Author

michae2 commented Aug 23, 2022

bors r-

@craig
Copy link
Contributor

craig bot commented Aug 23, 2022

Canceled.

@michae2
Copy link
Collaborator Author

michae2 commented Aug 23, 2022

Trying again.

bors r=mgartner,wenyihu6,rafiss

var sqlDefaultSettings = map[string]struct{}{
// PLEASE DO NOT ADD NEW SETTINGS TO THIS MAP. THANK YOU.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🖖

Thanks for adding these warnings!

@craig
Copy link
Contributor

craig bot commented Aug 23, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 23, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 24, 2022

Build failed:

In 22.2 the use of cluster settings for session setting defaults is
deprecated, but I forgot this when reviewing cockroachdb#86033. Remove the
unreleased default cluster setting we added.

Release note: None
@michae2
Copy link
Collaborator Author

michae2 commented Aug 24, 2022

Third time's the charm.

bors r=mgartner,wenyihu6,rafiss

@michae2
Copy link
Collaborator Author

michae2 commented Aug 24, 2022

bors r-

@craig
Copy link
Contributor

craig bot commented Aug 24, 2022

Canceled.

@michae2 michae2 force-pushed the optusenot branch 2 times, most recently from 917c5de to 6208560 Compare August 24, 2022 14:07
Add some missing session variables to statement diagnostic bundles. This
isn't quite everything, but it's better than what we had before.

Release note: None
@michae2
Copy link
Collaborator Author

michae2 commented Aug 24, 2022

"It's definitely going to work this time."

bors r=mgartner,wenyihu6,rafiss

@mgartner
Copy link
Collaborator

The second commit makes progress towards #72434. @michae2 do you think there are other session settings that we should add to the statement bundle, or should we just close #72434?

@michae2
Copy link
Collaborator Author

michae2 commented Aug 24, 2022

The second commit makes progress towards #72434. @michae2 do you think there are other session settings that we should add to the statement bundle, or should we just close #72434?

This was just a quick-and-dirty attempt to add more while I was in the area. I think I probably missed a few, and something more systematic (i.e. automatically adding all session settings) would be better. So I left the TODO in the code, and I think we should leave #72434 open.

@craig
Copy link
Contributor

craig bot commented Aug 24, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 25, 2022

Build succeeded:

@craig craig bot merged commit 2787ff1 into cockroachdb:master Aug 25, 2022
@michae2 michae2 deleted the optusenot branch August 25, 2022 04:33
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.

5 participants