From 4fb43f6aa7740947f5f25dc68e9e5cf1ff115eaa Mon Sep 17 00:00:00 2001 From: "zhengfang.sun" Date: Thu, 9 Jan 2020 13:30:14 +0800 Subject: [PATCH] #1526 remove column autoIncrement and let the incrementColumn cover the function (#1626) --- .../config/loader/xml/XMLSchemaLoader.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/main/java/com/actiontech/dble/config/loader/xml/XMLSchemaLoader.java b/src/main/java/com/actiontech/dble/config/loader/xml/XMLSchemaLoader.java index d5746d640..45e09fe08 100644 --- a/src/main/java/com/actiontech/dble/config/loader/xml/XMLSchemaLoader.java +++ b/src/main/java/com/actiontech/dble/config/loader/xml/XMLSchemaLoader.java @@ -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);