mirror of
https://github.com/actiontech/dble.git
synced 2026-05-03 21:10:31 -05:00
fix: newly added instance needs to create a connection pool immediately (#3334)
This commit is contained in:
@@ -467,9 +467,11 @@ public abstract class PhysicalDbInstance implements ReadTimeStatusInstance {
|
||||
|
||||
public void updatePoolCapacity() {
|
||||
//minCon/maxCon/numOfShardingNodes
|
||||
checkPoolSize();
|
||||
connectionPool.evictImmediately();
|
||||
connectionPool.fillPool();
|
||||
if ((dbGroupConfig.getRwSplitMode() != RW_SPLIT_OFF || dbGroup.getWriteDbInstance() == this) && !dbGroup.isUseless()) {
|
||||
checkPoolSize();
|
||||
connectionPool.evictImmediately();
|
||||
connectionPool.fillPool();
|
||||
}
|
||||
}
|
||||
|
||||
public void closeAllConnection(String reason) {
|
||||
|
||||
@@ -227,6 +227,10 @@ public class MySQLHeartbeat {
|
||||
Map<String, String> labels = AlertUtil.genSingleLabel("dbInstance", this.source.getDbGroupConfig().getName() + "-" + this.source.getConfig().getInstanceName());
|
||||
AlertUtil.alertResolve(AlarmCode.HEARTBEAT_FAIL, Alert.AlertLevel.WARN, "mysql", this.source.getConfig().getId(), labels);
|
||||
}
|
||||
//after the heartbeat changes from failure to success, it needs to be expanded immediately
|
||||
if (source.getTotalConnections() == 0) {
|
||||
source.updatePoolCapacity();
|
||||
}
|
||||
if (isStop) {
|
||||
LOGGER.warn("heartbeat[{}] had been stop", source.getConfig().getUrl());
|
||||
detector.quit();
|
||||
|
||||
Reference in New Issue
Block a user