MyCATApache/Mycat-Server · error · ConfigException
oldSchema: is not exists!
Error message
oldSchema:{schemaName} is not exists! What it means
loadMigratorTables validates that every schema listed in tablesFile.properties exists in the OLD schema configuration (schema.xml before migration). If the schema name is absent (case-insensitive check), migration cannot proceed and a ConfigException is thrown. This guards against migrating tables from a schema that never existed in the source cluster.
Solutions
- Open tablesFile.properties and check the offending key; correct the schema name to exactly match a schema in the old schema.xml.
- Compare against the schemas loaded from the old config and remove entries for schemas that no longer exist.
- Trim whitespace around the key in the properties file.
- Regenerate tablesFile.properties from the actual old configuration instead of hand-editing.
Example fix
// before: tablesFile.properties ORDERS_DB:table1,table2 // after (schema exists in old schema.xml as ordersdb) ordersdb:table1,table2
Defensive patterns
Strategy: validation
Validate before calling
Set<String> oldSchemaNames = oldSchemas.keySet().stream()
.map(String::toLowerCase).collect(Collectors.toSet());
for (String schema : prop.stringPropertyNames()) {
if (!oldSchemaNames.contains(schema.toLowerCase().trim())) {
throw new IllegalArgumentException("schema not in old config: " + schema);
}
} Try / catch
try {
comparer.compare();
} catch (ConfigException e) {
if (e.getMessage().startsWith("oldSchema:")) {
// fix tablesFile.properties schema key against old schema.xml
}
throw e;
} Prevention
- Generate tablesFile.properties keys directly from old schema.xml rather than typing them
- Trim whitespace in properties keys
- Grep the old schema.xml for the schema name before running migration
- Keep old and new configs in version control side by side
When it happens
Trigger: tablesFile.properties contains a key (schema name) that does not match any schema defined in the old schema.xml — due to typos, renamed schemas, case mismatches beyond the ignore-case handling, or a stale properties file.
Common situations: Operator edits tablesFile.properties and misspells a schema; schema was renamed/dropped in the old config; copy-pasting schema names with extra whitespace.
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
- newSchema: 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/4130d24539293d5a.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/util/dataMigrator/ConfigComparer.java:133
String tables = entry.getValue().toString();
loadMigratorTables(schemaName,getTables(tables));
}
}
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();View on GitHub (pinned to 65f8d8beb7)