risingwavelabs/risingwave · error · SinkError::DorisStarrocksConnect

{err}

Error message

{err}

What it means

The StarRocks schema client failed to create a MySQL-protocol connection pool because `mysql_async::Opts::from_url` could not parse the provided connection URI, and the error is wrapped as `SinkError::DorisStarrocksConnect`. The URI comes from the sink's host/port/user/password configuration.

Solutions

  1. Use a `mysql://user:password@host:port/db` format URL (mysql_async supported format)
  2. Percent-encode special characters (`@`, `:`, `/`) in user/password within the URL
  3. If using a JDBC URL, strip the `jdbc:` prefix and translate parameters
  4. Check host/port values are correct (default StarRocks FE query port 9030)

Example fix

// before
'starrocks.url' = 'jdbc:mysql://fe:9030/db'
// after
'starrocks.url' = 'mysql://user:pass@fe:9030/db'
Defensive patterns

Strategy: validation

Validate before calling

try {
  new URL("mysql://user:pass@fe:9030/db"); // mirror of Opts::from_url format
} catch (e) {
  throw "starrocks.url must be mysql://user:pass@host:port/db";
}

Try / catch

match err {
  SinkError::DorisStarrocksConnect(e) => log("check connection URI format", e),
  other => return Err(other),
}

Prevention

When it happens

Trigger: Malformed or unsupported JDBC-style or URL-encoded connection string passed to the StarRocks sink (e.g. `jdbc:mysql://host:port/db` instead of a plain `mysql://` URL, missing scheme, invalid characters/credentials in URL).

Common situations: Users copying a JDBC URL from StarRocks docs into the sink's `starrocks.url`/host option; special characters in the password not percent-encoded; empty host.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at src/connector/src/sink/starrocks.rs:768

        // username & password may contain special chars, so we need to do URL encoding on them.
        // Otherwise, Opts::from_url may report a `Parse error`
        let user = form_urlencoded::byte_serialize(user.as_bytes()).collect::<String>();
        let password = form_urlencoded::byte_serialize(password.as_bytes()).collect::<String>();

        let conn_uri = format!(
            "mysql://{}:{}@{}:{}/{}?prefer_socket={}&max_allowed_packet={}&wait_timeout={}",
            user,
            password,
            host,
            port,
            db,
            STARROCK_MYSQL_PREFER_SOCKET,
            STARROCK_MYSQL_MAX_ALLOWED_PACKET,
            STARROCK_MYSQL_WAIT_TIMEOUT
        );
        let pool = mysql_async::Pool::new(
            Opts::from_url(&conn_uri)
                .map_err(|err| SinkError::DorisStarrocksConnect(anyhow!(err)))?,
        );
        let conn = pool
            .get_conn()
            .await
            .map_err(|err| SinkError::DorisStarrocksConnect(anyhow!(err)))?;

        Ok(Self { table, db, conn })
    }

    pub async fn get_columns_from_starrocks(&mut self) -> Result<HashMap<String, String>> {
        let query = format!(
            "select column_name, column_type from information_schema.columns where table_name = {:?} and table_schema = {:?};",
            self.table, self.db
        );
        let mut query_map: HashMap<String, String> = HashMap::default();
        self.conn
            .query_map(query, |(column_name, column_type)| {
                query_map.insert(column_name, column_type)

View on GitHub (pinned to 6469eb736d)