mirror of
https://github.com/actiontech/dble.git
synced 2026-01-05 20:30:40 -06:00
Merge pull request #3819 from actiontech/fix/taimei-2060
[inner-2060] fix: database is not checked during login(cherry-pick)
This commit is contained in:
@@ -190,6 +190,8 @@ public final class SystemConfig {
|
||||
|
||||
private boolean closeHeartBeatRecord = false;
|
||||
|
||||
private int enableCheckSchema = 1;
|
||||
|
||||
private int enableAsyncRelease = 1;
|
||||
//unit: ms
|
||||
private long releaseTimeout = 10L;
|
||||
@@ -1412,6 +1414,18 @@ public final class SystemConfig {
|
||||
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 final class SystemConfig {
|
||||
", routePenetrationRules='" + routePenetrationRules + '\'' +
|
||||
", releaseTimeout=" + releaseTimeout +
|
||||
", enableAsyncRelease=" + enableAsyncRelease +
|
||||
", enableCheckSchema=" + enableCheckSchema +
|
||||
"]";
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ package com.actiontech.dble.config.model.user;
|
||||
|
||||
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 class RwSplitUserConfig extends ServerUserConfig {
|
||||
if (schema == null) {
|
||||
return 0;
|
||||
}
|
||||
if (SystemConfig.getInstance().getEnableCheckSchema() == 0) {
|
||||
return 0;
|
||||
}
|
||||
boolean exist;
|
||||
Set<String> schemas = new MysqlDatabaseHandler(DbleServer.getInstance().getConfig().getDbGroups()).execute(dbGroup);
|
||||
if (DbleServer.getInstance().getSystemVariables().isLowerCaseTableNames()) {
|
||||
|
||||
@@ -87,6 +87,10 @@ public class RWSplitHandler implements ResponseHandler, LoadDataResponseHandler,
|
||||
@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();
|
||||
|
||||
@@ -137,7 +137,7 @@ public final class 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)"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user