1use mz_dyncfg::{Config, ConfigSet};
14use std::time::Duration;
15
16pub const CLUSTER_SHUTDOWN_GRACE_PERIOD: Config<Duration> = Config::new(
20 "storage_cluster_shutdown_grace_period",
21 Duration::from_secs(10 * 60),
22 "When dataflows observe an invariant violation it is either due to a bug or due to \
23 the cluster being shut down. This configuration defines the amount of time to \
24 wait before panicking the process, which will register the invariant violation.",
25);
26
27pub const DELAY_SOURCES_PAST_REHYDRATION: Config<bool> = Config::new(
32 "storage_dataflow_delay_sources_past_rehydration",
33 true,
35 "Whether or not to delay sources producing values in some scenarios \
36 (namely, upsert) till after rehydration is finished",
37);
38
39pub const SUSPENDABLE_SOURCES: Config<bool> = Config::new(
42 "storage_dataflow_suspendable_sources",
43 true,
44 "Whether storage dataflows should suspend execution while downstream operators are still \
45 processing data.",
46);
47
48pub const STORAGE_DOWNGRADE_SINCE_DURING_FINALIZATION: Config<bool> = Config::new(
53 "storage_downgrade_since_during_finalization",
54 true,
56 "When enabled, force-downgrade the controller's since handle on the shard\
57 during shard finalization",
58);
59
60pub const REPLICA_METRICS_HISTORY_RETENTION_INTERVAL: Config<Duration> = Config::new(
62 "replica_metrics_history_retention_interval",
63 Duration::from_secs(60 * 60 * 24 * 30), "The interval of time to keep when truncating the replica metrics history.",
65);
66
67pub const WALLCLOCK_LAG_HISTORY_RETENTION_INTERVAL: Config<Duration> = Config::new(
69 "wallclock_lag_history_retention_interval",
70 Duration::from_secs(60 * 60 * 24 * 30), "The interval of time to keep when truncating the wallclock lag history.",
72);
73
74pub const WALLCLOCK_GLOBAL_LAG_HISTOGRAM_RETENTION_INTERVAL: Config<Duration> = Config::new(
76 "wallclock_global_lag_histogram_retention_interval",
77 Duration::from_secs(60 * 60 * 24 * 30), "The interval of time to keep when truncating the wallclock lag histogram.",
79);
80
81pub const KAFKA_CLIENT_ID_ENRICHMENT_RULES: Config<fn() -> serde_json::Value> = Config::new(
94 "kafka_client_id_enrichment_rules",
95 || serde_json::json!([]),
96 "Rules for enriching the `client.id` property of Kafka clients with additional data.",
97);
98
99pub const KAFKA_POLL_MAX_WAIT: Config<Duration> = Config::new(
102 "kafka_poll_max_wait",
103 Duration::from_secs(1),
104 "The maximum time we will wait before re-polling rdkafka to see if new partitions/data are \
105 available.",
106);
107
108pub const KAFKA_LOW_WATERMARK_CHECK: Config<bool> = Config::new(
111 "kafka_low_watermark_check",
112 true,
113 "Whether to check the low watermark for Kafka sources and error if the start \
114 offset/resume upper has been compacted away.",
115);
116
117pub const KAFKA_DEFAULT_AWS_PRIVATELINK_ENDPOINT_IDENTIFICATION_ALGORITHM: Config<&'static str> =
118 Config::new(
119 "kafka_default_aws_privatelink_endpoint_identification_algorithm",
120 "none",
122 "The value we set for the 'ssl.endpoint.identification.algorithm' option in the Kafka \
123 Connection config. default: 'none'",
124 );
125
126pub const KAFKA_BUFFERED_EVENT_RESIZE_THRESHOLD_ELEMENTS: Config<usize> = Config::new(
127 "kafka_buffered_event_resize_threshold_elements",
128 1000,
129 "In the Kafka sink operator we might need to buffer messages before emitting them. As a \
130 performance optimization we reuse the buffer allocations, but shrink it to retain at \
131 most this number of elements.",
132);
133
134pub const KAFKA_RETRY_BACKOFF: Config<Duration> = Config::new(
137 "kafka_retry_backoff",
138 Duration::from_millis(100),
139 "Sets retry.backoff.ms in librdkafka for sources and sinks.",
140);
141
142pub const KAFKA_RETRY_BACKOFF_MAX: Config<Duration> = Config::new(
145 "kafka_retry_backoff_max",
146 Duration::from_secs(1),
147 "Sets retry.backoff.max.ms in librdkafka for sources and sinks.",
148);
149
150pub const KAFKA_RECONNECT_BACKOFF: Config<Duration> = Config::new(
153 "kafka_reconnect_backoff",
154 Duration::from_millis(100),
155 "Sets reconnect.backoff.ms in librdkafka for sources and sinks.",
156);
157
158pub const KAFKA_RECONNECT_BACKOFF_MAX: Config<Duration> = Config::new(
163 "kafka_reconnect_backoff_max",
164 Duration::from_secs(30),
165 "Sets reconnect.backoff.max.ms in librdkafka for sources and sinks.",
166);
167
168pub const KAFKA_SINK_MESSAGE_MAX_BYTES: Config<usize> = Config::new(
174 "kafka_sink_message_max_bytes",
175 1_000_000,
176 "Sets message.max.bytes in librdkafka for Kafka sink producers.",
177);
178
179pub const KAFKA_SINK_BATCH_SIZE: Config<usize> = Config::new(
185 "kafka_sink_batch_size",
186 1_000_000,
187 "Sets batch.size in librdkafka for Kafka sink producers.",
188);
189
190pub const KAFKA_SINK_BATCH_NUM_MESSAGES: Config<usize> = Config::new(
195 "kafka_sink_batch_num_messages",
196 10_000,
197 "Sets batch.num.messages in librdkafka for Kafka sink producers.",
198);
199
200pub const MYSQL_REPLICATION_HEARTBEAT_INTERVAL: Config<Duration> = Config::new(
204 "mysql_replication_heartbeat_interval",
205 Duration::from_secs(30),
206 "Replication heartbeat interval requested from the MySQL server.",
207);
208
209pub static MYSQL_SOURCE_SNAPSHOT_PARALLELISM: Config<bool> = Config::new(
213 "mysql_source_snapshot_parallelism",
214 false,
215 "Whether to split MySQL snapshot reads across workers by primary-key ranges.",
216);
217
218pub static MYSQL_SOURCE_SNAPSHOT_EXACT_COUNT_MAX_ROWS: Config<usize> = Config::new(
221 "mysql_source_snapshot_exact_count_max_rows",
222 1_000_000,
223 "Maximum estimated table size for which MySQL snapshots compute an exact COUNT(*) \
224 for the size gauge; larger tables report the information_schema estimate.",
225);
226
227pub const PG_FETCH_SLOT_RESUME_LSN_INTERVAL: Config<Duration> = Config::new(
231 "postgres_fetch_slot_resume_lsn_interval",
232 Duration::from_millis(500),
233 "Interval to poll `confirmed_flush_lsn` to get a resumption lsn.",
234);
235
236pub const PG_SCHEMA_VALIDATION_INTERVAL: Config<Duration> = Config::new(
238 "pg_schema_validation_interval",
239 Duration::from_secs(15),
240 "Interval to re-validate the schemas of ingested tables.",
241);
242
243pub static PG_SOURCE_VALIDATE_TIMELINE: Config<bool> = Config::new(
249 "pg_source_validate_timeline",
250 true,
251 "Whether to treat a timeline switch as a definite error",
252);
253
254pub static SQL_SERVER_SOURCE_VALIDATE_RESTORE_HISTORY: Config<bool> = Config::new(
260 "sql_server_source_validate_restore_history",
261 true,
262 "Whether to treat a restore history change as a definite error",
263);
264
265pub const AWS_PREFETCH_STS_CONNECT_TIMEOUT: Config<Duration> = Config::new(
276 "aws_prefetch_sts_connect_timeout",
277 Duration::from_millis(3100),
278 "Connect timeout for the AWS AssumeRole credentials prefetcher's STS calls.",
279);
280
281pub const ENFORCE_EXTERNAL_ADDRESSES: Config<bool> = Config::new(
286 "storage_enforce_external_addresses",
287 false,
288 "Whether or not to enforce that external connection addresses are global \
289 (not private or local) when resolving them",
290);
291
292pub const STORAGE_UPSERT_PREVENT_SNAPSHOT_BUFFERING: Config<bool> = Config::new(
309 "storage_upsert_prevent_snapshot_buffering",
310 true,
311 "Prevent snapshot buffering in upsert.",
312);
313
314pub const STORAGE_ROCKSDB_USE_MERGE_OPERATOR: Config<bool> = Config::new(
316 "storage_rocksdb_use_merge_operator",
317 true,
318 "Use the native rocksdb merge operator where possible.",
319);
320
321pub const STORAGE_UPSERT_MAX_SNAPSHOT_BATCH_BUFFERING: Config<Option<usize>> = Config::new(
326 "storage_upsert_max_snapshot_batch_buffering",
327 None,
328 "Limit snapshot buffering in upsert.",
329);
330
331pub const ENABLE_UPSERT_PAGED_SPILL: Config<bool> = Config::new(
342 "enable_upsert_paged_spill",
343 false,
344 "Allow the upsert-v2 source stash to spill chunks to the shared buffer pool, gated \
345 independently of the compute `enable_column_paged_batcher_spill`.",
346);
347
348pub const STORAGE_ROCKSDB_CLEANUP_TRIES: Config<usize> = Config::new(
352 "storage_rocksdb_cleanup_tries",
353 5,
354 "How many times to try to cleanup old RocksDB DB's on disk before giving up.",
355);
356
357pub const STORAGE_SUSPEND_AND_RESTART_DELAY: Config<Duration> = Config::new(
359 "storage_suspend_and_restart_delay",
360 Duration::from_secs(5),
361 "Delay interval when reconnecting to a source / sink after halt.",
362);
363
364pub const STORAGE_USE_CONTINUAL_FEEDBACK_UPSERT: Config<bool> = Config::new(
366 "storage_use_continual_feedback_upsert",
367 true,
368 "Whether to use the new continual feedback upsert operator.",
369);
370
371pub const ENABLE_UPSERT_V2: Config<bool> = Config::new(
373 "enable_upsert_v2",
374 false,
375 "Whether to use the v2 upsert operator.",
376);
377
378pub const STORAGE_SERVER_MAINTENANCE_INTERVAL: Config<Duration> = Config::new(
380 "storage_server_maintenance_interval",
381 Duration::from_millis(10),
382 "The interval at which the storage server performs maintenance tasks. Zero enables maintenance on every iteration.",
383);
384
385pub const SINK_PROGRESS_SEARCH: Config<bool> = Config::new(
387 "storage_sink_progress_search",
388 true,
389 "If set, iteratively search the progress topic for a progress record with increasing lookback.",
390);
391
392pub const SINK_ENSURE_TOPIC_CONFIG: Config<&'static str> = Config::new(
394 "storage_sink_ensure_topic_config",
395 "skip",
396 "If `skip`, don't check the config of existing topics; if `check`, fetch the config and \
397 warn if it does not match the expected configs; if `alter`, attempt to change the upstream to \
398 match the expected configs.",
399);
400
401pub const ORE_OVERFLOWING_BEHAVIOR: Config<&'static str> = Config::new(
403 "ore_overflowing_behavior",
404 "soft_panic",
405 "Overflow behavior for Overflowing types. One of 'ignore', 'panic', 'soft_panic'.",
406);
407
408pub const STATISTICS_RETENTION_DURATION: Config<Duration> = Config::new(
414 "storage_statistics_retention_duration",
415 Duration::from_secs(86_400), "The time after which we delete per replica statistics (for sources and sinks) after there have been no updates.",
417);
418
419pub fn all_dyncfgs(configs: ConfigSet) -> ConfigSet {
421 configs
422 .add(&AWS_PREFETCH_STS_CONNECT_TIMEOUT)
423 .add(&CLUSTER_SHUTDOWN_GRACE_PERIOD)
424 .add(&DELAY_SOURCES_PAST_REHYDRATION)
425 .add(&ENFORCE_EXTERNAL_ADDRESSES)
426 .add(&KAFKA_BUFFERED_EVENT_RESIZE_THRESHOLD_ELEMENTS)
427 .add(&KAFKA_CLIENT_ID_ENRICHMENT_RULES)
428 .add(&KAFKA_DEFAULT_AWS_PRIVATELINK_ENDPOINT_IDENTIFICATION_ALGORITHM)
429 .add(&KAFKA_LOW_WATERMARK_CHECK)
430 .add(&KAFKA_POLL_MAX_WAIT)
431 .add(&KAFKA_RETRY_BACKOFF)
432 .add(&KAFKA_RETRY_BACKOFF_MAX)
433 .add(&KAFKA_RECONNECT_BACKOFF)
434 .add(&KAFKA_RECONNECT_BACKOFF_MAX)
435 .add(&KAFKA_SINK_MESSAGE_MAX_BYTES)
436 .add(&KAFKA_SINK_BATCH_SIZE)
437 .add(&KAFKA_SINK_BATCH_NUM_MESSAGES)
438 .add(&MYSQL_REPLICATION_HEARTBEAT_INTERVAL)
439 .add(&MYSQL_SOURCE_SNAPSHOT_EXACT_COUNT_MAX_ROWS)
440 .add(&MYSQL_SOURCE_SNAPSHOT_PARALLELISM)
441 .add(&ORE_OVERFLOWING_BEHAVIOR)
442 .add(&PG_FETCH_SLOT_RESUME_LSN_INTERVAL)
443 .add(&PG_SCHEMA_VALIDATION_INTERVAL)
444 .add(&PG_SOURCE_VALIDATE_TIMELINE)
445 .add(&REPLICA_METRICS_HISTORY_RETENTION_INTERVAL)
446 .add(&SINK_ENSURE_TOPIC_CONFIG)
447 .add(&SINK_PROGRESS_SEARCH)
448 .add(&SQL_SERVER_SOURCE_VALIDATE_RESTORE_HISTORY)
449 .add(&STORAGE_DOWNGRADE_SINCE_DURING_FINALIZATION)
450 .add(&STORAGE_ROCKSDB_CLEANUP_TRIES)
451 .add(&STORAGE_ROCKSDB_USE_MERGE_OPERATOR)
452 .add(&STORAGE_SERVER_MAINTENANCE_INTERVAL)
453 .add(&STORAGE_SUSPEND_AND_RESTART_DELAY)
454 .add(&STORAGE_UPSERT_MAX_SNAPSHOT_BATCH_BUFFERING)
455 .add(&STORAGE_UPSERT_PREVENT_SNAPSHOT_BUFFERING)
456 .add(&STORAGE_USE_CONTINUAL_FEEDBACK_UPSERT)
457 .add(&ENABLE_UPSERT_V2)
458 .add(&SUSPENDABLE_SOURCES)
459 .add(&ENABLE_UPSERT_PAGED_SPILL)
460 .add(&WALLCLOCK_GLOBAL_LAG_HISTOGRAM_RETENTION_INTERVAL)
461 .add(&WALLCLOCK_LAG_HISTORY_RETENTION_INTERVAL)
462 .add(&crate::sources::sql_server::CDC_CLEANUP_CHANGE_TABLE)
463 .add(&crate::sources::sql_server::CDC_CLEANUP_CHANGE_TABLE_MAX_DELETES)
464 .add(&crate::sources::sql_server::MAX_LSN_WAIT)
465 .add(&crate::sources::sql_server::SNAPSHOT_PROGRESS_REPORT_INTERVAL)
466 .add(&STATISTICS_RETENTION_DURATION)
467}