risingwavelabs/risingwave · error

missing required property 'hostname' for MySQL CDC source

Error message

missing required property 'hostname' for MySQL CDC source

What it means

`monitor_mysql_binlog_files` reads the `hostname` property from the CDC properties map to label metrics (host/port); if absent, it throws this anyhow error. Unlike the SQL Server path this is for MySQL CDC monitoring of binlog files, and the property is treated as required even though it is used for labeling.

Source

Thrown at src/connector/src/source/cdc/enumerator/mod.rs:417

    async fn monitor_cdc(&mut self) -> ConnectorResult<()>;
}

#[async_trait]
impl<T: CdcSourceTypeTrait> CdcMonitor for DebeziumSplitEnumerator<T> {
    default async fn monitor_cdc(&mut self) -> ConnectorResult<()> {
        Ok(())
    }
}

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)

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Add `hostname` to the MySQL CDC source properties when creating the table
  2. Check for key-name typos (`host` vs `hostname`) — the code expects exactly `hostname`
  3. Verify upstream option parsing passes hostname through to the enumerator
  4. Recreate the table with a complete `with` clause including hostname and port

Example fix

// before
CREATE TABLE t (...) WITH (
  connector = 'mysql-cdc'
);
// after
CREATE TABLE t (...) WITH (
  connector = 'mysql-cdc',
  hostname = '127.0.0.1',
  port = '3306'
);
Defensive patterns

Strategy: validation

Validate before calling

let required = ["hostname", "port", "username", "password", "database.name", "server.timezone"];
for key in required {
    if !properties.contains_key(key) {
        return Err(format!("MySQL CDC source is missing required property: {}", key));
    }
}

Prevention

When it happens

Trigger: Calling `monitor_mysql_binlog_files` (via `monitor_cdc`) on a MySqlEnumerator whose `properties` map lacks `hostname`.

Common situations: MySQL CDC table created without `hostname` in the `with` clause; properties built from env vars where the host var is unset; key typo like `host` instead of `hostname`.

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


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/8d1b9ae49920a773. Report an issue: GitHub.