Skip to content

Commit

Permalink
clusterversion,kv: remove NonVotingReplicas
Browse files Browse the repository at this point in the history
Partially addresses cockroachdb#66544 by removing a cluster version and its associated
dependencies which, for any cluster whose version is at least 21.1, is certain
to be active.

Release justification: cluster version cleanup
  • Loading branch information
nvanbenschoten committed Sep 2, 2021
1 parent ac4cfa5 commit ef4710c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 67 deletions.
6 changes: 0 additions & 6 deletions pkg/clusterversion/cockroach_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ const (
// are propagated across RPC boundaries independently of their verbosity setting.
// This requires a version gate this violates implicit assumptions in v20.2.
TracingVerbosityIndependentSemantics
// NonVotingReplicas enables the creation of non-voting replicas.
NonVotingReplicas
// V21_1 is CockroachDB v21.1. It's used for all v21.1.x patch releases.
V21_1

Expand Down Expand Up @@ -371,10 +369,6 @@ var versionsSingleton = keyedVersions{
Key: TracingVerbosityIndependentSemantics,
Version: roachpb.Version{Major: 20, Minor: 2, Internal: 28},
},
{
Key: NonVotingReplicas,
Version: roachpb.Version{Major: 20, Minor: 2, Internal: 46},
},
{
// V21_1 is CockroachDB v21.1. It's used for all v21.1.x patch releases.
Key: V21_1,
Expand Down
69 changes: 34 additions & 35 deletions pkg/clusterversion/key_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions pkg/kv/kvserver/replicate_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"time"

"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/clusterversion"
"github.com/cockroachdb/cockroach/pkg/gossip"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvserverpb"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/liveness/livenesspb"
Expand Down Expand Up @@ -661,11 +660,6 @@ func (rq *replicateQueue) addOrReplaceNonVoters(
removeIdx int,
dryRun bool,
) (requeue bool, _ error) {
// Non-voter creation is disabled before 21.1.
if v, st := clusterversion.NonVotingReplicas, repl.ClusterSettings(); !st.Version.IsActive(ctx, v) {
return false, errors.AssertionFailedf("non-voting replicas cannot be created pre-21.1")
}

desc, conf := repl.DescAndSpanConfig()
existingNonVoters := desc.Replicas().NonVoterDescriptors()

Expand Down
20 changes: 0 additions & 20 deletions pkg/sql/set_zone_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"strings"

"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/clusterversion"
"github.com/cockroachdb/cockroach/pkg/config"
"github.com/cockroachdb/cockroach/pkg/config/zonepb"
"github.com/cockroachdb/cockroach/pkg/keys"
Expand Down Expand Up @@ -78,9 +77,6 @@ var supportedZoneConfigOptions = map[tree.Name]struct {
requiredType: types.Bool,
setter: func(c *zonepb.ZoneConfig, d tree.Datum) { c.GlobalReads = proto.Bool(bool(tree.MustBeDBool(d))) },
checkAllowed: func(ctx context.Context, execCfg *ExecutorConfig, d tree.Datum) error {
if err := checkVersionActive(ctx, execCfg, clusterversion.NonVotingReplicas, "global_reads"); err != nil {
return err
}
if !tree.MustBeDBool(d) {
// Always allow the value to be unset.
return nil
Expand All @@ -100,9 +96,6 @@ var supportedZoneConfigOptions = map[tree.Name]struct {
"num_voters": {
requiredType: types.Int,
setter: func(c *zonepb.ZoneConfig, d tree.Datum) { c.NumVoters = proto.Int32(int32(tree.MustBeDInt(d))) },
checkAllowed: func(ctx context.Context, execCfg *ExecutorConfig, _ tree.Datum) error {
return checkVersionActive(ctx, execCfg, clusterversion.NonVotingReplicas, "num_voters")
},
},
"gc.ttlseconds": {
requiredType: types.Int,
Expand Down Expand Up @@ -133,9 +126,6 @@ var supportedZoneConfigOptions = map[tree.Name]struct {
c.VoterConstraints = voterConstraintsList.Constraints
c.NullVoterConstraintsIsEmpty = true
},
checkAllowed: func(ctx context.Context, execCfg *ExecutorConfig, _ tree.Datum) error {
return checkVersionActive(ctx, execCfg, clusterversion.NonVotingReplicas, "voter_constraints")
},
},
"lease_preferences": {
requiredType: types.String,
Expand Down Expand Up @@ -164,16 +154,6 @@ func loadYAML(dst interface{}, yamlString string) {
}
}

func checkVersionActive(
ctx context.Context, execCfg *ExecutorConfig, minVersion clusterversion.Key, option string,
) error {
if !execCfg.Settings.Version.IsActive(ctx, minVersion) {
return pgerror.Newf(pgcode.FeatureNotSupported,
"%s cannot be used until cluster version is finalized", option)
}
return nil
}

func (p *planner) SetZoneConfig(ctx context.Context, n *tree.SetZoneConfig) (planNode, error) {
if err := checkSchemaChangeEnabled(
ctx,
Expand Down

0 comments on commit ef4710c

Please sign in to comment.