risingwavelabs/risingwave · error
missing required property 'port' for MySQL CDC source
Error message
missing required property 'port' for MySQL CDC source
What it means
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.
Source
Thrown at src/connector/src/source/cdc/enumerator/mod.rs:424
}
}
impl DebeziumSplitEnumerator<Mysql> {
async fn monitor_mysql_binlog_files(&mut self) -> ConnectorResult<()> {
// Get hostname and port for metrics labels
let hostname = self
.properties
.get("hostname")
.map(|s| s.as_str())
.ok_or_else(|| {
anyhow::anyhow!("missing required property 'hostname' for MySQL CDC source")
})?;
let port = self
.properties
.get("port")
.map(|s| s.as_str())
.ok_or_else(|| {
anyhow::anyhow!("missing required property 'port' for MySQL CDC source")
})?;
// Query binlog files and update metrics
let binlog_files = self.query_binlog_files().await.with_context(|| {
format!(
"failed to query binlog files for MySQL CDC source {} ({}:{})",
self.source_id, hostname, port
)
})?;
if let Some((oldest_file, oldest_size)) = binlog_files.first()
&& let Some(seq) = extract_binlog_file_seq(oldest_file)
{
let labels = vec![
self.source_id.to_string(),
hostname.to_owned(),
port.to_owned(),
];
get_or_create_guarded_int_gauge(View on GitHub (pinned to 6469eb736d)
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.
Example fix
// before CREATE TABLE t (...) WITH ( connector = 'mysql-cdc', hostname = 'mysql.example.com', username = 'u', password = 'p', database.name = 'db', table.name = 't' ); // after CREATE TABLE t (...) WITH ( connector = 'mysql-cdc', hostname = 'mysql.example.com', port = '3306', username = 'u', password = 'p', database.name = 'db', table.name = 't' );
Defensive patterns
Strategy: validation
Validate before calling
let required = ["hostname", "port", "username", "password", "database.name"];
assert!(required.iter().all(|k| props.contains_key(*k)), "missing 'port' (and check all of {:?}) in CDC properties", required); Try / catch
match monitor_cdc_result {
Err(e) if e.to_string().contains("missing required property 'port'") => {
log::error!("CDC source misconfigured: add port to WITH options: {e}");
// halt monitoring until source is recreated with full props
}
Err(e) => return Err(e),
Ok(v) => Ok(v),
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- missing required property 'hostname' for MySQL CDC source
- unsupported SSL mode
- received a DDL message, please set `canal.instance.filter.qu
- no value found at column: {}, index: {}
- failed to deserialize MySQL value into rust value
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/496162a2fd91643b.
Report an issue: GitHub.