MyCATApache/Mycat-Server · error · ConfigException
new & old table config is not equal!
Error message
new & old table config is not equal!
What it means
When migrating all tables under a schema (no explicit table list), ConfigComparer requires the set of table names to be identical in the old and new configurations. If the key sets differ, a ConfigException is thrown because safe migration cannot map tables that exist in only one config.
Solutions
- Diff the <table> entries of the schema between old and new schema.xml and make the table sets identical.
- If a table should not be migrated, list only the intended tables explicitly in tablesFile.properties instead of migrating all.
- Fix misspelled table names so both configs match.
- Remove leftover table definitions from whichever config should not have them.
Example fix
// before: new config missing table old: order_main, order_detail ; new: order_main // after new schema.xml also defines <table name="order_detail" ...>
Defensive patterns
Strategy: validation
Validate before calling
Set<String> oldT = oldSchema.getTables().keySet();
Set<String> newT = newSchema.getTables().keySet();
if (!oldT.equals(newT)) {
Set<String> diff = new HashSet<>(oldT); diff.removeAll(newT);
Set<String> diff2 = new HashSet<>(newT); diff2.removeAll(oldT);
throw new IllegalStateException("table set mismatch; only-old=" + diff + " only-new=" + diff2);
} Try / catch
try {
comparer.compare();
} catch (ConfigException e) {
if (e.getMessage().contains("new & old table config is not equal")) {
// diff <table> entries for the schema, align them, or list tables explicitly
}
throw e;
} Prevention
- Align table sets in old/new schema.xml before migration planning
- When tables differ intentionally, migrate them by explicit table list instead of whole-schema
- Diff schema.xml files in CI before approving a migration plan
When it happens
Trigger: Migrating a whole schema (tables entry empty) where the old schema.xml defines tables that the new schema.xml does not, or vice versa — e.g. a table was added or removed between configurations.
Common situations: Adding a new sharding table to the new config but not the old; removing a table in the new config; copy of schema.xml not kept in sync; typo in a table name in either config.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- please check tableFile.properties,make sure
- : old & new partition column is not same!
- : old & new rule Algorithm is not same!
- tablesFile.properties read fail!
- oldSchema: is not exists!
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/6c0b49bdc17411a5.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/util/dataMigrator/ConfigComparer.java:153
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!");
}
for(String tableName:oldSet){
TableConfig oldTable = oldTables.get(tableName);
TableConfig newTable = newTables.get(tableName);
loadMigratorTable(oldTable, newTable,schemaName,tableName);
}
}
}
private void loadMigratorTable(TableConfig oldTable,TableConfig newTable,String schemaName,String tableName){
//禁止配置非拆分表
if(oldTable == null || newTable == null){
throw new ConfigException("please check tableFile.properties,make sure "+schemaName+":"+tableName+" is sharding table ");
}
//忽略全局表View on GitHub (pinned to 65f8d8beb7)