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
ringhash: fix normalizeWeights #7156
base: master
Are you sure you want to change the base?
Conversation
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.
Tests are failing because some subConn
are instantiated with a default weight of 0 at
grpc-go/xds/internal/balancer/ringhash/ring_test.go
Lines 41 to 43 in 1949035
testSubConnMap.Set(testAddrs[0], &subConn{addr: "a"}) | |
testSubConnMap.Set(testAddrs[1], &subConn{addr: "b"}) | |
testSubConnMap.Set(testAddrs[2], &subConn{addr: "c"}) |
Thanks for the review @atollena and @aranjans. I still think this diff is not ready to be merged yet. There is still the open question why getWeightAttribute(a) doesnt work in this case, even though (*subConn).weight is set using getWeightAttribute(a). I wanted to check with @zasweq if he knows what's going on. |
There's two other maintainers actively looking at this so I'll remove myself. |
Ha. I thought that you had that figured out. I took a look at the code and, with my limited understanding, it looks like the "bug" is in At L86, when we found that we already had the address in the map, the code only updates the value, not the addr. So if the BalancerAttribute changed, the addr isn't updated. As a result, if the weight changes, which is a From the documentation of I see two options to fix this:
I'd sollicit Doug and Zach's input on this because I don't have the context of when address map is useful (looks like it's mostly to find existing subconn associated with an address in O(1)?), but option 1 seems more realistic. |
If we are open to making a breaking change, another option to consider, in addition to those listed in #7156 (comment) :
We could also achieve the same by first deprecating the existing |
what the docstring on resolver.AddressMap really talks about is that we should not be relying on the balancerAttributes in the key, but use value instead. And in ringHash, the value is of type The actual bug is with using the rignhash.getWeightAttribute helper. This is helpful when getting the balancerattribute weight when updating addresses. But is incorrect when used to get weights from the AddressMap. Instead, we should type assert to ringhash.subConn and read weights from that instead. cc'ing: @easwars; since he has most context on ringhash. |
RELEASE NOTES: