-
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 default_value and origin to show cluster settings #104449
Conversation
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.
nice, this is a great improvement! just small nits
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @maryliag)
-- commits
line 12 at r1:
nit: let's avoid mentioning the crdb_internal table in the release note. it's good for the commit message though.
pkg/sql/crdb_internal.go
line 2117 at r1 (raw file):
defaultVal, err := setting.DecodeToString(setting.EncodedDefault()) if err != nil { defaultVal = setting.EncodedDefault()
why should we ignore the error here? i don't think this is ever expected to happen. if it is expected for some reason, that deserves a comment in the code
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! 0 of 0 LGTMs obtained (waiting on @rafiss)
pkg/sql/crdb_internal.go
line 2117 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
why should we ignore the error here? i don't think this is ever expected to happen. if it is expected for some reason, that deserves a comment in the code
do you think this is a "panic" level or just "log this error" type of thing here?
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! 0 of 0 LGTMs obtained (waiting on @maryliag)
pkg/sql/crdb_internal.go
line 2117 at r1 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
do you think this is a "panic" level or just "log this error" type of thing here?
i'd say neither, it should just be a:
if err != nil {
return err
}
Maybe this would benefit from #104487 |
Made changes to the column be |
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! 0 of 0 LGTMs obtained (waiting on @rafiss)
Previously, rafiss (Rafi Shamim) wrote…
nit: let's avoid mentioning the crdb_internal table in the release note. it's good for the commit message though.
Done
pkg/sql/crdb_internal.go
line 2117 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
i'd say neither, it should just be a:
if err != nil { return err }
Done
0c55b5b
to
73a3bed
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.
lgtm, but had a question
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @maryliag)
pkg/sql/crdb_internal.go
line 2123 at r4 (raw file):
// TODO(dt): make this reflect overrides for tenants if strVal != defaultVal { origin = "override"
what would "external-override" mean? i saw it in the comment, but doesn't look like we ever use it.
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! 0 of 0 LGTMs obtained (waiting on @rafiss)
pkg/sql/crdb_internal.go
line 2123 at r4 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
what would "external-override" mean? i saw it in the comment, but doesn't look like we ever use it.
Currently not using because I'm waiting for #104487 to get merged, so I can use the flag from there on this PR as I mentioned on this comment.
The difference:
default: the default
ExplicitlySet: the user was the one who made the change
ExternallySet: someone set up for the entire cluster, so if a tenant is looking it will see the value has changed, but they were not the ones who did it
This adds an API to the settings package to track the origin of the current value of each setting, such as whether it is set by the the default value, an explicit override or an external override. Release note: none. Epic: none.
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.
Commit from #104487 was added to this PR. PTAL
thank you @dt for the changes!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)
pkg/sql/logictest/testdata/logic_test/cluster_settings
line 95 at r6 (raw file):
---- sql.index_recommendation.drop_unused_duration 10s 168h0m0s override
@dt do you have any suggestions on how to test the external-override ?
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! 0 of 0 LGTMs obtained (waiting on @dt and @maryliag)
pkg/settings/setting.go
line 164 at r7 (raw file):
func (v ValueOrigin) String() string { return [...]string{"default", "override", "external-override"}[v]
nit: this has a risk of an index out of bounds. can we add:
if v > OriginExternallySet {
return fmt.Sprintf("invalid (%d)", m)
}
pkg/sql/logictest/testdata/logic_test/cluster_settings
line 95 at r6 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
@dt do you have any suggestions on how to test the external-override ?
i think it would be something like this:
user host-cluster-root
statement ok
ALTER TENANT ALL SET CLUSTER SETTING some.setting = 'value'
user root
query TTTT
SELECT variable, value, default_value, origin FROM [SHOW ALL CLUSTER SETTINGS]
WHERE variable IN ('some.setting')
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! 0 of 0 LGTMs obtained (waiting on @dt and @rafiss)
pkg/settings/setting.go
line 164 at r7 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
nit: this has a risk of an index out of bounds. can we add:
if v > OriginExternallySet { return fmt.Sprintf("invalid (%d)", m) }
Done
pkg/sql/logictest/testdata/logic_test/cluster_settings
line 95 at r6 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
i think it would be something like this:
user host-cluster-root statement ok ALTER TENANT ALL SET CLUSTER SETTING some.setting = 'value' user root query TTTT SELECT variable, value, default_value, origin FROM [SHOW ALL CLUSTER SETTINGS] WHERE variable IN ('some.setting')
Nice! Thanks! Added
4e44d1b
to
c33aa4d
Compare
Fixes https://cockroachlabs.atlassian.net/browse/CRDB-28519 Previously, there was no easy way to see default values for cluster settings. This commit add the column for `default_value` and `origin` to `crdb_internal.cluster_settings` and the `show cluster settings` command. Release note (sql change): Add columns `default_value` and `origin` (default, override, external-override) to the `show cluster settings` command.
TFTRs! |
Build succeeded: |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error setting reviewers, but backport branch blathers/backport-release-23.1-104449 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/105452/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. [] Backport to branch 23.1.x failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
The addition of new columns on cluster_settings view done on cockroachdb#104449 were causing debug zip fails to add the information from that table, since the query used to gather the information was doing a join and not considering the new columns. This commit updates the query to use the explicit columns, so even if new columns are added it won't be a problem in the future. It also adds tests for all custom querys used to generate the debug zip, so this type of issue would have been caught. Fixes cockroachdb#107103 Release note (bug fix): Debug zip now are properly showing the information from cluster_settings.
The addition of new columns on cluster_settings view done on cockroachdb#104449 were causing debug zip fails to add the information from that table, since the query used to gather the information was doing a join and not considering the new columns. This commit updates the query to use the explicit columns, so even if new columns are added it won't be a problem in the future. It also adds tests for all custom querys used to generate the debug zip, so this type of issue would have been caught. Fixes cockroachdb#107103 Release note (bug fix): Debug zip now are properly showing the information from cluster_settings.
The addition of new columns on cluster_settings view done on cockroachdb#104449 were causing debug zip fails to add the information from that table, since the query used to gather the information was doing a join and not considering the new columns. This commit updates the query to use the explicit columns, so even if new columns are added it won't be a problem in the future. It also adds tests for all custom querys used to generate the debug zip, so this type of issue would have been caught. The file `crdb_internal.cluster_settings.txt` in debug zips was empty due to this bug on v23.1.5 (only version affected by this bug). Fixes cockroachdb#107103 Release note (bug fix): Debug zip now are properly showing the information from cluster_settings. The file `crdb_internal.cluster_settings.txt` in debug zips was empty due to this bug on v23.1.5 (only version affected by this bug).
The addition of new columns on cluster_settings view done on cockroachdb#104449 were causing debug zip fails to add the information from that table, since the query used to gather the information was doing a join and not considering the new columns. This commit updates the query to use the explicit columns, so even if new columns are added it won't be a problem in the future. It also adds tests for all custom querys used to generate the debug zip, so this type of issue would have been caught. The file `crdb_internal.cluster_settings.txt` in debug zips was empty due to this bug on v23.1.5 (only version affected by this bug). Fixes cockroachdb#107103 Release note (bug fix): Debug zip now are properly showing the information from cluster_settings. The file `crdb_internal.cluster_settings.txt` in debug zips was empty due to this bug on v23.1.5 (only version affected by this bug).
The addition of new columns on cluster_settings view done on cockroachdb#104449 were causing debug zip fails to add the information from that table, since the query used to gather the information was doing a join and not considering the new columns. This commit updates the query to use the explicit columns, so even if new columns are added it won't be a problem in the future. It also adds tests for all custom querys used to generate the debug zip, so this type of issue would have been caught. The file `crdb_internal.cluster_settings.txt` in debug zips was empty due to this bug on v23.1.5 (only version affected by this bug). Fixes cockroachdb#107103 Release note (bug fix): Debug zip now are properly showing the information from cluster_settings. The file `crdb_internal.cluster_settings.txt` in debug zips was empty due to this bug on v23.1.5 (only version affected by this bug).
106485: opt: only infer self-join equality with a key over the base table r=DrewKimball a=DrewKimball #### opt: only infer self-join equality with a key over the base table Self-join equality inference was added by #105214, so that the `FuncDeps` for a self-join would include equalities between *every* pair of columns at the same ordinal position in the base table if there was an equality between key columns (also at the same ordinal position). However, the key column check was performed using the FDs of the join inputs rather than the base table's FDs. This could lead to incorrectly adding self-join equality filters. For example, consider the following: ``` CREATE TABLE t106371 (x INT NOT NULL, y INT NOT NULL); INSERT INTO t106371 VALUES (1, 1), (1, 2); SELECT * FROM t106371 a JOIN t106371 b ON a.x = b.x; SELECT * FROM (SELECT * FROM t106371 ORDER BY y DESC LIMIT 1) a JOIN (SELECT DISTINCT ON (x) * FROM t106371) b ON a.x = b.x; ``` In the first query above, `a.x = b.x` does not consitute joining on key columns. But in the second query, one input has one row and the other de-duplicated by the `x` column and so `x` is a key over both inputs. However, the query as written will select different rows for each input - `a` will return the `(1, 2)` row, while `b` will return the `(1, 1)` row. Inferring a `a.y = b.y` filter will incorrectly cause the join to return no rows. This patch fixes the problem by requiring the initial self-join equalities to form a key over the *base* table, not just the inputs of the join. Fixes #106371 Release note: None 106779: acceptance: Fix DockerCSharp Test r=rimadeodhar a=rimadeodhar This PR updates the .net framework within the csproj setup to .net 6. Additionally, it also fixes the CS program that we run as a part of this test with the new npgsql DateTime changes made as a part of npgsql 6 version update. The old datetime types have been deprecated and needed to be removed. With these fixes, the test is running successfully and can be unskipped. Epic: none Fixes: #86852 Release note: none 107104: cli: fix debug zip with new columns for cluster settings r=maryliag a=maryliag The addition of new columns on cluster_settings view done on #104449 were causing debug zip fails to add the information from that table, since the query used to gather the information was doing a join and not considering the new columns. This commit updates the query to use the explicit columns, so even if new columns are added it won't be a problem in the future. It also adds tests for all custom querys used to generate the debug zip, so this type of issue would have been caught. The file `crdb_internal.cluster_settings.txt` in debug zips was empty due to this bug on v23.1.5 (only version affected by this bug). Fixes #107103 Release note (bug fix): Debug zip now are properly showing the information from cluster_settings. The file `crdb_internal.cluster_settings.txt` in debug zips was empty due to this bug on v23.1.5 (only version affected by this bug). Co-authored-by: Drew Kimball <[email protected]> Co-authored-by: rimadeodhar <[email protected]> Co-authored-by: maryliag <[email protected]>
The addition of new columns on cluster_settings view done on #104449 were causing debug zip fails to add the information from that table, since the query used to gather the information was doing a join and not considering the new columns. This commit updates the query to use the explicit columns, so even if new columns are added it won't be a problem in the future. It also adds tests for all custom querys used to generate the debug zip, so this type of issue would have been caught. The file `crdb_internal.cluster_settings.txt` in debug zips was empty due to this bug on v23.1.5 (only version affected by this bug). Fixes #107103 Release note (bug fix): Debug zip now are properly showing the information from cluster_settings. The file `crdb_internal.cluster_settings.txt` in debug zips was empty due to this bug on v23.1.5 (only version affected by this bug).
Fixes https://cockroachlabs.atlassian.net/browse/CRDB-28519
Commit 1
This adds an API to the settings package to track the origin of the current value of each setting, such as whether it is set by the the default value, an explicit override or an external override.
Commit 2
Previously, there was no easy way to see default values for
cluster settings. This commit add the column for
default_value
and
origin
tocrdb_internal.cluster_settings
andthe
show cluster settings
command.Release note (sql change): Add columns
default_value
andorigin
(default, override, external-override) to theshow cluster settings
command.