-
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
schemachanger: remove discard named range fallback #135909
Conversation
Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
c04320c
to
9eb50a4
Compare
9eb50a4
to
18e29f9
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.
Looks good. I just had a couple of questions.
Reviewed 18 of 18 files at r1, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @annrpom)
pkg/sql/schemachanger/testdata/end_to_end/alter_named_range_configure_zone_discard/alter_named_range_configure_zone_discard.definition
line 4 at r1 (raw file):
ALTER RANGE meta CONFIGURE ZONE USING num_replicas = 7; ALTER RANGE meta CONFIGURE ZONE USING gc.ttlseconds = 10000; ALTER RANGE meta CONFIGURE ZONE DISCARD;
Can we add a test that first discards the configuration and then applies updates in the same transaction? For example:
ALTER RANGE meta CONFIGURE ZONE DISCARD;
ALTER RANGE meta CONFIGURE ZONE USING num_replicas = 7;
ALTER RANGE meta CONFIGURE ZONE USING gc.ttlseconds = 10000;
I'm curious if we handle the operation ordering correctly, ensuring num_replicas
and gc.ttlseconds
are applied after the discard.
pkg/sql/schemachanger/scbuild/internal/scbuildstmt/configure_zone.go
line 128 at r1 (raw file):
id, found := zonepb.NamedZones[namedZone] if !found { return nil, fmt.Errorf("%q is not a built-in zone", string(zs.NamedZone))
Should this error have a proper pgcode set? I was able to find the error in the legacy schema changer that this mirrors.
18e29f9
to
16e7349
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! 0 of 0 LGTMs obtained (waiting on @spilchen)
pkg/sql/schemachanger/scbuild/internal/scbuildstmt/configure_zone.go
line 128 at r1 (raw file):
Previously, spilchen wrote…
Should this error have a proper pgcode set? I was able to find the error in the legacy schema changer that this mirrors.
done -- ah as in add a pgcode for this + the legacy schema changer? i can do that; i think 42602 might make the most sense (InvalidName)
pkg/sql/schemachanger/testdata/end_to_end/alter_named_range_configure_zone_discard/alter_named_range_configure_zone_discard.definition
line 4 at r1 (raw file):
Previously, spilchen wrote…
Can we add a test that first discards the configuration and then applies updates in the same transaction? For example:
ALTER RANGE meta CONFIGURE ZONE DISCARD; ALTER RANGE meta CONFIGURE ZONE USING num_replicas = 7; ALTER RANGE meta CONFIGURE ZONE USING gc.ttlseconds = 10000;
I'm curious if we handle the operation ordering correctly, ensuring
num_replicas
andgc.ttlseconds
are applied after the discard.
done -- added a logictest as that seemed better suited; wdyt?
This patch removes the fallback to legacy schema changer path we have for discarding named ranges. This includes ensuring we block the ability to discard the system range. Fixes: cockroachdb#133157 Epic: none Release note: None
16e7349
to
75b6d58
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.
Reviewed 3 of 4 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @annrpom)
pkg/sql/schemachanger/testdata/end_to_end/alter_named_range_configure_zone_discard/alter_named_range_configure_zone_discard.definition
line 4 at r1 (raw file):
Previously, annrpom (annie pompa) wrote…
done -- added a logictest as that seemed better suited; wdyt?
Logic tests are much simpler! It seems mutations are applied in statement order, even when they involve different types of operations (e.g., discard vs. setting specific values).
pkg/sql/logictest/testdata/logic_test/zone_config
line 450 at r2 (raw file):
statement ok RESET use_declarative_schema_changer;
Is this safe to apply to the local legacy schema changer? We won't lose track of the fact that it's operating under the legacy schema changer, correct?
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 @spilchen)
pkg/sql/logictest/testdata/logic_test/zone_config
line 450 at r2 (raw file):
Previously, spilchen wrote…
Is this safe to apply to the local legacy schema changer? We won't lose track of the fact that it's operating under the legacy schema changer, correct?
ooo good question! it looks like we will not lose track since that config overrides the cluster setting -- not the session variable (i also just confirmed this real quick by showing the session var value under the legacy config and it is confirmed off)
cockroach/pkg/sql/logictest/logic.go
Lines 1770 to 1777 in 0d3d74c
// We support disabling the declarative schema changer, so that no regressions | |
// occur in the legacy schema changer. | |
if cfg.DisableDeclarativeSchemaChanger { | |
if _, err := conn.Exec( | |
"SET CLUSTER SETTING sql.defaults.use_declarative_schema_changer='off'"); err != nil { | |
t.Fatal(err) | |
} | |
} |
TFTR! ('-')7 bors r+ |
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
pkg/sql/logictest/testdata/logic_test/zone_config
line 450 at r2 (raw file):
Previously, annrpom (annie pompa) wrote…
ooo good question! it looks like we will not lose track since that config overrides the cluster setting -- not the session variable (i also just confirmed this real quick by showing the session var value under the legacy config and it is confirmed off)
cockroach/pkg/sql/logictest/logic.go
Lines 1770 to 1777 in 0d3d74c
// We support disabling the declarative schema changer, so that no regressions // occur in the legacy schema changer. if cfg.DisableDeclarativeSchemaChanger { if _, err := conn.Exec( "SET CLUSTER SETTING sql.defaults.use_declarative_schema_changer='off'"); err != nil { t.Fatal(err) } }
Thanks for confirming.
This patch removes the fallback to legacy schema changer
path we have for discarding named ranges. This includes
ensuring we block the ability to discard the system range.
Fixes: #133157
Epic: none
Release note: None