apache/seatunnel · warning

MySQL-CDC diagnostic: cannot compare binlog sequence…

Error message

MySQL-CDC diagnostic: cannot compare binlog sequence because available binlog filenames don't match required prefix '{}'

What it means

Part of the binlog-not-available diagnostics: the connector parsed available binlog filenames from SHOW BINARY LOGS, but none of them matched the prefix of the required binlog file (e.g. required 'mysql-bin.000123' while server files are named 'binlog.000001'). Without a shared prefix, sequence comparison is impossible, so the connector reports it cannot determine whether the required file is older/newer than what the server has.

Solutions

  1. Verify the job is connecting to the same MySQL instance that produced the required offset (check host, port, and proxy/replica routing).
  2. Check the server's log_bin_basename in my.cnf — if the prefix changed, the required offsets are no longer interpretable; restart the CDC job from snapshot or a valid position.
  3. Compare output of SHOW BINARY LOGS against the required filename manually.
  4. If a proxy/load balancer is in front of MySQL, pin the connection to a single node.

Example fix

// before: my.cnf prefix changed
log-bin = new-bin
// after: keep the original basename so old offsets remain valid
log-bin = mysql-bin
Defensive patterns

Strategy: validation

Validate before calling

SHOW BINARY LOGS; -- verify filename prefixes match the offset's binlog file, e.g. mysql-bin.%d

Prevention

When it happens

Trigger: logBinlogRangeAnalysis is invoked from logBinlogNotAvailableDiagnostics after a required binlog file is missing; every available filename fails to parse against required.prefix (log-bin basename changed, or server is a different instance with different naming).

Common situations: log-bin basename renamed in my.cnf and server restarted; connecting to a replica/proxy with different binlog naming than the original master; RESET MASTER wiping and regenerating files with a new prefix; switching between MySQL and MariaDB (mysql-bin vs mariadb-bin).

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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

Appendix: 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:621

        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;
            }
            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,

View on GitHub (pinned to cf67b549a7)