apache/seatunnel · warning

MySQL-CDC diagnostic: required binlog sequence {}{} is older

Error message

MySQL-CDC diagnostic: required binlog sequence {}{} is older than the earliest available {}{}; likely purged/expired binlog on server

What it means

Diagnostic WARN emitted when the required binlog sequence number is LOWER than the earliest binlog file currently present on the server — meaning the needed file no longer exists because it was purged (binlog retention expired) or the binlogs were cleared. The connector cannot resume from the saved offset, and the job will fail with 'binlog not available'.

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

        boolean any = false;
        for (String file : availableBinlogFiles) {
            BinlogFileNumber parsed = parseBinlogFileNumber(file);
            if (parsed == null || !required.prefix.equals(parsed.prefix)) {
                continue;
            }
            any = true;
            min = Math.min(min, parsed.number);
            max = Math.max(max, parsed.number);
        }
        if (!any) {
            LOG.warn(
                    "MySQL-CDC diagnostic: cannot compare binlog sequence because available binlog filenames don't match required prefix '{}'",
                    required.prefix);
            return;
        }

        if (required.number < min) {
            LOG.warn(
                    "MySQL-CDC diagnostic: required binlog sequence {}{} is older than the earliest available {}{}; likely purged/expired binlog on server",
                    required.prefix,
                    required.number,
                    required.prefix,
                    min);
        } else if (required.number > max) {
            LOG.warn(
                    "MySQL-CDC diagnostic: required binlog sequence {}{} is newer than the latest available {}{}; possible connection to an out-of-date replica, proxy routing to different instance, or RESET MASTER",
                    required.prefix,
                    required.number,
                    required.prefix,
                    max);
        } else {
            LOG.warn(
                    "MySQL-CDC diagnostic: required binlog sequence {}{} is within available range {}{}..{}{} but missing; possible manual binlog deletion, binlog.index corruption, or connecting to a different MySQL instance intermittently",
                    required.prefix,
                    required.number,
                    required.prefix,

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Increase retention: SET GLOBAL binlog_expire_logs_seconds=604800 (7 days) or the equivalent expire_logs_days, and keep it longer than worst-case downtime.
  2. Restart the SeaTunnel CDC job from a fresh snapshot (reset the offset/state) since the required position is unrecoverable.
  3. Restore the purged binlog files from backup if continuity from the exact offset is mandatory.
  4. Set up monitoring to alert when job lag approaches the binlog retention window.

Example fix

// before: binlogs expire after 1 day
binlog_expire_logs_seconds = 86400
// after: retain 7 days, exceeding max downtime
binlog_expire_logs_seconds = 604800
Defensive patterns

Strategy: validation

Validate before calling

-- required file must be >= earliest available
SHOW BINARY LOGS; -- compare earliest file to the offset's binlog filename
SHOW VARIABLES LIKE 'binlog_expire_logs_seconds';

Prevention

When it happens

Trigger: logBinlogRangeAnalysis (via logBinlogNotAvailableDiagnostics) compares the required file (e.g. mysql-bin.000042) with SHOW BINARY LOGS results and required.number < min of available sequences (earliest available is mysql-bin.000100).

Common situations: binlog_expire_logs_seconds / expire_logs_days too short for job downtime; long outages or paused pipelines while the server purges binlogs; manual PURGE BINARY LOGS; replica promoted after master purged old files.

Related errors


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