Skip to content

Commit 06521cd

Browse files
committed
*: audit all duration settings to add validation function
This commit adjusts the DurationSetting so that if no validation function is provided, it assumes the non-negative duration. This commit audits all duration settings to add validation functions. In vast majority cases non-negative duration seems reasonable, for three I'm adding positive validation: - `kv.gc.txn_cleanup_threshold` - `jobs.scheduler.pace` - `sql.stats.max_timestamp_age`. `sql.crdb_internal.table_row_statistics.as_of_time` got a non-positive validation. Note that since we're adding new validation logic, it can be possible for existing setting values to not pass the validation anymore. In such case the default will be used instead (and a log message will be written) which seems like a reasonable behavior. Release note: None
1 parent 308665f commit 06521cd

File tree

65 files changed

+70
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+70
-121
lines changed

pkg/backup/backup_processor.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,18 @@ var (
5353
"bulkio.backup.read_with_priority_after",
5454
"amount of time since the read-as-of time above which a BACKUP should use priority when retrying reads",
5555
time.Minute,
56-
settings.NonNegativeDuration,
5756
settings.WithPublic)
5857
delayPerAttempt = settings.RegisterDurationSetting(
5958
settings.ApplicationLevel,
6059
"bulkio.backup.read_retry_delay",
6160
"amount of time since the read-as-of time, per-prior attempt, to wait before making another attempt",
6261
time.Second*5,
63-
settings.NonNegativeDuration,
6462
)
6563
timeoutPerAttempt = settings.RegisterDurationSetting(
6664
settings.ApplicationLevel,
6765
"bulkio.backup.read_timeout",
6866
"amount of time after which a read attempt is considered timed out, which causes the backup to fail",
6967
time.Minute*5,
70-
settings.NonNegativeDuration,
7168
settings.WithPublic)
7269

7370
preSplitExports = settings.RegisterBoolSetting(

pkg/ccl/changefeedccl/cdcevent/rowfetcher_cache.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ var traceKVLogFrequency = settings.RegisterDurationSetting(
3838
"changefeed.cdcevent.trace_kv.log_frequency",
3939
"controls how frequently KVs are logged when KV tracing is enabled",
4040
500*time.Millisecond,
41-
settings.NonNegativeDuration,
4241
)
4342

4443
// rowFetcherCache maintains a cache of single table row.Fetchers. Given a key

pkg/ccl/changefeedccl/changefeed_processors.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ var aggregatorHeartbeatFrequency = settings.RegisterDurationSetting(
694694
"changefeed aggregator will emit a heartbeat message to the coordinator with this frequency; 0 disables. "+
695695
"The setting value should be <=1/2 of server.shutdown.jobs.timeout period",
696696
4*time.Second,
697-
settings.NonNegativeDuration,
698697
)
699698

700699
var aggregatorFlushJitter = settings.RegisterFloatSetting(

pkg/ccl/changefeedccl/changefeedbase/settings.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ var TableDescriptorPollInterval = settings.RegisterDurationSetting(
2323
"changefeed.experimental_poll_interval",
2424
"polling interval for the table descriptors",
2525
1*time.Second,
26-
settings.NonNegativeDuration,
2726
)
2827

2928
// DefaultMinCheckpointFrequency is the default frequency to flush sink.
@@ -53,7 +52,6 @@ var SlowSpanLogThreshold = settings.RegisterDurationSetting(
5352
"changefeed.slow_span_log_threshold",
5453
"a changefeed will log spans with resolved timestamps this far behind the current wall-clock time; if 0, a default value is calculated based on other cluster settings",
5554
0,
56-
settings.NonNegativeDuration,
5755
)
5856

5957
// IdleTimeout controls how long the changefeed will wait for a new KV being
@@ -63,7 +61,6 @@ var IdleTimeout = settings.RegisterDurationSetting(
6361
"changefeed.idle_timeout",
6462
"a changefeed will mark itself idle if no changes have been emitted for greater than this duration; if 0, the changefeed will never be marked idle",
6563
10*time.Minute,
66-
settings.NonNegativeDuration,
6764
settings.WithName("changefeed.auto_idle.timeout"),
6865
)
6966

@@ -75,7 +72,6 @@ var SpanCheckpointInterval = settings.RegisterDurationSetting(
7572
"interval at which span-level checkpoints will be written; "+
7673
"if 0, span-level checkpoints are disabled",
7774
10*time.Minute,
78-
settings.NonNegativeDuration,
7975
settings.WithName("changefeed.span_checkpoint.interval"),
8076
)
8177

@@ -90,7 +86,6 @@ var SpanCheckpointLagThreshold = settings.RegisterDurationSetting(
9086
"to save leading span progress is written; if 0, span-level checkpoints "+
9187
"due to lagging spans is disabled",
9288
10*time.Minute,
93-
settings.NonNegativeDuration,
9489
settings.WithPublic,
9590
settings.WithName("changefeed.span_checkpoint.lag_threshold"),
9691
)
@@ -185,7 +180,6 @@ var ResolvedTimestampMinUpdateInterval = settings.RegisterDurationSetting(
185180
"updated again; default of 0 means no minimum interval is enforced but "+
186181
"updating will still be limited by the average time it takes to checkpoint progress",
187182
0,
188-
settings.NonNegativeDuration,
189183
settings.WithPublic,
190184
settings.WithName("changefeed.resolved_timestamp.min_update_interval"),
191185
)
@@ -227,7 +221,6 @@ var MaxProtectedTimestampAge = settings.RegisterDurationSetting(
227221
"changefeed.protect_timestamp.max_age",
228222
"fail the changefeed if the protected timestamp age exceeds this threshold; 0 disables expiration",
229223
4*24*time.Hour,
230-
settings.NonNegativeDuration,
231224
settings.WithPublic)
232225

233226
// BatchReductionRetryEnabled enables the temporary reduction of batch sizes upon kafka message too large errors
@@ -354,5 +347,4 @@ var Quantize = settings.RegisterDurationSettingWithExplicitUnit(
354347
"changefeed.resolved_timestamp.granularity",
355348
"the granularity at which changefeed progress are quantized to make tracking more efficient",
356349
0,
357-
settings.NonNegativeDuration,
358350
)

pkg/ccl/changefeedccl/telemetry.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,5 +181,4 @@ var continuousTelemetryInterval = settings.RegisterDurationSetting(
181181
"determines the interval at which each node emits continuous telemetry events"+
182182
" during the lifespan of every changefeed; setting a zero value disables logging",
183183
24*time.Hour,
184-
settings.NonNegativeDuration,
185184
)

pkg/ccl/jwtauthccl/settings.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ var JWTAuthClientTimeout = settings.RegisterDurationSetting(
142142
"sets the client timeout for external calls made during JWT authentication "+
143143
"(e.g. fetching JWKS, etc.)",
144144
15*time.Second,
145-
settings.NonNegativeDuration,
146145
settings.WithPublic,
147146
)
148147

pkg/ccl/kvccl/kvfollowerreadsccl/followerreads.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ var ClosedTimestampPropagationSlack = settings.RegisterDurationSetting(
3939
"propagate from a leaseholder to followers. This is taken into account by "+
4040
"follower_read_timestamp().",
4141
time.Second,
42-
settings.NonNegativeDuration,
4342
)
4443

4544
// getFollowerReadLag returns the (negative) offset duration from hlc.Now()

pkg/ccl/oidcccl/settings.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ var OIDCAuthClientTimeout = settings.RegisterDurationSetting(
8181
"sets the client timeout for external calls made during OIDC authentication "+
8282
"(e.g. authorization code flow, etc.)",
8383
15*time.Second,
84-
settings.NonNegativeDuration,
8584
settings.WithPublic,
8685
)
8786

pkg/crosscluster/logical/logical_replication_job.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ var (
5757
settings.ApplicationLevel,
5858
"logical_replication.consumer.job_checkpoint_frequency",
5959
"controls the frequency with which the job updates their progress; if 0, disabled",
60-
10*time.Second,
61-
settings.NonNegativeDuration)
60+
10*time.Second)
6261

6362
// heartbeatFrequency controls frequency the stream replication
6463
// destination cluster sends heartbeat to the source cluster to keep
@@ -69,7 +68,6 @@ var (
6968
"controls frequency the stream replication destination cluster sends heartbeat "+
7069
"to the source cluster to keep the stream alive",
7170
30*time.Second,
72-
settings.NonNegativeDuration,
7371
)
7472
)
7573

pkg/crosscluster/physical/stream_ingestion_processor.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ var cutoverSignalPollInterval = settings.RegisterDurationSetting(
8888
"bulkio.stream_ingestion.failover_signal_poll_interval",
8989
"the interval at which the stream ingestion job checks if it has been signaled to cutover",
9090
10*time.Second,
91-
settings.NonNegativeDuration,
9291
settings.WithName("physical_replication.consumer.failover_signal_poll_interval"),
9392
)
9493

0 commit comments

Comments
 (0)