{"record":{"id":"73537e6003150e9e","repo":"MyCATApache/Mycat-Server","slug":"can-t-suport-district-table-tablename-schema-73537e","errorCode":null,"errorMessage":"can't suport district table  ${tableName} schema:${schema.getName()} for mutiple dataNode ${dataNodes}","messagePattern":"can't suport district table  (.+?) schema:(.+?) for mutiple dataNode (.+?)","errorType":"exception","errorClass":"java.sql.SQLNonTransientException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/route/util/RouterUtil.java","lineNumber":1454,"sourceCode":"            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\n            List<String> subTables = tableConfig.getDistTables();\r\n            tablesRouteSet.addAll(subTables);\r\n    \r\n            nodes = getNode(rrs, orgSql, tablesRouteSet, dataNode, false, tableName);\r\n        } else {\r\n            if (entry == null) {\r\n                for(Map.Entry<String, Map<String, Set<ColumnRoutePair>>> entry1 : tablesAndConditions.entrySet()) {\r\n                    //boolean isFoundPartitionValue = partionCol != null && entry.getValue().get(partionCol) != null;\r\n                    setNodes(rrs, tableConfig, partionCol, tablesRouteSet, entry1);\r\n                }\r\n            } else {\r\n                setNodes(rrs, tableConfig, partionCol, tablesRouteSet, entry);\r","sourceCodeStart":1436,"sourceCodeEnd":1472,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/util/RouterUtil.java#L1436-L1472","documentation":"Thrown when a district (dist) table is configured with more than one dataNode; dist-table routing requires the table to live on exactly one datanode because individual dist sub-tables are addressed by the sharding algorithm instead.","triggerScenarios":"routeToDistTableNode on a TableConfig whose getDataNodes().size() > 1 — i.e. schema.xml lists multiple dataNode entries for a dist table.","commonSituations":"Copy-pasted multi-node dataNode attribute on a dist table; misunderstanding that dist tables shard by sub-table name, not by datanode list; migration from a normal sharded table to dist tables without trimming dataNodes.","solutions":["Set the dist table's dataNode in schema.xml to exactly one datanode","Distribute sub-tables via the distTables naming pattern and the sharding algorithm's calculate() index instead of multiple dataNodes","Reload configuration after the change"],"exampleFix":"// before (schema.xml)\n<table name=\"log\" dataNode=\"dn1,dn2\" distTables=\"log_$0-9\"/>\n// after\n<table name=\"log\" dataNode=\"dn1\" distTables=\"log_$0-9\"/>","handlingStrategy":"validation","validationCode":"TableConfig tc = schema.getTables().get(tableName.toUpperCase());\nif (tc != null && tc.getDataNodes().size() > 1) throw new IllegalArgumentException(\"dist table must have one dataNode: \" + tableName);","typeGuard":null,"tryCatchPattern":"try { rrs = route(...); } catch (SQLNonTransientException e) { if (e.getMessage().contains(\"mutiple dataNode\")) { LOG.warn(\"dist table dataNode must be single: \" + e.getMessage()); } throw e; }","preventionTips":["Configure dist tables with exactly one dataNode","Scale via distTables naming pattern, not extra dataNodes","Add schema.xml lint checks for dist-table definitions"],"tags":["config","dist-table","sharding"],"backgroundTag":"invalid-config-value","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"}