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"}) |
@@ -407,6 +416,23 @@ func (s) TestAddrWeightChange(t *testing.T) { | |||
if p2.(*picker).ring == ring1 { | |||
t.Fatalf("new picker after changing address weight has the same ring as before, want different") | |||
} | |||
// Ideally with the new update, the ring should contain 3 entries. 1 for the |
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.
"Ideally" threw me off a bit here, it sounds like it isn't always going to be the case. I'd simply suggest:
// Ideally with the new update, the ring should contain 3 entries. 1 for the | |
// With the new update, the ring must contain 3 entries. 1 for the ... |
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 |
RELEASE NOTES: