Skip to content
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

Fix Eureka instance count and status logging #130

Merged
merged 2 commits into from
May 30, 2014

Conversation

pgkelley4
Copy link
Contributor

Eureka client would only log the number of UP instances but with the
deceiving message:

logger.debug("The total number of instances in the client now is {}",
totInstances);

Eureka client would only log the number of UP instances but with the
deceiving message:

logger.debug("The total number of instances in the client now is {}",
                totInstances);
@pgkelley4
Copy link
Contributor Author

The log message is deceiving as-is. Another fix would be to change the log message to be:

logger.debug("The total number of UP instances in the client now is {}", totInstances);

Let me know which you would prefer.

@cloudbees-pull-request-builder

eureka-pull-requests #132 FAILURE
Looks like there's a problem with this pull request

@pgkelley4 pgkelley4 changed the title Eureka should log the total number of instances Fix Eureka instance count and status logging May 20, 2014
@cloudbees-pull-request-builder

eureka-pull-requests #133 SUCCESS
This pull request looks good

@cloudbees-pull-request-builder

eureka-pull-requests #134 FAILURE
Looks like there's a problem with this pull request

@pgkelley4
Copy link
Contributor Author

A few points to make about the "Fix appsHashCode not getting updated" commit.

  • There could be other code paths I have missed where AppsHashCode isn't getting set correctly. It is currently inconsistent where it is set. In InstanceRegistry it is set in getApplicationsFromMultipleRegions but there isn't an analogous place in DiscoveryClient. This should probably be rethought, I think it made it easy to miss this bug.
  • Why is AbstractDiscoveryClientTester.CLIENT_REFRESH_RATE = 10? Can we lower it to speed up the tests?
  • This code reconcileHashCode.equals(delta.getAppsHashCode()) In fetchRegistry will not return false and log differences if one app goes from UP to DOWN and another from DOWN to UP. Is this not a concern?

appsHashCode was not getting updated under 2 circumstances.

First when a BackupRegistry is used at all. Second when
fetchRegistry is called. Most notably when this is called
by the CacheRefreshThread.
@cloudbees-pull-request-builder

eureka-pull-requests #135 SUCCESS
This pull request looks good

@NiteshKant
Copy link
Contributor

@pgkelley4 apologies for the late reply.

There could be other code paths I have missed where AppsHashCode isn't getting set correctly. It is currently inconsistent where it is set. In InstanceRegistry it is set in getApplicationsFromMultipleRegions but there isn't an analogous place in DiscoveryClient. This should probably be rethought, I think it made it easy to miss this bug.

In the DiscoveryClient, the app hash code used to always come from the server (in the response) but looks like after the remote region change, this hash code was not getting updated to reflect the remote instances.
The app hashcode is used only when applying delta, where it seems to be checking correctly. Which bug are you referring to?

Why is AbstractDiscoveryClientTester.CLIENT_REFRESH_RATE = 10? Can we lower it to speed up the tests?

Sure it can be.

This code reconcileHashCode.equals(delta.getAppsHashCode()) In fetchRegistry will not return false and log differences if one app goes from UP to DOWN and another from DOWN to UP. Is this not a concern?

Yes thats a valid point and we have thought about it before. You are correct that this scenario can occur and will incorrectly indicate that the registry contents are identical.
However, the point to note is that the hashcode comes into picture only when it does not match (after applying the delta on the client). So, if the delta calculation at the server is correct, then the client would get the same registry information after applying the delta even though the hashcode did not change between the two calls (before and after this delta).
In other words, since the delta application is not conditional (based on the hashcode) the fact that the hashcode is not completely indicative of the registry content is not really an issue.

@NiteshKant
Copy link
Contributor

The changes look good to me. Should I merge it or you have some more changes to make?

@pgkelley4
Copy link
Contributor Author

My first point was more about when/where AppsHashCode should be set. I followed the pattern already in the code, but I really think it would be cleaner if it was managed by the Applications class, where it is stored. Then anytime the apps changed the AppsHashCode would be updated. This is a bit tricker because if someone changes instances through Application and not Applications, then AppHashCode would still have to be updated.

Either way at this point that is something long term to consider. Please merge this immediate fix.

NiteshKant added a commit that referenced this pull request May 30, 2014
Fix Eureka instance count and status logging
@NiteshKant NiteshKant merged commit 0f4960d into Netflix:master May 30, 2014
@NiteshKant
Copy link
Contributor

@pgkelley4 sure if you have thoughts on how to fix it, feel free to issue a PR or open an issue to discuss.

@NiteshKant NiteshKant added this to the 1.1.133 milestone Jun 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants