Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
116457: sql: remove some leftover tenant-specific stuff r=yuzefovich a=yuzefovich

Informs: cockroachdb#116445.

Epic: None

Release note: None

Co-authored-by: Yahor Yuzefovich <[email protected]>
  • Loading branch information
craig[bot] and yuzefovich committed Dec 15, 2023
2 parents 40d6e44 + 9ea34c5 commit 129b274
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 35 deletions.
1 change: 0 additions & 1 deletion pkg/sql/alter_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ func (p *planner) checkCanDropSystemDatabaseRegion(ctx context.Context, region t
// - either be part of an admin role.
// - or be an owner of the table.
// - or have the CREATE privilege on the table.
// privilege on the table descriptor.
//
// For the system database, the conditions are more stringent. The user must
// be the node user, and this must be a secondary tenant.
Expand Down
4 changes: 0 additions & 4 deletions pkg/sql/conn_executor_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -1881,10 +1881,6 @@ func (ex *connExecutor) dispatchToExecutionEngine(
panic(err)
}

if !planner.ExecCfg().Codec.ForSystemTenant() {
planner.curPlan.flags.Set(planFlagTenant)
}

switch distributePlan {
case physicalplan.FullyDistributedPlan:
planner.curPlan.flags.Set(planFlagFullyDistributed)
Expand Down
3 changes: 0 additions & 3 deletions pkg/sql/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,6 @@ const (
// engine.
planFlagVectorized

// planFlagTenant is set if the plan is executed on behalf of a tenant.
planFlagTenant

// planFlagContainsFullTableScan is set if the plan involves an unconstrained
// scan on (the primary key of) a table. This could be an unconstrained scan
// of any cardinality.
Expand Down
30 changes: 3 additions & 27 deletions pkg/sql/set_cluster_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ func (n *setClusterSettingNode) startExec(params runParams) error {
n.st,
n.value,
params.p.EvalContext(),
params.extendedEvalCtx.Codec.ForSystemTenant(),
params.p.logEvent,
params.p.descCollection.ReleaseLeases,
params.p.makeUnsafeSettingInterlockInfo(),
Expand Down Expand Up @@ -430,7 +429,6 @@ func writeSettingInternal(
st *cluster.Settings,
value tree.TypedExpr,
evalCtx *eval.Context,
forSystemTenant bool,
logFn func(context.Context, descpb.ID, logpb.EventPayload) error,
releaseLeases func(context.Context),
interlockInfo unsafeSettingInterlockInfo,
Expand All @@ -451,10 +449,7 @@ func writeSettingInternal(
return err
}
reportedValue, expectedEncodedValue, err = writeNonDefaultSettingValue(
ctx, hook, db,
setting, user, st, value, forSystemTenant,
releaseLeases,
interlockInfo,
ctx, hook, db, setting, user, st, value, releaseLeases, interlockInfo,
)
if err != nil {
return err
Expand Down Expand Up @@ -505,7 +500,6 @@ func writeNonDefaultSettingValue(
user username.SQLUsername,
st *cluster.Settings,
value tree.Datum,
forSystemTenant bool,
releaseLeases func(context.Context),
interlockInfo unsafeSettingInterlockInfo,
) (reportedValue string, expectedEncodedValue string, err error) {
Expand All @@ -522,8 +516,7 @@ func writeNonDefaultSettingValue(
verSetting, isSetVersion := setting.(*settings.VersionSetting)
if isSetVersion {
if err := setVersionSetting(
ctx, hook, verSetting, db, user, st, value, encoded,
forSystemTenant, releaseLeases,
ctx, hook, verSetting, db, user, st, value, encoded, releaseLeases,
); err != nil {
return reportedValue, expectedEncodedValue, err
}
Expand Down Expand Up @@ -559,7 +552,6 @@ func setVersionSetting(
st *cluster.Settings,
value tree.Datum,
encoded string,
forSystemTenant bool,
releaseLeases func(context.Context),
) error {
// In the special case of the 'version' cluster setting,
Expand All @@ -579,23 +571,7 @@ func setVersionSetting(
// hasn't run yet, we can't update the version as we don't
// have good enough information about the current cluster
// version.
if forSystemTenant {
return errors.New("no persisted cluster version found, please retry later")
}
// The tenant cluster in 20.2 did not ever initialize this value and
// utilized this hard-coded value instead. In 21.1, the builtin
// which creates tenants sets up the cluster version state. It also
// is set when the version is upgraded.
tenantDefaultVersion := clusterversion.ClusterVersion{
Version: roachpb.Version{Major: 20, Minor: 2},
}
// Pretend that the expected value was already there to allow us to
// run migrations.
prevEncoded, err := protoutil.Marshal(&tenantDefaultVersion)
if err != nil {
return errors.WithAssertionFailure(err)
}
prev = tree.NewDString(string(prevEncoded))
return errors.New("no persisted cluster version found, please retry later")
} else {
prev = datums[0]
}
Expand Down

0 comments on commit 129b274

Please sign in to comment.