|
12 | 12 | import com.ctrip.xpipe.redis.checker.alert.AlertManager;
|
13 | 13 | import com.ctrip.xpipe.redis.checker.config.CheckerConfig;
|
14 | 14 | import com.ctrip.xpipe.redis.checker.healthcheck.actions.interaction.compensator.data.XPipeInstanceHealthHolder;
|
| 15 | +import com.ctrip.xpipe.redis.core.entity.ClusterMeta; |
| 16 | +import com.ctrip.xpipe.redis.core.entity.ShardMeta; |
15 | 17 | import com.ctrip.xpipe.redis.core.meta.MetaCache;
|
| 18 | +import com.ctrip.xpipe.redis.core.meta.XpipeMetaManager; |
16 | 19 | import com.ctrip.xpipe.utils.XpipeThreadFactory;
|
17 | 20 | import com.google.common.annotations.VisibleForTesting;
|
18 | 21 | import org.slf4j.Logger;
|
19 | 22 | import org.slf4j.LoggerFactory;
|
20 | 23 | import org.springframework.beans.factory.annotation.Autowired;
|
21 | 24 | import org.springframework.stereotype.Component;
|
| 25 | +import com.ctrip.xpipe.redis.core.entity.DcMeta; |
22 | 26 |
|
23 | 27 | import javax.annotation.PostConstruct;
|
24 | 28 | import java.util.*;
|
@@ -87,7 +91,8 @@ public Set<HostPortDcStatus> getNeedAdjustInstances(String cluster, Set<HostPort
|
87 | 91 | @Override
|
88 | 92 | public void doMarkInstances(String clusterName, String activeDc, Set<HostPortDcStatus> instances) throws OuterClientException {
|
89 | 93 | alertMarkInstance(clusterName, instances);
|
90 |
| - MarkInstanceRequest markInstanceRequest = new MarkInstanceRequest(instances, clusterName, activeDc); |
| 94 | + Map<String, Integer> dcInstancesCnt = metaCache.getClusterCntMap(clusterName); |
| 95 | + MarkInstanceRequest markInstanceRequest = new MarkInstanceRequest(instances, clusterName, activeDc, dcInstancesCnt); |
91 | 96 | outerClientService.batchMarkInstance(markInstanceRequest);
|
92 | 97 | }
|
93 | 98 |
|
@@ -170,4 +175,9 @@ protected void setExecutors(Executor executors) {
|
170 | 175 | this.executors = executors;
|
171 | 176 | }
|
172 | 177 |
|
| 178 | + @VisibleForTesting |
| 179 | + protected void setMetaCache(MetaCache metaCache) { |
| 180 | + this.metaCache = metaCache; |
| 181 | + } |
| 182 | + |
173 | 183 | }
|
0 commit comments