{"record":{"id":"37421931d3ae8557","repo":"MyCATApache/Mycat-Server","slug":"e","errorCode":null,"errorMessage":"${e}","messagePattern":"\\$\\{e\\}","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"src/main/java/io/mycat/migrate/BinlogStream.java","lineNumber":193,"sourceCode":"\n        private final Map<Long, TableMapEventData> tablesById = new HashMap<Long, TableMapEventData>();\n        private final Map<String, Map<Integer, Map<String, Object>>> tablesColumnMap = new HashMap<>();\n\n        private boolean transactionInProgress;\n        private String binlogFilename;\n\n\n        //当发现ddl语句时 需要更新重新取列名\n        private Map<Integer, Map<String, Object>> loadColumn(String database, String table) {\n            Map<Integer, Map<String, Object>> rtn = new HashMap<>();\n            List<Map<String, Object>> list = null;\n            Connection con = null;\n            try {\n                con = DriverManager.getConnection(\"jdbc:mysql://\" + hostname + \":\" + port, username, password);\n                list = executeQuery(con, \"select  COLUMN_NAME, ORDINAL_POSITION, DATA_TYPE, CHARACTER_SET_NAME from INFORMATION_SCHEMA.COLUMNS where table_name='\" + table + \"' and TABLE_SCHEMA='\" + database + \"'\");\n\n            } catch (SQLException e) {\n                throw new RuntimeException(e);\n            } finally {\n                JdbcUtils.close(con);\n            }\n            for (Map<String, Object> stringObjectMap : list) {\n                BigInteger pos = (BigInteger) stringObjectMap.get(\"ORDINAL_POSITION\");\n                rtn.put(pos.intValue(), stringObjectMap);\n            }\n            return rtn;\n        }\n\n        @Override\n        public void onEvent(Event event) {\n            logger.debug(\"----->migrate binlog event:\" + event.toString());\n            EventType eventType = event.getHeader().getEventType();\n            switch (eventType) {\n                case TABLE_MAP:\n                    TableMapEventData tableMapEventData = event.getData();\n                    tablesById.put(tableMapEventData.getTableId(), tableMapEventData);","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/migrate/BinlogStream.java#L175-L211","documentation":"loadColumn queries INFORMATION_SCHEMA.COLUMNS to map a table's column ordinals during migration. Any SQLException (connection failure, bad credentials, missing table/schema, SQL syntax) is wrapped in a RuntimeException, so the original JDBC error surfaces as an opaque '${e}' message. It aborts binlog replay because column metadata is mandatory.","triggerScenarios":"DriverManager.getConnection to jdbc:mysql://hostname:port fails; the table or database name is wrong so INFORMATION_SCHEMA returns nothing useful; MySQL rejects the query due to privileges or connectivity loss mid-migration.","commonSituations":"Wrong MySQL host/port/credentials in migration config; the migrated table was dropped or renamed; network/firewall blocks the data node; user lacks privileges on INFORMATION_SCHEMA for that schema.","solutions":["Verify the MySQL host, port, username and password used by the migration task are correct and the server is reachable (mysql -h ... -P ...).","Confirm the table and database names in the migration task exist on the source node.","Grant the migration user SELECT on INFORMATION_SCHEMA and the target schema.","Unwrap the cause ('Caused by' in the stack trace) to see the actual SQLException and fix accordingly."],"exampleFix":"// before\nlist = executeQuery(con, \"select COLUMN_NAME ... where table_name='\" + table + \"' and TABLE_SCHEMA='\" + database + \"'\");\n// after\n// use parameter binding / verify identifiers first\nif (!tableExists(con, database, table)) {\n    throw new IllegalStateException(\"Table \" + database + \".\" + table + \" not found on source node\");\n}","handlingStrategy":"try-catch","validationCode":"// before migration\ntry (Connection c = DriverManager.getConnection(url, user, pass)) {\n    ResultSet rs = c.createStatement().executeQuery(\n        \"SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='\" + table + \"' AND TABLE_SCHEMA='\" + db + \"'\");\n    rs.next();\n    if (rs.getInt(1) == 0) throw new IllegalStateException(\"table/columns missing on source\");\n}","typeGuard":null,"tryCatchPattern":"try { migrationStep(); } catch (RuntimeException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof SQLException) { /* reconnect / fix creds / retry */ }\n    throw e;\n}","preventionTips":["Pre-validate JDBC connectivity and credentials before starting migration","Confirm the table exists in the source schema before binlog replay","Grant the migration account SELECT on INFORMATION_SCHEMA","Always log e.getCause() to see the real SQLException"],"tags":["jdbc","mysql","migration","sql-exception"],"backgroundTag":"database-query-failed","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}