New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SCB-986] Cache instances result in CseDiscoveryClient #990
Conversation
|
||
@Override | ||
public int getOrder() { | ||
return Integer.MAX_VALUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should give a change to filter List
so set order to be max int is not a good idea
we can set it to be: (int) Short.MAX_VALUE;
|
||
@Override | ||
public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { | ||
return createDiscoveryTreeNode(context, parent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no cache logic, because create new node each time,
take a look at: org.apache.servicecomb.loadbalance.filter.ServerDiscoveryFilter
@@ -75,5 +75,9 @@ | |||
<groupId>org.apache.servicecomb</groupId> | |||
<artifactId>service-registry</artifactId> | |||
</dependency> | |||
<dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why need this new dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DiscoveryFilter interface is defined in this package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no , you add new core dependence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's for Const.RESTFUL
List<ServiceInstance> instances = new ArrayList<>(); | ||
for (MicroserviceInstance instance : ((Map<String, MicroserviceInstance>) parent.data()).values()) { | ||
for (String endpoint : instance.getEndpoints()) { | ||
URIEndpointObject uri = new URIEndpointObject(endpoint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zuul can not support highway
so we need to log and ignore highway endpoints
Map<String, MicroserviceInstance> servers = serversVersionedCache.data(); | ||
List<ServiceInstance> instances = new ArrayList<>(servers.size()); | ||
List<ServiceInstance> instances = null; | ||
instances = serversVersionedCache.data(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge line 93 and 94 to one line.
List<ServiceInstance> instances = null; | ||
instances = serversVersionedCache.data(); | ||
|
||
//Map<String, MicroserviceInstance> servers = serversVersionedCache.data(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remote line from 96 to 104
@wujimin All are fixed, could you please check again? |
protected DiscoveryTreeNode createDiscoveryTreeNode(DiscoveryContext context, | ||
DiscoveryTreeNode parent) { | ||
String serviceName = context.getInputParameters(); | ||
List<ServiceInstance> instances = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not align?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix
@@ -44,24 +51,55 @@ public String description() { | |||
|
|||
@Override | |||
public List<ServiceInstance> getInstances(final String serviceId) { | |||
class InstanceDiscoveryFilter implements DiscoveryFilter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put class InstanceDiscoveryFilter in "getInstances", make "getInstances" logic not clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will move to a separate class
} | ||
return instances; | ||
|
||
return serversVersionedCache.data(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happened when serversVersionedCache is empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK for the versionedCache to be empty. As it will not be NULL. When there are associated filters and the children data is null, an Exception will be raised.
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.apache.servicecomb.core.Const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove java-chassis-core dependency
define a new const "rest" or just hard code is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Follow this checklist to help us incorporate your contribution quickly and easily:
[SCB-XXX] Fixes bug in ApproximateQuantiles
, where you replaceSCB-XXX
with the appropriate JIRA issue.mvn clean install
to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.