-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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 hashCode change in 2.6 DIY ConsistentHashLoadBalance #12468
Conversation
When using 2.6.x DIY ConsistentHashLoadBalance, Invoker will wrap to CompatibleInvoker. Then invokers.hashCode() will return different hashCode event original Invokers not change. This will cause many duplicate Object like ConsistentHashSelector in jvm Eden space, and young gc will be very frequently.
@@ -95,5 +95,10 @@ public void destroy() { | |||
public org.apache.dubbo.rpc.Invoker<T> getOriginal() { | |||
return invoker; | |||
} | |||
|
|||
@Override | |||
public int hashCode() { |
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.
override equals
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.
override equals
done
|
||
@Override | ||
public boolean equals(Object o) { | ||
return invoker.equals(o); |
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.
Check if target object's type is alibaba invoker
would be better?
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.
Check if target object's type is
alibaba invoker
would be better?
done
Kudos, SonarCloud Quality Gate passed! |
When using 2.6.x DIY ConsistentHashLoadBalance, Invoker will wrap to CompatibleInvoker. Then invokers.hashCode() will return different hashCode event original Invokers not change. This will cause many duplicate Object like ConsistentHashSelector in jvm Eden space, and young gc will be very frequently.
What is the purpose of the change
Compatible of invokers' hashCode method using in 2.6.x's DIY ConsistentHashLoadBalance
Brief changelog
In CompatibleInvoker.java, call invoker.hashCode()
Verifying this change
Verified on my local env
Checklist