diff --git a/pkg/base/license.go b/pkg/base/license.go index 6674788e0e55..0d3c82b88a9d 100644 --- a/pkg/base/license.go +++ b/pkg/base/license.go @@ -28,7 +28,7 @@ var errEnterpriseNotEnabled = errors.New("OSS binaries do not include enterprise // enable it. // // This function is overridden by an init hook in CCL builds. -var CheckEnterpriseEnabled = func(_ *cluster.Settings, _ uuid.UUID, org, feature string) error { +var CheckEnterpriseEnabled = func(_ *cluster.Settings, _ uuid.UUID, feature string) error { return errEnterpriseNotEnabled // nb: this is squarely in the hot path on OSS builds } diff --git a/pkg/ccl/backupccl/alter_backup_schedule.go b/pkg/ccl/backupccl/alter_backup_schedule.go index 7fda1b2e2c29..fbd4eaa1d5e3 100644 --- a/pkg/ccl/backupccl/alter_backup_schedule.go +++ b/pkg/ccl/backupccl/alter_backup_schedule.go @@ -627,7 +627,7 @@ func makeAlterBackupScheduleSpec( } enterpriseCheckErr := utilccl.CheckEnterpriseEnabled( - p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), p.ExecCfg().Organization(), + p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), "BACKUP INTO LATEST") spec.isEnterpriseUser = enterpriseCheckErr == nil diff --git a/pkg/ccl/backupccl/backup_job.go b/pkg/ccl/backupccl/backup_job.go index d1fed05eab61..67f9ff1baf91 100644 --- a/pkg/ccl/backupccl/backup_job.go +++ b/pkg/ccl/backupccl/backup_job.go @@ -561,7 +561,7 @@ func (b *backupResumer) Resume(ctx context.Context, execCtx interface{}) error { // Collect telemetry, once per backup after resolving its destination. lic := utilccl.CheckEnterpriseEnabled( - p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), p.ExecCfg().Organization(), "", + p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), "", ) != nil collectTelemetry(ctx, m, initialDetails, details, lic, b.job.ID()) } diff --git a/pkg/ccl/backupccl/backup_planning.go b/pkg/ccl/backupccl/backup_planning.go index e8a51ec710d7..6c0e1bba34c4 100644 --- a/pkg/ccl/backupccl/backup_planning.go +++ b/pkg/ccl/backupccl/backup_planning.go @@ -485,7 +485,7 @@ func checkPrivilegesForBackup( func requireEnterprise(execCfg *sql.ExecutorConfig, feature string) error { if err := utilccl.CheckEnterpriseEnabled( - execCfg.Settings, execCfg.NodeInfo.LogicalClusterID(), execCfg.Organization(), + execCfg.Settings, execCfg.NodeInfo.LogicalClusterID(), fmt.Sprintf("BACKUP with %s", feature), ); err != nil { return err diff --git a/pkg/ccl/backupccl/create_scheduled_backup.go b/pkg/ccl/backupccl/create_scheduled_backup.go index 63c16d4045a0..066c4bd58565 100644 --- a/pkg/ccl/backupccl/create_scheduled_backup.go +++ b/pkg/ccl/backupccl/create_scheduled_backup.go @@ -769,7 +769,7 @@ func makeScheduledBackupSpec( } enterpriseCheckErr := utilccl.CheckEnterpriseEnabled( - p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), p.ExecCfg().Organization(), + p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), "BACKUP INTO LATEST") spec.isEnterpriseUser = enterpriseCheckErr == nil diff --git a/pkg/ccl/backupccl/restore_planning.go b/pkg/ccl/backupccl/restore_planning.go index 7e4c1ebc1b97..d195f915e85c 100644 --- a/pkg/ccl/backupccl/restore_planning.go +++ b/pkg/ccl/backupccl/restore_planning.go @@ -2074,7 +2074,7 @@ func planDatabaseModifiersForRestore( return nil, nil, nil } if err := multiregionccl.CheckClusterSupportsMultiRegion( - p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), p.ExecCfg().Organization(), + p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), ); err != nil { return nil, nil, errors.WithHintf( err, diff --git a/pkg/ccl/changefeedccl/changefeed_stmt.go b/pkg/ccl/changefeedccl/changefeed_stmt.go index dc796396a190..c7c8840a48b0 100644 --- a/pkg/ccl/changefeedccl/changefeed_stmt.go +++ b/pkg/ccl/changefeedccl/changefeed_stmt.go @@ -553,7 +553,7 @@ func createChangefeedJobRecord( if scope, ok := opts.GetMetricScope(); ok { if err := utilccl.CheckEnterpriseEnabled( - p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), p.ExecCfg().Organization(), "CHANGEFEED", + p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), "CHANGEFEED", ); err != nil { return nil, errors.Wrapf(err, "use of %q option requires enterprise license.", changefeedbase.OptMetricsScope) @@ -586,7 +586,7 @@ func createChangefeedJobRecord( } if err := utilccl.CheckEnterpriseEnabled( - p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), p.ExecCfg().Organization(), "CHANGEFEED", + p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), "CHANGEFEED", ); err != nil { return nil, err } diff --git a/pkg/ccl/gssapiccl/gssapi.go b/pkg/ccl/gssapiccl/gssapi.go index faca9ec48e85..3eed38fadcf3 100644 --- a/pkg/ccl/gssapiccl/gssapi.go +++ b/pkg/ccl/gssapiccl/gssapi.go @@ -107,7 +107,7 @@ func authGSS( // their GSS configuration is correct. That is, the presence of this error // message means they have a correctly functioning GSS/Kerberos setup, // but now need to enable enterprise features. - return utilccl.CheckEnterpriseEnabled(execCfg.Settings, execCfg.NodeInfo.LogicalClusterID(), execCfg.Organization(), "GSS authentication") + return utilccl.CheckEnterpriseEnabled(execCfg.Settings, execCfg.NodeInfo.LogicalClusterID(), "GSS authentication") }) return behaviors, nil } diff --git a/pkg/ccl/jwtauthccl/BUILD.bazel b/pkg/ccl/jwtauthccl/BUILD.bazel index 59961022f48d..dd28304d4aac 100644 --- a/pkg/ccl/jwtauthccl/BUILD.bazel +++ b/pkg/ccl/jwtauthccl/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//pkg/server/telemetry", "//pkg/settings", "//pkg/settings/cluster", - "//pkg/sql", "//pkg/sql/pgwire", "//pkg/sql/pgwire/identmap", "//pkg/util/log", diff --git a/pkg/ccl/jwtauthccl/authentication_jwt.go b/pkg/ccl/jwtauthccl/authentication_jwt.go index 176380a014a2..493ae22681a2 100644 --- a/pkg/ccl/jwtauthccl/authentication_jwt.go +++ b/pkg/ccl/jwtauthccl/authentication_jwt.go @@ -15,7 +15,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/security/username" "github.com/cockroachdb/cockroach/pkg/server/telemetry" "github.com/cockroachdb/cockroach/pkg/settings/cluster" - "github.com/cockroachdb/cockroach/pkg/sql" "github.com/cockroachdb/cockroach/pkg/sql/pgwire" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/identmap" "github.com/cockroachdb/cockroach/pkg/util/log" @@ -186,8 +185,7 @@ func (authenticator *jwtAuthenticator) ValidateJWTLogin( "token issued with an audience of %s", parsedToken.Audience()) } - org := sql.ClusterOrganization.Get(&st.SV) - if err = utilccl.CheckEnterpriseEnabled(st, authenticator.clusterUUID, org, "JWT authentication"); err != nil { + if err = utilccl.CheckEnterpriseEnabled(st, authenticator.clusterUUID, "JWT authentication"); err != nil { return err } diff --git a/pkg/ccl/kvccl/kvfollowerreadsccl/boundedstaleness.go b/pkg/ccl/kvccl/kvfollowerreadsccl/boundedstaleness.go index 7c9971e60534..f82c55e020ce 100644 --- a/pkg/ccl/kvccl/kvfollowerreadsccl/boundedstaleness.go +++ b/pkg/ccl/kvccl/kvfollowerreadsccl/boundedstaleness.go @@ -13,7 +13,6 @@ import ( "time" "github.com/cockroachdb/cockroach/pkg/ccl/utilccl" - "github.com/cockroachdb/cockroach/pkg/sql" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/sql/sem/asof" @@ -24,11 +23,9 @@ import ( ) func checkBoundedStalenessEnabled(evalCtx *eval.Context) error { - st := evalCtx.Settings return utilccl.CheckEnterpriseEnabled( - st, + evalCtx.Settings, evalCtx.ClusterID, - sql.ClusterOrganization.Get(&st.SV), "bounded staleness", ) } diff --git a/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads.go b/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads.go index 26715ffc0722..a350c2a68d09 100644 --- a/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads.go +++ b/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads.go @@ -74,15 +74,13 @@ func getGlobalReadsLead(clock *hlc.Clock) time.Duration { // reads is enabled, returning a detailed error if not. It is not suitable for // use in hot paths since a new error may be instantiated on each call. func checkEnterpriseEnabled(logicalClusterID uuid.UUID, st *cluster.Settings) error { - org := sql.ClusterOrganization.Get(&st.SV) - return utilccl.CheckEnterpriseEnabled(st, logicalClusterID, org, "follower reads") + return utilccl.CheckEnterpriseEnabled(st, logicalClusterID, "follower reads") } // isEnterpriseEnabled is faster than checkEnterpriseEnabled, and suitable // for hot paths. func isEnterpriseEnabled(logicalClusterID uuid.UUID, st *cluster.Settings) bool { - org := sql.ClusterOrganization.Get(&st.SV) - return utilccl.IsEnterpriseEnabled(st, logicalClusterID, org, "follower reads") + return utilccl.IsEnterpriseEnabled(st, logicalClusterID, "follower reads") } func checkFollowerReadsEnabled(logicalClusterID uuid.UUID, st *cluster.Settings) bool { diff --git a/pkg/ccl/multiregionccl/multiregion.go b/pkg/ccl/multiregionccl/multiregion.go index c6df35b4aa6a..ce200b5d7c16 100644 --- a/pkg/ccl/multiregionccl/multiregion.go +++ b/pkg/ccl/multiregionccl/multiregion.go @@ -36,7 +36,6 @@ func initializeMultiRegionMetadata( descIDGenerator eval.DescIDGenerator, settings *cluster.Settings, clusterID uuid.UUID, - clusterOrganization string, liveRegions sql.LiveClusterRegions, goal tree.SurvivalGoal, primaryRegion catpb.RegionName, @@ -45,7 +44,7 @@ func initializeMultiRegionMetadata( secondaryRegion catpb.RegionName, ) (*multiregion.RegionConfig, error) { if err := CheckClusterSupportsMultiRegion( - settings, clusterID, clusterOrganization, + settings, clusterID, ); err != nil { return nil, err } @@ -130,13 +129,10 @@ func initializeMultiRegionMetadata( // CheckClusterSupportsMultiRegion returns whether the current cluster supports // multi-region features. -func CheckClusterSupportsMultiRegion( - settings *cluster.Settings, clusterID uuid.UUID, organization string, -) error { +func CheckClusterSupportsMultiRegion(settings *cluster.Settings, clusterID uuid.UUID) error { return utilccl.CheckEnterpriseEnabled( settings, clusterID, - organization, "multi-region features", ) } @@ -147,7 +143,6 @@ func getMultiRegionEnumAddValuePlacement( if err := utilccl.CheckEnterpriseEnabled( execCfg.Settings, execCfg.NodeInfo.LogicalClusterID(), - execCfg.Organization(), "ADD REGION", ); err != nil { return tree.AlterTypeAddValue{}, err diff --git a/pkg/ccl/oidcccl/BUILD.bazel b/pkg/ccl/oidcccl/BUILD.bazel index 00a6930a50f0..c5d7718551cf 100644 --- a/pkg/ccl/oidcccl/BUILD.bazel +++ b/pkg/ccl/oidcccl/BUILD.bazel @@ -18,7 +18,6 @@ go_library( "//pkg/server/telemetry", "//pkg/settings", "//pkg/settings/cluster", - "//pkg/sql", "//pkg/ui", "//pkg/util/log", "//pkg/util/protoutil", diff --git a/pkg/ccl/oidcccl/authentication_oidc.go b/pkg/ccl/oidcccl/authentication_oidc.go index 0e889010fcbb..759db7272bd0 100644 --- a/pkg/ccl/oidcccl/authentication_oidc.go +++ b/pkg/ccl/oidcccl/authentication_oidc.go @@ -20,7 +20,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/server" "github.com/cockroachdb/cockroach/pkg/server/telemetry" "github.com/cockroachdb/cockroach/pkg/settings/cluster" - "github.com/cockroachdb/cockroach/pkg/sql" "github.com/cockroachdb/cockroach/pkg/ui" "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/syncutil" @@ -365,8 +364,7 @@ var ConfigureOIDC = func( return } - org := sql.ClusterOrganization.Get(&st.SV) - if err := utilccl.CheckEnterpriseEnabled(st, cluster, org, "OIDC"); err != nil { + if err := utilccl.CheckEnterpriseEnabled(st, cluster, "OIDC"); err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return } diff --git a/pkg/ccl/partitionccl/partition.go b/pkg/ccl/partitionccl/partition.go index 8ddbb93d7eed..27ffa362706c 100644 --- a/pkg/ccl/partitionccl/partition.go +++ b/pkg/ccl/partitionccl/partition.go @@ -346,8 +346,7 @@ func createPartitioning( allowedNewColumnNames []tree.Name, allowImplicitPartitioning bool, ) (newImplicitCols []catalog.Column, newPartitioning catpb.PartitioningDescriptor, err error) { - org := sql.ClusterOrganization.Get(&st.SV) - if err := utilccl.CheckEnterpriseEnabled(st, evalCtx.ClusterID, org, "partitions"); err != nil { + if err := utilccl.CheckEnterpriseEnabled(st, evalCtx.ClusterID, "partitions"); err != nil { return nil, newPartitioning, err } diff --git a/pkg/ccl/streamingccl/streamingest/stream_ingest_manager.go b/pkg/ccl/streamingccl/streamingest/stream_ingest_manager.go index db7bdcc457c0..0f2e8b24ecd8 100644 --- a/pkg/ccl/streamingccl/streamingest/stream_ingest_manager.go +++ b/pkg/ccl/streamingccl/streamingest/stream_ingest_manager.go @@ -57,7 +57,7 @@ func newStreamIngestManagerWithPrivilegesCheck( execCfg := evalCtx.Planner.ExecutorConfig().(*sql.ExecutorConfig) enterpriseCheckErr := utilccl.CheckEnterpriseEnabled( - execCfg.Settings, execCfg.NodeInfo.LogicalClusterID(), execCfg.Organization(), "REPLICATION") + execCfg.Settings, execCfg.NodeInfo.LogicalClusterID(), "REPLICATION") if enterpriseCheckErr != nil { return nil, pgerror.Wrap(enterpriseCheckErr, pgcode.InsufficientPrivilege, "replication requires enterprise license") diff --git a/pkg/ccl/streamingccl/streamingest/stream_ingestion_planning.go b/pkg/ccl/streamingccl/streamingest/stream_ingestion_planning.go index 3a61717d49ba..7b32c2778978 100644 --- a/pkg/ccl/streamingccl/streamingest/stream_ingestion_planning.go +++ b/pkg/ccl/streamingccl/streamingest/stream_ingestion_planning.go @@ -93,7 +93,7 @@ func ingestionPlanHook( defer span.Finish() if err := utilccl.CheckEnterpriseEnabled( - p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), p.ExecCfg().Organization(), + p.ExecCfg().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), "RESTORE FROM REPLICATION STREAM", ); err != nil { return err diff --git a/pkg/ccl/streamingccl/streamproducer/replication_manager.go b/pkg/ccl/streamingccl/streamproducer/replication_manager.go index be8f04a7cfb8..5ab6c379d5c8 100644 --- a/pkg/ccl/streamingccl/streamproducer/replication_manager.go +++ b/pkg/ccl/streamingccl/streamproducer/replication_manager.go @@ -78,7 +78,7 @@ func newReplicationStreamManagerWithPrivilegesCheck( execCfg := evalCtx.Planner.ExecutorConfig().(*sql.ExecutorConfig) enterpriseCheckErr := utilccl.CheckEnterpriseEnabled( - execCfg.Settings, execCfg.NodeInfo.LogicalClusterID(), execCfg.Organization(), "REPLICATION") + execCfg.Settings, execCfg.NodeInfo.LogicalClusterID(), "REPLICATION") if enterpriseCheckErr != nil { return nil, pgerror.Wrap(enterpriseCheckErr, pgcode.InsufficientPrivilege, "replication requires enterprise license") diff --git a/pkg/ccl/utilccl/BUILD.bazel b/pkg/ccl/utilccl/BUILD.bazel index 526bd045f141..0b93909b0ebc 100644 --- a/pkg/ccl/utilccl/BUILD.bazel +++ b/pkg/ccl/utilccl/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//pkg/server", "//pkg/settings", "//pkg/settings/cluster", + "//pkg/sql", "//pkg/sql/pgwire/pgcode", "//pkg/sql/pgwire/pgerror", "//pkg/sql/sem/builtins/builtinsregistry", diff --git a/pkg/ccl/utilccl/license_check.go b/pkg/ccl/utilccl/license_check.go index e5b2d94a5995..3fdb1cc82929 100644 --- a/pkg/ccl/utilccl/license_check.go +++ b/pkg/ccl/utilccl/license_check.go @@ -20,6 +20,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/server" "github.com/cockroachdb/cockroach/pkg/settings" "github.com/cockroachdb/cockroach/pkg/settings/cluster" + "github.com/cockroachdb/cockroach/pkg/sql" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/util/envutil" @@ -114,8 +115,8 @@ func ApplyTenantLicense() error { // The ClusterID argument should be the tenant-specific logical // cluster ID. is not used for the check itself; it is merely embedded // in the URL displayed in the error message. -func CheckEnterpriseEnabled(st *cluster.Settings, cluster uuid.UUID, org, feature string) error { - return checkEnterpriseEnabledAt(st, timeutil.Now(), cluster, org, feature, true /* withDetails */) +func CheckEnterpriseEnabled(st *cluster.Settings, cluster uuid.UUID, feature string) error { + return checkEnterpriseEnabledAt(st, timeutil.Now(), cluster, feature, true /* withDetails */) } // IsEnterpriseEnabled returns whether the requested enterprise feature is @@ -126,9 +127,9 @@ func CheckEnterpriseEnabled(st *cluster.Settings, cluster uuid.UUID, org, featur // The ClusterID argument should be the tenant-specific logical // cluster ID. is not used for the check itself; it is merely embedded // in the URL displayed in the error message. -func IsEnterpriseEnabled(st *cluster.Settings, cluster uuid.UUID, org, feature string) bool { +func IsEnterpriseEnabled(st *cluster.Settings, cluster uuid.UUID, feature string) bool { return checkEnterpriseEnabledAt( - st, timeutil.Now(), cluster, org, feature, false /* withDetails */) == nil + st, timeutil.Now(), cluster, feature, false /* withDetails */) == nil } func init() { @@ -184,7 +185,7 @@ func updateMetricWithLicenseTTL( } func checkEnterpriseEnabledAt( - st *cluster.Settings, at time.Time, cluster uuid.UUID, org, feature string, withDetails bool, + st *cluster.Settings, at time.Time, cluster uuid.UUID, feature string, withDetails bool, ) error { if atomic.LoadInt32(&enterpriseStatus) == enterpriseEnabled { return nil @@ -193,6 +194,7 @@ func checkEnterpriseEnabledAt( if err != nil { return err } + org := sql.ClusterOrganization.Get(&st.SV) return check(license, at, cluster, org, feature, withDetails) } diff --git a/pkg/ccl/utilccl/license_check_test.go b/pkg/ccl/utilccl/license_check_test.go index 734a50b6239a..b1610a81050a 100644 --- a/pkg/ccl/utilccl/license_check_test.go +++ b/pkg/ccl/utilccl/license_check_test.go @@ -68,7 +68,7 @@ func TestSettingAndCheckingLicense(t *testing.T) { if err := setLicense(ctx, updater, tc.lic); err != nil { t.Fatal(err) } - err := checkEnterpriseEnabledAt(st, tc.checkTime, tc.checkCluster, "", "", true) + err := checkEnterpriseEnabledAt(st, tc.checkTime, tc.checkCluster, "", true) if !testutils.IsError(err, tc.err) { l, _ := decode(tc.lic) t.Fatalf("%d: lic %v, update by %T, checked by %s at %s, got %q", i, l, updater, tc.checkCluster, tc.checkTime, err) @@ -204,11 +204,11 @@ func TestApplyTenantLicenseWithLicense(t *testing.T) { settings := cluster.MakeClusterSettings() - require.Error(t, CheckEnterpriseEnabled(settings, uuid.MakeV4(), "", "")) - require.False(t, IsEnterpriseEnabled(settings, uuid.MakeV4(), "", "")) + require.Error(t, CheckEnterpriseEnabled(settings, uuid.MakeV4(), "")) + require.False(t, IsEnterpriseEnabled(settings, uuid.MakeV4(), "")) require.NoError(t, ApplyTenantLicense()) - require.NoError(t, CheckEnterpriseEnabled(settings, uuid.MakeV4(), "", "")) - require.True(t, IsEnterpriseEnabled(settings, uuid.MakeV4(), "", "")) + require.NoError(t, CheckEnterpriseEnabled(settings, uuid.MakeV4(), "")) + require.True(t, IsEnterpriseEnabled(settings, uuid.MakeV4(), "")) } func TestApplyTenantLicenseWithoutLicense(t *testing.T) { @@ -219,11 +219,11 @@ func TestApplyTenantLicenseWithoutLicense(t *testing.T) { envutil.ClearEnvCache() require.False(t, ok) - require.Error(t, CheckEnterpriseEnabled(settings, uuid.MakeV4(), "", "")) - require.False(t, IsEnterpriseEnabled(settings, uuid.MakeV4(), "", "")) + require.Error(t, CheckEnterpriseEnabled(settings, uuid.MakeV4(), "")) + require.False(t, IsEnterpriseEnabled(settings, uuid.MakeV4(), "")) require.NoError(t, ApplyTenantLicense()) - require.Error(t, CheckEnterpriseEnabled(settings, uuid.MakeV4(), "", "")) - require.False(t, IsEnterpriseEnabled(settings, uuid.MakeV4(), "", "")) + require.Error(t, CheckEnterpriseEnabled(settings, uuid.MakeV4(), "")) + require.False(t, IsEnterpriseEnabled(settings, uuid.MakeV4(), "")) } func TestApplyTenantLicenseWithInvalidLicense(t *testing.T) { diff --git a/pkg/server/admin.go b/pkg/server/admin.go index f8851aec3850..f99aad26d6b5 100644 --- a/pkg/server/admin.go +++ b/pkg/server/admin.go @@ -1978,11 +1978,9 @@ func (s *adminServer) Cluster( // Check if enterprise features are enabled. We currently test for the // feature "BACKUP", although enterprise licenses do not yet distinguish // between different features. - organization := sql.ClusterOrganization.Get(&s.server.st.SV) enterpriseEnabled := base.CheckEnterpriseEnabled( s.server.st, s.server.rpcContext.LogicalClusterID.Get(), - organization, "BACKUP") == nil return &serverpb.ClusterResponse{ diff --git a/pkg/server/admin_test.go b/pkg/server/admin_test.go index b6b5d778c2d7..4cdc4a084f5d 100644 --- a/pkg/server/admin_test.go +++ b/pkg/server/admin_test.go @@ -1435,7 +1435,7 @@ func TestClusterAPI(t *testing.T) { // Override server license check. if enterpriseOn { old := base.CheckEnterpriseEnabled - base.CheckEnterpriseEnabled = func(_ *cluster.Settings, _ uuid.UUID, _, _ string) error { + base.CheckEnterpriseEnabled = func(_ *cluster.Settings, _ uuid.UUID, _ string) error { return nil } defer func() { base.CheckEnterpriseEnabled = old }() diff --git a/pkg/server/testserver.go b/pkg/server/testserver.go index 42c1c4e190af..de94437c4693 100644 --- a/pkg/server/testserver.go +++ b/pkg/server/testserver.go @@ -514,9 +514,8 @@ func (ts *TestServer) TestTenants() []serverutils.TestTenantInterface { // enterprise enabled build. This is due to licensing restrictions on the MT // capabilities. func (ts *TestServer) maybeStartDefaultTestTenant(ctx context.Context) error { - org := sql.ClusterOrganization.Get(&ts.st.SV) clusterID := ts.sqlServer.execCfg.NodeInfo.LogicalClusterID - if err := base.CheckEnterpriseEnabled(ts.st, clusterID(), org, "SQL servers"); err != nil { + if err := base.CheckEnterpriseEnabled(ts.st, clusterID(), "SQL servers"); err != nil { // If not enterprise enabled, we won't be able to use SQL Servers so eat // the error and return without creating/starting a SQL server. ts.cfg.DisableDefaultTestTenant = true diff --git a/pkg/sql/descriptor.go b/pkg/sql/descriptor.go index 89c0212b3f6b..33e5d00d20bb 100644 --- a/pkg/sql/descriptor.go +++ b/pkg/sql/descriptor.go @@ -353,7 +353,6 @@ var InitializeMultiRegionMetadataCCL = func( descIDGenerator eval.DescIDGenerator, settings *cluster.Settings, clusterID uuid.UUID, - clusterOrganization string, liveClusterRegions LiveClusterRegions, survivalGoal tree.SurvivalGoal, primaryRegion catpb.RegionName, @@ -447,7 +446,6 @@ func (p *planner) maybeInitializeMultiRegionMetadata( p.EvalContext().DescIDGenerator, p.EvalContext().Settings, p.ExecCfg().NodeInfo.LogicalClusterID(), - p.ExecCfg().Organization(), liveRegions, survivalGoal, catpb.RegionName(primaryRegion), diff --git a/pkg/sql/partition_utils.go b/pkg/sql/partition_utils.go index 5521678b0d2b..773352ed74b2 100644 --- a/pkg/sql/partition_utils.go +++ b/pkg/sql/partition_utils.go @@ -79,8 +79,7 @@ func GenerateSubzoneSpans( ) ([]zonepb.SubzoneSpan, error) { // Removing zone configs does not require a valid license. if hasNewSubzones { - org := ClusterOrganization.Get(&st.SV) - if err := base.CheckEnterpriseEnabled(st, logicalClusterID, org, + if err := base.CheckEnterpriseEnabled(st, logicalClusterID, "replication zones on indexes or partitions"); err != nil { return nil, err } diff --git a/pkg/sql/set_zone_config.go b/pkg/sql/set_zone_config.go index 1be2b04c8370..06379f1baf51 100644 --- a/pkg/sql/set_zone_config.go +++ b/pkg/sql/set_zone_config.go @@ -88,7 +88,6 @@ var supportedZoneConfigOptions = map[tree.Name]struct { return base.CheckEnterpriseEnabled( execCfg.Settings, execCfg.NodeInfo.LogicalClusterID(), - execCfg.Organization(), "global_reads", ) },