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: use a 3-valued type instead of 2 booleans for relocate statements #73803

Merged
merged 4 commits into from
Dec 14, 2021

Conversation

knz
Copy link
Contributor

@knz knz commented Dec 14, 2021

Informs #73315.
First 3 commits from #73802 (reviewers, focus on the last commit)

By using a 3-valued types, we greatly simplify the code to print out
statement types, and also clarify intent in all the conditionals that
depend on the relocation mode.

The idiom for positional keywords in SQL is to either use words
separated by spaces (e.g. NOT NULL), or to concatenate the words
together (ISERROR, NOLOGIN, LINESTRING).

Release note (sql change): In the experimental RELOCATE syntax
forms, the positional keyword that indicates that the statement
should move non-voter replicas is now spelled `NONVOTERS`, instead
of `NON_VOTERS` previously.
@knz knz requested review from arulajmani and lunevalex December 14, 2021 17:41
@knz knz requested a review from a team as a code owner December 14, 2021 17:41
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@knz knz force-pushed the 20211214-kv-alter branch from 928009d to dd9e307 Compare December 14, 2021 17:44
Release note (sql change): The inline help for the ALTER
statements now mentions the RELOCATE syntax.
@knz knz force-pushed the 20211214-kv-alter branch from dd9e307 to 4092554 Compare December 14, 2021 17:45
Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

:lgtm_strong: Nice improvement!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @arulajmani, @knz, and @lunevalex)


pkg/sql/sem/tree/alter_range.go, line 29 at r4 (raw file):

// RelocateSubject indicates what replicas of a range should be relocated.
type RelocateSubject int

[supernit] It won't matter here, but it's good practice to use small types when they're sufficient (int8 here)

@knz knz force-pushed the 20211214-kv-alter branch from 88161fe to 4092554 Compare December 14, 2021 18:58
knz added 2 commits December 14, 2021 20:00
There is no need for separate non-terminals for the 'LEASE' variants of
RELOCATE. This commit deletes them.

Release note: None
By using a 3-valued types, we greatly simplify the code to print out
statement types, and also clarify intent in all the conditionals that
depend on the relocation mode.

Release note: None
Copy link
Contributor Author

@knz knz 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! 1 of 0 LGTMs obtained (waiting on @arulajmani, @lunevalex, and @RaduBerinde)


pkg/sql/sem/tree/alter_range.go, line 29 at r4 (raw file):

Previously, RaduBerinde wrote…

[supernit] It won't matter here, but it's good practice to use small types when they're sufficient (int8 here)

Good idea. Done.

@knz
Copy link
Contributor Author

knz commented Dec 14, 2021

TFYR

bors r=RaduBerinde

@craig
Copy link
Contributor

craig bot commented Dec 14, 2021

Build succeeded:

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.

3 participants