#26344·risingwave

bug(mysql-cdc): multi-database source fails at binlog fetch — enumerator ignores #19038's fix (Unknown database 'db1,db2')

Author: damokelisCreated Jul 20, 2026Updated Sep 19, 2026
Labelsno-issue-activity

Describe the bug

CREATE SOURCE with multi-database database.name='db1,db2' passes validation and initial backfill succeeds, but the MySQL CDC enumerator fails to fetch binlog files with Unknown database. The root cause is that PR #19038 (support mysql source capture multiple databases) fixed the Java MySqlValidator to split the DB list, but the Rust enumerator at src/connector/src/source/cdc/enumerator/mod.rs:509-521 still passes the full comma-separated string as the JDBC default database.

Error message

ERROR risingwave_connector::source::cdc::enumerator: Failed to query binlog files for MySQL CDC source 8 (10.113.233.41:2883): Failed to connect to MySQL: Server error: `ERROR 42000 (1049): Unknown database 'erp_finance,external_access''

To Reproduce

  1. Create a multi-database CDC source:
sql
CREATE SOURCE repro_multi WITH (
  connector = 'mysql-cdc',
  hostname = '<host>',
  port = '3306',
  username = '<user>',
  password = '<pw>',
  database.name = 'db1,db2',
  server.id = '8002'
);

→ ✅ succeeds (validator passes, following #19038).

  1. Create a CDC table on one of the databases:
sql
CREATE TABLE t (id BIGINT, PRIMARY KEY(id))
  FROM repro_multi TABLE 'db1.some_table';

→ ✅ succeeds, initial backfill completes with correct row count.

  1. Wait ~30s. Meta pod logs (kubectl logs <meta-pod>) show:
ERROR risingwave_connector::source::cdc::enumerator: 
  Failed to query binlog files for MySQL CDC source 8 (host:port): 
  Failed to connect to MySQL: Server error: 
  `ERROR 42000 (1049): Unknown database 'db1,db2'`

And this error repeats every 30 seconds indefinitely — the source ID is registered but the enumerator can never fetch binlog progress.

Expected behavior

Since PR #19038 explicitly documents multi-database support with database.name='db1,db2', the enumerator should also handle the comma-separated list correctly (e.g., connect without a default database, or use only the first DB, mirroring the validator's fix).

Root cause

Comparing PR #19038's fix in MySqlValidator.java:48:

java
// Before (broken):
var jdbcUrl = ValidatorUtils.getJdbcUrl(SourceTypeE.MYSQL, dbHost, dbPort, dbName);
// After (fixed):
var jdbcUrl = String.format("jdbc:mysql://%s:%s", dbHost, dbPort);  // no default DB
// then split(",") and check each DB exists

But the Rust enumerator at enumerator/mod.rs:509-521 was not updated:

rust
let database = self
    .properties
    .get("database.name")
    .ok_or_else(|| anyhow::anyhow!("database.name not found in CDC properties"))?;
// ...
let pool = build_mysql_connection_pool(
    hostname, port, username, password, database, ssl_mode
);  // ← `database` is 'db1,db2' — passed verbatim as JDBC default DB

build_mysql_connection_pool sets database as the connection default database, so MySQL returns Unknown database 'db1,db2'.

Suggested fix

Two options mirroring the validator fix:

  1. Connect without a default database (recommended), or
  2. Use only the first DB from the split list (matches JDBC single-DB semantics).

Happy to open a PR.

Environment

  • RisingWave version: 3.0.1 (PostgreSQL 13.14.0-RisingWave-3.0.1)
  • Upstream: OceanBase 4.5.0 binlog service (MySQL wire protocol)
  • Deployment: TKE (Tencent Kubernetes), risingwave-operator

Related

  • Original feature PR: #19038
  • Cherry-picks: #19125 (2.1), #19317 (2.0)
  • Issue tracker: N/A (this is a follow-up bug of #19038)

Source: risingwavelabs/risingwave