mirror of
https://github.com/actiontech/dble.git
synced 2026-01-05 20:30:40 -06:00
Merge pull request #3790 from actiontech/inner-2318
[inner-2318] the lowercase on the mysql side changes, after 'reload @@config_all', the heartbeat of the dbInstance should be in the error state
This commit is contained in:
@@ -17,7 +17,6 @@ public final class DbleTempConfig {
|
||||
private RawJson shardingConfig;
|
||||
private RawJson userConfig;
|
||||
private RawJson sequenceConfig;
|
||||
private Boolean lowerCase;
|
||||
|
||||
public RawJson getDbConfig() {
|
||||
return dbConfig;
|
||||
@@ -51,14 +50,6 @@ public final class DbleTempConfig {
|
||||
this.sequenceConfig = sequenceConfig;
|
||||
}
|
||||
|
||||
public Boolean isLowerCase() {
|
||||
return lowerCase;
|
||||
}
|
||||
|
||||
public void setLowerCase(Boolean lowerCase) {
|
||||
this.lowerCase = lowerCase;
|
||||
}
|
||||
|
||||
public static DbleTempConfig getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@ public class ServerConfig {
|
||||
private RawJson shardingConfig;
|
||||
private RawJson userConfig;
|
||||
private RawJson sequenceConfig;
|
||||
private Boolean lowerCase;
|
||||
|
||||
public ServerConfig() {
|
||||
//read sharding.xml,db.xml and user.xml
|
||||
@@ -166,7 +165,6 @@ public class ServerConfig {
|
||||
public void getAndSyncKeyVariables() throws Exception {
|
||||
ConfigUtil.checkDbleAndMysqlVersion(confInitNew.getDbGroups());
|
||||
ConfigUtil.getAndSyncKeyVariables(confInitNew.getDbGroups(), true);
|
||||
DbleServer.getInstance().getConfig().setLowerCase(DbleTempConfig.getInstance().isLowerCase());
|
||||
}
|
||||
|
||||
public boolean isFullyConfigured() {
|
||||
@@ -464,7 +462,6 @@ public class ServerConfig {
|
||||
this.dbConfig = dbJsonConfig;
|
||||
this.shardingConfig = shardingJsonConfig;
|
||||
this.sequenceConfig = sequenceJsonConfig;
|
||||
this.lowerCase = DbleTempConfig.getInstance().isLowerCase();
|
||||
|
||||
try {
|
||||
ReloadLogHelper.briefInfo("ha config init ...");
|
||||
@@ -995,14 +992,6 @@ public class ServerConfig {
|
||||
public RawJson getSequenceConfig() {
|
||||
return sequenceConfig;
|
||||
}
|
||||
|
||||
public Boolean isLowerCase() {
|
||||
return lowerCase;
|
||||
}
|
||||
|
||||
public void setLowerCase(Boolean lowerCase) {
|
||||
this.lowerCase = lowerCase;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.actiontech.dble.DbleServer;
|
||||
import com.actiontech.dble.backend.datasource.*;
|
||||
import com.actiontech.dble.backend.mysql.VersionUtil;
|
||||
import com.actiontech.dble.config.ConfigInitializer;
|
||||
import com.actiontech.dble.config.DbleTempConfig;
|
||||
import com.actiontech.dble.config.helper.GetAndSyncDbInstanceKeyVariables;
|
||||
import com.actiontech.dble.config.helper.KeyVariables;
|
||||
import com.actiontech.dble.config.model.MysqlVersion;
|
||||
@@ -94,7 +93,7 @@ public final class ConfigUtil {
|
||||
Map<String, PhysicalDbInstance> oldDbInstanceMaps = new HashMap<>();
|
||||
DbleServer.getInstance().getConfig().getDbGroups()
|
||||
.values().stream().forEach(group -> group.getAllDbInstanceMap()
|
||||
.values().stream().forEach(db -> oldDbInstanceMaps.put(genDataSourceKey(group.getGroupName(), db.getName()), db)));
|
||||
.values().stream().forEach(db -> oldDbInstanceMaps.put(genDataSourceKey(group.getGroupName(), db.getName()), db)));
|
||||
|
||||
if (CollectionUtil.isEmpty(oldDbInstanceMaps)) return false;
|
||||
|
||||
@@ -213,7 +212,7 @@ public final class ConfigUtil {
|
||||
private static List<String> getClickHouseSyncKeyVariables(Set<PhysicalDbInstance> ckDbInstances, boolean isAllChange, boolean needSync, boolean existMysql) throws Exception {
|
||||
if (ckDbInstances.size() == 0)
|
||||
return new ArrayList<>();
|
||||
Boolean lowerCase = (isAllChange && !existMysql) ? null : DbleServer.getInstance().getConfig().isLowerCase();
|
||||
Boolean lowerCase = (isAllChange && !existMysql) ? null : DbleServer.getInstance().getSystemVariables().getLowerCase();
|
||||
if (lowerCase != null && lowerCase) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("The configuration add Clickhouse. Since clickhouse is not case sensitive, so the values of lower_case_table_names for previous dbInstances must be 0.");
|
||||
@@ -234,7 +233,7 @@ public final class ConfigUtil {
|
||||
return msgList;
|
||||
|
||||
String msg;
|
||||
Boolean lowerCase = isAllChange ? null : DbleServer.getInstance().getConfig().isLowerCase();
|
||||
Boolean lowerCase = isAllChange ? null : DbleServer.getInstance().getSystemVariables().getLowerCase();
|
||||
boolean reInitLowerCase = false;
|
||||
Set<String> leftGroup = new HashSet<>();
|
||||
Set<String> rightGroup = new HashSet<>();
|
||||
@@ -310,7 +309,6 @@ public final class ConfigUtil {
|
||||
throw new IOException("The configuration contains Clickhouse. Since clickhouse is not case sensitive, so the values of lower_case_table_names for all dbInstances must be 0. Current all dbInstances are 1.");
|
||||
}
|
||||
dbInstanceList.forEach(dbInstance -> dbInstance.setNeedSkipHeartTest(true));
|
||||
DbleTempConfig.getInstance().setLowerCase(lowerCase);
|
||||
return msgList;
|
||||
}
|
||||
|
||||
@@ -340,7 +338,6 @@ public final class ConfigUtil {
|
||||
LOGGER.warn(msg);
|
||||
}
|
||||
dbInstanceList.forEach(dbInstance -> dbInstance.setNeedSkipHeartTest(true));
|
||||
DbleTempConfig.getInstance().setLowerCase(lowerCaseA);
|
||||
return msgList;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.Map;
|
||||
public final class SystemVariables {
|
||||
|
||||
private Map<String, String> sessionVariables;
|
||||
private volatile boolean lowerCase = true;
|
||||
private volatile Boolean lowerCase = null;
|
||||
|
||||
public SystemVariables() {
|
||||
sessionVariables = new HashMap<>();
|
||||
@@ -23,6 +23,13 @@ public final class SystemVariables {
|
||||
}
|
||||
|
||||
public boolean isLowerCaseTableNames() {
|
||||
if (lowerCase == null)
|
||||
// if uninitialized, the default is case-insensitive, so return true
|
||||
return true;
|
||||
return lowerCase;
|
||||
}
|
||||
|
||||
public Boolean getLowerCase() {
|
||||
return lowerCase;
|
||||
}
|
||||
|
||||
|
||||
@@ -347,8 +347,8 @@ public final class ReloadConfig {
|
||||
ConfigUtil.checkDbleAndMysqlVersion(changeItemList, loader);
|
||||
//check packetSize/lowerCase
|
||||
ConfigUtil.getAndSyncKeyVariables(changeItemList, true);
|
||||
//get system variables
|
||||
newSystemVariables = getSystemVariablesFromdbGroup(loader, loader.getDbGroups());
|
||||
//keep the original system variables
|
||||
newSystemVariables = DbleServer.getInstance().getSystemVariables();
|
||||
}
|
||||
ReloadLogHelper.briefInfo("check and get system variables from random node end");
|
||||
return newSystemVariables;
|
||||
|
||||
Reference in New Issue
Block a user