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 static KAFKA_METADATA_FETCH_INTERVAL: Config<Duration> = Config::new(
110 "kafka_default_metadata_fetch_interval",
111 Duration::from_secs(1),
112 "Interval to fetch topic partition metadata.",
113);
114
115pub const KAFKA_DEFAULT_AWS_PRIVATELINK_ENDPOINT_IDENTIFICATION_ALGORITHM: Config<&'static str> =
116 Config::new(
117 "kafka_default_aws_privatelink_endpoint_identification_algorithm",
118 "none",
120 "The value we set for the 'ssl.endpoint.identification.algorithm' option in the Kafka \
121 Connection config. default: 'none'",
122 );
123
124pub const KAFKA_BUFFERED_EVENT_RESIZE_THRESHOLD_ELEMENTS: Config<usize> = Config::new(
125 "kafka_buffered_event_resize_threshold_elements",
126 1000,
127 "In the Kafka sink operator we might need to buffer messages before emitting them. As a \
128 performance optimization we reuse the buffer allocations, but shrink it to retain at \
129 most this number of elements.",
130);
131
132pub const KAFKA_RETRY_BACKOFF: Config<Duration> = Config::new(
135 "kafka_retry_backoff",
136 Duration::from_millis(100),
137 "Sets retry.backoff.ms in librdkafka for sources and sinks.",
138);
139
140pub const KAFKA_RETRY_BACKOFF_MAX: Config<Duration> = Config::new(
143 "kafka_retry_backoff_max",
144 Duration::from_secs(1),
145 "Sets retry.backoff.max.ms in librdkafka for sources and sinks.",
146);
147
148pub const KAFKA_RECONNECT_BACKOFF: Config<Duration> = Config::new(
151 "kafka_reconnect_backoff",
152 Duration::from_millis(100),
153 "Sets reconnect.backoff.ms in librdkafka for sources and sinks.",
154);
155
156pub const KAFKA_RECONNECT_BACKOFF_MAX: Config<Duration> = Config::new(
161 "kafka_reconnect_backoff_max",
162 Duration::from_secs(30),
163 "Sets reconnect.backoff.max.ms in librdkafka for sources and sinks.",
164);
165
166pub const MYSQL_REPLICATION_HEARTBEAT_INTERVAL: Config<Duration> = Config::new(
170 "mysql_replication_heartbeat_interval",
171 Duration::from_secs(30),
172 "Replication heartbeat interval requested from the MySQL server.",
173);
174
175pub const MYSQL_OFFSET_KNOWN_INTERVAL: Config<Duration> = Config::new(
177 "mysql_offset_known_interval",
178 Duration::from_secs(1),
179 "Interval to fetch `offset_known`, from `@gtid_executed`",
180);
181
182pub const PG_FETCH_SLOT_RESUME_LSN_INTERVAL: Config<Duration> = Config::new(
186 "postgres_fetch_slot_resume_lsn_interval",
187 Duration::from_millis(500),
188 "Interval to poll `confirmed_flush_lsn` to get a resumption lsn.",
189);
190
191pub const PG_OFFSET_KNOWN_INTERVAL: Config<Duration> = Config::new(
193 "pg_offset_known_interval",
194 Duration::from_secs(1),
195 "Interval to fetch `offset_known`, from `pg_current_wal_lsn`",
196);
197
198pub const PG_SCHEMA_VALIDATION_INTERVAL: Config<Duration> = Config::new(
200 "pg_schema_validation_interval",
201 Duration::from_secs(15),
202 "Interval to re-validate the schemas of ingested tables.",
203);
204
205pub static PG_SOURCE_VALIDATE_TIMELINE: Config<bool> = Config::new(
211 "pg_source_validate_timeline",
212 true,
213 "Whether to treat a timeline switch as a definite error",
214);
215
216pub static SQL_SERVER_SOURCE_VALIDATE_RESTORE_HISTORY: Config<bool> = Config::new(
222 "sql_server_source_validate_restore_history",
223 true,
224 "Whether to treat a restore history change as a definite error",
225);
226
227pub const ENFORCE_EXTERNAL_ADDRESSES: Config<bool> = Config::new(
232 "storage_enforce_external_addresses",
233 false,
234 "Whether or not to enforce that external connection addresses are global \
235 (not private or local) when resolving them",
236);
237
238pub const STORAGE_UPSERT_PREVENT_SNAPSHOT_BUFFERING: Config<bool> = Config::new(
255 "storage_upsert_prevent_snapshot_buffering",
256 true,
257 "Prevent snapshot buffering in upsert.",
258);
259
260pub const STORAGE_ROCKSDB_USE_MERGE_OPERATOR: Config<bool> = Config::new(
262 "storage_rocksdb_use_merge_operator",
263 true,
264 "Use the native rocksdb merge operator where possible.",
265);
266
267pub const STORAGE_UPSERT_MAX_SNAPSHOT_BATCH_BUFFERING: Config<Option<usize>> = Config::new(
272 "storage_upsert_max_snapshot_batch_buffering",
273 None,
274 "Limit snapshot buffering in upsert.",
275);
276
277pub const STORAGE_ROCKSDB_CLEANUP_TRIES: Config<usize> = Config::new(
281 "storage_rocksdb_cleanup_tries",
282 5,
283 "How many times to try to cleanup old RocksDB DB's on disk before giving up.",
284);
285
286pub const STORAGE_SUSPEND_AND_RESTART_DELAY: Config<Duration> = Config::new(
288 "storage_suspend_and_restart_delay",
289 Duration::from_secs(5),
290 "Delay interval when reconnecting to a source / sink after halt.",
291);
292
293pub const STORAGE_RECLOCK_TO_LATEST: Config<bool> = Config::new(
296 "storage_reclock_to_latest",
297 true,
298 "Whether to mint reclock bindings based on the latest probed offset or the latest ingested offset.",
299);
300
301pub const STORAGE_USE_CONTINUAL_FEEDBACK_UPSERT: Config<bool> = Config::new(
303 "storage_use_continual_feedback_upsert",
304 true,
305 "Whether to use the new continual feedback upsert operator.",
306);
307
308pub const STORAGE_SERVER_MAINTENANCE_INTERVAL: Config<Duration> = Config::new(
310 "storage_server_maintenance_interval",
311 Duration::from_millis(10),
312 "The interval at which the storage server performs maintenance tasks. Zero enables maintenance on every iteration.",
313);
314
315pub const SINK_PROGRESS_SEARCH: Config<bool> = Config::new(
317 "storage_sink_progress_search",
318 true,
319 "If set, iteratively search the progress topic for a progress record with increasing lookback.",
320);
321
322pub const SINK_ENSURE_TOPIC_CONFIG: Config<&'static str> = Config::new(
324 "storage_sink_ensure_topic_config",
325 "skip",
326 "If `skip`, don't check the config of existing topics; if `check`, fetch the config and \
327 warn if it does not match the expected configs; if `alter`, attempt to change the upstream to \
328 match the expected configs.",
329);
330
331pub const ORE_OVERFLOWING_BEHAVIOR: Config<&'static str> = Config::new(
333 "ore_overflowing_behavior",
334 "soft_panic",
335 "Overflow behavior for Overflowing types. One of 'ignore', 'panic', 'soft_panic'.",
336);
337
338pub const STATISTICS_RETENTION_DURATION: Config<Duration> = Config::new(
344 "storage_statistics_retention_duration",
345 Duration::from_secs(86_400), "The time after which we delete per replica statistics (for sources and sinks) after there have been no updates.",
347);
348
349pub fn all_dyncfgs(configs: ConfigSet) -> ConfigSet {
351 configs
352 .add(&CLUSTER_SHUTDOWN_GRACE_PERIOD)
353 .add(&DELAY_SOURCES_PAST_REHYDRATION)
354 .add(&ENFORCE_EXTERNAL_ADDRESSES)
355 .add(&KAFKA_BUFFERED_EVENT_RESIZE_THRESHOLD_ELEMENTS)
356 .add(&KAFKA_CLIENT_ID_ENRICHMENT_RULES)
357 .add(&KAFKA_DEFAULT_AWS_PRIVATELINK_ENDPOINT_IDENTIFICATION_ALGORITHM)
358 .add(&KAFKA_METADATA_FETCH_INTERVAL)
359 .add(&KAFKA_POLL_MAX_WAIT)
360 .add(&KAFKA_RETRY_BACKOFF)
361 .add(&KAFKA_RETRY_BACKOFF_MAX)
362 .add(&KAFKA_RECONNECT_BACKOFF)
363 .add(&KAFKA_RECONNECT_BACKOFF_MAX)
364 .add(&MYSQL_OFFSET_KNOWN_INTERVAL)
365 .add(&MYSQL_REPLICATION_HEARTBEAT_INTERVAL)
366 .add(&ORE_OVERFLOWING_BEHAVIOR)
367 .add(&PG_FETCH_SLOT_RESUME_LSN_INTERVAL)
368 .add(&PG_OFFSET_KNOWN_INTERVAL)
369 .add(&PG_SCHEMA_VALIDATION_INTERVAL)
370 .add(&PG_SOURCE_VALIDATE_TIMELINE)
371 .add(&REPLICA_METRICS_HISTORY_RETENTION_INTERVAL)
372 .add(&SINK_ENSURE_TOPIC_CONFIG)
373 .add(&SINK_PROGRESS_SEARCH)
374 .add(&SQL_SERVER_SOURCE_VALIDATE_RESTORE_HISTORY)
375 .add(&STORAGE_DOWNGRADE_SINCE_DURING_FINALIZATION)
376 .add(&STORAGE_RECLOCK_TO_LATEST)
377 .add(&STORAGE_ROCKSDB_CLEANUP_TRIES)
378 .add(&STORAGE_ROCKSDB_USE_MERGE_OPERATOR)
379 .add(&STORAGE_SERVER_MAINTENANCE_INTERVAL)
380 .add(&STORAGE_SUSPEND_AND_RESTART_DELAY)
381 .add(&STORAGE_UPSERT_MAX_SNAPSHOT_BATCH_BUFFERING)
382 .add(&STORAGE_UPSERT_PREVENT_SNAPSHOT_BUFFERING)
383 .add(&STORAGE_USE_CONTINUAL_FEEDBACK_UPSERT)
384 .add(&SUSPENDABLE_SOURCES)
385 .add(&WALLCLOCK_GLOBAL_LAG_HISTOGRAM_RETENTION_INTERVAL)
386 .add(&WALLCLOCK_LAG_HISTORY_RETENTION_INTERVAL)
387 .add(&crate::sources::sql_server::CDC_POLL_INTERVAL)
388 .add(&crate::sources::sql_server::CDC_CLEANUP_CHANGE_TABLE)
389 .add(&crate::sources::sql_server::CDC_CLEANUP_CHANGE_TABLE_MAX_DELETES)
390 .add(&crate::sources::sql_server::MAX_LSN_WAIT)
391 .add(&crate::sources::sql_server::SNAPSHOT_PROGRESS_REPORT_INTERVAL)
392 .add(&crate::sources::sql_server::OFFSET_KNOWN_INTERVAL)
393 .add(&STATISTICS_RETENTION_DURATION)
394}