Skip to main content

mz_storage_types/
dyncfgs.rs

1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10//! Dyncfgs used by the storage layer. Despite their name, these can be used
11//! "statically" during rendering, or dynamically within timely operators.
12
13use mz_dyncfg::{Config, ConfigSet, ParameterScope};
14use std::time::Duration;
15
16/// When dataflows observe an invariant violation it is either due to a bug or due to the cluster
17/// being shut down. This configuration defines the amount of time to wait before panicking the
18/// process, which will register the invariant violation.
19pub 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    ParameterScope::Replica,
26);
27
28// Flow control
29
30/// Whether rendering should use `mz_join_core` rather than DD's `JoinCore::join_core`.
31/// Configuration for basic hydration backpressure.
32pub const DELAY_SOURCES_PAST_REHYDRATION: Config<bool> = Config::new(
33    "storage_dataflow_delay_sources_past_rehydration",
34    // This was original `false`, but it is not enabled everywhere.
35    true,
36    "Whether or not to delay sources producing values in some scenarios \
37        (namely, upsert) till after rehydration is finished",
38    ParameterScope::Environment,
39);
40
41/// Whether storage dataflows should suspend execution while downstream operators are still
42/// processing data.
43pub const SUSPENDABLE_SOURCES: Config<bool> = Config::new(
44    "storage_dataflow_suspendable_sources",
45    true,
46    "Whether storage dataflows should suspend execution while downstream operators are still \
47        processing data.",
48    ParameterScope::Environment,
49);
50
51// Controller
52
53/// When enabled, force-downgrade the controller's since handle on the shard
54/// during shard finalization.
55pub const STORAGE_DOWNGRADE_SINCE_DURING_FINALIZATION: Config<bool> = Config::new(
56    "storage_downgrade_since_during_finalization",
57    // This was original `false`, but it is not enabled everywhere.
58    true,
59    "When enabled, force-downgrade the controller's since handle on the shard\
60    during shard finalization",
61    ParameterScope::Environment,
62);
63
64/// The interval of time to keep when truncating the replica metrics history.
65pub const REPLICA_METRICS_HISTORY_RETENTION_INTERVAL: Config<Duration> = Config::new(
66    "replica_metrics_history_retention_interval",
67    Duration::from_secs(60 * 60 * 24 * 30), // 30 days
68    "The interval of time to keep when truncating the replica metrics history.",
69    ParameterScope::Environment,
70);
71
72/// The interval of time to keep when truncating the wallclock lag history.
73pub const WALLCLOCK_LAG_HISTORY_RETENTION_INTERVAL: Config<Duration> = Config::new(
74    "wallclock_lag_history_retention_interval",
75    Duration::from_secs(60 * 60 * 24 * 30), // 30 days
76    "The interval of time to keep when truncating the wallclock lag history.",
77    ParameterScope::Environment,
78);
79
80/// The interval of time to keep when truncating the wallclock lag histogram.
81pub const WALLCLOCK_GLOBAL_LAG_HISTOGRAM_RETENTION_INTERVAL: Config<Duration> = Config::new(
82    "wallclock_global_lag_histogram_retention_interval",
83    Duration::from_secs(60 * 60 * 24 * 30), // 30 days
84    "The interval of time to keep when truncating the wallclock lag histogram.",
85    ParameterScope::Environment,
86);
87
88// Kafka
89
90/// Rules for enriching the `client.id` property of Kafka clients with
91/// additional data.
92///
93/// The configuration value must be a JSON array of objects containing keys
94/// named `pattern` and `payload`, both of type string. Rules are checked in the
95/// order they are defined. The rule's pattern must be a regular expression
96/// understood by the Rust `regex` crate. If the rule's pattern matches the
97/// address of any broker in the connection, then the payload is appended to the
98/// client ID. A rule's payload is always prefixed with `-`, to separate it from
99/// the preceding data in the client ID.
100pub const KAFKA_CLIENT_ID_ENRICHMENT_RULES: Config<fn() -> serde_json::Value> = Config::new(
101    "kafka_client_id_enrichment_rules",
102    || serde_json::json!([]),
103    "Rules for enriching the `client.id` property of Kafka clients with additional data.",
104    ParameterScope::Environment,
105);
106
107/// The maximum time we will wait before re-polling rdkafka to see if new partitions/data are
108/// available.
109pub const KAFKA_POLL_MAX_WAIT: Config<Duration> = Config::new(
110    "kafka_poll_max_wait",
111    Duration::from_secs(1),
112    "The maximum time we will wait before re-polling rdkafka to see if new partitions/data are \
113    available.",
114    ParameterScope::Replica,
115);
116
117/// Sets fetch.message.max.bytes in librdkafka for Kafka source reader consumers. Values outside
118/// the range librdkafka accepts are clamped to it. Takes effect when the reader consumers are next
119/// created, for example on replica restart.
120pub const KAFKA_SOURCE_FETCH_MESSAGE_MAX_BYTES: Config<usize> = Config::new(
121    "kafka_source_fetch_message_max_bytes",
122    // Raised from the librdkafka default of 1048576 to fetch bigger batches, which trades memory
123    // for throughput.
124    134_217_728,
125    "Sets fetch.message.max.bytes in librdkafka for Kafka source reader consumers. Values are \
126    clamped to the range librdkafka accepts, from 1 to 1000000000.",
127    ParameterScope::Replica,
128);
129
130/// Sets receive.message.max.bytes in librdkafka for Kafka source reader consumers. Values outside
131/// the range librdkafka accepts are clamped to it. Takes effect when the reader consumers are next
132/// created, for example on replica restart.
133pub const KAFKA_SOURCE_RECEIVE_MESSAGE_MAX_BYTES: Config<usize> = Config::new(
134    "kafka_source_receive_message_max_bytes",
135    // The librdkafka default.
136    100_000_000,
137    "Sets receive.message.max.bytes in librdkafka for Kafka source reader consumers. Values \
138    are clamped to the range librdkafka accepts, from fetch.max.bytes + 512 to 2147483647.",
139    ParameterScope::Replica,
140);
141
142/// How often Kafka sources recommit offsets that have not changed, so that brokers do not expire
143/// them. Must stay well below the broker's `offsets.retention.minutes`. Zero disables it.
144pub const KAFKA_OFFSET_COMMIT_REFRESH_INTERVAL: Config<Duration> = Config::new(
145    "kafka_offset_commit_refresh_interval",
146    Duration::from_secs(10 * 60),
147    "How often Kafka sources recommit offsets that have not changed, which must stay well below \
148    the broker's offsets.retention.minutes. Zero disables it.",
149    ParameterScope::Replica,
150);
151
152/// Whether to check the low watermark for Kafka sources and error if the start offset/resume
153/// upper has been compacted away.
154/// Environment-scoped because it decides whether a definite error is emitted.
155/// Replicas of one cluster disagreeing would write different collection
156/// contents, so the value has to be coherent across them.
157pub const KAFKA_LOW_WATERMARK_CHECK: Config<bool> = Config::new(
158    "kafka_low_watermark_check",
159    true,
160    "Whether to check the low watermark for Kafka sources and error if the start \
161    offset/resume upper has been compacted away.",
162    ParameterScope::Environment,
163);
164
165pub const KAFKA_DEFAULT_AWS_PRIVATELINK_ENDPOINT_IDENTIFICATION_ALGORITHM: Config<&'static str> =
166    Config::new(
167        "kafka_default_aws_privatelink_endpoint_identification_algorithm",
168        // Default to no hostname verification, which is the default in versions of `librdkafka <1.9.2`.
169        "none",
170        "The value we set for the 'ssl.endpoint.identification.algorithm' option in the Kafka \
171    Connection config. default: 'none'",
172        ParameterScope::Environment,
173    );
174
175pub const KAFKA_BUFFERED_EVENT_RESIZE_THRESHOLD_ELEMENTS: Config<usize> = Config::new(
176    "kafka_buffered_event_resize_threshold_elements",
177    1000,
178    "In the Kafka sink operator we might need to buffer messages before emitting them. As a \
179        performance optimization we reuse the buffer allocations, but shrink it to retain at \
180        most this number of elements.",
181    ParameterScope::Replica,
182);
183
184/// Sets retry.backoff.ms in librdkafka for sources and sinks.
185/// See <https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html>
186pub const KAFKA_RETRY_BACKOFF: Config<Duration> = Config::new(
187    "kafka_retry_backoff",
188    Duration::from_millis(100),
189    "Sets retry.backoff.ms in librdkafka for sources and sinks.",
190    ParameterScope::Replica,
191);
192
193/// Sets retry.backoff.max.ms in librdkafka for sources and sinks.
194/// See <https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html>
195pub const KAFKA_RETRY_BACKOFF_MAX: Config<Duration> = Config::new(
196    "kafka_retry_backoff_max",
197    Duration::from_secs(1),
198    "Sets retry.backoff.max.ms in librdkafka for sources and sinks.",
199    ParameterScope::Replica,
200);
201
202/// Sets reconnect.backoff.ms in librdkafka for sources and sinks.
203/// See <https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html>
204pub const KAFKA_RECONNECT_BACKOFF: Config<Duration> = Config::new(
205    "kafka_reconnect_backoff",
206    Duration::from_millis(100),
207    "Sets reconnect.backoff.ms in librdkafka for sources and sinks.",
208    ParameterScope::Replica,
209);
210
211/// Sets reconnect.backoff.max.ms in librdkafka for sources and sinks.
212/// We default to 30s instead of 10s to avoid constant reconnection attempts in the event of
213/// auth changes or unavailability.
214/// See <https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html>
215pub const KAFKA_RECONNECT_BACKOFF_MAX: Config<Duration> = Config::new(
216    "kafka_reconnect_backoff_max",
217    Duration::from_secs(30),
218    "Sets reconnect.backoff.max.ms in librdkafka for sources and sinks.",
219    ParameterScope::Replica,
220);
221
222/// Sets message.max.bytes in librdkafka for Kafka sink producers.
223/// Maximum Kafka protocol request message size. Producer-side, this controls
224/// the maximum size of a single message (including framing) that the client
225/// will allow. Defaults to the librdkafka default of 1,000,000 bytes.
226/// See <https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html>
227pub const KAFKA_SINK_MESSAGE_MAX_BYTES: Config<usize> = Config::new(
228    "kafka_sink_message_max_bytes",
229    1_000_000,
230    "Sets message.max.bytes in librdkafka for Kafka sink producers.",
231    ParameterScope::Environment,
232);
233
234/// Sets batch.size in librdkafka for Kafka sink producers.
235/// Maximum size (in bytes) of all messages batched in one MessageSet, including
236/// protocol framing overhead. Defaults to the librdkafka default of 1,000,000
237/// bytes.
238/// See <https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html>
239pub const KAFKA_SINK_BATCH_SIZE: Config<usize> = Config::new(
240    "kafka_sink_batch_size",
241    1_000_000,
242    "Sets batch.size in librdkafka for Kafka sink producers.",
243    ParameterScope::Environment,
244);
245
246/// Sets batch.num.messages in librdkafka for Kafka sink producers.
247/// Maximum number of messages batched in one MessageSet. Defaults to the
248/// librdkafka default of 10,000 messages.
249/// See <https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html>
250pub const KAFKA_SINK_BATCH_NUM_MESSAGES: Config<usize> = Config::new(
251    "kafka_sink_batch_num_messages",
252    10_000,
253    "Sets batch.num.messages in librdkafka for Kafka sink producers.",
254    ParameterScope::Environment,
255);
256
257/// Whether Kafka sinks attach a `materialize-sink-id` header, holding the
258/// sink's `GlobalId`, to every message they produce.
259///
260/// Environment-scoped because it changes the messages the sink produces.
261pub const KAFKA_SINK_EMIT_SINK_ID_HEADER: Config<bool> = Config::new(
262    "kafka_sink_emit_sink_id_header",
263    true,
264    "Whether Kafka sinks attach a `materialize-sink-id` header to every message they produce.",
265    ParameterScope::Environment,
266);
267
268// MySQL
269
270/// Replication heartbeat interval requested from the MySQL server.
271pub const MYSQL_REPLICATION_HEARTBEAT_INTERVAL: Config<Duration> = Config::new(
272    "mysql_replication_heartbeat_interval",
273    Duration::from_secs(30),
274    "Replication heartbeat interval requested from the MySQL server.",
275    ParameterScope::Replica,
276);
277
278/// Whether to split snapshot reads of tables with a supported single-column
279/// primary key into per-worker PK ranges. When disabled, each table is read
280/// whole by a single worker.
281pub static MYSQL_SOURCE_SNAPSHOT_PARALLELISM: Config<bool> = Config::new(
282    "mysql_source_snapshot_parallelism",
283    true,
284    "Whether to split MySQL snapshot reads across workers by primary-key ranges.",
285    ParameterScope::Replica,
286);
287
288/// Smallest estimated row count the MySQL snapshot partitioner attempts to subdivide.
289pub static MYSQL_SOURCE_SNAPSHOT_PARTITION_MIN_ROWS: Config<usize> = Config::new(
290    "mysql_source_snapshot_partition_min_rows",
291    50_000,
292    "Minimum estimated rows the MySQL snapshot partitioner attempts to split.",
293    ParameterScope::Replica,
294);
295
296/// Cap on string primary key prefixes visited when attempting to partition a table for
297/// parallel snapshotting in MySQL. This limits runtime on high-cardinality prefixes,
298/// and will return correct but likely more skewed boundaries on budget exhaustion.
299pub static MYSQL_SOURCE_SNAPSHOT_PARTITION_PROBED_PREFIXES_PER_BILLION_ROWS: Config<usize> =
300    Config::new(
301        "mysql_source_snapshot_partition_probed_prefixes_per_billion_rows",
302        1_000,
303        "Cap on MySQL snapshot PK-prefix partitioning probed prefixes per table, per billion \
304     estimated rows; when exhausted, splitting stops early with coarser partition boundaries. \
305     The per-table budget is additionally hard-capped at 5000.",
306        ParameterScope::Replica,
307    );
308
309/// If the optimizer estimates the table has fewer rows than this, compute the exact row count
310/// with `COUNT(*)`. Otherwise, report the `information_schema` estimate directly.
311pub static MYSQL_SOURCE_SNAPSHOT_EXACT_COUNT_MAX_ROWS: Config<usize> = Config::new(
312    "mysql_source_snapshot_exact_count_max_rows",
313    1_000_000,
314    "Maximum estimated table size for which MySQL snapshots compute an exact COUNT(*) \
315     for the size gauge; larger tables report the information_schema estimate.",
316    ParameterScope::Replica,
317);
318
319// Postgres
320
321/// Interval to poll `confirmed_flush_lsn` to get a resumption lsn.
322pub const PG_FETCH_SLOT_RESUME_LSN_INTERVAL: Config<Duration> = Config::new(
323    "postgres_fetch_slot_resume_lsn_interval",
324    Duration::from_millis(500),
325    "Interval to poll `confirmed_flush_lsn` to get a resumption lsn.",
326    ParameterScope::Replica,
327);
328
329/// Timeout for `CREATE_REPLICATION_SLOT` on the upstream server. Applied as the session's
330/// `lock_timeout`, which bounds the wait for in-progress upstream transactions to end. This has
331/// no effect when the upsteam is a physical standby.
332pub const PG_SOURCE_REPLICATION_SLOT_CREATION_TIMEOUT: Config<Duration> = Config::new(
333    "pg_source_replication_slot_creation_timeout",
334    Duration::from_secs(60),
335    "Timeout for creating a replication slot on the upstream PostgreSQL server. Applied as \
336     `lock_timeout`, which bounds the wait for in-progress upstream transactions to end. \
337     Has no effect with physical standbys.",
338    ParameterScope::Replica,
339);
340
341/// Interval to re-validate the schemas of ingested tables.
342pub const PG_SCHEMA_VALIDATION_INTERVAL: Config<Duration> = Config::new(
343    "pg_schema_validation_interval",
344    Duration::from_secs(15),
345    "Interval to re-validate the schemas of ingested tables.",
346    ParameterScope::Environment,
347);
348
349/// Controls behavior of PG Source when the upstream DB timeline changes. The default behavior
350/// is to emit a definite error forcing source recreation. In cases of HA, the upstream DB may
351/// provide guarantees of failover without loss of data (e.g. CloudSQL maintenance). Changing this
352/// flag puts the onus on the customer to recreate the source if the upstream DB changes timeline
353/// in a way that introduces data loss (e.g. manual failover, restore, etc.).
354/// Environment-scoped because it decides whether a definite error is emitted.
355/// Replicas of one cluster disagreeing would write different collection
356/// contents, so the value has to be coherent across them.
357pub static PG_SOURCE_VALIDATE_TIMELINE: Config<bool> = Config::new(
358    "pg_source_validate_timeline",
359    true,
360    "Whether to treat a timeline switch as a definite error",
361    ParameterScope::Environment,
362);
363
364/// Controls behavior of the SQL Server source when the upstream DB restore history changes. The
365/// default behavior is to emit a definite error, forcing source recreation.  In cases of Always
366/// On Availability Group (AOAG), the upstream DB may guarantee continuity without loss of data.
367/// Changing this flag puts the onus on the customer to recreate the source if the upstream DB
368/// changes in a way that introduces data loss.
369/// Environment-scoped because it decides whether a definite error is emitted.
370/// Replicas of one cluster disagreeing would write different collection
371/// contents, so the value has to be coherent across them.
372pub static SQL_SERVER_SOURCE_VALIDATE_RESTORE_HISTORY: Config<bool> = Config::new(
373    "sql_server_source_validate_restore_history",
374    true,
375    "Whether to treat a restore history change as a definite error",
376    ParameterScope::Environment,
377);
378
379// AWS
380
381/// The AWS SDK's connect timeout on the AssumeRole prefetcher's STS calls.
382/// Raise it if credential fetches time out on slow connections.
383///
384/// The default matches the SDK's own 3.1 second default, so behavior only
385/// changes when an operator raises it.
386///
387/// Read once when a connection is set up. Running sinks are unaffected by
388/// changes until their dataflow restarts.
389pub const AWS_PREFETCH_STS_CONNECT_TIMEOUT: Config<Duration> = Config::new(
390    "aws_prefetch_sts_connect_timeout",
391    Duration::from_millis(3100),
392    "Connect timeout for the AWS AssumeRole credentials prefetcher's STS calls.",
393    ParameterScope::Replica,
394);
395
396// Networking
397
398/// Whether or not to enforce that external connection addresses are global
399/// (not private or local) when resolving them.
400///
401/// Read on both `environmentd` (purification, `COPY` planning) and the replica.
402/// Deliberately environment-scoped even so: this is a security control, and a
403/// per-replica override would weaken it for part of the environment only.
404pub const ENFORCE_EXTERNAL_ADDRESSES: Config<bool> = Config::new(
405    "storage_enforce_external_addresses",
406    false,
407    "Whether or not to enforce that external connection addresses are global \
408          (not private or local) when resolving them",
409    ParameterScope::Environment,
410);
411
412// Upsert
413
414/// Whether or not to prevent buffering the entire _upstream_ snapshot in
415/// memory when processing it in memory. This is generally understood to reduce
416/// memory consumption.
417///
418/// When false, in general the memory utilization while processing the snapshot is:
419/// # of snapshot updates + (# of unique keys in snapshot * N), where N is some small
420/// integer number of buffers
421///
422/// When true, in general the memory utilization while processing the snapshot is:
423/// # of snapshot updates + (RocksDB buffers + # of keys in batch produced by upstream) * # of
424/// workers.
425///
426/// Without hydration flow control, which is not yet implemented, there are workloads that may
427/// cause the latter to use more memory, which is why we offer this configuration.
428pub const STORAGE_UPSERT_PREVENT_SNAPSHOT_BUFFERING: Config<bool> = Config::new(
429    "storage_upsert_prevent_snapshot_buffering",
430    true,
431    "Prevent snapshot buffering in upsert.",
432    ParameterScope::Replica,
433);
434
435/// Whether to enable the merge operator in upsert for the RocksDB backend.
436pub const STORAGE_ROCKSDB_USE_MERGE_OPERATOR: Config<bool> = Config::new(
437    "storage_rocksdb_use_merge_operator",
438    true,
439    "Use the native rocksdb merge operator where possible.",
440    ParameterScope::Environment,
441);
442
443/// If `storage_upsert_prevent_snapshot_buffering` is true, this prevents the upsert
444/// operator from buffering too many events from the upstream snapshot. In the absence
445/// of hydration flow control, this could prevent certain workloads from causing egregiously
446/// large writes to RocksDB.
447pub const STORAGE_UPSERT_MAX_SNAPSHOT_BATCH_BUFFERING: Config<Option<usize>> = Config::new(
448    "storage_upsert_max_snapshot_batch_buffering",
449    None,
450    "Limit snapshot buffering in upsert.",
451    ParameterScope::Replica,
452);
453
454/// Allow the upsert-v2 stash to spill out of RSS. While off, the stash keeps
455/// everything resident.
456///
457/// Sets the storage chunk spill gate
458/// (`mz_timely_util::columnar::chunk::StorageSpill`), which only upsert's
459/// chunks read, independently of compute's `enable_column_paged_batcher_spill`.
460/// Spilled chunks draw on the one shared pool budget, and the gate is
461/// consulted at every chunk commit, so flips apply to running dataflows.
462///
463/// Enabling it also installs the process buffer pool (via compute's config
464/// handler, which reads this flag from the aggregate dyncfg set), so
465/// storage-only spilling needs no compute-side gate.
466pub const ENABLE_UPSERT_PAGED_SPILL: Config<bool> = Config::new(
467    "enable_upsert_paged_spill",
468    true,
469    "Allow the upsert-v2 stash to spill out of RSS, through the buffer pool.",
470    ParameterScope::Replica,
471);
472
473// RocksDB
474
475/// How many times to try to cleanup old RocksDB DB's on disk before giving up.
476pub const STORAGE_ROCKSDB_CLEANUP_TRIES: Config<usize> = Config::new(
477    "storage_rocksdb_cleanup_tries",
478    5,
479    "How many times to try to cleanup old RocksDB DB's on disk before giving up.",
480    ParameterScope::Replica,
481);
482
483/// Delay interval when reconnecting to a source / sink after halt.
484pub const STORAGE_SUSPEND_AND_RESTART_DELAY: Config<Duration> = Config::new(
485    "storage_suspend_and_restart_delay",
486    Duration::from_secs(5),
487    "Delay interval when reconnecting to a source / sink after halt.",
488    ParameterScope::Replica,
489);
490
491/// Whether to use the new continual feedback upsert operator.
492pub const STORAGE_USE_CONTINUAL_FEEDBACK_UPSERT: Config<bool> = Config::new(
493    "storage_use_continual_feedback_upsert",
494    true,
495    "Whether to use the new continual feedback upsert operator.",
496    ParameterScope::Environment,
497);
498
499/// Whether to use the v2 upsert operator.
500pub const ENABLE_UPSERT_V2: Config<bool> = Config::new(
501    "enable_upsert_v2",
502    true,
503    "Whether to use the v2 upsert operator.",
504    ParameterScope::Environment,
505);
506
507/// The interval at which the storage server performs maintenance tasks.
508pub const STORAGE_SERVER_MAINTENANCE_INTERVAL: Config<Duration> = Config::new(
509    "storage_server_maintenance_interval",
510    Duration::from_millis(10),
511    "The interval at which the storage server performs maintenance tasks. Zero enables maintenance on every iteration.",
512    ParameterScope::Replica,
513);
514
515/// If set, iteratively search the progress topic for a progress record with increasing lookback.
516pub const SINK_PROGRESS_SEARCH: Config<bool> = Config::new(
517    "storage_sink_progress_search",
518    true,
519    "If set, iteratively search the progress topic for a progress record with increasing lookback.",
520    ParameterScope::Environment,
521);
522
523/// Configure how to behave when trying to create an existing topic with specified configs.
524pub const SINK_ENSURE_TOPIC_CONFIG: Config<&'static str> = Config::new(
525    "storage_sink_ensure_topic_config",
526    "skip",
527    "If `skip`, don't check the config of existing topics; if `check`, fetch the config and \
528    warn if it does not match the expected configs; if `alter`, attempt to change the upstream to \
529    match the expected configs.",
530    ParameterScope::Environment,
531);
532
533/// How far ahead of the remap upper the source `persist_sink` commits a ceiling while a
534/// snapshotting export holds its frontier pinned, so that it can group updates into one batch.
535///
536/// The persist sink mints descriptions based on the data frontier. During a snapshot, that frontier
537/// does not progress. Providing a lookahead instructs the minter to commit to a ceiling based
538/// on the remap upper, which is used by the batch writers to group updates into a batch.
539/// The minter honors the ceiling by minting descriptions at or beyond it. The whole snapshot and
540/// the CDC events that were captured concurrently, up to the ceiling, become one description,
541/// appended once.
542///
543/// Because the reclock stamps every update below the remap upper, the ceiling is ahead of the data
544/// by at least the lookahead even if the export has seen no data. It still has to reach the writers
545/// ahead of the rows stamped under the newest binding, since a builder only takes updates at times
546/// it was opened for, so this wants to be at least one `timestamp_interval`. An update that outruns
547/// it writes a batch of its own instead, which costs a batch rather than correctness.
548///
549/// Only applies to an export of a Postgres or MySQL source that is snapshotting in this dataflow
550/// incarnation, and only until the frontier moves off the time its snapshot occupies. Zero disables
551/// committing ahead, leaving descriptions derived from the frontier alone and every timestamp
552/// writing its own batch.
553///
554/// A nonzero value also switches the Postgres and MySQL snapshot operators to emitting their rewind
555/// requests as soon as the snapshot bound is known instead of after the copy completes, so the
556/// replication stream is read while the snapshot runs, and lets each export's frontier advance
557/// once it has no snapshot data left to emit. Replication data received for an export that
558/// is still snapshotting is staged in the dataflow until its snapshot completes, which is the
559/// many-timestamp shape the lookahead groups. The two are one setting because reading the stream
560/// concurrently without the grouping keeps one batch builder per timestamp resident until each
561/// reaches the blob target size.
562pub const STORAGE_PERSIST_SINK_DESCRIPTION_LOOKAHEAD: Config<Duration> = Config::new(
563    "storage_persist_sink_description_lookahead",
564    Duration::ZERO,
565    "Determines how far past the remap upper the source persist sink will commit to a ceiling \
566    in order to group data into one batch and one description, and whether the Postgres and \
567    MySQL replication streams are read while a snapshot runs. Zero disables both, leaving every \
568    timestamp writing its own batch. Other values below the tick interval are clamped to the \
569    tick interval.",
570    ParameterScope::Environment,
571);
572
573/// Configure mz-ore overflowing type behavior.
574pub const ORE_OVERFLOWING_BEHAVIOR: Config<&'static str> = Config::new(
575    "ore_overflowing_behavior",
576    "soft_panic",
577    "Overflow behavior for Overflowing types. One of 'ignore', 'panic', 'soft_panic'.",
578    ParameterScope::Environment,
579);
580
581/// The time after which we delete per-replica statistics (for sources and
582/// sinks) after there have been no updates.
583///
584/// This time is opportunistic, statistics are not guaranteed to be deleted
585/// after the retention time runs out.
586pub const STATISTICS_RETENTION_DURATION: Config<Duration> = Config::new(
587    "storage_statistics_retention_duration",
588    Duration::from_secs(86_400), /* one day */
589    "The time after which we delete per replica statistics (for sources and sinks) after there have been no updates.",
590    ParameterScope::Environment,
591);
592
593/// Adds the full set of all storage `Config`s.
594pub fn all_dyncfgs(configs: ConfigSet) -> ConfigSet {
595    configs
596        .add(&AWS_PREFETCH_STS_CONNECT_TIMEOUT)
597        .add(&CLUSTER_SHUTDOWN_GRACE_PERIOD)
598        .add(&DELAY_SOURCES_PAST_REHYDRATION)
599        .add(&ENFORCE_EXTERNAL_ADDRESSES)
600        .add(&KAFKA_BUFFERED_EVENT_RESIZE_THRESHOLD_ELEMENTS)
601        .add(&KAFKA_CLIENT_ID_ENRICHMENT_RULES)
602        .add(&KAFKA_DEFAULT_AWS_PRIVATELINK_ENDPOINT_IDENTIFICATION_ALGORITHM)
603        .add(&KAFKA_LOW_WATERMARK_CHECK)
604        .add(&KAFKA_OFFSET_COMMIT_REFRESH_INTERVAL)
605        .add(&KAFKA_POLL_MAX_WAIT)
606        .add(&KAFKA_RETRY_BACKOFF)
607        .add(&KAFKA_RETRY_BACKOFF_MAX)
608        .add(&KAFKA_RECONNECT_BACKOFF)
609        .add(&KAFKA_RECONNECT_BACKOFF_MAX)
610        .add(&KAFKA_SINK_MESSAGE_MAX_BYTES)
611        .add(&KAFKA_SINK_BATCH_SIZE)
612        .add(&KAFKA_SINK_BATCH_NUM_MESSAGES)
613        .add(&KAFKA_SINK_EMIT_SINK_ID_HEADER)
614        .add(&KAFKA_SOURCE_FETCH_MESSAGE_MAX_BYTES)
615        .add(&KAFKA_SOURCE_RECEIVE_MESSAGE_MAX_BYTES)
616        .add(&MYSQL_REPLICATION_HEARTBEAT_INTERVAL)
617        .add(&MYSQL_SOURCE_SNAPSHOT_EXACT_COUNT_MAX_ROWS)
618        .add(&MYSQL_SOURCE_SNAPSHOT_PARALLELISM)
619        .add(&MYSQL_SOURCE_SNAPSHOT_PARTITION_MIN_ROWS)
620        .add(&MYSQL_SOURCE_SNAPSHOT_PARTITION_PROBED_PREFIXES_PER_BILLION_ROWS)
621        .add(&ORE_OVERFLOWING_BEHAVIOR)
622        .add(&PG_FETCH_SLOT_RESUME_LSN_INTERVAL)
623        .add(&PG_SCHEMA_VALIDATION_INTERVAL)
624        .add(&PG_SOURCE_REPLICATION_SLOT_CREATION_TIMEOUT)
625        .add(&PG_SOURCE_VALIDATE_TIMELINE)
626        .add(&REPLICA_METRICS_HISTORY_RETENTION_INTERVAL)
627        .add(&SINK_ENSURE_TOPIC_CONFIG)
628        .add(&SINK_PROGRESS_SEARCH)
629        .add(&SQL_SERVER_SOURCE_VALIDATE_RESTORE_HISTORY)
630        .add(&STORAGE_DOWNGRADE_SINCE_DURING_FINALIZATION)
631        .add(&STORAGE_ROCKSDB_CLEANUP_TRIES)
632        .add(&STORAGE_ROCKSDB_USE_MERGE_OPERATOR)
633        .add(&STORAGE_PERSIST_SINK_DESCRIPTION_LOOKAHEAD)
634        .add(&STORAGE_SERVER_MAINTENANCE_INTERVAL)
635        .add(&STORAGE_SUSPEND_AND_RESTART_DELAY)
636        .add(&STORAGE_UPSERT_MAX_SNAPSHOT_BATCH_BUFFERING)
637        .add(&STORAGE_UPSERT_PREVENT_SNAPSHOT_BUFFERING)
638        .add(&STORAGE_USE_CONTINUAL_FEEDBACK_UPSERT)
639        .add(&ENABLE_UPSERT_V2)
640        .add(&SUSPENDABLE_SOURCES)
641        .add(&ENABLE_UPSERT_PAGED_SPILL)
642        .add(&WALLCLOCK_GLOBAL_LAG_HISTOGRAM_RETENTION_INTERVAL)
643        .add(&WALLCLOCK_LAG_HISTORY_RETENTION_INTERVAL)
644        .add(&crate::sources::sql_server::CDC_CLEANUP_CHANGE_TABLE)
645        .add(&crate::sources::sql_server::CDC_CLEANUP_CHANGE_TABLE_MAX_DELETES)
646        .add(&crate::sources::sql_server::MAX_LSN_WAIT)
647        .add(&crate::sources::sql_server::SNAPSHOT_PROGRESS_REPORT_INTERVAL)
648        .add(&STATISTICS_RETENTION_DURATION)
649}