apache/seatunnel · warning
MySQL-CDC diagnostic: failed to query MySQL server identity:
Error message
MySQL-CDC diagnostic: failed to query MySQL server identity: {} What it means
Diagnostic WARN from logMySqlServerIdentity's catch block: the SQL query used to fetch server identity (server_id, uuid, gtid_mode, etc.) raised a SQLException, so the identity diagnostics could not be collected. The CDC task itself continues; only the diagnostic output is lost.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/reader/fetch/MySqlSourceFetchTaskContext.java:477
connection.query(
sql,
rs -> {
if (!rs.next()) {
return;
}
LOG.warn(
"MySQL-CDC diagnostic: connected to MySQL hostname={}, port={}, server_id={}, server_uuid={}, read_only={}, super_read_only={}, version={}, gtid_mode={}",
rs.getString("hostname"),
rs.getString("port"),
rs.getString("server_id"),
rs.getString("server_uuid"),
rs.getString("read_only"),
rs.getString("super_read_only"),
rs.getString("version"),
rs.getString("gtid_mode"));
});
} catch (SQLException e) {
LOG.warn(
"MySQL-CDC diagnostic: failed to query MySQL server identity: {}",
e.getMessage());
}
}
private void logMySqlBinlogRetentionVariables() {
logMySqlVariable("log_bin");
logMySqlVariable("binlog_format");
logMySqlVariable("binlog_expire_logs_seconds");
logMySqlVariable("expire_logs_days");
}
private void logMySqlVariable(String variableName) {
final String sql = String.format("SHOW VARIABLES LIKE '%s'", variableName);
try {
connection.query(
sql,
rs -> {View on GitHub (pinned to cf67b549a7)
Solutions
- Grant the CDC user privileges to query system variables/information_schema (e.g. SELECT on *.* or PERFORMANCE_SCHEMA/session_variables)
- Check network stability to the MySQL host; re-run the job and inspect earlier connection errors
- If a proxy restricts queries, run the identity SQL manually with a DBA account to gather the same values
Example fix
// before GRANT SELECT ON db.* TO 'stuser'@'%'; // after GRANT SELECT, RELOAD, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'stuser'@'%';
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify privileges and connectivity first mysql -h <host> -u stuser -p -e 'SELECT @@gtid_mode; SELECT @@server_uuid;' SHOW GRANTS FOR 'stuser'@'%';
Try / catch
try {
runIdentityQuery(connection);
} catch (SQLException e) {
LOG.warn("identity diagnostics skipped: {}", e.getMessage());
// fall back to manual SHOW VARIABLES as DBA
} Prevention
- Grant SELECT on information_schema/PERFORMANCE_SCHEMA and global variable read access to the CDC user
- Keep connections alive across the diagnostic phase (avoid pool teardown mid-task)
- Whitelist SHOW/SELECT diagnostics on DB proxies
When it happens
Trigger: The identity query fails due to lost connection, insufficient privileges to read the queried variables/information_schema, or the server rejecting the diagnostic SQL while handling a binlog/GTID unavailability condition.
Common situations: User lacks SELECT privilege on information_schema or SESSION_VARIABLES; connection dropped mid-diagnostic; firewall or proxy blocking the query.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- MySQL-CDC diagnostic: failed to query SHOW MASTER STATUS: {}
- MySQL-CDC diagnostic: {} failed: {}
- MySQL-CDC diagnostic: failed to query variable {}: {}
- Unexpected error while connecting to MySQL and looking at GT
- Unexpected error while connecting to MySQL and looking at gt
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/5613de116075c18a.
Report an issue: GitHub.