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: remove enterprise check for subzone rep ctrls #132788

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pkg/ccl/partitionccl/zone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1067,9 +1067,7 @@ func TestGenerateSubzoneSpans(t *testing.T) {
if err != nil {
t.Fatalf("%+v", err)
}
hasNewSubzones := false
spans, err := sql.GenerateSubzoneSpans(
cluster.NoSettings, keys.SystemSQLCodec, parse.tableDesc, parse.subzones, hasNewSubzones)
spans, err := sql.GenerateSubzoneSpans(keys.SystemSQLCodec, parse.tableDesc, parse.subzones)
if err != nil {
t.Fatalf("generating subzone spans: %+v", err)
}
Expand Down
4 changes: 1 addition & 3 deletions pkg/kv/kvserver/reports/constraint_stats_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1048,9 +1048,7 @@ func generateTableZone(t table, tableDesc descpb.TableDescriptor) (*zonepb.ZoneC
// Fill in the SubzoneSpans.
if tableZone != nil {
var err error
tableZone.SubzoneSpans, err = sql.GenerateSubzoneSpans(
nil, keys.SystemSQLCodec,
tabledesc.NewBuilder(&tableDesc).BuildImmutableTable(), tableZone.Subzones, false /* hasNewSubzones */)
tableZone.SubzoneSpans, err = sql.GenerateSubzoneSpans(keys.SystemSQLCodec, tabledesc.NewBuilder(&tableDesc).BuildImmutableTable(), tableZone.Subzones)
if err != nil {
return nil, errors.Wrap(err, "error generating subzone spans")
}
Expand Down
8 changes: 1 addition & 7 deletions pkg/sql/drop_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,7 @@ func (p *planner) dropIndexByName(

for _, s := range zone.Subzones {
if s.IndexID != uint32(idx.GetID()) {
_, err = GenerateSubzoneSpans(
p.ExecCfg().Settings,
p.ExecCfg().Codec,
tableDesc,
zone.Subzones,
false, /* newSubzones */
)
_, err = GenerateSubzoneSpans(p.ExecCfg().Codec, tableDesc, zone.Subzones)
if sqlerrors.IsCCLRequiredError(err) {
return sqlerrors.NewCCLRequiredError(fmt.Errorf("schema change requires a CCL binary "+
"because table %q has at least one remaining index or partition with a zone config",
Expand Down
16 changes: 1 addition & 15 deletions pkg/sql/partition_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ package sql
import (
"bytes"

"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/config/zonepb"
"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/sql/catalog"
"github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb"
"github.com/cockroachdb/cockroach/pkg/sql/covering"
Expand Down Expand Up @@ -64,20 +62,8 @@ import (
// TODO(benesch): remove the hasNewSubzones parameter when a statement to clear
// all subzones at once is introduced.
func GenerateSubzoneSpans(
st *cluster.Settings,
codec keys.SQLCodec,
tableDesc catalog.TableDescriptor,
subzones []zonepb.Subzone,
hasNewSubzones bool,
codec keys.SQLCodec, tableDesc catalog.TableDescriptor, subzones []zonepb.Subzone,
) ([]zonepb.SubzoneSpan, error) {
// Removing zone configs does not require a valid license.
if hasNewSubzones {
if err := base.CheckEnterpriseEnabled(st,
"replication zones on indexes or partitions"); err != nil {
return nil, err
}
}

// We already completely avoid creating subzone spans for dropped indexes.
// Whether this was intentional is a different story, but it turns out to be
// pretty sane. Dropped elements may refer to dropped types and we aren't
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ go_library(
importpath = "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scbuild/internal/scbuildstmt",
visibility = ["//pkg/sql/schemachanger/scbuild:__subpackages__"],
deps = [
"//pkg/base",
"//pkg/build",
"//pkg/clusterversion",
"//pkg/config/zonepb",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"context"
"fmt"

"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/config/zonepb"
"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/roachpb"
Expand Down Expand Up @@ -652,10 +651,6 @@ func accumulateNewUniqueConstraints(currentZone, newZone *zonepb.ZoneConfig) []z
func generateSubzoneSpans(
b BuildCtx, tableID catid.DescID, subzones []zonepb.Subzone,
) ([]zonepb.SubzoneSpan, error) {
if err := base.CheckEnterpriseEnabled(b.ClusterSettings(),
"replication zones on indexes or partitions"); err != nil {
return nil, err
}
// We already completely avoid creating subzone spans for dropped indexes.
// Whether this was intentional is a different story, but it turns out to be
// pretty sane. Dropped elements may refer to dropped types and we aren't
Expand Down
4 changes: 1 addition & 3 deletions pkg/sql/set_zone_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1009,9 +1009,7 @@ func prepareZoneConfigWrites(
hasNewSubzones bool,
) (_ *zoneConfigUpdate, err error) {
if len(z.Subzones) > 0 {
st := execCfg.Settings
z.SubzoneSpans, err = GenerateSubzoneSpans(
st, execCfg.Codec, table, z.Subzones, hasNewSubzones)
z.SubzoneSpans, err = GenerateSubzoneSpans(execCfg.Codec, table, z.Subzones)
if err != nil {
return nil, err
}
Expand Down
16 changes: 1 addition & 15 deletions pkg/sql/sqlnoccltest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,11 @@ load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "sqlnoccltest_test",
srcs = [
"main_test.go",
"partition_test.go",
],
srcs = ["main_test.go"],
deps = [
"//pkg/base",
"//pkg/config/zonepb",
"//pkg/security/securityassets",
"//pkg/security/securitytest",
"//pkg/server",
"//pkg/sql/catalog/catalogkeys",
"//pkg/sql/catalog/catpb",
"//pkg/sql/catalog/desctestutils",
"//pkg/sql/tests",
"//pkg/testutils/serverutils",
"//pkg/testutils/sqlutils",
"//pkg/util/encoding",
"//pkg/util/leaktest",
"//pkg/util/log",
"//pkg/util/protoutil",
],
)
153 changes: 0 additions & 153 deletions pkg/sql/sqlnoccltest/partition_test.go

This file was deleted.

Loading