Skip to content

Commit

Permalink
inner-2383: fix for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
dcy10000 committed Apr 12, 2024
1 parent 48986e4 commit fcba510
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
22 changes: 11 additions & 11 deletions src/main/java/com/actiontech/dble/config/ConfigInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,14 @@ public void testConnection() {
// check whether dbInstance is connected
String dbGroupName;
PhysicalDbGroup dbGroup;
boolean skipTestConnectionOnUpdate = false;
if (SystemConfig.getInstance().isSkipTestConOnUpdate()) {
if (reloadContext != null && !reloadContext.getAffectDbInstanceList().isEmpty()) {
boolean useSharding = reloadContext.getAffectDbInstanceList().stream().map(ele -> dbGroups.get(ele.getGroupName())).anyMatch((ele) -> ele != null && !ele.isShardingUseless());
if (useSharding) {
//not support for sharding db group
reloadContext.getAffectDbInstanceList().clear();

//not support for sharding db group
if (!useSharding) {
skipTestConnectionOnUpdate = true;
}
}
}
Expand All @@ -221,14 +223,12 @@ public void testConnection() {
}

for (PhysicalDbInstance ds : dbGroup.getDbInstances(true)) {
if (SystemConfig.getInstance().isSkipTestConOnUpdate()) {
if (reloadContext != null && !reloadContext.getAffectDbInstanceList().isEmpty()) {
String finalDbGroupName = dbGroupName;
boolean find = reloadContext.getAffectDbInstanceList().stream().anyMatch((ele) -> ele.getGroupName().equals(finalDbGroupName) && ele.getInstanceName().equals(ds.getName()));
if (!find) {
//skip test connection on this dbInstance
continue;
}
if (skipTestConnectionOnUpdate) {
String finalDbGroupName = dbGroupName;
boolean find = reloadContext.getAffectDbInstanceList().stream().anyMatch((ele) -> ele.getGroupName().equals(finalDbGroupName) && ele.getInstanceName().equals(ds.getName()));
if (!find) {
//skip test connection on this dbInstance
continue;
}
}
if (ds.getConfig().isDisabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private int updateRows(ManagerService service, ManagerWritableTable managerTable
for (LinkedHashMap<String, String> affectPk : affectPks) {
String instanceName = affectPk.get("name");
String dbGroup = affectPk.get("db_group");
reloadContext.getAffectDbInstanceList().add(new UniqueDbInstance(dbGroup, instanceName));
reloadContext.addAffectDbInstance(new UniqueDbInstance(dbGroup, instanceName));
}
}
ReloadConfig.execute(service, 0, false, new ConfStatus(ConfStatus.Status.MANAGER_UPDATE, managerTable.getTableName()), reloadContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
package com.actiontech.dble.services.manager.response;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ReloadContext {
List<UniqueDbInstance> affectDbInstanceList = new ArrayList<>();
private final List<UniqueDbInstance> affectDbInstanceList = new ArrayList<>();

public List<UniqueDbInstance> getAffectDbInstanceList() {
return affectDbInstanceList;
return Collections.unmodifiableList(affectDbInstanceList);
}

public void addAffectDbInstance(UniqueDbInstance dbInstance) {
affectDbInstanceList.add(dbInstance);
}
}

0 comments on commit fcba510

Please sign in to comment.