Skip to content

cli: Warn users if --locality doesn't include "region"#57179

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
ajstorm:warn-no-region
Dec 1, 2020
Merged

cli: Warn users if --locality doesn't include "region"#57179
craig[bot] merged 1 commit intocockroachdb:masterfrom
ajstorm:warn-no-region

Conversation

@ajstorm
Copy link
Copy Markdown
Collaborator

@ajstorm ajstorm commented Nov 26, 2020

With the new multi-region abstractions coming in 21.1, users will need
to add regions to databases (and optionally, tables). The regions
defined at the cluster level are derived from the locality flags, but we
search explicitly for "region". As a result, if the user wishes to
leverage the new abstractions, they must provide a "region" tier in the
locality flag when starting their nodes.

To push users in that direction, we warn on cockroach start if the
supplied locality flag doesn't include a region tier.

Release note (cli change): Warn users if locality flag doesn't contain a
"region" tier.

@ajstorm ajstorm requested a review from a team as a code owner November 26, 2020 16:15
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@ajstorm ajstorm requested a review from otan November 26, 2020 16:16
pkg/cli/start.go Outdated
// if they've provided a --locality value which doesn't include a "region" tier.
if len(serverCfg.Locality.Tiers) > 0 {
if _, containsRegion := serverCfg.Locality.Find("region"); !containsRegion {
warningString := "The --locality flag does not contain a \"region\" tier. To add regions\n" +
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe to enable multi-region functionality

// (and optionally, "zones"). To push users in that direction, we warn them here
// if they've provided a --locality value which doesn't include a "region" tier.
if len(serverCfg.Locality.Tiers) > 0 {
if _, containsRegion := serverCfg.Locality.Find("region"); !containsRegion {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we have to check whether region is the first tier, or does all out logic allow that?

@ajstorm ajstorm requested a review from otan November 26, 2020 22:28
Copy link
Copy Markdown
Collaborator Author

@ajstorm ajstorm 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! 0 of 0 LGTMs obtained (waiting on @otan)


pkg/cli/start.go, line 1128 at r1 (raw file):

Previously, otan (Oliver Tan) wrote…

do we have to check whether region is the first tier, or does all out logic allow that?

Doesn't matter which tier the region is in, so long as it's there somewhere.


pkg/cli/start.go, line 1129 at r1 (raw file):

Previously, otan (Oliver Tan) wrote…

maybe to enable multi-region functionality

I contemplated something like that, but I found that the wording was too vague to be actionable. I wanted to have something very specific (and provide a doc link with more detail) to ensure that users could take this warning message and act on it with very little additional context.

With the new multi-region abstractions coming in 21.1, users will need
to add regions to databases (and optionally, tables).  The regions
defined at the cluster level are derived from the locality flags, but we
search explicitly for "region".  As a result, if the user wishes to
leverage the new abstractions, they must provide a "region" tier in the
locality flag when starting their nodes.

To push users in that direction, we warn on `cockroach start` if the
supplied locality flag doesn't include a region tier.

Release note (cli change): Warn users if locality flag doesn't contain a
"region" tier.
@ajstorm
Copy link
Copy Markdown
Collaborator Author

ajstorm commented Dec 1, 2020

bors r=otan

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 1, 2020

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