Skip to content

Commit

Permalink
settings: rename and better document the setting classes
Browse files Browse the repository at this point in the history
**TLDR: "TenantReadOnly" -> "SystemVisible"; "TenantWritable" ->
"ApplicationLevel".**

See the new/extended explanatory comments in `pkg/settings/setting.go`
for details.

Review guidance: the only manual change is in
`pkg/settings/setting.go`. Everything else was automated
search-replace.

No release note because the classes are not user-visible.

Release note: None
  • Loading branch information
knz committed Sep 29, 2023
1 parent 59afb79 commit a7c5cf2
Show file tree
Hide file tree
Showing 225 changed files with 959 additions and 898 deletions.
2 changes: 1 addition & 1 deletion docs/RFCS/20211207_graceful_draining.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ declared as a `*settings.DurationSetting` as follows:

```go
connectionWait = settings.RegisterDurationSetting(
settings.TenantReadOnly,
settings.SystemVisible,
"server.shutdown.connection_wait",
"the amount of time a server waits for clients to close existing SQL
connections. After the start of connection_wait, no new SQL connections are
Expand Down
480 changes: 240 additions & 240 deletions docs/generated/settings/settings-for-tenants.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/ccl/auditloggingccl/audit_log_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const auditConfigDefaultValue = ""

// UserAuditLogConfig is a cluster setting that takes a user/role-based audit configuration.
var UserAuditLogConfig = settings.RegisterStringSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"sql.log.user_audit",
"user/role-based audit logging configuration. An enterprise license is required for this cluster setting to take effect.",
auditConfigDefaultValue,
Expand All @@ -39,7 +39,7 @@ var UserAuditLogConfig = settings.RegisterStringSetting(
// reflected within session. Users will need to start a new session to see these changes in their
// auditing behaviour.
var UserAuditEnableReducedConfig = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"sql.log.user_audit.reduced_config.enabled",
"enables logic to compute a reduced audit configuration, computing the audit "+
"configuration only once at session start instead of at each SQL event. The tradeoff "+
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/backup_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import (
// BackupCheckpointInterval is the interval at which backup progress is saved
// to durable storage.
var BackupCheckpointInterval = settings.RegisterDurationSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.backup.checkpoint_interval",
"the minimum time between writing progress checkpoints during a backup",
time.Minute)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/backup_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type tableAndIndex struct {

// featureBackupEnabled is used to enable and disable the BACKUP feature.
var featureBackupEnabled = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"feature.backup.enabled",
"set to true to enable backups, false to disable; default is true",
featureflag.FeatureFlagEnabledDefault,
Expand Down
12 changes: 6 additions & 6 deletions pkg/ccl/backupccl/backup_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,43 +52,43 @@ var backupOutputTypes = []*types.T{}

var (
priorityAfter = settings.RegisterDurationSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.backup.read_with_priority_after",
"amount of time since the read-as-of time above which a BACKUP should use priority when retrying reads",
time.Minute,
settings.NonNegativeDuration,
settings.WithPublic)
delayPerAttempt = settings.RegisterDurationSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.backup.read_retry_delay",
"amount of time since the read-as-of time, per-prior attempt, to wait before making another attempt",
time.Second*5,
settings.NonNegativeDuration,
)
timeoutPerAttempt = settings.RegisterDurationSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.backup.read_timeout",
"amount of time after which a read attempt is considered timed out, which causes the backup to fail",
time.Minute*5,
settings.NonNegativeDuration,
settings.WithPublic)
targetFileSize = settings.RegisterByteSizeSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.backup.file_size",
"target size for individual data files produced during BACKUP",
128<<20,
settings.WithPublic)

splitKeysOnTimestamps = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.backup.split_keys_on_timestamps",
"split backup data on timestamps when writing revision history",
true,
settings.WithName("bulkio.backup.split_keys_on_timestamps.enabled"),
)

sendExportRequestWithVerboseTracing = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.backup.export_request_verbose_tracing",
"send each export request with a verbose tracing span",
util.ConstantWithMetamorphicTestBool("export_request_verbose_tracing", false),
Expand Down
6 changes: 3 additions & 3 deletions pkg/ccl/backupccl/backup_tenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestTenantBackupMultiRegionDatabases(t *testing.T) {
{
// Flip the tenant-read only cluster setting; ensure database can be restored
// on the system tenant but not on the secondary tenant.
setAndWaitForTenantReadOnlyClusterSetting(
setAndWaitForSystemVisibleClusterSetting(
t,
sql.SecondaryTenantsMultiRegionAbstractionsEnabledSettingName,
sqlDB,
Expand All @@ -184,7 +184,7 @@ func TestTenantBackupMultiRegionDatabases(t *testing.T) {
{
// Flip the tenant-read only cluster setting back to true and ensure the
// restore succeeds.
setAndWaitForTenantReadOnlyClusterSetting(
setAndWaitForSystemVisibleClusterSetting(
t,
sql.SecondaryTenantsMultiRegionAbstractionsEnabledSettingName,
sqlDB,
Expand All @@ -205,7 +205,7 @@ func TestTenantBackupMultiRegionDatabases(t *testing.T) {
"SET CLUSTER SETTING %s = 'us-east1'", sql.DefaultPrimaryRegionClusterSettingName,
),
)
setAndWaitForTenantReadOnlyClusterSetting(
setAndWaitForSystemVisibleClusterSetting(
t,
sql.SecondaryTenantsMultiRegionAbstractionsEnabledSettingName,
sqlDB,
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/backupbase/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (
// SmallFileBuffer is the size limit used when buffering backup files before
// merging them.
SmallFileBuffer = settings.RegisterByteSizeSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.backup.merge_file_buffer_size",
"size limit used when buffering backup files before merging them",
int64(defaultSmallFileBuffer),
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/backupdest/backup_destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var backupPathRE = regexp.MustCompile("^/?[^\\/]+/[^\\/]+/[^\\/]+/" + backupbase
// specified subdirectory if no backup already exists at that subdirectory. As
// of 22.1, this feature is default disabled, and will be totally disabled by 22.2.
var featureFullBackupUserSubdir = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.backup.deprecated_full_backup_with_subdir.enabled",
"when true, a backup command with a user specified subdirectory will create a full backup at"+
" the subdirectory if no backup already exists at that subdirectory",
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccl/backupccl/backupinfo/manifest_handling.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const (
// WriteMetadataSST controls if we write the experimental new format BACKUP
// metadata file.
var WriteMetadataSST = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"kv.bulkio.write_metadata_sst.enabled",
"write experimental new format BACKUP metadata file",
util.ConstantWithMetamorphicTestBool("write-metadata-sst", false),
Expand All @@ -102,7 +102,7 @@ var WriteMetadataSST = settings.RegisterBoolSetting(
// descriptors. This new format of metadata is written in addition to the
// `BACKUP_MANIFEST` file, and is expected to be its replacement in the future.
var WriteMetadataWithExternalSSTsEnabled = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"backup.write_metadata_with_external_ssts.enabled",
"write BACKUP metadata along with supporting SST files",
util.ConstantWithMetamorphicTestBool("backup.write_metadata_with_external_ssts.enabled", true),
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/create_scheduled_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var scheduledBackupOptionExpectValues = map[string]exprutil.KVStringOptValidate{
// scheduledBackupGCProtectionEnabled is used to enable and disable the chaining
// of protected timestamps amongst scheduled backups.
var scheduledBackupGCProtectionEnabled = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"schedules.backup.gc_protection.enabled",
"enable chaining of GC protection across backups run as part of a schedule",
true, /* defaultValue */
Expand Down
6 changes: 3 additions & 3 deletions pkg/ccl/backupccl/restore_data_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ var defaultNumWorkers = util.ConstantWithMetamorphicTestRange(
// The maximum is not enforced since if the maximum is reduced in the future that
// may cause the cluster setting to fail.
var numRestoreWorkers = settings.RegisterIntSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"kv.bulk_io_write.restore_node_concurrency",
fmt.Sprintf("the number of workers processing a restore per job per node; maximum %d",
maxConcurrentRestoreWorkers),
Expand All @@ -153,7 +153,7 @@ var numRestoreWorkers = settings.RegisterIntSetting(
// and the limit determined by restorePerProcessorMemoryLimitSQLFraction
// and --max-sql-memory.
var restorePerProcessorMemoryLimit = settings.RegisterByteSizeSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.restore.per_processor_memory_limit",
"limit on the amount of memory that can be used by a restore processor",
1<<30, // 1 GiB
Expand All @@ -162,7 +162,7 @@ var restorePerProcessorMemoryLimit = settings.RegisterByteSizeSetting(
// restorePerProcessorMemoryLimitSQLFraction is the maximum percentage of the
// SQL memory pool that could be used by a restoreDataProcessor.
var restorePerProcessorMemoryLimitSQLFraction = settings.RegisterFloatSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.restore.per_processor_memory_limit_sql_fraction",
"limit on the amount of memory that can be used by a restore processor as a fraction of max SQL memory",
0.5,
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccl/backupccl/restore_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ import (
const restoreStatsInsertBatchSize = 10

var useSimpleImportSpans = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.restore.use_simple_import_spans",
"if set to true, restore will generate its import spans using the makeSimpleImportSpans algorithm",
false,
settings.WithName("bulkio.restore.simple_import_spans.enabled"),
)

var restoreStatsInsertionConcurrency = settings.RegisterIntSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.restore.insert_stats_workers",
"number of concurrent workers that will restore backed up table statistics",
5,
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/restore_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var allowedDebugPauseOnValues = map[string]struct{}{

// featureRestoreEnabled is used to enable and disable the RESTORE feature.
var featureRestoreEnabled = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"feature.restore.enabled",
"set to true to enable restore, false to disable; default is true",
featureflag.FeatureFlagEnabledDefault,
Expand Down
6 changes: 3 additions & 3 deletions pkg/ccl/backupccl/restore_processor_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ import (
)

var replanRestoreThreshold = settings.RegisterFloatSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.restore.replan_flow_threshold",
"fraction of initial flow instances that would be added or updated above which a RESTORE execution plan is restarted from the last checkpoint (0=disabled)",
0.0,
)

var replanRestoreFrequency = settings.RegisterDurationSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.restore.replan_flow_frequency",
"frequency at which RESTORE checks to see if restarting would change its updates its physical execution plan",
time.Minute*2,
settings.PositiveDuration,
)

var memoryMonitorSSTs = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"bulkio.restore.memory_monitor_ssts",
"if true, restore will limit number of simultaneously open SSTs to keep memory usage under the configured memory fraction",
false,
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/restore_progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
// to the checkpoint record. The default is set using the same reasoning as
// changefeed.frontier_checkpoint_max_bytes.
var restoreCheckpointMaxBytes = settings.RegisterByteSizeSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"restore.frontier_checkpoint_max_bytes",
"controls the maximum size of the restore checkpoint frontier as a the sum of the (span,"+
"timestamp) tuples",
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/restore_span_covering.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (ie intervalSpan) Range() interval.Range {
// tracked within restore spans, this could become dynamic and much larger (e.g.
// totalSize/numNodes*someConstant).
var targetRestoreSpanSize = settings.RegisterByteSizeSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"backup.restore_span.target_size",
"target size to which base spans of a restore are merged to produce a restore span (0 disables)",
384<<20,
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func thresholdFromTrace(t *testing.T, traceString string) hlc.Timestamp {
return thresh
}

func setAndWaitForTenantReadOnlyClusterSetting(
func setAndWaitForSystemVisibleClusterSetting(
t *testing.T,
settingName settings.SettingName,
systemTenantRunner *sqlutils.SQLRunner,
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccl/changefeedccl/changefeed_dist.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func startDistChangefeed(
}

var enableBalancedRangeDistribution = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"changefeed.balance_range_distribution.enable",
"if enabled, the ranges are balanced equally among all nodes",
util.ConstantWithMetamorphicTestBool(
Expand Down Expand Up @@ -508,7 +508,7 @@ func (w *changefeedResultWriter) Err() error {
}

var rebalanceThreshold = settings.RegisterFloatSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"changefeed.balance_range_distribution.sensitivity",
"rebalance if the number of ranges on a node exceeds the average by this fraction",
0.05,
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/changefeed_processors.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ func (ca *changeAggregator) close() {
}

var aggregatorHeartbeatFrequency = settings.RegisterDurationSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"changefeed.aggregator.heartbeat",
"changefeed aggregator will emit a heartbeat message to the coordinator with this frequency; 0 disables. "+
"The setting value should be <=1/2 of server.shutdown.jobs_wait period",
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/changefeed_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import (

// featureChangefeedEnabled is used to enable and disable the CHANGEFEED feature.
var featureChangefeedEnabled = settings.RegisterBoolSetting(
settings.TenantWritable,
settings.ApplicationLevel,
"feature.changefeed.enabled",
"set to true to enable changefeeds, false to disable; default is true",
featureflag.FeatureFlagEnabledDefault,
Expand Down
Loading

0 comments on commit a7c5cf2

Please sign in to comment.