{"record":{"id":"f44adb85042b8585","repo":"apache/seatunnel","slug":"mysql-cdc-diagnostic-required-binlog-sequence","errorCode":null,"errorMessage":"MySQL-CDC diagnostic: required binlog sequence {}{} is older than the earliest available {}{}; likely purged/expired binlog on server","messagePattern":"MySQL-CDC diagnostic: required binlog sequence (.+?)(.+?) is older than the earliest available (.+?)(.+?); likely purged/expired binlog on server","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/reader/fetch/MySqlSourceFetchTaskContext.java","lineNumber":628,"sourceCode":"        boolean any = false;\n        for (String file : availableBinlogFiles) {\n            BinlogFileNumber parsed = parseBinlogFileNumber(file);\n            if (parsed == null || !required.prefix.equals(parsed.prefix)) {\n                continue;\n            }\n            any = true;\n            min = Math.min(min, parsed.number);\n            max = Math.max(max, parsed.number);\n        }\n        if (!any) {\n            LOG.warn(\n                    \"MySQL-CDC diagnostic: cannot compare binlog sequence because available binlog filenames don't match required prefix '{}'\",\n                    required.prefix);\n            return;\n        }\n\n        if (required.number < min) {\n            LOG.warn(\n                    \"MySQL-CDC diagnostic: required binlog sequence {}{} is older than the earliest available {}{}; likely purged/expired binlog on server\",\n                    required.prefix,\n                    required.number,\n                    required.prefix,\n                    min);\n        } else if (required.number > max) {\n            LOG.warn(\n                    \"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\",\n                    required.prefix,\n                    required.number,\n                    required.prefix,\n                    max);\n        } else {\n            LOG.warn(\n                    \"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\",\n                    required.prefix,\n                    required.number,\n                    required.prefix,","sourceCodeStart":610,"sourceCodeEnd":646,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/reader/fetch/MySqlSourceFetchTaskContext.java#L610-L646","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","solutions":["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.","Restart the SeaTunnel CDC job from a fresh snapshot (reset the offset/state) since the required position is unrecoverable.","Restore the purged binlog files from backup if continuity from the exact offset is mandatory.","Set up monitoring to alert when job lag approaches the binlog retention window."],"exampleFix":"// before: binlogs expire after 1 day\nbinlog_expire_logs_seconds = 86400\n// after: retain 7 days, exceeding max downtime\nbinlog_expire_logs_seconds = 604800","handlingStrategy":"validation","validationCode":"-- required file must be >= earliest available\nSHOW BINARY LOGS; -- compare earliest file to the offset's binlog filename\nSHOW VARIABLES LIKE 'binlog_expire_logs_seconds';","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set binlog retention well beyond max planned downtime (e.g. 7 days).","Alert on CDC lag approaching retention limits.","Avoid ad-hoc PURGE BINARY LOGS while CDC jobs run.","Restart from snapshot when retention loss is confirmed — old offsets are unrecoverable."],"tags":["mysql","cdc","binlog","retention","diagnostics"],"backgroundTag":"binlog-purged","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}