1use std::time::Duration;
13
14use mz_dyncfg::{Config, ConfigSet, ParameterScope};
15
16pub const ALLOW_USER_SESSIONS: Config<bool> = Config::new(
17 "allow_user_sessions",
18 true,
19 "Whether to allow user roles to create new sessions. When false, only system roles will be permitted to create new sessions.",
20 ParameterScope::Environment,
21);
22
23pub const WITH_0DT_DEPLOYMENT_MAX_WAIT: Config<Duration> = Config::new(
25 "with_0dt_deployment_max_wait",
26 Duration::from_hours(365 * 24),
29 "How long to wait at most for clusters to be hydrated, when doing a zero-downtime deployment.",
30 ParameterScope::Environment,
31);
32
33pub const WITH_0DT_DEPLOYMENT_DDL_CHECK_INTERVAL: Config<Duration> = Config::new(
34 "with_0dt_deployment_ddl_check_interval",
35 Duration::from_secs(5 * 60),
36 "How often to check for DDL changes during zero-downtime deployment.",
37 ParameterScope::Environment,
38);
39
40pub const ENABLE_0DT_DEPLOYMENT_PANIC_AFTER_TIMEOUT: Config<bool> = Config::new(
41 "enable_0dt_deployment_panic_after_timeout",
42 false,
43 "Whether to panic if the maximum wait time is reached but preflight checks have not succeeded.",
44 ParameterScope::Environment,
45);
46
47pub const WITH_0DT_DEPLOYMENT_CAUGHT_UP_CHECK_INTERVAL: Config<Duration> = Config::new(
48 "0dt_deployment_hydration_check_interval",
50 Duration::from_secs(10),
51 "Interval at which to check whether clusters are caught up, when doing zero-downtime deployment.",
52 ParameterScope::Environment,
53);
54
55pub const WITH_0DT_CAUGHT_UP_CHECK_ALLOWED_LAG: Config<Duration> = Config::new(
56 "with_0dt_caught_up_check_allowed_lag",
57 Duration::from_secs(60),
58 "Maximum allowed lag when determining whether collections are caught up for 0dt deployments.",
59 ParameterScope::Environment,
60);
61
62pub const WITH_0DT_CAUGHT_UP_CHECK_CUTOFF: Config<Duration> = Config::new(
63 "with_0dt_caught_up_check_cutoff",
64 Duration::from_secs(2 * 60 * 60), "Collections whose write frontier is behind 'now' by more than the cutoff are ignored when doing caught-up checks for 0dt deployments.",
66 ParameterScope::Environment,
67);
68
69pub const ENABLE_0DT_CAUGHT_UP_REPLICA_STATUS_CHECK: Config<bool> = Config::new(
70 "enable_0dt_caught_up_replica_status_check",
71 true,
72 "Enable checking for crash/OOM-looping replicas during 0dt caught-up checks. Emergency break-glass flag to disable this feature if needed.",
73 ParameterScope::Environment,
74);
75
76pub const ENABLE_0DT_CAUGHT_UP_STABILITY_CHECK: Config<bool> = Config::new(
80 "enable_0dt_caught_up_stability_check",
81 true,
82 "Require clusters to stay caught-up and healthy for a stability period before being considered ready during 0dt deployments. Emergency break-glass flag: disabling reverts to treating a caught-up cluster as ready with no replica-health requirement, which differs from setting the stability period to zero (a zero period still requires all replicas to be healthy).",
83 ParameterScope::Environment,
84);
85
86pub const WITH_0DT_CAUGHT_UP_CHECK_STABILITY_PERIOD: Config<Duration> = Config::new(
87 "with_0dt_caught_up_check_stability_period",
88 Duration::from_secs(10 * 60), "Required continuous hydration before a caught-up cluster is ready for 0dt cutover. Each non-exempt replica's period is capped at its catalog creation age when it hydrated. Missing creation evidence retains the full period.",
90 ParameterScope::Environment,
91);
92
93pub const ENABLE_0DT_HYDRATE_MIGRATED_BUILTIN_MVS: Config<bool> = Config::new(
94 "enable_0dt_hydrate_migrated_builtin_mvs",
95 true,
96 "Write-enable replacement-migrated and new builtin materialized views while read-only during \
97 a 0dt deployment, so they hydrate before cut-over and gate promotion. Emergency break-glass \
98 flag: disabling excludes these MVs and every other new builtin (and their dependents) from \
99 the caught-up check, so promotion proceeds with them unhydrated. Not an exact revert: a \
100 collection with no live leader frontier must be hydrated either way, and new builtin tables \
101 and sources are written either way. Only takes effect when the leader is new enough for the \
102 write to make progress, and is read once at startup, so changing it means setting it on the \
103 leader and restarting the new deployment.",
104 ParameterScope::Environment,
105);
106
107pub const ENABLE_STATEMENT_LIFECYCLE_LOGGING: Config<bool> = Config::new(
109 "enable_statement_lifecycle_logging",
110 true,
111 "Enable logging of statement lifecycle events in mz_internal.mz_statement_lifecycle_history.",
112 ParameterScope::Environment,
113);
114
115pub const ENABLE_INTROSPECTION_SUBSCRIBES: Config<bool> = Config::new(
117 "enable_introspection_subscribes",
118 true,
119 "Enable installation of introspection subscribes.",
120 ParameterScope::Environment,
121);
122
123pub const PLAN_INSIGHTS_NOTICE_FAST_PATH_CLUSTERS_OPTIMIZE_DURATION: Config<Duration> = Config::new(
125 "plan_insights_notice_fast_path_clusters_optimize_duration",
126 Duration::from_millis(10),
132 "Enable plan insights fast path clusters calculation if the optimize step took less than this duration.",
133 ParameterScope::Environment,
134);
135
136pub const ENABLE_EXPRESSION_CACHE: Config<bool> = Config::new(
138 "enable_expression_cache",
139 true,
140 "Use a cache to store optimized expressions to help speed up start times. \
141 Read at startup, so changing it takes effect on the next restart.",
142 ParameterScope::Environment,
143);
144
145pub const ENABLE_PASSWORD_AUTH: Config<bool> = Config::new(
147 "enable_password_auth",
148 false,
149 "Enable password authentication.",
150 ParameterScope::Environment,
151);
152
153pub const READ_THEN_WRITE_MAX_DEPENDENCIES: Config<usize> = Config::new(
159 "read_then_write_max_dependencies",
160 100_000,
161 "Maximum number of transitive dependencies validated for a read-then-write \
162 statement before it is rejected.",
163 ParameterScope::Environment,
164);
165
166pub const OIDC_ISSUER: Config<Option<&'static str>> = Config::new(
168 "oidc_issuer",
169 None,
170 "OIDC issuer URL.",
171 ParameterScope::Environment,
172);
173
174pub const OIDC_AUDIENCE: Config<fn() -> serde_json::Value> = Config::new(
180 "oidc_audience",
181 || serde_json::json!([]),
182 "OIDC audience (client IDs). A JSON array of strings. When empty, audience validation is skipped.",
183 ParameterScope::Environment,
184);
185
186pub const OIDC_AUTHENTICATION_CLAIM: Config<&'static str> = Config::new(
188 "oidc_authentication_claim",
189 "sub",
190 "OIDC authentication claim to use as username.",
191 ParameterScope::Environment,
192);
193
194pub const OIDC_GROUP_ROLE_SYNC_ENABLED: Config<bool> = Config::new(
197 "oidc_group_role_sync_enabled",
198 false,
199 "Enable OIDC JWT group-to-role membership sync on login.",
200 ParameterScope::Environment,
201);
202
203pub const OIDC_GROUP_CLAIM: Config<&'static str> = Config::new(
207 "oidc_group_claim",
208 "groups",
209 "JWT claim path containing group memberships for role sync. Supports dot-separated paths into nested objects (e.g. customClaims.groups).",
210 ParameterScope::Environment,
211);
212
213pub const OIDC_GROUP_ROLE_SYNC_STRICT: Config<bool> = Config::new(
216 "oidc_group_role_sync_strict",
217 false,
218 "When true, reject login if OIDC group-to-role sync fails (fail-closed).",
219 ParameterScope::Environment,
220);
221
222pub const PERSIST_FAST_PATH_ORDER: Config<bool> = Config::new(
223 "persist_fast_path_order",
224 true,
225 "If set, send queries with a compatible literal constraint or ordering clause down the Persist fast path.",
226 ParameterScope::Environment,
227);
228
229pub const ENABLE_S3_TABLES_REGION_CHECK: Config<bool> = Config::new(
232 "enable_s3_tables_region_check",
233 false,
234 "Whether to enforce that S3 Tables connections are in the same region as the environment.",
235 ParameterScope::Environment,
236);
237
238pub const ENABLE_MCP_AGENT: Config<bool> = Config::new(
240 "enable_mcp_agent",
241 true,
242 "Whether the MCP agent HTTP endpoint is enabled. When false, requests to /api/mcp/agent return 503 Service Unavailable.",
243 ParameterScope::Environment,
244);
245
246pub const ENABLE_MCP_AGENT_QUERY_TOOL: Config<bool> = Config::new(
250 "enable_mcp_agent_query_tool",
251 true,
252 "Whether the MCP agent query tool is enabled. When false, the query tool is not advertised and calls to it are rejected. Agents can still discover and inspect data products.",
253 ParameterScope::Environment,
254);
255
256pub const ENABLE_MCP_AGENT_READ_DATA_PRODUCT_TOOL: Config<bool> = Config::new(
260 "enable_mcp_agent_read_data_product_tool",
261 true,
262 "Whether the MCP agent read_data_product tool is enabled. When false, the read_data_product tool is not advertised and calls to it are rejected. Agents can use the query tool to read data products.",
263 ParameterScope::Environment,
264);
265
266pub const ENABLE_MCP_DEVELOPER: Config<bool> = Config::new(
268 "enable_mcp_developer",
269 true,
270 "Whether the MCP developer HTTP endpoint is enabled. When false, requests to /api/mcp/developer return 503 Service Unavailable.",
271 ParameterScope::Environment,
272);
273
274pub const ENABLE_MCP_DEVELOPER_QUERY_TOOL: Config<bool> = Config::new(
278 "enable_mcp_developer_query_tool",
279 true,
280 "Whether the MCP developer query tool is enabled. When false, the query tool is not advertised and calls to it are rejected. Developers can still use query_system_catalog.",
281 ParameterScope::Environment,
282);
283
284pub const ENABLE_MCP_UNIFIED: Config<bool> = Config::new(
288 "enable_mcp_unified",
289 false,
290 "Whether the unified MCP HTTP endpoint is enabled. When false, requests to /api/mcp return 503 Service Unavailable.",
291 ParameterScope::Environment,
292);
293
294pub const ENABLE_PUBLIC_METRICS_ENDPOINT: Config<bool> = Config::new(
296 "enable_public_metrics_endpoint",
297 true,
298 "Whether the external metrics endpoint on environmentd is enabled. When false, requests return 503.",
299 ParameterScope::Environment,
300);
301
302pub const MCP_MAX_RESPONSE_SIZE: Config<usize> = Config::new(
306 "mcp_max_response_size",
307 1_000_000,
308 "Maximum size in bytes of MCP tool response content. Responses exceeding this limit are rejected with an error telling the agent to narrow its query.",
309 ParameterScope::Environment,
310);
311
312pub const MCP_REQUEST_TIMEOUT: Config<Duration> = Config::new(
315 "mcp_request_timeout",
316 Duration::from_secs(60),
317 "Maximum time an MCP request may run before it is aborted with a timeout error.",
318 ParameterScope::Environment,
319);
320
321pub const WEBHOOK_MAX_REQUEST_SIZE_BYTES: Config<usize> = Config::new(
326 "webhook_max_request_size_bytes",
327 5 * 1024 * 1024,
329 "The maximum size in bytes of a webhook request body, measured after decompression.",
330 ParameterScope::Environment,
331);
332
333pub const WEBHOOK_VALIDATION_MEMORY_BUDGET_BYTES: Config<usize> = Config::new(
348 "webhook_validation_memory_budget_bytes",
349 20 * 1024 * 1024,
350 "The maximum bytes of temporary storage a webhook CHECK expression may allocate while validating one request.",
351 ParameterScope::Environment,
352);
353
354pub const SUBSCRIBE_MAX_BUFFERED_BYTES: Config<usize> = Config::new(
368 "subscribe_max_buffered_bytes",
369 128 * 1024 * 1024,
370 "Maximum bytes a SUBSCRIBE may buffer in environmentd for a slow client before it is retired with an error.",
371 ParameterScope::Environment,
372);
373
374pub const USER_ID_POOL_BATCH_SIZE: Config<u32> = Config::new(
377 "user_id_pool_batch_size",
378 512,
379 "Number of user IDs to pre-allocate in a batch for DDL operations.",
380 ParameterScope::Environment,
381);
382
383pub const GROUP_COMMIT_MAX_ATTEMPTS: Config<usize> = Config::new(
387 "group_commit_max_attempts",
388 100,
389 "Maximum number of txns-shard write attempts before rebuilding environmentd. Values below 1 are treated as 1.",
390 ParameterScope::Environment,
391);
392
393pub const CONSOLE_OIDC_CLIENT_ID: Config<&'static str> = Config::new(
395 "console_oidc_client_id",
396 "",
397 "OIDC client ID for the web console.",
398 ParameterScope::Environment,
399);
400
401pub const CONSOLE_OIDC_SCOPES: Config<&'static str> = Config::new(
403 "console_oidc_scopes",
404 "",
405 "Space-separated OIDC scopes requested by the web console.",
406 ParameterScope::Environment,
407);
408
409pub const ARRANGEMENT_SIZE_HISTORY_COLLECTION_INTERVAL: Config<Duration> = Config::new(
411 "arrangement_size_history_collection_interval",
412 Duration::ZERO,
414 "Interval at which to collect and snapshot per-object arrangement sizes \
415 into mz_internal.mz_object_arrangement_size_history.",
416 ParameterScope::Environment,
417);
418
419pub const ARRANGEMENT_SIZE_HISTORY_RETENTION_PERIOD: Config<Duration> = Config::new(
421 "arrangement_size_history_retention_period",
422 Duration::from_hours(7 * 24),
423 "How long to retain rows in mz_internal.mz_object_arrangement_size_history.",
424 ParameterScope::Environment,
425);
426
427pub const HYDRATION_HISTORY_COLLECTION_INTERVAL: Config<Duration> = Config::new(
429 "hydration_history_collection_interval",
430 Duration::from_secs(60),
431 "How often to record completed object and replica hydration episodes. A zero duration prevents new collection and retention sweeps.",
432 ParameterScope::Environment,
433);
434
435pub const HYDRATION_HISTORY_RETENTION_PERIOD: Config<Duration> = Config::new(
437 "hydration_history_retention_period",
438 Duration::from_hours(30 * 24),
439 "How long to retain rows in mz_internal.mz_object_hydration_history.",
440 ParameterScope::Environment,
441);
442
443pub const REPLICA_HYDRATION_HISTORY_RETENTION_PERIOD: Config<Duration> = Config::new(
445 "replica_hydration_history_retention_period",
446 Duration::from_hours(120 * 24),
447 "How long to retain rows in mz_internal.mz_replica_hydration_history.",
448 ParameterScope::Environment,
449);
450
451pub const CATALOG_INFO_METRICS_RECONCILE_INTERVAL: Config<Duration> = Config::new(
455 "catalog_info_metrics_reconcile_interval",
456 Duration::from_secs(30),
457 "How frequently to reconcile the catalog `*_info` metrics with the catalog. A zero duration disables reconciliation.",
458 ParameterScope::Environment,
459);
460
461pub const PG_TIMESTAMP_ORACLE_STATEMENT_TIMEOUT: Config<Duration> = Config::new(
465 "pg_timestamp_oracle_statement_timeout",
466 crate::timestamp_oracle::DEFAULT_PG_TIMESTAMP_ORACLE_STATEMENT_TIMEOUT,
467 "The server-side statement timeout to set on Postgres/CRDB connections used by the \
468 Postgres/CRDB timestamp oracle. A value of zero leaves the statement timeout unset.",
469 ParameterScope::Environment,
470);
471
472pub const CLUSTER_CONTROLLER_TICK_INTERVAL: Config<Duration> = Config::new(
474 "cluster_controller_tick_interval",
475 Duration::from_secs(5),
476 "How often the cluster controller runs a reconcile tick.",
477 ParameterScope::Environment,
478);
479
480pub const ENABLE_CLUSTER_RECONFIGURATION_LAG_GATE: Config<bool> = Config::new(
485 "enable_cluster_reconfiguration_lag_gate",
486 true,
487 "Whether graceful reconfiguration and hydration-burst retirement require surviving replicas \
488 to be within cluster_reconfiguration_allowed_lag of the retiring replicas, on top of being hydrated.",
489 ParameterScope::Environment,
490);
491
492pub const CLUSTER_RECONFIGURATION_ALLOWED_LAG: Config<Duration> = Config::new(
494 "cluster_reconfiguration_allowed_lag",
495 Duration::from_secs(60),
496 "Maximum allowed lag when determining whether surviving compute replicas \
497 have caught up with replicas retired by graceful reconfiguration or hydration burst.",
498 ParameterScope::Environment,
499);
500
501pub const ENABLE_BACKGROUND_ALTER_CLUSTER: Config<bool> = Config::new(
508 "enable_background_alter_cluster",
509 true,
510 "Whether a config-shape ALTER CLUSTER returns immediately (true) or the session blocks on a wait-shim over the durable reconfiguration record (false).",
511 ParameterScope::Environment,
512);
513
514pub const DEFAULT_CLUSTER_RECONFIGURATION_TIMEOUT: Config<Duration> = Config::new(
518 "default_cluster_reconfiguration_timeout",
519 Duration::from_secs(60 * 60 * 24),
520 "The reconfiguration deadline written when a config-shape ALTER CLUSTER omits WITH (WAIT ...).",
521 ParameterScope::Environment,
522);
523
524pub const ENABLE_HYDRATION_BURST: Config<bool> = Config::new(
532 "enable_hydration_burst",
533 true,
534 "Whether the cluster controller's hydration-burst strategy may run a burst replica (break-glass; leaves graceful reconfiguration and ON REFRESH untouched).",
535 ParameterScope::Environment,
536);
537
538pub const DEFAULT_HYDRATION_BURST_LINGER: Config<Duration> = Config::new(
542 "default_hydration_burst_linger",
543 Duration::from_secs(0),
544 "The burst-replica linger duration written when an AUTO SCALING STRATEGY omits LINGER DURATION.",
545 ParameterScope::Environment,
546);
547
548pub fn all_dyncfgs(configs: ConfigSet) -> ConfigSet {
550 configs
551 .add(&ALLOW_USER_SESSIONS)
552 .add(&CLUSTER_CONTROLLER_TICK_INTERVAL)
553 .add(&ENABLE_CLUSTER_RECONFIGURATION_LAG_GATE)
554 .add(&CLUSTER_RECONFIGURATION_ALLOWED_LAG)
555 .add(&ENABLE_BACKGROUND_ALTER_CLUSTER)
556 .add(&DEFAULT_CLUSTER_RECONFIGURATION_TIMEOUT)
557 .add(&ENABLE_HYDRATION_BURST)
558 .add(&DEFAULT_HYDRATION_BURST_LINGER)
559 .add(&WITH_0DT_DEPLOYMENT_MAX_WAIT)
560 .add(&WITH_0DT_DEPLOYMENT_DDL_CHECK_INTERVAL)
561 .add(&ENABLE_0DT_DEPLOYMENT_PANIC_AFTER_TIMEOUT)
562 .add(&WITH_0DT_DEPLOYMENT_CAUGHT_UP_CHECK_INTERVAL)
563 .add(&WITH_0DT_CAUGHT_UP_CHECK_ALLOWED_LAG)
564 .add(&WITH_0DT_CAUGHT_UP_CHECK_CUTOFF)
565 .add(&ENABLE_0DT_CAUGHT_UP_REPLICA_STATUS_CHECK)
566 .add(&ENABLE_0DT_CAUGHT_UP_STABILITY_CHECK)
567 .add(&WITH_0DT_CAUGHT_UP_CHECK_STABILITY_PERIOD)
568 .add(&ENABLE_0DT_HYDRATE_MIGRATED_BUILTIN_MVS)
569 .add(&ENABLE_STATEMENT_LIFECYCLE_LOGGING)
570 .add(&ENABLE_INTROSPECTION_SUBSCRIBES)
571 .add(&PLAN_INSIGHTS_NOTICE_FAST_PATH_CLUSTERS_OPTIMIZE_DURATION)
572 .add(&ENABLE_EXPRESSION_CACHE)
573 .add(&ENABLE_PASSWORD_AUTH)
574 .add(&READ_THEN_WRITE_MAX_DEPENDENCIES)
575 .add(&OIDC_ISSUER)
576 .add(&OIDC_AUDIENCE)
577 .add(&OIDC_AUTHENTICATION_CLAIM)
578 .add(&OIDC_GROUP_ROLE_SYNC_ENABLED)
579 .add(&OIDC_GROUP_CLAIM)
580 .add(&OIDC_GROUP_ROLE_SYNC_STRICT)
581 .add(&PERSIST_FAST_PATH_ORDER)
582 .add(&ENABLE_S3_TABLES_REGION_CHECK)
583 .add(&ENABLE_MCP_AGENT)
584 .add(&ENABLE_MCP_AGENT_QUERY_TOOL)
585 .add(&ENABLE_MCP_AGENT_READ_DATA_PRODUCT_TOOL)
586 .add(&ENABLE_MCP_DEVELOPER)
587 .add(&ENABLE_MCP_DEVELOPER_QUERY_TOOL)
588 .add(&ENABLE_MCP_UNIFIED)
589 .add(&ENABLE_PUBLIC_METRICS_ENDPOINT)
590 .add(&MCP_MAX_RESPONSE_SIZE)
591 .add(&MCP_REQUEST_TIMEOUT)
592 .add(&WEBHOOK_MAX_REQUEST_SIZE_BYTES)
593 .add(&WEBHOOK_VALIDATION_MEMORY_BUDGET_BYTES)
594 .add(&SUBSCRIBE_MAX_BUFFERED_BYTES)
595 .add(&USER_ID_POOL_BATCH_SIZE)
596 .add(&GROUP_COMMIT_MAX_ATTEMPTS)
597 .add(&CONSOLE_OIDC_CLIENT_ID)
598 .add(&CONSOLE_OIDC_SCOPES)
599 .add(&ARRANGEMENT_SIZE_HISTORY_COLLECTION_INTERVAL)
600 .add(&ARRANGEMENT_SIZE_HISTORY_RETENTION_PERIOD)
601 .add(&HYDRATION_HISTORY_COLLECTION_INTERVAL)
602 .add(&HYDRATION_HISTORY_RETENTION_PERIOD)
603 .add(&REPLICA_HYDRATION_HISTORY_RETENTION_PERIOD)
604 .add(&CATALOG_INFO_METRICS_RECONCILE_INTERVAL)
605 .add(&PG_TIMESTAMP_ORACLE_STATEMENT_TIMEOUT)
606}