1use std::time::Duration;
13
14use mz_dyncfg::{Config, ConfigSet};
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);
21
22pub const WITH_0DT_DEPLOYMENT_MAX_WAIT: Config<Duration> = Config::new(
24 "with_0dt_deployment_max_wait",
25 Duration::from_secs(60 * 60 * 72),
26 "How long to wait at most for clusters to be hydrated, when doing a zero-downtime deployment.",
27);
28
29pub const WITH_0DT_DEPLOYMENT_DDL_CHECK_INTERVAL: Config<Duration> = Config::new(
30 "with_0dt_deployment_ddl_check_interval",
31 Duration::from_secs(5 * 60),
32 "How often to check for DDL changes during zero-downtime deployment.",
33);
34
35pub const ENABLE_0DT_DEPLOYMENT_PANIC_AFTER_TIMEOUT: Config<bool> = Config::new(
36 "enable_0dt_deployment_panic_after_timeout",
37 false,
38 "Whether to panic if the maximum wait time is reached but preflight checks have not succeeded.",
39);
40
41pub const WITH_0DT_DEPLOYMENT_CAUGHT_UP_CHECK_INTERVAL: Config<Duration> = Config::new(
42 "0dt_deployment_hydration_check_interval",
44 Duration::from_secs(10),
45 "Interval at which to check whether clusters are caught up, when doing zero-downtime deployment.",
46);
47
48pub const WITH_0DT_CAUGHT_UP_CHECK_ALLOWED_LAG: Config<Duration> = Config::new(
49 "with_0dt_caught_up_check_allowed_lag",
50 Duration::from_secs(60),
51 "Maximum allowed lag when determining whether collections are caught up for 0dt deployments.",
52);
53
54pub const WITH_0DT_CAUGHT_UP_CHECK_CUTOFF: Config<Duration> = Config::new(
55 "with_0dt_caught_up_check_cutoff",
56 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.",
58);
59
60pub const ENABLE_0DT_CAUGHT_UP_REPLICA_STATUS_CHECK: Config<bool> = Config::new(
61 "enable_0dt_caught_up_replica_status_check",
62 true,
63 "Enable checking for crash/OOM-looping replicas during 0dt caught-up checks. Emergency break-glass flag to disable this feature if needed.",
64);
65
66pub const ENABLE_STATEMENT_LIFECYCLE_LOGGING: Config<bool> = Config::new(
68 "enable_statement_lifecycle_logging",
69 true,
70 "Enable logging of statement lifecycle events in mz_internal.mz_statement_lifecycle_history.",
71);
72
73pub const ENABLE_INTROSPECTION_SUBSCRIBES: Config<bool> = Config::new(
75 "enable_introspection_subscribes",
76 true,
77 "Enable installation of introspection subscribes.",
78);
79
80pub const ENABLE_FRONTEND_SUBSCRIBES: Config<bool> = Config::new(
82 "enable_frontend_subscribes",
83 true,
84 "Enable sending subscribes down the new frontend-peek path.",
85);
86
87pub const PLAN_INSIGHTS_NOTICE_FAST_PATH_CLUSTERS_OPTIMIZE_DURATION: Config<Duration> = Config::new(
89 "plan_insights_notice_fast_path_clusters_optimize_duration",
90 Duration::from_millis(10),
96 "Enable plan insights fast path clusters calculation if the optimize step took less than this duration.",
97);
98
99pub const ENABLE_CONTINUAL_TASK_BUILTINS: Config<bool> = Config::new(
101 "enable_continual_task_builtins",
102 false,
103 "Create system builtin continual tasks on boot.",
104);
105
106pub const ENABLE_EXPRESSION_CACHE: Config<bool> = Config::new(
108 "enable_expression_cache",
109 true,
110 "Use a cache to store optimized expressions to help speed up start times.",
111);
112
113pub const ENABLE_MULTI_REPLICA_SOURCES: Config<bool> = Config::new(
115 "enable_multi_replica_sources",
116 true,
117 "Enable multi-replica sources.",
118);
119
120pub const ENABLE_PASSWORD_AUTH: Config<bool> = Config::new(
122 "enable_password_auth",
123 false,
124 "Enable password authentication.",
125);
126
127pub const OIDC_ISSUER: Config<Option<&'static str>> =
129 Config::new("oidc_issuer", None, "OIDC issuer URL.");
130
131pub const OIDC_AUDIENCE: Config<fn() -> serde_json::Value> = Config::new(
137 "oidc_audience",
138 || serde_json::json!([]),
139 "OIDC audience (client IDs). A JSON array of strings. When empty, audience validation is skipped.",
140);
141
142pub const OIDC_AUTHENTICATION_CLAIM: Config<&'static str> = Config::new(
144 "oidc_authentication_claim",
145 "sub",
146 "OIDC authentication claim to use as username.",
147);
148
149pub const PERSIST_FAST_PATH_ORDER: Config<bool> = Config::new(
150 "persist_fast_path_order",
151 false,
152 "If set, send queries with a compatible literal constraint or ordering clause down the Persist fast path.",
153);
154
155pub const ENABLE_S3_TABLES_REGION_CHECK: Config<bool> = Config::new(
158 "enable_s3_tables_region_check",
159 false,
160 "Whether to enforce that S3 Tables connections are in the same region as the environment.",
161);
162
163pub const ENABLE_MCP_AGENTS: Config<bool> = Config::new(
165 "enable_mcp_agents",
166 false,
167 "Whether the MCP agents HTTP endpoint is enabled. When false, requests to /api/mcp/agents return 503 Service Unavailable.",
168);
169
170pub const ENABLE_MCP_AGENTS_QUERY_TOOL: Config<bool> = Config::new(
174 "enable_mcp_agents_query_tool",
175 false,
176 "Whether the MCP agents 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.",
177);
178
179pub const ENABLE_MCP_OBSERVATORY: Config<bool> = Config::new(
181 "enable_mcp_observatory",
182 false,
183 "Whether the MCP observatory HTTP endpoint is enabled. When false, requests to /api/mcp/observatory return 503 Service Unavailable.",
184);
185
186pub const MCP_MAX_RESPONSE_SIZE: Config<usize> = Config::new(
190 "mcp_max_response_size",
191 1_000_000,
192 "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.",
193);
194
195pub const USER_ID_POOL_BATCH_SIZE: Config<u32> = Config::new(
198 "user_id_pool_batch_size",
199 512,
200 "Number of user IDs to pre-allocate in a batch for DDL operations.",
201);
202
203pub const CONSOLE_OIDC_CLIENT_ID: Config<&'static str> = Config::new(
205 "console_oidc_client_id",
206 "",
207 "OIDC client ID for the web console.",
208);
209
210pub const CONSOLE_OIDC_SCOPES: Config<&'static str> = Config::new(
212 "console_oidc_scopes",
213 "",
214 "Space-separated OIDC scopes requested by the web console.",
215);
216
217pub fn all_dyncfgs(configs: ConfigSet) -> ConfigSet {
219 configs
220 .add(&ALLOW_USER_SESSIONS)
221 .add(&WITH_0DT_DEPLOYMENT_MAX_WAIT)
222 .add(&WITH_0DT_DEPLOYMENT_DDL_CHECK_INTERVAL)
223 .add(&ENABLE_0DT_DEPLOYMENT_PANIC_AFTER_TIMEOUT)
224 .add(&WITH_0DT_DEPLOYMENT_CAUGHT_UP_CHECK_INTERVAL)
225 .add(&WITH_0DT_CAUGHT_UP_CHECK_ALLOWED_LAG)
226 .add(&WITH_0DT_CAUGHT_UP_CHECK_CUTOFF)
227 .add(&ENABLE_0DT_CAUGHT_UP_REPLICA_STATUS_CHECK)
228 .add(&ENABLE_STATEMENT_LIFECYCLE_LOGGING)
229 .add(&ENABLE_INTROSPECTION_SUBSCRIBES)
230 .add(&ENABLE_FRONTEND_SUBSCRIBES)
231 .add(&PLAN_INSIGHTS_NOTICE_FAST_PATH_CLUSTERS_OPTIMIZE_DURATION)
232 .add(&ENABLE_CONTINUAL_TASK_BUILTINS)
233 .add(&ENABLE_EXPRESSION_CACHE)
234 .add(&ENABLE_MULTI_REPLICA_SOURCES)
235 .add(&ENABLE_PASSWORD_AUTH)
236 .add(&OIDC_ISSUER)
237 .add(&OIDC_AUDIENCE)
238 .add(&OIDC_AUTHENTICATION_CLAIM)
239 .add(&PERSIST_FAST_PATH_ORDER)
240 .add(&ENABLE_S3_TABLES_REGION_CHECK)
241 .add(&ENABLE_MCP_AGENTS)
242 .add(&ENABLE_MCP_AGENTS_QUERY_TOOL)
243 .add(&ENABLE_MCP_OBSERVATORY)
244 .add(&MCP_MAX_RESPONSE_SIZE)
245 .add(&USER_ID_POOL_BATCH_SIZE)
246 .add(&CONSOLE_OIDC_CLIENT_ID)
247 .add(&CONSOLE_OIDC_SCOPES)
248}