diff --git a/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/ClusterMetaVisitor.java b/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/ClusterMetaVisitor.java index 1bf18e2ae..f5ce6549e 100644 --- a/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/ClusterMetaVisitor.java +++ b/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/ClusterMetaVisitor.java @@ -21,11 +21,6 @@ public ClusterMetaVisitor(ShardMetaVisitor shardMetaVisitor) { @Override public void accept(ClusterMeta clusterMeta) { - if (ClusterType.lookup(clusterMeta.getType()).supportSingleActiveDC() - && clusterMeta.getBackupDcs() != null - && Sets.newHashSet(clusterMeta.getBackupDcs().toUpperCase().split("\\s*,\\s*")).contains(FoundationService.DEFAULT.getDataCenter().toUpperCase())) { - return; - } for(ShardMeta shard : clusterMeta.getShards().values()) { shardMetaVisitor.accept(shard); } diff --git a/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/ShardMetaVisitor.java b/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/ShardMetaVisitor.java index b63005ad0..96cc0483b 100644 --- a/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/ShardMetaVisitor.java +++ b/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/ShardMetaVisitor.java @@ -22,11 +22,6 @@ public ShardMetaVisitor(RedisMetaVisitor redisMetaVisitor) { @Override public void accept(ShardMeta shardMeta) { - if (ClusterType.lookup(((ClusterMeta) shardMeta.parent()).getType()).supportSingleActiveDC() - && shardMeta.getBackupDcs() != null - && Sets.newHashSet(shardMeta.getBackupDcs().toUpperCase().split("\\s*,\\s*")).contains(FoundationService.DEFAULT.getDataCenter().toUpperCase())) { - return; - } for(RedisMeta redisMeta : shardMeta.getRedises()) { redisMetaVisitor.accept(redisMeta); } diff --git a/redis/redis-checker/src/test/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/DefaultDcMetaChangeManagerTest.java b/redis/redis-checker/src/test/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/DefaultDcMetaChangeManagerTest.java index fe73ce780..1ac5f33d2 100644 --- a/redis/redis-checker/src/test/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/DefaultDcMetaChangeManagerTest.java +++ b/redis/redis-checker/src/test/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/DefaultDcMetaChangeManagerTest.java @@ -163,7 +163,7 @@ public void testActiveDcOY2JQ() { manager.compare(future, null); Mockito.verify(instanceManager, times(2)).getOrCreate(any(RedisMeta.class)); - Mockito.verify(instanceManager, never()).remove(any(HostPort.class)); + Mockito.verify(instanceManager, times(2)).remove(any(HostPort.class)); Assert.assertEquals(Sets.newHashSet(new HostPort("127.0.0.2", 8100), new HostPort("127.0.0.2", 8101)), addedRedises); } @@ -308,7 +308,7 @@ public void testSwitchClusterName() throws Exception { Mockito.verify(instanceManager, times(1)).getOrCreate(any(ClusterMeta.class)); Mockito.verify(instanceManager, times(4)).getOrCreate(any(RedisMeta.class)); - Mockito.verify(instanceManager, times(4)).remove(any(HostPort.class)); + Mockito.verify(instanceManager, times(6)).remove(any(HostPort.class)); Mockito.verify(instanceManager, never()).remove(anyString()); } @@ -399,7 +399,7 @@ public void testBackupDcClusterModified() throws Exception { Mockito.verify(instanceManager, never()).getOrCreate(any(ClusterMeta.class)); Mockito.verify(instanceManager, never()).getOrCreate(any(RedisMeta.class)); - Mockito.verify(instanceManager, never()).remove(any(HostPort.class)); + Mockito.verify(instanceManager, times(2)).remove(any(HostPort.class)); Mockito.verify(instanceManager, times(1)).remove(anyString()); }