apache/seatunnel · error · DebeziumException
Unexpected error while connecting to MySQL and looking at GT
Error message
Unexpected error while connecting to MySQL and looking at GTID mode:
What it means
isGtidModeEnabled queries the server (SELECT @@GLOBAL.gtid_mode) to determine whether GTID replication is on, and wraps any SQLException into this DebeziumException. The message text mentions GTID mode even though the real failure is the underlying query/connection error preserved as cause.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/MySqlConnection.java:274
/**
* Determine whether the MySQL server has GTIDs enabled.
*
* @return {@code false} if the server's {@code gtid_mode} is set and is {@code OFF}, or {@code
* true} otherwise
*/
public boolean isGtidModeEnabled() {
try {
return queryAndMap(
"SHOW GLOBAL VARIABLES LIKE 'GTID_MODE'",
rs -> {
if (rs.next()) {
return !"OFF".equalsIgnoreCase(rs.getString(2));
}
return false;
});
} catch (SQLException e) {
throw new DebeziumException(
"Unexpected error while connecting to MySQL and looking at GTID mode: ", e);
}
}
/**
* Determine the executed GTID set for MySQL.
*
* @return the string representation of MySQL's GTID sets; never null but an empty string if the
* server does not use GTIDs
*/
public String knownGtidSet() {
try {
return queryAndMap(
binaryLogStatusStatement(),
rs -> {
if (rs.next() && rs.getMetaData().getColumnCount() > 4) {
return rs.getString(
5); // GTID set, may be null, blank, or contain a GTID setView on GitHub (pinned to cf67b549a7)
Solutions
- Reconnect/verify the MySQL connection is healthy and credentials are valid
- Check the user has privileges to query @@GLOBAL.gtid_mode
- Inspect the cause SQLException for the actual root error and address it
- Retry the connector after resolving network/database issues
Example fix
// before: user without privileges CREATE USER 'cdc'@'%' IDENTIFIED BY 'pw'; // after GRANT SELECT ON *.* TO 'cdc'@'%';
Defensive patterns
Strategy: retry
Validate before calling
try (Connection c = DriverManager.getConnection(url, user, pass); Statement s = c.createStatement()) { s.executeQuery("SELECT @@GLOBAL.gtid_mode"); } Try / catch
catch (DebeziumException e) { logger.error("GTID mode check failed", e.getCause()); retryWithBackoff(); } Prevention
- Health-check the MySQL endpoint before connector startup
- Grant the CDC user privileges for global variable queries
- Add retry with backoff around startup validation
- Watch server logs during failovers
When it happens
Trigger: SQLException while executing the GTID-mode query inside isGtidModeEnabled: connection lost, credentials invalid, or server refusing the statement.
Common situations: MySQL connection dropped during startup validation; user lacking privileges to read global variables; network interruption or DB failover while the connector checks GTID mode.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Unexpected error while connecting to MySQL and looking at GT
- Unexpected error while connecting to MySQL and looking at gt
- Error reading MySQL variables:
- Unexpected error while connecting to MySQL and looking at gt
- Unexpected error while connecting to MySQL and looking at pr
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/b3e450a95e78b44d.
Report an issue: GitHub.