diff --git a/src/main/java/com/actiontech/dble/config/model/SystemConfig.java b/src/main/java/com/actiontech/dble/config/model/SystemConfig.java index 2b30856135..746781aa87 100644 --- a/src/main/java/com/actiontech/dble/config/model/SystemConfig.java +++ b/src/main/java/com/actiontech/dble/config/model/SystemConfig.java @@ -190,6 +190,8 @@ private SystemConfig() { private boolean closeHeartBeatRecord = false; + private int enableCheckSchema = 1; + private int enableAsyncRelease = 1; //unit: ms private long releaseTimeout = 10L; @@ -1412,6 +1414,18 @@ public void setRoutePenetrationRules(String sqlPenetrationRegexesTmp) { routePenetrationRules = sqlPenetrationRegexesTmp; } + public int getEnableCheckSchema() { + return enableCheckSchema; + } + + public void setEnableCheckSchema(int enableCheckSchema) { + if (enableCheckSchema >= 0 && enableCheckSchema <= 1) { + this.enableCheckSchema = enableCheckSchema; + } else if (this.problemReporter != null) { + problemReporter.warn(String.format(WARNING_FORMAT, "enableCheckSchema", enableCheckSchema, this.enableCheckSchema)); + } + } + @Override public String toString() { return "SystemConfig [" + @@ -1512,6 +1526,7 @@ public String toString() { ", routePenetrationRules='" + routePenetrationRules + '\'' + ", releaseTimeout=" + releaseTimeout + ", enableAsyncRelease=" + enableAsyncRelease + + ", enableCheckSchema=" + enableCheckSchema + "]"; } diff --git a/src/main/java/com/actiontech/dble/config/model/user/RwSplitUserConfig.java b/src/main/java/com/actiontech/dble/config/model/user/RwSplitUserConfig.java index 5f44d92852..c5324ac848 100644 --- a/src/main/java/com/actiontech/dble/config/model/user/RwSplitUserConfig.java +++ b/src/main/java/com/actiontech/dble/config/model/user/RwSplitUserConfig.java @@ -7,6 +7,7 @@ import com.actiontech.dble.DbleServer; import com.actiontech.dble.config.ErrorCode; +import com.actiontech.dble.config.model.SystemConfig; import com.actiontech.dble.services.mysqlauthenticate.MysqlDatabaseHandler; import com.actiontech.dble.util.StringUtil; import com.alibaba.druid.wall.WallProvider; @@ -37,6 +38,9 @@ public int checkSchema(String schema) { if (schema == null) { return 0; } + if (SystemConfig.getInstance().getEnableCheckSchema() == 0) { + return 0; + } boolean exist; Set schemas = new MysqlDatabaseHandler(DbleServer.getInstance().getConfig().getDbGroups()).execute(dbGroup); if (DbleServer.getInstance().getSystemVariables().isLowerCaseTableNames()) { diff --git a/src/main/java/com/actiontech/dble/services/rwsplit/RWSplitHandler.java b/src/main/java/com/actiontech/dble/services/rwsplit/RWSplitHandler.java index 7f1cafc208..6b7967c8cc 100644 --- a/src/main/java/com/actiontech/dble/services/rwsplit/RWSplitHandler.java +++ b/src/main/java/com/actiontech/dble/services/rwsplit/RWSplitHandler.java @@ -87,6 +87,10 @@ public void connectionError(Throwable e, Object attachment) { @Override public void errorResponse(byte[] data, AbstractService service) { StatisticListener.getInstance().record(rwSplitService, r -> r.onBackendSqlError(data)); + ErrorPacket errorPacket = new ErrorPacket(); + errorPacket.read(data); + String error = "[MySQL Error Packet] " + new String(errorPacket.getMessage()); + LOGGER.warn(error); MySQLResponseService mysqlService = (MySQLResponseService) service; loadDataClean(); initDbClean(); diff --git a/src/main/java/com/actiontech/dble/singleton/SystemParams.java b/src/main/java/com/actiontech/dble/singleton/SystemParams.java index c3282aa4ff..74df8e0127 100644 --- a/src/main/java/com/actiontech/dble/singleton/SystemParams.java +++ b/src/main/java/com/actiontech/dble/singleton/SystemParams.java @@ -137,7 +137,7 @@ private SystemParams() { readOnlyParams.add(new ParamInfo("routePenetrationRules", sysConfig.getRoutePenetrationRules() + "", "The config of route penetration")); readOnlyParams.add(new ParamInfo("enableAsyncRelease", sysConfig.getEnableAsyncRelease() + "", "Whether enable async release . default value is 1(off).")); readOnlyParams.add(new ParamInfo("releaseTimeout", sysConfig.getReleaseTimeout() + "", "time wait for release ,unit is ms, default value is 10 ms")); - + readOnlyParams.add(new ParamInfo("enableCheckSchema", sysConfig.getEnableCheckSchema() + "", "Whether enable check schema, default value is 1(on)")); }