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: gate global_reads zone attribute on cluster version and enterprise license #62764

Merged

Conversation

nvanbenschoten
Copy link
Member

Fixes #61039.

This commit gates the use of the global_reads zone configuration
attribute on the cluster version and on the use of an enterprise
license.

The first half of this is necessary for correctness. The second half is
not, because follower reads won't be served from global read followers
without an enterprise license, but a check when the zone configs are set
improves UX.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

defer utilccl.TestingEnableEnterprise()()

_, sqlDB, cleanup := multiregionccltestutils.TestingCreateMultiRegionCluster(
t, 3 /* numServers */, base.TestingKnobs{}, nil, /* baseDir */
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you can probably get away with just one server for this

c.InheritedVoterConstraints = false
},
checkAllowed: func(ctx context.Context, execCfg *ExecutorConfig, _ tree.Datum) error {
return checkVersionActive(ctx, execCfg, clusterversion.NonVotingReplicas, "voter_constraints")
Copy link
Contributor

Choose a reason for hiding this comment

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

can you have voter constraints with global_read=false? if so, do we want that enterprise only or nah?

…se license

Fixes cockroachdb#61039.

This commit gates the use of the global_reads zone configuration
attribute on the cluster version and on the use of an enterprise
license.

The first half of this is necessary for correctness. The second half is
not, because follower reads won't be served from global read followers
without an enterprise license, but a check when the zone configs are set
improves UX.
@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/gateGlobalReads branch from 0ee4687 to 42f7f08 Compare March 30, 2021 03:10
Copy link
Member Author

@nvanbenschoten nvanbenschoten 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 @aayushshah15, @awoods187, and @otan)


pkg/ccl/multiregionccl/multiregion_test.go, line 127 at r1 (raw file):

Previously, otan (Oliver Tan) wrote…

nit: you can probably get away with just one server for this

Good point, done.


pkg/sql/set_zone_config.go, line 137 at r1 (raw file):

Previously, otan (Oliver Tan) wrote…

can you have voter constraints with global_read=false? if so, do we want that enterprise only or nah?

This is a good question. Follower reads are enterprise-only and there's not a great reason to create non-voting replicas if you can't read from them, so I don't think there's much of a reason to allow non-voting replicas without a license. But I also don't think we explicitly decided to disallow them. Or at least, non-voting replicas aren't mentioned in the "Enterprise License & Multi-region" doc.

cc. @aayushshah15 and @awoods187

Copy link
Contributor

@aayushshah15 aayushshah15 left a comment

Choose a reason for hiding this comment

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

LGTM

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @awoods187 and @otan)


pkg/sql/set_zone_config.go, line 137 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

This is a good question. Follower reads are enterprise-only and there's not a great reason to create non-voting replicas if you can't read from them, so I don't think there's much of a reason to allow non-voting replicas without a license. But I also don't think we explicitly decided to disallow them. Or at least, non-voting replicas aren't mentioned in the "Enterprise License & Multi-region" doc.

cc. @aayushshah15 and @awoods187

This sounds good. There isn't any reason to be able to create non-voters (won't be in 21.1, at least) without being able to follower-read, so requiring an enterprise license makes sense to me (unless Andy has objections).

@nvanbenschoten
Copy link
Member Author

TFTRs!

This sounds good. There isn't any reason to be able to create non-voters (won't be in 21.1, at least) without being able to follower-read, so requiring an enterprise license makes sense to me (unless Andy has objections).

Will leave this for a follow-up PR if we decide to proceed with locking more behind an enterprise license.

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 30, 2021

Build succeeded:

@craig craig bot merged commit fed2225 into cockroachdb:master Mar 30, 2021
@nvanbenschoten nvanbenschoten deleted the nvanbenschoten/gateGlobalReads branch April 1, 2021 19:38
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.

kv: gate global_reads replicas on cluster version and enterprise license
4 participants