apache/seatunnel · info

MySQL-CDC diagnostic: variable {} not found

Error message

MySQL-CDC diagnostic: variable {} not found

What it means

Diagnostic WARN from logMySqlVariable: a SHOW VARIABLES LIKE '<name>' query for a specific MySQL variable (used by logMySqlBinlogRetentionVariables, e.g. binlog_expire_logs_seconds or expire_logs_days) returned no rows, meaning the variable does not exist on this server version. This indicates the retention analysis cannot be based on that variable.

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

                    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 -> {
                        if (!rs.next()) {
                            LOG.warn("MySQL-CDC diagnostic: variable {} not found", variableName);
                            return;
                        }
                        LOG.warn(
                                "MySQL-CDC diagnostic: variable {}={}",
                                rs.getString(1),
                                rs.getString(2));
                    });
        } catch (SQLException e) {
            LOG.warn(
                    "MySQL-CDC diagnostic: failed to query variable {}: {}",
                    variableName,
                    e.getMessage());
        }
    }

    private void logMySqlMasterStatus() {
        try {
            connection.query(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify which retention variable your MySQL version supports (binlog_expire_logs_seconds for 8.0, expire_logs_days for 5.7) and read it manually
  2. Upgrade SeaTunnel/Debezium connector version if it needs to cover the other variable name
  3. Treat the warning as benign if the counterpart variable was found
Defensive patterns

Strategy: fallback

Validate before calling

SELECT @@version; -- 8.0+: binlog_expire_logs_seconds, 5.7: expire_logs_days
SHOW VARIABLES LIKE 'binlog_expire%';
SHOW VARIABLES LIKE 'expire_logs_days';

Try / catch

try (ResultSet rs = stmt.executeQuery("SHOW VARIABLES LIKE 'binlog_expire_logs_seconds'")) {
    if (!rs.next()) {
        // fallback for MySQL 5.7
        query("SHOW VARIABLES LIKE 'expire_logs_days'");
    }
}

Prevention

When it happens

Trigger: logMySqlBinlogRetentionVariables calls logMySqlVariable for a retention variable and rs.next() is false — typically because the MySQL version names the variable differently (binlog_expire_logs_seconds on 8.0 vs expire_logs_days on 5.7) or the variable was removed.

Common situations: Mixed MySQL 5.7/8.0 environments; Percona/MariaDB variants lacking a variable; checking both names and seeing one 'not found' warning per missing name.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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