-
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, distsql: add enum cluster settings, add distsql cluster setting #15307
Conversation
438d8a9
to
9e159f1
Compare
Review status: 0 of 10 files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. pkg/settings/registry.go, line 271 at r1 (raw file):
nit: pkg/settings/registry.go, line 283 at r1 (raw file):
nit: "e"? "enum"? pkg/settings/registry.go, line 294 at r1 (raw file):
s/ pkg/settings/registry.go, line 308 at r1 (raw file):
why include the values in this string? Can they be of interest to a client? At least in the "acceptable values" error msg they seem out of place. pkg/settings/registry.go, line 424 at r1 (raw file):
nit: put these assertions next to the definition of the structs. Otherwise a new implementation copying an existing one will not see it. pkg/settings/registry.go, line 315 at r2 (raw file):
I think it'd be nicer if the default was passed as the key (string), not the value. pkg/settings/registry.go, line 315 at r2 (raw file):
nit: the name "defVal" for a default is not used outside of this file. It's called "defaultValue" in the struct, which I prefer. Also the next argument spells out "Values". pkg/sql/logic_test.go, line 1443 at r2 (raw file):
well you can't run it here cause the cluster doesn't exist yet, right? It's only started in the pkg/sql/session.go, line 109 at r2 (raw file):
nit: what's pkg/sql/session.go, line 109 at r2 (raw file):
if this is the default and means "auto", we're not ready yet. pkg/sql/session.go, line 114 at r2 (raw file):
-1? And you parse any negative value as "always"? Use the actualy consts (cast to int) here, and cast the other way in Comments from Reviewable |
Review status: 0 of 10 files reviewed at latest revision, 15 unresolved discussions, some commit checks failed. pkg/settings/registry.go, line 269 at r1 (raw file):
why pkg/settings/registry.go, line 328 at r1 (raw file):
TestingEnumSetting. Also is this actually used anywhere? pkg/sql/logic_test.go, line 1443 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Seems to me that we need some kind of pkg/sql/session.go, line 111 at r2 (raw file):
why do we have a completely new mapping instead of using the actual enum values ( pkg/sql/session.go, line 114 at r2 (raw file):
I don't think we want Comments from Reviewable |
Review status: 0 of 10 files reviewed at latest revision, 19 unresolved discussions, some commit checks failed. pkg/server/settingsworker.go, line 101 at r1 (raw file):
nope, it's a bit subtle, but as you'll see from the test failures, an error from pkg/settings/registry.go, line 268 at r1 (raw file):
I think you can just embed an existing Setting impl and only override the methods as needed, similar to ByteSizeSetting. alternately, you could just add an optional whitelist or validate param to the existing StringSetting? pkg/settings/registry.go, line 269 at r1 (raw file): Previously, RaduBerinde wrote…
since we're using atomic and have to specify the size of our integers anyway, intsettings just use int64 thoughout rather than going back and forth to a platform-defined int (since their callers often are using int64 too). pkg/settings/registry.go, line 279 at r1 (raw file):
String() is supposed to print for humans, so I'd rather return the string, not the int. pkg/settings/registry.go, line 283 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
nope, single char is in keeping with the rest (and leaves using a pkg/settings/registry.go, line 294 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
@tamird has been requesting the opposite in all my recent reviews, which is where the error copy/pasted here came from. pkg/settings/registry.go, line 315 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
strong ditto pkg/settings/registry.go, line 315 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
defVal is consistent with the others @knz added, so unless you're gonna rename them all, consistency wins. pkg/settings/updater.go, line 98 at r1 (raw file):
just also, consider mirroring pattern of importantly though, in the event that the settings table contains a value this node thinks is invalid, you want to keep using the value this node was using? fall back to default? pkg/sql/logic_test.go, line 1443 at r2 (raw file): Previously, RaduBerinde wrote…
that's what the TestingFoo mocks are for -- you swap the pkg var with one. Comments from Reviewable |
Too many cooks in this game. :-) I suggest we stick to reviewing the two commits separately. Andrei, Arjun is following pattern in this code, if you think the settings package deserves some clean-up, please file a follow-up clean-up issue. Reviewed 6 of 6 files at r1, 4 of 4 files at r2. pkg/settings/registry.go, line 271 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
It's following pattern. pkg/settings/registry.go, line 279 at r1 (raw file): Previously, dt (David Taylor) wrote…
We discussed this earlier with Arjun -- the setting description will list the mapping, and String() can print the value. This allows us to change the symbolic names later for documentation purposes without having to re-interpret whatever pkg/settings/registry.go, line 294 at r1 (raw file): Previously, dt (David Taylor) wrote…
Arjun: please also allow the user to set enums using the numeric value. pkg/settings/registry.go, line 306 at r1 (raw file):
This printout is ... not very user-friendly. Try this: buffer.WriteByte('(')
i := 0
for k, v := range enumValues {
if i > 0 {
buffer.WriteString(", ")
}
fmt.Fprintf(&buffer, "%d = %s", v, k)
}
buffer.WriteByte(')') pkg/settings/registry.go, line 308 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
My request: we want to be able to change the symbolic names for documentation reasons; the mapping in the description explains what's going on if a name changes. pkg/settings/registry.go, line 315 at r1 (raw file):
Please add an assert (with panic) that the map is not empty and that the default value is in the map. pkg/settings/registry.go, line 315 at r2 (raw file): Previously, dt (David Taylor) wrote…
yeah default must be string Comments from Reviewable |
Review status: all files reviewed at latest revision, 21 unresolved discussions, some commit checks failed. pkg/settings/registry.go, line 306 at r1 (raw file): Previously, knz (kena) wrote…
there's a Comments from Reviewable |
pkg/server/settingsworker.go, line 101 at r1 (raw file): Previously, dt (David Taylor) wrote…
That sucks. We really want it to fail when someone says Comments from Reviewable |
Review status: all files reviewed at latest revision, 21 unresolved discussions, some commit checks failed. pkg/server/settingsworker.go, line 101 at r1 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
You can extend Comments from Reviewable |
Review status: all files reviewed at latest revision, 21 unresolved discussions, some commit checks failed. pkg/server/settingsworker.go, line 101 at r1 (raw file): Previously, knz (kena) wrote…
So this wouldn't do that for you anyway -- this code is what loads the table data from gossip to the in-memory values on each node. By the time a valueis in gossip, the As knz says, you want to do validation in Comments from Reviewable |
I realize the "following the pattern", but patterns are useful where they help readability or something, not patterns for patterns sake. For example, if you agree that Review status: all files reviewed at latest revision, 21 unresolved discussions, some commit checks failed. Comments from Reviewable |
Review status: all files reviewed at latest revision, 21 unresolved discussions, some commit checks failed. pkg/settings/registry.go, line 294 at r1 (raw file): Previously, knz (kena) wrote…
Why's tamir down on Comments from Reviewable |
The meaning is slightly different. From https://golang.org/pkg/fmt/:
%s the uninterpreted bytes of the string or slice
%q a double-quoted string safely escaped with Go syntax
…On Tue, Apr 25, 2017 at 1:53 PM, Andrei Matei ***@***.***> wrote:
Review status: all files reviewed at latest revision, 21 unresolved
discussions, some commit checks failed.
------------------------------
*pkg/settings/registry.go, line 294 at r1
<https://reviewable.io:443/reviews/cockroachdb/cockroach/15307#-KiWhPvtf5lmnuCHGy5B:-KiaEcajufixPwRzuSAS:b-f25c46>
(raw file
<https://github.com/cockroachdb/cockroach/blob/fc743e63315990f08181d0ef1fe62bc2b714e1e7/pkg/settings/registry.go#L294>):*
*Previously, knz (kena) wrote…*
Arjun: please also allow the user to set enums using the numeric value.
Why's tamir down on %q?
------------------------------
*Comments from Reviewable
<https://reviewable.io:443/reviews/cockroachdb/cockroach/15307>*
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15307 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABdsPPHiVMkxiSToWUOlZ5Ca0xZK9DIlks5rzjMPgaJpZM4NGrYP>
.
|
Maybe %q is the right thing after all ¯\_(ツ)_/¯
On Tue, Apr 25, 2017 at 1:55 PM, Tamir Duberstein <[email protected]>
wrote:
… The meaning is slightly different. From https://golang.org/pkg/fmt/:
%s the uninterpreted bytes of the string or slice
%q a double-quoted string safely escaped with Go syntax
On Tue, Apr 25, 2017 at 1:53 PM, Andrei Matei ***@***.***>
wrote:
> Review status: all files reviewed at latest revision, 21 unresolved
> discussions, some commit checks failed.
> ------------------------------
>
> *pkg/settings/registry.go, line 294 at r1
> <https://reviewable.io:443/reviews/cockroachdb/cockroach/15307#-KiWhPvtf5lmnuCHGy5B:-KiaEcajufixPwRzuSAS:b-f25c46>
> (raw file
> <https://github.com/cockroachdb/cockroach/blob/fc743e63315990f08181d0ef1fe62bc2b714e1e7/pkg/settings/registry.go#L294>):*
> *Previously, knz (kena) wrote…*
>
> Arjun: please also allow the user to set enums using the numeric value.
>
> Why's tamir down on %q?
> ------------------------------
>
> *Comments from Reviewable
> <https://reviewable.io:443/reviews/cockroachdb/cockroach/15307>*
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#15307 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABdsPPHiVMkxiSToWUOlZ5Ca0xZK9DIlks5rzjMPgaJpZM4NGrYP>
> .
>
|
9e159f1
to
7cfc639
Compare
Switched everything to Review status: 2 of 9 files reviewed at latest revision, 21 unresolved discussions. pkg/settings/registry.go, line 268 at r1 (raw file): Previously, dt (David Taylor) wrote…
Done, using pkg/settings/registry.go, line 279 at r1 (raw file): Previously, knz (kena) wrote…
I was with @dt, but I'm convinced by the point that allowing names to be changed easily is worth it. pkg/settings/registry.go, line 294 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
As a side note, I don't really like this nitpicking about using @knz I don't know how to do that, lets talk about it. pkg/settings/registry.go, line 306 at r1 (raw file): Previously, knz (kena) wrote…
Done. pkg/settings/registry.go, line 315 at r1 (raw file): Previously, knz (kena) wrote…
Done. pkg/settings/registry.go, line 328 at r1 (raw file): Previously, RaduBerinde wrote…
It is now, in the logic tests (but good catch). pkg/settings/registry.go, line 424 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. pkg/settings/registry.go, line 315 at r2 (raw file): Previously, knz (kena) wrote…
Done. pkg/settings/updater.go, line 98 at r1 (raw file): Previously, dt (David Taylor) wrote…
Fixed to just returning pkg/sql/logic_test.go, line 1443 at r2 (raw file): Previously, dt (David Taylor) wrote…
I still don't know how to do this, would appreciate a little help. I'll come find you @dt. pkg/sql/session.go, line 109 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
nit: use an editor that does this for you! Anyway this is a moo point since we now pass default values by string. pkg/sql/session.go, line 109 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. pkg/sql/session.go, line 111 at r2 (raw file): Previously, RaduBerinde wrote…
Fixed. pkg/sql/session.go, line 114 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Fixed. pkg/sql/session.go, line 114 at r2 (raw file): Previously, RaduBerinde wrote…
Removed. pkg/server/settingsworker.go, line 101 at r1 (raw file): Previously, dt (David Taylor) wrote…
I'll add this and add a test to ensure that the SET command fails on an invalid settings change. Comments from Reviewable |
Reviewed 5 of 8 files at r3, 4 of 4 files at r4. pkg/settings/registry.go, line 294 at r1 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
if !ok {
// Try to see if there is a valid numeric value instead
var err error
v, err = strconv.ParseInt(k, 10, 64)
if err != nil {
return invalidEnumValueError(e, k)
}
isValid := false
for _, allowedValue := range e.enumValues {
if v == allowedValue {
isValid = true
break
}
}
if !isValid {
return invalidEnumValueError(e, k)
}
}
atomic.StoreInt64(&e.v, v) pkg/sql/logic_test.go, line 1443 at r2 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
hint: use Comments from Reviewable |
Review status: all files reviewed at latest revision, 18 unresolved discussions, some commit checks failed. pkg/settings/registry.go, line 294 at r1 (raw file): Previously, knz (kena) wrote…
FWIW, this was a nit meant to tell you about the existence of Comments from Reviewable |
Review status: all files reviewed at latest revision, 18 unresolved discussions, some commit checks failed. pkg/settings/registry.go, line 268 at r1 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
Not quite: you don't need Comments from Reviewable |
Review status: all files reviewed at latest revision, 17 unresolved discussions, some commit checks failed. pkg/settings/registry.go, line 279 at r1 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
ditto above: it it is just a wrapped And I'm still of the opinion that minimizing cognitive load with easily, rapidly understood names is greater value than ability to rename, but if everyone else likes opaque ints, I'll shut up. pkg/sql/logic_test.go, line 1443 at r2 (raw file): Previously, knz (kena) wrote…
Yeah, either do what @knz said, or look at https://github.com/cockroachdb/cockroach/blob/master/pkg/sql/logic_test.go#L1413 (though you might want to use a Comments from Reviewable |
0e1c71f
to
d73282a
Compare
RFAL. TFTRs everyone! Review status: 2 of 9 files reviewed at latest revision, 16 unresolved discussions, some commit checks pending. pkg/settings/registry.go, line 268 at r1 (raw file): Previously, dt (David Taylor) wrote…
Done. pkg/settings/registry.go, line 294 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Thanks for clarifying :) pkg/sql/logic_test.go, line 1443 at r2 (raw file): Previously, dt (David Taylor) wrote…
Done. Thank you! Comments from Reviewable |
Reviewed 3 of 7 files at r5, 4 of 4 files at r6. pkg/sql/logic_test.go, line 1443 at r2 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
Consider using the new mechanism from #15361 here. Comments from Reviewable |
Review status: all files reviewed at latest revision, 18 unresolved discussions, some commit checks failed. pkg/settings/registry.go, line 268 at r1 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
Don't need pkg/settings/registry.go, line 294 at r1 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
this error isn't going to to show up to a user, btw -- pkg/settings/registry.go, line 286 at r6 (raw file):
don't need to override this? pkg/settings/registry.go, line 290 at r6 (raw file):
don't need to override this? Comments from Reviewable |
d73282a
to
6a900ff
Compare
e42522f
to
6e96990
Compare
Review status: 2 of 12 files reviewed at latest revision, 20 unresolved discussions, some commit checks pending. pkg/settings/registry.go, line 378 at r7 (raw file): Previously, RaduBerinde wrote…
Thank you Radu. Done. pkg/settings/registry.go, line 311 at r8 (raw file): Previously, dt (David Taylor) wrote…
pkg/settings/registry.go, line 353 at r8 (raw file): Previously, dt (David Taylor) wrote…
Done. pkg/sql/logic_test.go, line 1468 at r8 (raw file): Previously, RaduBerinde wrote…
Great suggestion, done. Thank you, I did not catch the race possibility. pkg/sql/set.go, line 182 at r8 (raw file): Previously, dt (David Taylor) wrote…
Done. Comments from Reviewable |
Review status: 2 of 12 files reviewed at latest revision, 23 unresolved discussions, some commit checks pending. pkg/settings/registry.go, line 84 at r10 (raw file):
Also explain the gossip thing (which explains why we change the pointer). "The original Setting remains registered for gossip-driven updates which become visible when it is restored." pkg/sql/logic_test.go, line 1473 at r10 (raw file):
shouldn't we do Maybe it would be easier to just put the pkg/sql/logic_test.go, line 1474 at r10 (raw file):
2? We need to set to Comments from Reviewable |
Review status: 2 of 12 files reviewed at latest revision, 24 unresolved discussions, some commit checks failed. pkg/sql/vars.go, line 146 at r10 (raw file):
Need to check override here too. Probably easier if we just store the default mode in Comments from Reviewable |
72b849b
to
00f00a4
Compare
Review status: 2 of 12 files reviewed at latest revision, 24 unresolved discussions, some commit checks pending. pkg/settings/registry.go, line 84 at r10 (raw file): Previously, RaduBerinde wrote…
Done. pkg/sql/logic_test.go, line 1473 at r10 (raw file): Previously, RaduBerinde wrote…
We don't need to initialize pkg/sql/logic_test.go, line 1474 at r10 (raw file): Previously, RaduBerinde wrote…
Done. pkg/sql/vars.go, line 146 at r10 (raw file): Previously, RaduBerinde wrote…
I originally didn't because no tests call Comments from Reviewable |
00f00a4
to
078485b
Compare
Review status: 2 of 12 files reviewed at latest revision, 23 unresolved discussions, some commit checks failed. pkg/sql/logic_test.go, line 1473 at r10 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
Then do we need this line at all? (seems like it would work the same if it's left as nil). pkg/sql/vars.go, line 146 at r10 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
Nice, thanks! Comments from Reviewable |
LGTM! Please rebase on top of #15429 to make TC happy. Also look at the linter output. Reviewed 3 of 9 files at r7, 2 of 7 files at r9, 7 of 7 files at r12. Comments from Reviewable |
As part of the release plan we want to start testing with distsql=auto on the adriatic/omega/cerulean clusters as soon as possible (without waiting for the other pending distsql PRs). Please deploy a new build to those clusters when this is merged. Review status: all files reviewed at latest revision, 22 unresolved discussions, some commit checks failed. Comments from Reviewable |
Following up what @bdarnell said, we really want to get this merged tonight and deployed to the test clusters. |
Review status: all files reviewed at latest revision, 23 unresolved discussions, some commit checks failed. pkg/sql/session.go, line 122 at r12 (raw file):
Comments from Reviewable |
EnumSetting takes a map of acceptable strings to integer values upon creation. EnumSetting accepts strings and if it matches one of the acceptable values, stores the corresponding integer value.
110abff
to
713e725
Compare
This cluster setting replaces the environment variable. The session variable accessible through `SET distsql = ?` is still available, and defaults to the cluster setting upon session creation. Closes cockroachdb#15045.
713e725
to
4534d7c
Compare
TFTRs everyone. Will deploy on release clusters after another PR that enables distsql in auto mode (since that requires changing a few tests that check the distsql mode). Review status: 4 of 12 files reviewed at latest revision, 20 unresolved discussions, all commit checks successful. pkg/sql/logic_test.go, line 1473 at r10 (raw file): Previously, RaduBerinde wrote…
Yes, we need the line. The Later, the executor checks if the testing knob is non-nil, and if so, uses the testing mock instead. pkg/sql/session.go, line 122 at r12 (raw file): Previously, petermattis (Peter Mattis) wrote…
I'll do this in a separate PR. This requires changing a bunch of logic tests that are hardcoded to expect Off. Don't want to comingle any more commits in this PR. Comments from Reviewable |
@knz: commit 1.
@andreimatei: commit 2. Please note the
TODO(DONOTMERGE)
, help will be appreciated with fixing that! Thank you.