Skip to content

Commit

Permalink
pcr: delete physical_replication.enabled setting
Browse files Browse the repository at this point in the history
Release note (enterprise change): Physical Cluster Replication is now always enabled, and the setting physical_replication.enabled has been removed.
  • Loading branch information
dt committed Feb 13, 2024
1 parent 730ffe0 commit b5dbc5f
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 62 deletions.
3 changes: 0 additions & 3 deletions pkg/ccl/backupccl/tenant_backup_nemesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,6 @@ func newBackupNemesis(
n.t.Log("already hit replication limit")
return nil
}
if _, err := hostDB.Exec("SET CLUSTER SETTING physical_replication.enabled = true"); err != nil {
return err
}
if _, err := hostDB.Exec("SET CLUSTER SETTING kv.rangefeed.enabled = true"); err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ func NewReplicationHelper(
sqlDB.ExecMultiple(t,
// Required for replication stremas to work.
`SET CLUSTER SETTING kv.rangefeed.enabled = true`,
`SET CLUSTER SETTING physical_replication.enabled = true`,

// Speeds up the tests a bit.
`SET CLUSTER SETTING kv.rangefeed.closed_timestamp_refresh_interval = '200ms'`,
Expand Down
2 changes: 0 additions & 2 deletions pkg/ccl/streamingccl/replicationtestutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ func (c *TenantStreamingClusters) init(ctx context.Context) {
if c.Args.DestInitFunc != nil {
c.Args.DestInitFunc(c.T, c.DestSysSQL)
}
c.SrcSysSQL.Exec(c.T, `SET CLUSTER SETTING physical_replication.enabled = true;`)
c.DestSysSQL.Exec(c.T, `SET CLUSTER SETTING physical_replication.enabled = true;`)
}

// StartDestTenant starts the destination tenant and returns a cleanup function
Expand Down
10 changes: 0 additions & 10 deletions pkg/ccl/streamingccl/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ import (
"github.com/cockroachdb/cockroach/pkg/settings"
)

// CrossClusterReplicationEnabled enables the ability to setup and control a
// cross cluster replication stream.
var CrossClusterReplicationEnabled = settings.RegisterBoolSetting(
settings.SystemVisible,
"cross_cluster_replication.enabled",
"enables the ability to setup and control a cross cluster replication stream",
false,
settings.WithName("physical_replication.enabled"),
)

// StreamReplicationStreamLivenessTrackFrequency controls frequency to check
// the liveness of a streaming replication producer job.
var StreamReplicationStreamLivenessTrackFrequency = settings.RegisterDurationSetting(
Expand Down
14 changes: 0 additions & 14 deletions pkg/ccl/streamingccl/streamingest/alter_replication_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,6 @@ func alterReplicationJobTypeCheck(
return true, nil, nil
}

var physicalReplicationDisabledErr = errors.WithTelemetry(
pgerror.WithCandidateCode(
errors.WithHint(
errors.Newf("physical replication is disabled"),
"You can enable physical replication by running `SET CLUSTER SETTING physical_replication.enabled = true`.",
),
pgcode.ExperimentalFeature,
),
"physical_replication.enabled")

func alterReplicationJobHook(
ctx context.Context, stmt tree.Statement, p sql.PlanHookState,
) (sql.PlanHookRowFn, colinfo.ResultColumns, []sql.PlanNode, bool, error) {
Expand All @@ -156,10 +146,6 @@ func alterReplicationJobHook(
return nil, nil, nil, false, nil
}

if !streamingccl.CrossClusterReplicationEnabled.Get(&p.ExecCfg().Settings.SV) {
return nil, nil, nil, false, physicalReplicationDisabledErr
}

if !p.ExecCfg().Codec.ForSystemTenant() {
return nil, nil, nil, false, pgerror.Newf(pgcode.InsufficientPrivilege,
"only the system tenant can alter tenant")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,6 @@ func TestStreamIngestionJobWithRandomClient(t *testing.T) {
streamAddr := getTestRandomClientURI(roachpb.MustMakeTenantID(oldTenantID), oldTenantName)
query := fmt.Sprintf(`CREATE TENANT "30" FROM REPLICATION OF "10" ON '%s'`, streamAddr)

// Attempt to run the ingestion job without enabling the experimental setting.
_, err = conn.Exec(query)
require.True(t, testutils.IsError(err, "physical replication is disabled"))

_, err = conn.Exec(`SET CLUSTER SETTING physical_replication.enabled = true;`)
require.NoError(t, err)

_, err = conn.Exec(query)
require.NoError(t, err)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func TestTenantStreamingCreationErrors(t *testing.T) {

sysSQL := sqlutils.MakeSQLRunner(db)
sysSQL.Exec(t, `SET CLUSTER SETTING kv.rangefeed.enabled = true`)
sysSQL.Exec(t, `SET CLUSTER SETTING physical_replication.enabled = true`)

srcPgURL, cleanupSink := sqlutils.PGUrl(t, srv.SystemLayer().AdvSQLAddr(), t.Name(), url.User(username.RootUser))
defer cleanupSink()
Expand Down Expand Up @@ -129,7 +128,6 @@ func TestTenantStreamingFailback(t *testing.T) {
defer cleanupURLB()

for _, s := range []string{
"SET CLUSTER SETTING physical_replication.enabled = true",
"SET CLUSTER SETTING kv.rangefeed.enabled = true",
"SET CLUSTER SETTING kv.rangefeed.closed_timestamp_refresh_interval = '200ms'",
"SET CLUSTER SETTING kv.closed_timestamp.target_duration = '100ms'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ func ingestionPlanHook(
return nil, nil, nil, false, nil
}

if !streamingccl.CrossClusterReplicationEnabled.Get(&p.ExecCfg().Settings.SV) {
return nil, nil, nil, false, physicalReplicationDisabledErr
}

if !p.ExecCfg().Codec.ForSystemTenant() {
return nil, nil, nil, false, pgerror.Newf(pgcode.InsufficientPrivilege,
"only the system tenant can create other tenants")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,7 @@ func startReplication(
conn, err := pgx.ConnectConfig(queryCtx, pgxConfig)
require.NoError(t, err)

rows, err := conn.Query(queryCtx, `SET CLUSTER SETTING physical_replication.enabled = true;`)
require.NoError(t, err)
rows.Close()

rows, err = conn.Query(queryCtx, `SET avoid_buffering = true`)
rows, err := conn.Query(queryCtx, `SET avoid_buffering = true`)
require.NoError(t, err)
rows.Close()
rows, err = conn.Query(queryCtx, create, args...)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/cluster_to_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,7 @@ func srcClusterSettings(t test.Test, db *sqlutils.SQLRunner) {
}

func destClusterSettings(t test.Test, db *sqlutils.SQLRunner, additionalDuration time.Duration) {
db.ExecMultiple(t, `SET CLUSTER SETTING cross_cluster_replication.enabled = true;`,
db.ExecMultiple(t,
`SET CLUSTER SETTING kv.rangefeed.enabled = true;`,
`SET CLUSTER SETTING stream_replication.replan_flow_threshold = 0.1;`,
`SET CLUSTER SETTING physical_replication.consumer.node_lag_replanning_threshold = '5m';`)
Expand Down
1 change: 0 additions & 1 deletion pkg/configprofiles/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ func enableReplication(baseTasks []autoconfigpb.Task) []autoconfigpb.Task {
makeTask("enable rangefeeds and replication",
/* nonTxnSQL */ []string{
"SET CLUSTER SETTING kv.rangefeed.enabled = true",
"SET CLUSTER SETTING physical_replication.enabled = true",
},
nil, /* txnSQL */
),
Expand Down
4 changes: 1 addition & 3 deletions pkg/configprofiles/testdata/virtual-app
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ WHERE variable IN (
'sql.drop_virtual_cluster.enabled',
'sql.create_virtual_cluster.default_template',
'server.controller.default_target_cluster',
'kv.rangefeed.enabled',
'physical_replication.enabled'
'kv.rangefeed.enabled'
)
ORDER BY variable
----
kv.rangefeed.enabled false
physical_replication.enabled false
server.controller.default_target_cluster application
spanconfig.range_coalescing.application.enabled false
spanconfig.range_coalescing.system.enabled false
Expand Down
4 changes: 1 addition & 3 deletions pkg/configprofiles/testdata/virtual-app-repl
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ WHERE variable IN (
'sql.drop_virtual_cluster.enabled',
'sql.create_virtual_cluster.default_template',
'server.controller.default_target_cluster',
'kv.rangefeed.enabled',
'physical_replication.enabled'
'kv.rangefeed.enabled'
)
ORDER BY variable
----
kv.rangefeed.enabled true
physical_replication.enabled true
server.controller.default_target_cluster application
spanconfig.range_coalescing.application.enabled false
spanconfig.range_coalescing.system.enabled false
Expand Down
4 changes: 1 addition & 3 deletions pkg/configprofiles/testdata/virtual-noapp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ WHERE variable IN (
'sql.drop_virtual_cluster.enabled',
'sql.create_virtual_cluster.default_template',
'server.controller.default_target_cluster',
'kv.rangefeed.enabled',
'physical_replication.enabled'
'kv.rangefeed.enabled'
)
ORDER BY variable
----
kv.rangefeed.enabled false
physical_replication.enabled false
server.controller.default_target_cluster system
spanconfig.range_coalescing.application.enabled false
spanconfig.range_coalescing.system.enabled false
Expand Down
4 changes: 1 addition & 3 deletions pkg/configprofiles/testdata/virtual-noapp-repl
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ WHERE variable IN (
'sql.drop_virtual_cluster.enabled',
'sql.create_virtual_cluster.default_template',
'server.controller.default_target_cluster',
'kv.rangefeed.enabled',
'physical_replication.enabled'
'kv.rangefeed.enabled'
)
ORDER BY variable
----
kv.rangefeed.enabled true
physical_replication.enabled true
server.controller.default_target_cluster system
spanconfig.range_coalescing.application.enabled false
spanconfig.range_coalescing.system.enabled false
Expand Down
1 change: 1 addition & 0 deletions pkg/settings/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ var retiredSettings = map[InternalKey]struct{}{
"kv.rangefeed.use_dedicated_connection_class.enabled": {},
"sql.trace.session_eventlog.enabled": {},
"sql.show_ranges_deprecated_behavior.enabled": {},
"physical_replication.enabled": {},
}

// sqlDefaultSettings is the list of "grandfathered" existing sql.defaults
Expand Down

0 comments on commit b5dbc5f

Please sign in to comment.