#1526 remove column autoIncrement and let the incrementColumn cover the function (#1626)

This commit is contained in:
zhengfang.sun
2020-01-09 13:30:14 +08:00
committed by tiger.yan
parent eee49a30f8
commit 4fb43f6aa7
@@ -296,12 +296,6 @@ public class XMLSchemaLoader implements SchemaLoader {
String cacheKey = tableElement.hasAttribute("cacheKey") ? tableElement.getAttribute("cacheKey").toUpperCase() : null;
//if autoIncrement,it will use sequence handler
String incrementColumn = tableElement.hasAttribute("incrementColumn") ? tableElement.getAttribute("incrementColumn").toUpperCase() : null;
boolean autoIncrement = isAutoIncrement(tableElement, incrementColumn);
if (incrementColumn != null && !autoIncrement) {
throw new ConfigException("table " + tableNameElement + " has incrementColumn but not autoIncrement");
}
String checkClass = tableElement.hasAttribute("globalCheckClass") ? tableElement.getAttribute("globalCheckClass").toUpperCase() : GLOBAL_TABLE_CHECK_DEFAULT;
String corn = tableElement.hasAttribute("cron") ? tableElement.getAttribute("cron").toUpperCase() : GLOBAL_TABLE_CHECK_DEFAULT_CRON;
boolean globalCheck = tableElement.hasAttribute("globalCheck") ? Boolean.valueOf(tableElement.getAttribute("globalCheck")) : false;
@@ -335,15 +329,6 @@ public class XMLSchemaLoader implements SchemaLoader {
return tables;
}
private boolean isAutoIncrement(Element tableElement, String incrementColumn) {
String autoIncrementStr = ConfigUtil.checkAndGetAttribute(tableElement, "autoIncrement", "false", problemReporter);
boolean autoIncrement = Boolean.parseBoolean(autoIncrementStr);
if (autoIncrement && incrementColumn == null) {
throw new ConfigException("autoIncrement is true but cacheKey and incrementColumn is not setting!");
}
return autoIncrement;
}
/**
* distribute data nodes in multi hosts, reorder data node according to host .
* eg :dn1 (host1),dn2(host1),dn100(host2),dn101(host2),dn300(host3),dn101(host2),dn301(host3)...etc
@@ -402,10 +387,6 @@ public class XMLSchemaLoader implements SchemaLoader {
String parentKey = childTbElement.getAttribute("parentKey").toUpperCase();
String cacheKey = childTbElement.hasAttribute("cacheKey") ? childTbElement.getAttribute("cacheKey").toUpperCase() : null;
String incrementColumn = childTbElement.hasAttribute("incrementColumn") ? childTbElement.getAttribute("incrementColumn").toUpperCase() : null;
boolean autoIncrement = isAutoIncrement(childTbElement, incrementColumn);
if (incrementColumn != null && !autoIncrement) {
throw new ConfigException("table " + cdTbName + " has incrementColumn but not AutoIncrement");
}
TableConfig table = new TableConfig(cdTbName, cacheKey, needAddLimit,
TableTypeEnum.TYPE_SHARDING_TABLE, strDatoNodes, null, false, parentTable, joinKey, parentKey, incrementColumn,
null, null, false);