MyCATApache/Mycat-Server · error · ConfigException
newSchema: is not exists!
Error message
newSchema:{schemaName} is not exists! What it means
loadMigratorTables also validates the schema name against the NEW schema configuration (schema.xml after migration). If the schema exists in the old config but not in the new one, a ConfigException is thrown. Migration requires the schema to exist in both configurations so tables can be compared and moved.
Solutions
- Add the missing schema definition to the new schema.xml (with its tables and data nodes).
- Or update tablesFile.properties to use the schema's new name as defined in the new schema.xml.
- Confirm both schema.xml versions define the same schema names before rerunning the migrator.
Example fix
// before: new schema.xml lacks the schema <schema name="ordersdb" ...> <!-- missing --> // after <schema name="ordersdb" checkSQLschema="false" dataNode="dn1"> ... </schema>
Defensive patterns
Strategy: validation
Validate before calling
Set<String> newSchemaNames = newSchemas.keySet().stream()
.map(String::toLowerCase).collect(Collectors.toSet());
for (String schema : prop.stringPropertyNames()) {
if (!newSchemaNames.contains(schema.toLowerCase().trim())) {
throw new IllegalArgumentException("schema missing from NEW config: " + schema);
}
} Try / catch
try {
comparer.compare();
} catch (ConfigException e) {
if (e.getMessage().startsWith("newSchema:")) {
// add the schema to new schema.xml or rename the entry in tablesFile.properties
}
throw e;
} Prevention
- Diff old vs new schema.xml schema names before every migration
- Never drop a schema from the new config while it still has rows to migrate
- Automate a pre-flight check comparing schema sets in both configs
When it happens
Trigger: tablesFile.properties lists a schema present in the old schema.xml but missing from the new schema.xml — typically the schema was dropped or renamed in the target configuration.
Common situations: Operator removed the schema from the new schema.xml while planning data redistribution; renamed schema during migration but forgot to update tablesFile.properties; typo when writing the new schema.xml.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- oldSchema: is not exists!
- tablesFile.properties read fail!
- new & old table config is not equal!
- please check tableFile.properties,make sure
- : old & new partition column is not same!
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/cab0c92be6ef4e8a.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/util/dataMigrator/ConfigComparer.java:136
}
private String[] getTables(String tables){
if(tables.equalsIgnoreCase("all") || tables.isEmpty()){
return new String[]{};
}else{
return tables.split(",");
}
}
/*
* 加载迁移表信息,tables大小为0表示迁移schema下所有表
*/
private void loadMigratorTables(String schemaName,String[] tables){
if(!DataMigratorUtil.isKeyExistIgnoreCase(oldSchemas, schemaName)){
throw new ConfigException("oldSchema:"+schemaName+" is not exists!");
}
if(!DataMigratorUtil.isKeyExistIgnoreCase(newSchemas,schemaName)){
throw new ConfigException("newSchema:"+schemaName+" is not exists!");
}
Map<String, TableConfig> oldTables = DataMigratorUtil.getValueIgnoreCase(oldSchemas, schemaName).getTables();
Map<String, TableConfig> newTables = DataMigratorUtil.getValueIgnoreCase(newSchemas, schemaName).getTables();
if(tables.length>0){
//指定schema下的表进行迁移
for(int i =0;i<tables.length;i++){
TableConfig oldTable = DataMigratorUtil.getValueIgnoreCase(oldTables,tables[i]);
TableConfig newTable = DataMigratorUtil.getValueIgnoreCase(newTables,tables[i]);
loadMigratorTable(oldTable, newTable,schemaName,tables[i]);
}
}else{
//迁移schema下所有的表
//校验新旧schema中的table配置是否一致
Set<String> oldSet = oldTables.keySet();
Set<String> newSet = newTables.keySet();
if(!oldSet.equals(newSet)){
throw new ConfigException("new & old table config is not equal!");
}View on GitHub (pinned to 65f8d8beb7)