risingwavelabs/risingwave · error

missing `hostname` in CDC properties

Error message

missing `hostname` in CDC properties

What it means

This error is raised by `query_sql_server_lsns` when the CDC source properties map does not contain a `hostname` key. The function needs the SQL Server host to build a tiberius `Config` for querying CDC LSN metadata; without it the connection cannot even be constructed. It surfaces as a `ConnectorResult` error propagated up through `monitor_sql_server_lsns`.

Source

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

                Ok(Some((
                    confirmed_flush_lsn.map(Into::into),
                    upstream_max_lsn.into(),
                    slot_name.clone(),
                )))
            }
            None => {
                tracing::warn!("no replication slot found with name: {}", slot_name);
                Ok(None)
            }
        }
    }

    /// Query min/max LSNs from SQL Server CDC.
    async fn query_sql_server_lsns(&self) -> ConnectorResult<Option<(String, String)>> {
        let hostname = self
            .properties
            .get("hostname")
            .ok_or_else(|| anyhow!("missing `hostname` in CDC properties"))?;
        let port = self
            .properties
            .get("port")
            .ok_or_else(|| anyhow!("missing `port` in CDC properties"))?
            .parse::<u16>()
            .context("failed to parse `port` as a u16")?;
        let username = self
            .properties
            .get("username")
            .ok_or_else(|| anyhow!("missing `username` in CDC properties"))?;
        let password = self
            .properties
            .get("password")
            .ok_or_else(|| anyhow!("missing `password` in CDC properties"))?;
        let database = self
            .properties
            .get("database.name")
            .ok_or_else(|| anyhow!("missing `database.name` in CDC properties"))?;

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Add `hostname` to the CDC source properties when creating the table (e.g. `sqlserver.properties.hostname = '...'`)
  2. Verify the properties map passed to the enumerator is populated from the connector options, not an empty map
  3. Check upstream pipeline config serialization so hostname is not stripped
  4. Recreate the CDC table with a complete `with` clause including hostname

Example fix

// before
CREATE TABLE t (...) WITH (
  connector = 'cdc',
  database.name = 'db'
);
// after
CREATE TABLE t (...) WITH (
  connector = 'cdc',
  hostname = 'sqlserver.host',
  database.name = 'db'
);
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: Calling `monitor_sql_server_lsns` (e.g. via the CDC monitoring loop) on a SqlServerEnumerator whose `properties` map lacks the `hostname` entry — typically when the upstream table was created without a hostname in its CDC `with` properties.

Common situations: User creates a SQL Server CDC table omitting `hostname` in the `sqlserver.properties`; a provisioning script drops the property; properties are reconstructed from env vars where HOSTNAME is unset.

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/26d2be9259eb63c1. Report an issue: GitHub.