MyCATApache/Mycat-Server · error · SQLNonTransientException
can't suport district table + tableName + schema: +…
Error message
can't suport district table + tableName + schema: + schema.getName() + for global table
What it means
When routing a district (dist) table, RouterUtil checks tableConfig.isGlobalTable() and refuses the operation: global tables are replicated to all nodes and have no district partitioning, so a district-table route is meaningless. It throws SQLNonTransientException naming the table and schema.
Solutions
- Remove type="global" from the table in schema.xml if it should be district/sharded, then reload
- Keep the table global and route via normal global-table logic instead of routeToDistTable
- Update application SQL/ORM so global tables are not passed through the dist-table routing path
Example fix
// before (schema.xml) <table name="dict" type="global" dataNode="dn1,dn2"/> // routed as district table // after <table name="dict" dataNode="dn1,dn2" rule="mod-rule"/> // non-global, or use normal route
Defensive patterns
Strategy: validation
Validate before calling
// verify the table is not global before district routing
// (via MyCat management port)
// mysql -uuser -p -P9066 -> show @@schema; / inspect schema.xml
boolean isGlobal = schemaXmlTableEntry(tableName).attr("type").equals("global");
if (isGlobal) throw new IllegalStateException("Use normal routing for global table " + tableName); Try / catch
try {
execute(sql);
} catch (SQLNonTransientException e) {
if (e.getMessage().contains("can't suport district table"))
throw new IllegalStateException("Global table cannot use district routing: " + e.getMessage(), e);
throw e;
} Prevention
- Keep global tables out of district-table routing paths in application code
- Review schema.xml type attributes when converting tables between global/sharded/dist
When it happens
Trigger: Invoking the district-table routing method (routeToDistTable) on a table declared with type="global" in schema.xml — e.g. a JOIN or query path that treats the global table as a dist table.
Common situations: Table recently changed from global to sharded (or vice versa) in schema.xml; JOIN routing logic misidentifies a global table as a district table; developer copied a dist-table route call for a replicated lookup table.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- can't suport district table + tableName + schema: +…
- schema: ,table: ,sql: is not allowed,because table is…
- can't find hint datanode
- can't find hint schema
- Multi statements is not supported,use single statement…
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/3dc1770e1ef70d28.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/route/util/RouterUtil.java:1441
LayerCachePool cachePool, boolean isSelect, Map.Entry<String, Map<String, Set<ColumnRoutePair>>> entry) throws SQLNonTransientException {
String tableName = null;
if (entry != null) {
tableName = entry.getKey().toUpperCase();
} else {
List<String> tables = rrs.getTables();
tableName = tables.get(0);
}
TableConfig tableConfig = schema.getTables().get(tableName);
if(tableConfig == null) {
String msg = "can't find table define in schema " + tableName + " schema:" + schema.getName();
LOGGER.warn(msg);
throw new SQLNonTransientException(msg);
}
if(tableConfig.isGlobalTable()){
String msg = "can't suport district table " + tableName + " schema:" + schema.getName() + " for global table ";
LOGGER.warn(msg);
throw new SQLNonTransientException(msg);
}
String partionCol = tableConfig.getPartitionColumn();
// String primaryKey = tableConfig.getPrimaryKey();
//boolean isLoadData=false;
Set<String> tablesRouteSet = new HashSet<String>();
List<String> dataNodes = tableConfig.getDataNodes();
if(dataNodes.size()>1){
String msg = "can't suport district table " + tableName + " schema:" + schema.getName() + " for mutiple dataNode " + dataNodes;
LOGGER.warn(msg);
throw new SQLNonTransientException(msg);
}
String dataNode = dataNodes.get(0);
RouteResultsetNode[] nodes = null;
//主键查找缓存暂时不实现
View on GitHub (pinned to 65f8d8beb7)