Check if a timeseries collection has CDC enabled. Returns `false` (CDC off) by default for timeseries to prevent high-cardinality metric streams from flooding the ChangeStream bus. Users opt in via `CREATE TIMESERIES name WITH (cdc = 'true')`.
(shared: &SharedState, tenant_id: TenantId, collection: &str)
| 367 | /// high-cardinality metric streams from flooding the ChangeStream bus. |
| 368 | /// Users opt in via `CREATE TIMESERIES name WITH (cdc = 'true')`. |
| 369 | fn is_timeseries_cdc_enabled(shared: &SharedState, tenant_id: TenantId, collection: &str) -> bool { |
| 370 | if let Some(catalog) = shared.credentials.catalog() |
| 371 | && let Ok(Some(coll)) = |
| 372 | catalog.get_collection(DatabaseId::DEFAULT, tenant_id.as_u64(), collection) |
| 373 | && coll.collection_type.is_timeseries() |
| 374 | { |
| 375 | if let Some(config) = coll.get_timeseries_config() |
| 376 | && let Some(cdc_val) = config.get("cdc") |
| 377 | { |
| 378 | return cdc_val.as_str() == Some("true") || cdc_val.as_bool() == Some(true); |
| 379 | } |
| 380 | // Default: CDC off for timeseries. |
| 381 | return false; |
| 382 | } |
| 383 | // Not timeseries or catalog unavailable — allow publishing. |
| 384 | true |
| 385 | } |
| 386 | |
| 387 | #[cfg(test)] |
| 388 | mod collect_budget_tests { |
no test coverage detected