{"record":{"id":"997179244c3a12dc","repo":"apache/seatunnel","slug":"mysql-cdc-diagnostic-failed","errorCode":null,"errorMessage":"MySQL-CDC diagnostic: {} failed: {}","messagePattern":"MySQL-CDC diagnostic: (.+?) failed: (.+?)","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":596,"sourceCode":"                        row.add(\"io_running=\" + ioRunning);\n                        row.add(\"sql_running=\" + sqlRunning);\n                        row.add(\"relay_master_log_file=\" + relayMasterLogFile);\n                        row.add(\"exec_master_log_pos=\" + execMasterLogPos);\n                        if (retrievedGtidSet != null) {\n                            row.add(\"retrieved_gtid_set=\" + retrievedGtidSet);\n                        }\n                        if (executedGtidSet != null) {\n                            row.add(\"executed_gtid_set=\" + executedGtidSet);\n                        }\n                    });\n            if (row.isEmpty()) {\n                LOG.warn(\"MySQL-CDC diagnostic: {} status empty/unsupported\", label);\n                return true;\n            }\n            LOG.warn(\"MySQL-CDC diagnostic: {} status {}\", label, String.join(\", \", row));\n            return true;\n        } catch (SQLException e) {\n            LOG.warn(\"MySQL-CDC diagnostic: {} failed: {}\", sql, e.getMessage());\n            return false;\n        }\n    }\n\n    private void logBinlogRangeAnalysis(\n            String requiredBinlogFilename, List<String> availableBinlogFiles) {\n        BinlogFileNumber required = parseBinlogFileNumber(requiredBinlogFilename);\n        if (required == null) {\n            return;\n        }\n\n        long min = Long.MAX_VALUE;\n        long max = Long.MIN_VALUE;\n        boolean any = false;\n        for (String file : availableBinlogFiles) {\n            BinlogFileNumber parsed = parseBinlogFileNumber(file);\n            if (parsed == null || !required.prefix.equals(parsed.prefix)) {\n                continue;","sourceCodeStart":578,"sourceCodeEnd":614,"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#L578-L614","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Grant the CDC user the required privileges: GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'user'@'%'.","Check the logged exception message for the root cause (access denied vs connection error) and address accordingly.","Verify connectivity/stability to the MySQL server (timeouts, proxy idle disconnects).","If the server variant genuinely doesn't support the statement, accept the degraded diagnostics or upgrade the connector."],"exampleFix":"// before: CDC user without privileges\nCREATE USER 'st'@'%' IDENTIFIED BY '***';\n// after\nCREATE USER 'st'@'%' IDENTIFIED BY '***';\nGRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'st'@'%';","handlingStrategy":"try-catch","validationCode":"// verify the CDC user can run status statements\nmysql -u st -p -e 'SHOW SLAVE STATUS; SHOW MASTER STATUS;'","typeGuard":null,"tryCatchPattern":"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 }","preventionTips":["Grant REPLICATION SLAVE and REPLICATION CLIENT to the CDC user.","Check managed-service (RDS/Aurora) restrictions on SHOW statements.","Keep connections alive to avoid mid-query disconnects (idle timeouts).","Read the logged SQL + message to classify privilege vs connectivity failure."],"tags":["mysql","cdc","sql","diagnostics","permissions"],"backgroundTag":"sql-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}