apache/seatunnel · warning

MySQL-CDC diagnostic: {} failed: {}

Error message

MySQL-CDC diagnostic: {} failed: {}

What it means

This WARN logs that the connector's replication-status diagnostic SQL statement threw a SQLException; the message includes the failing SQL text and the exception's getMessage(). The connector treats diagnostics as best-effort: it logs the failure and returns false instead of propagating the exception, so the CDC task keeps running.

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:596

                        row.add("io_running=" + ioRunning);
                        row.add("sql_running=" + sqlRunning);
                        row.add("relay_master_log_file=" + relayMasterLogFile);
                        row.add("exec_master_log_pos=" + execMasterLogPos);
                        if (retrievedGtidSet != null) {
                            row.add("retrieved_gtid_set=" + retrievedGtidSet);
                        }
                        if (executedGtidSet != null) {
                            row.add("executed_gtid_set=" + executedGtidSet);
                        }
                    });
            if (row.isEmpty()) {
                LOG.warn("MySQL-CDC diagnostic: {} status empty/unsupported", label);
                return true;
            }
            LOG.warn("MySQL-CDC diagnostic: {} status {}", label, String.join(", ", row));
            return true;
        } catch (SQLException e) {
            LOG.warn("MySQL-CDC diagnostic: {} failed: {}", sql, e.getMessage());
            return false;
        }
    }

    private void logBinlogRangeAnalysis(
            String requiredBinlogFilename, List<String> availableBinlogFiles) {
        BinlogFileNumber required = parseBinlogFileNumber(requiredBinlogFilename);
        if (required == null) {
            return;
        }

        long min = Long.MAX_VALUE;
        long max = Long.MIN_VALUE;
        boolean any = false;
        for (String file : availableBinlogFiles) {
            BinlogFileNumber parsed = parseBinlogFileNumber(file);
            if (parsed == null || !required.prefix.equals(parsed.prefix)) {
                continue;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Grant the CDC user the required privileges: GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'user'@'%'.
  2. Check the logged exception message for the root cause (access denied vs connection error) and address accordingly.
  3. Verify connectivity/stability to the MySQL server (timeouts, proxy idle disconnects).
  4. If the server variant genuinely doesn't support the statement, accept the degraded diagnostics or upgrade the connector.

Example fix

// before: CDC user without privileges
CREATE USER 'st'@'%' IDENTIFIED BY '***';
// after
CREATE USER 'st'@'%' IDENTIFIED BY '***';
GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'st'@'%';
Defensive patterns

Strategy: try-catch

Validate before calling

// verify the CDC user can run status statements
mysql -u st -p -e 'SHOW SLAVE STATUS; SHOW MASTER STATUS;'

Try / catch

try (Statement s = conn.createStatement(); ResultSet rs = s.executeQuery("SHOW SLAVE STATUS")) { ... } catch (SQLException e) { LOG.warn("status query failed: {}", e.getMessage()); // degrade gracefully, do not fail the task }

Prevention

When it happens

Trigger: During logMySqlReplicationStatus, logReplicationStatus executes a status statement (SHOW SLAVE/REPLICA STATUS, SHOW MASTER STATUS) and the driver throws — e.g. insufficient privileges for the statement, connection dropped mid-query, or the statement being rejected by the server variant.

Common situations: CDC user lacking REPLICATION CLIENT/SLAVE privileges needed for status statements; firewall/proxy terminating idle connections; running diagnostics against managed services (RDS, Aurora) that restrict some SHOW statements.

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/997179244c3a12dc. Report an issue: GitHub.