{"record":{"id":"91282ce8f9b7050e","repo":"MyCATApache/Mycat-Server","slug":"can-t-suport-district-table-tablename-schema","errorCode":null,"errorMessage":"can't suport district table  ${tableName} schema:${schema.getName()} for global table ","messagePattern":"can't suport district table  (.+?) schema:(.+?) for global table ","errorType":"exception","errorClass":"java.sql.SQLNonTransientException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/route/util/RouterUtil.java","lineNumber":1442,"sourceCode":"\r\n\r\n        String tableName = null;\r\n        if (entry != null) {\r\n            tableName = entry.getKey().toUpperCase();\r\n        } else {\r\n            List<String> tables = rrs.getTables();\r\n            tableName = tables.get(0);\r\n        }\r\n        TableConfig tableConfig = schema.getTables().get(tableName);\r\n        if(tableConfig == null) {\r\n            String msg = \"can't find table define in schema \" + tableName + \" schema:\" + schema.getName();\r\n            LOGGER.warn(msg);\r\n            throw new SQLNonTransientException(msg);\r\n        }\r\n        if(tableConfig.isGlobalTable()){\r\n            String msg = \"can't suport district table  \" + tableName + \" schema:\" + schema.getName() + \" for global table \";\r\n            LOGGER.warn(msg);\r\n            throw new SQLNonTransientException(msg);\r\n        }\r\n        String partionCol = tableConfig.getPartitionColumn();\r\n    //  String primaryKey = tableConfig.getPrimaryKey();\r\n        //boolean isLoadData=false;\r\n    \r\n        Set<String> tablesRouteSet = new HashSet<String>();\r\n    \r\n        List<String> dataNodes = tableConfig.getDataNodes();\r\n        if(dataNodes.size()>1){\r\n            String msg = \"can't suport district table  \" + tableName + \" schema:\" + schema.getName() + \" for mutiple dataNode \" + dataNodes;\r\n            LOGGER.warn(msg);\r\n            throw new SQLNonTransientException(msg);\r\n        }\r\n        String dataNode = dataNodes.get(0);\r\n    \r\n        RouteResultsetNode[] nodes = null;\r\n        //主键查找缓存暂时不实现\r\n        if(tablesAndConditions.isEmpty()){\r","sourceCodeStart":1424,"sourceCodeEnd":1460,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/util/RouterUtil.java#L1424-L1460","documentation":"Thrown when the table being routed as a district (dist) table is actually configured as a global table. Global tables have their own replication routing and cannot be routed with the dist-table mechanism.","triggerScenarios":"routeToDistTableNode is invoked for a table whose TableConfig.isGlobalTable() returns true — i.e. schema.xml marks it with type=\"global\" while dist-table routing is attempted.","commonSituations":"schema.xml misconfiguration where a table has both global type semantics and dist table usage; developer refactoring a global table into dist tables without removing type=\"global\"; SQL path that unexpectedly reaches dist routing for global tables.","solutions":["Remove type=\"global\" from the table definition in schema.xml if it should be a dist table, or stop using dist-table routing for it","Keep global tables out of dist-table routing paths (configure them as normal global tables with dataNodes only)","Reload Mycat config after fixing schema.xml"],"exampleFix":"// before (schema.xml)\n<table name=\"dict\" type=\"global\" dataNode=\"dn1,dn2\"/>\n// after (as dist table)\n<table name=\"dict\" dataNode=\"dn1\" distTables=\"dict_$0-9\"/>","handlingStrategy":"validation","validationCode":"TableConfig tc = schema.getTables().get(tableName.toUpperCase());\nif (tc != null && tc.isGlobalTable()) throw new IllegalArgumentException(\"global table cannot use dist routing: \" + tableName);","typeGuard":"if (tc != null && tc.isGlobalTable()) { /* skip dist-table path */ }","tryCatchPattern":"try { rrs = route(...); } catch (SQLNonTransientException e) { if (e.getMessage().contains(\"global table\")) { LOG.warn(\"remove type=global or use dist routing, not both\"); } throw e; }","preventionTips":["Decide per table: global OR dist, never both","Review schema.xml after migrations between table types","Document table types to avoid conflicting attributes"],"tags":["config","dist-table","global-table"],"backgroundTag":"unsupported-operation","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}