Skip to content

Commit

Permalink
Merge pull request #876 from ctripcorp/bugfix/cross_region_ping_check
Browse files Browse the repository at this point in the history
remove cluster meta change filter
  • Loading branch information
LanternLee authored Sep 10, 2024
2 parents 6ffea44 + 1b0fa9b commit 92bec94
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -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());

}
Expand Down

0 comments on commit 92bec94

Please sign in to comment.