{"record":{"id":"f1c7ca0377c49b7d","repo":"risingwavelabs/risingwave","slug":"show-binary-logs-missing-log-name-column","errorCode":null,"errorMessage":"`SHOW BINARY LOGS`: missing `Log_name` column","messagePattern":"`SHOW BINARY LOGS`: missing `Log_name` column","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/source/cdc/enumerator/mod.rs","lineNumber":548,"sourceCode":"            .await\n            .context(\"failed to connect to MySQL\")?;\n\n        // Query binlog files using SHOW BINARY LOGS.\n        // MySQL 8.0+ may return 3 columns (Log_name, File_size, Encrypted), while some variants\n        // only return the first 2. Decode the row manually so we don't panic on column-count\n        // differences.\n        let rows: Vec<Row> = conn\n            .query(\"SHOW BINARY LOGS\")\n            .await\n            .context(\"failed to execute `SHOW BINARY LOGS`\")?;\n        let query_result = rows\n            .into_iter()\n            .map(|mut row| -> ConnectorResult<(String, u64)> {\n                let log_name = row\n                    .take_opt::<String, _>(0)\n                    .transpose()\n                    .context(\"`SHOW BINARY LOGS`: failed to decode `Log_name`\")?\n                    .ok_or_else(|| anyhow!(\"`SHOW BINARY LOGS`: missing `Log_name` column\"))?;\n                let file_size = row\n                    .take_opt::<u64, _>(1)\n                    .transpose()\n                    .context(\"`SHOW BINARY LOGS`: failed to decode `File_size`\")?\n                    .ok_or_else(|| anyhow!(\"`SHOW BINARY LOGS`: missing `File_size` column\"))?;\n                Ok((log_name, file_size))\n            })\n            .collect::<ConnectorResult<Vec<_>>>()?;\n\n        drop(conn);\n        pool.disconnect().await.ok();\n\n        Ok(query_result)\n    }\n}\n\nimpl ListCdcSplits for DebeziumSplitEnumerator<Mysql> {\n    type CdcSourceType = Mysql;","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/source/cdc/enumerator/mod.rs#L530-L566","documentation":"After running `SHOW BINARY LOGS`, the enumerator decodes each row positionally: column 0 must be the log file name (`Log_name`). If take_opt::<String> returns Ok(None), MySQL returned a row without a value in that column, which is not a valid result for this statement, so the code fails with this anyhow error.","triggerScenarios":"`SHOW BINARY LOGS` on the target MySQL server returns rows whose first column is NULL or absent — e.g. a non-standard proxy/sharding layer rewriting the result set, or a server build with an altered column layout.","commonSituations":"Connecting through a MySQL-compatible proxy (Vitess, ProxySQL, TiDB variants) that reshapes `SHOW BINARY LOGS` output, or insufficient privileges causing a degenerate result set.","solutions":["Connect directly to the MySQL primary instead of through a proxy for the CDC source.","Verify with an mysql client that `SHOW BINARY LOGS` returns non-NULL Log_name values using the same account.","Check MySQL version/variant compatibility; use a standard MySQL 5.7/8.0 server.","Grant the account REPLICATION CLIENT/SLAVE privileges so the statement returns full rows."],"exampleFix":"// before (via proxy) hostname = 'vitess-proxy:15306'\n// after\nWITH (connector = 'mysql-cdc', hostname = 'mysql-primary.internal', port = '3306', ...)","handlingStrategy":"try-catch","validationCode":"// pre-flight: verify the server returns a proper result set\nlet rows: Vec<(String, u64)> = sqlx::query_as(\n    \"SHOW BINARY LOGS\"\n).fetch_all(&pool).await?;\nassert!(!rows.is_empty() && rows.iter().all(|(n, _)| !n.is_empty()));","typeGuard":null,"tryCatchPattern":"match monitor_res {\n    Err(e) if e.to_string().contains(\"missing `Log_name`\") => {\n        log::warn!(\"MySQL returned malformed SHOW BINARY LOGS output; check for proxy/non-standard server\");\n        // back off and alert instead of hot-looping\n    }\n    r => r?,\n}","preventionTips":["Point CDC sources at the actual MySQL primary, not proxies or shards.","Test `SHOW BINARY LOGS` with the same account before enabling CDC.","Stick to standard MySQL 5.7/8.0 servers supported by RisingWave CDC."],"tags":["cdc","mysql","binlog","result-decode"],"backgroundTag":"unexpected-response-shape","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}