{"record":{"id":"11454c1af9c7ce08","repo":"MyCATApache/Mycat-Server","slug":"can-not-find-the-data-node-with-name-datanode","errorCode":null,"errorMessage":"can not find the data node with name:{dataNode}","messagePattern":"can not find the data node with name:(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/route/sequence/handler/SequenceVal.java","lineNumber":231,"sourceCode":"\t\t\t\t\t\tcon.close();\n\t\t\t\t\t\tpstmt.close();\n\t\t\t\t\t\trs.close();\n\t\t\t\t\t} catch (SQLException e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tLOGGER.error(\"get sequence:\" + this.seqName + \" value failure, please check the sequence config\");\n\t\tthis.fetching.compareAndSet(true, false);\n\t\treturn null;\n\t}\n\n\tprivate DataHostConfig getDBHostConfig() {\n\t\tMycatConfig conf = MycatServer.getInstance().getConfig();\n\t\tPhysicalDBNode mysqlDN = conf.getDataNodes().get(this.dataNode);\n\t\tif (mysqlDN == null) {\n\t\t\tthrow new RuntimeException(\"can not find the data node with name:\" + this.dataNode);\n\t\t}\n\t\tPhysicalDatasource physicalDatasource = mysqlDN.getDbPool().getSource();\n\t\treturn physicalDatasource.getHostConfig();\n\t}\n\n\tpublic void sleep(long time) {\n\t\ttry {\n\t\t\tThread.sleep(time);\n\t\t} catch (InterruptedException e) {\n\t\t\tIncrSequenceMySQLHandler.LOGGER\n\t\t\t\t\t.warn(\"wait db fetch sequnce err \" + e);\n\t\t}\n\t}\n\t//是否成功返回。\n\tpublic boolean isSuccessFetched() {\n\t\treturn successFetched;\n\t}\n\t//下一个可用的id","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/sequence/handler/SequenceVal.java#L213-L249","documentation":"Before fetching, SequenceVal resolves the data host config for the sequence's dataNode from MycatConfig. If conf.getDataNodes() has no entry for this.dataNode, it throws a RuntimeException naming the missing data node. This is a configuration-resolution failure, not a runtime DB failure.","triggerScenarios":"SequenceVal constructed with a dataNode name that is not declared in schema.xml's <dataNode> definitions (typo, dataNode removed, config not reloaded).","commonSituations":"Sequence configured under a table whose dataNode was renamed; stale Mycat config after editing schema.xml without restart/reload.","solutions":["Verify the dataNode name in the sequence/table config matches a <dataNode name=\"...\"> entry in schema.xml.","Fix the typo or add the missing dataNode definition, then restart/reload Mycat.","Check that the config Mycat loaded at runtime is the file you edited (correct conf directory)."],"exampleFix":"// before (schema.xml)\n<table name=\"t\" dataNode=\"dnX\"/> <!-- dnX not defined -->\n// after\n<dataNode name=\"dn1\" dataHost=\"host1\" database=\"db1\"/>\n<table name=\"t\" dataNode=\"dn1\"/>","handlingStrategy":"validation","validationCode":"if (!MycatServer.getInstance().getConfig().getDataNodes().containsKey(dataNode)) {\n    throw new IllegalArgumentException(\"dataNode not defined: \" + dataNode);\n}","typeGuard":null,"tryCatchPattern":"try { seqVal.fetchSequenceFromDB(); } catch (RuntimeException e) { log.error(\"missing dataNode for sequence\", e); }","preventionTips":["Validate that table/sequence dataNodes exist in schema.xml at startup","Reload config consistently after renames","Keep sequence dataNode references generated from the same config source"],"tags":["java","mycat","config","datanode","not-found"],"backgroundTag":"resource-not-found","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"}