Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1096 from MaxFedotov/skip_adding_replicas
Browse files Browse the repository at this point in the history
skip AddReplicaKey if it is specified in config.Config.DiscoveryIgnoreReplicaHostnameFilters
  • Loading branch information
shlomi-noach authored Apr 28, 2020
2 parents f6e6e2f + 470852c commit 1b84075
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions go/inst/instance_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,9 @@ func ReadTopologyInstanceBufferable(instanceKey *InstanceKey, bufferWrites bool,

replicaKey, err := NewResolveInstanceKey(host, port)
if err == nil && replicaKey.IsValid() {
instance.AddReplicaKey(replicaKey)
if !RegexpMatchPatterns(replicaKey.StringCode(), config.Config.DiscoveryIgnoreReplicaHostnameFilters) {
instance.AddReplicaKey(replicaKey)
}
foundByShowSlaveHosts = true
}
return err
Expand Down Expand Up @@ -632,7 +634,9 @@ func ReadTopologyInstanceBufferable(instanceKey *InstanceKey, bufferWrites bool,
logReadTopologyInstanceError(instanceKey, "ResolveHostname: processlist", resolveErr)
}
replicaKey := InstanceKey{Hostname: cname, Port: instance.Key.Port}
instance.AddReplicaKey(&replicaKey)
if !RegexpMatchPatterns(replicaKey.StringCode(), config.Config.DiscoveryIgnoreReplicaHostnameFilters) {
instance.AddReplicaKey(&replicaKey)
}
return err
})

Expand Down

0 comments on commit 1b84075

Please sign in to comment.