{"record":{"id":"496162a2fd91643b","repo":"risingwavelabs/risingwave","slug":"missing-required-property-port-for-mysql-cdc-sou","errorCode":null,"errorMessage":"missing required property 'port' for MySQL CDC source","messagePattern":"missing required property 'port' for MySQL CDC source","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/source/cdc/enumerator/mod.rs","lineNumber":424,"sourceCode":"    }\n}\n\nimpl DebeziumSplitEnumerator<Mysql> {\n    async fn monitor_mysql_binlog_files(&mut self) -> ConnectorResult<()> {\n        // Get hostname and port for metrics labels\n        let hostname = self\n            .properties\n            .get(\"hostname\")\n            .map(|s| s.as_str())\n            .ok_or_else(|| {\n                anyhow::anyhow!(\"missing required property 'hostname' for MySQL CDC source\")\n            })?;\n        let port = self\n            .properties\n            .get(\"port\")\n            .map(|s| s.as_str())\n            .ok_or_else(|| {\n                anyhow::anyhow!(\"missing required property 'port' for MySQL CDC source\")\n            })?;\n\n        // Query binlog files and update metrics\n        let binlog_files = self.query_binlog_files().await.with_context(|| {\n            format!(\n                \"failed to query binlog files for MySQL CDC source {} ({}:{})\",\n                self.source_id, hostname, port\n            )\n        })?;\n        if let Some((oldest_file, oldest_size)) = binlog_files.first()\n            && let Some(seq) = extract_binlog_file_seq(oldest_file)\n        {\n            let labels = vec![\n                self.source_id.to_string(),\n                hostname.to_owned(),\n                port.to_owned(),\n            ];\n            get_or_create_guarded_int_gauge(","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/source/cdc/enumerator/mod.rs#L406-L442","documentation":"The MySQL CDC binlog monitor requires a 'port' entry in the source's CDC properties map before it can connect to MySQL. When `monitor_mysql_binlog_files` looks up `properties.get(\"port\")` and finds nothing, it fails fast with this anyhow error instead of attempting a connection to a default or unspecified port. It exists to surface an incomplete source definition early, in the background monitor loop.","triggerScenarios":"A MySQL CDC source (CREATE SOURCE / CREATE TABLE ... WITH connector='mysql-cdc') is running and monitor_cdc spawns monitor_mysql_binlog_files, but the user's `properties` map passed to CdcSplitEnumerator has no 'port' key.","commonSituations":"Creating a CDC source without specifying the port (expecting the MySQL default 3306 to be assumed), building properties programmatically and skipping optional-looking keys, or upgrading from a version where the port was defaulted elsewhere.","solutions":["Add 'port' to the WITH/properties of the MySQL CDC source, e.g. port = '3306'.","If building properties in code, insert(\"port\".into(), port.to_string()) before constructing the enumerator.","Drop and recreate the source with the complete property set so the running monitor picks it up."],"exampleFix":"// before\nCREATE TABLE t (...) WITH (\n  connector = 'mysql-cdc',\n  hostname = 'mysql.example.com',\n  username = 'u', password = 'p', database.name = 'db', table.name = 't'\n);\n// after\nCREATE TABLE t (...) WITH (\n  connector = 'mysql-cdc',\n  hostname = 'mysql.example.com',\n  port = '3306',\n  username = 'u', password = 'p', database.name = 'db', table.name = 't'\n);","handlingStrategy":"validation","validationCode":"let required = [\"hostname\", \"port\", \"username\", \"password\", \"database.name\"];\nassert!(required.iter().all(|k| props.contains_key(*k)), \"missing 'port' (and check all of {:?}) in CDC properties\", required);","typeGuard":null,"tryCatchPattern":"match monitor_cdc_result {\n    Err(e) if e.to_string().contains(\"missing required property 'port'\") => {\n        log::error!(\"CDC source misconfigured: add port to WITH options: {e}\");\n        // halt monitoring until source is recreated with full props\n    }\n    Err(e) => return Err(e),\n    Ok(v) => Ok(v),\n}","preventionTips":["Always include hostname, port, username, password, database.name and table.name in mysql-cdc WITH options.","Validate the properties map against a required-keys checklist before CREATE SOURCE.","Never assume defaults (like 3306) are applied server-side; set port explicitly."],"tags":["cdc","mysql","missing-property","configuration"],"backgroundTag":"missing-required-config-field","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}