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

balancer/pickfirstleaf: Fix handling of Addresses with Metadata #8227

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arjan-bal
Copy link
Contributor

@arjan-bal arjan-bal commented Apr 4, 2025

Addresses: #8225

This PR introduces a new data structure that wraps AddressMap but considers Address.Metadata while comparing map keys. This is required since pickfirst must consider addresses with different Metadata as separate.

RELEASE NOTES:

  • balancer/pickfirstleaf: Fix handling of the deprecated Address.Metadata field.

@arjan-bal arjan-bal changed the title balancer/pickfirstleaf: Handle metadata pf balancer/pickfirstleaf: Handle Addresses with Metadata Apr 4, 2025
Copy link

codecov bot commented Apr 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.03%. Comparing base (ce35fd4) to head (c8fb55c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8227      +/-   ##
==========================================
- Coverage   82.16%   82.03%   -0.13%     
==========================================
  Files         410      411       +1     
  Lines       40248    40284      +36     
==========================================
- Hits        33068    33047      -21     
- Misses       5830     5875      +45     
- Partials     1350     1362      +12     
Files with missing lines Coverage Δ
balancer/pickfirst/pickfirstleaf/pickfirstleaf.go 86.57% <100.00%> (-0.03%) ⬇️
balancer/pickfirst/pickfirstleaf/subconn_map.go 100.00% <100.00%> (ø)

... and 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arjan-bal arjan-bal added this to the 1.72 Release milestone Apr 4, 2025
@arjan-bal arjan-bal requested review from dfawley and easwars and removed request for dfawley April 4, 2025 07:56
@arjan-bal arjan-bal force-pushed the handle-metadata-pf branch from b5b2dbc to c8fb55c Compare April 4, 2025 08:03
@arjan-bal arjan-bal changed the title balancer/pickfirstleaf: Handle Addresses with Metadata balancer/pickfirstleaf: Fix handling of Addresses with Metadata Apr 4, 2025
@easwars
Copy link
Contributor

easwars commented Apr 7, 2025

Do we still want to do this?

The most recent comment on etcd-io/etcd#19700 (comment) says that etcd itself is not affected by this and that they are going to prioritize the long term fix of not using the Metadata field over any short term fixes.

But I also see that your note saying pickfirstleaf is affected and that it does not work with Addresses that contain the Metadata field. Can we say that the new pick_first policy will not support the Metadata field since it has now been marked as deprecated for over 5 years and thereby simplify our lives?

@easwars easwars assigned arjan-bal and unassigned easwars and dfawley Apr 7, 2025
@arjan-bal
Copy link
Contributor Author

arjan-bal commented Apr 9, 2025

Waiting to discuss this with @dfawley. If we think is fine not to support Metadata to differentiate addresses in the new pickfirst, we would need to change the following condition. Having a test for the behaviour would be good.

func equalAddressIgnoringBalAttributes(a, b *resolver.Address) bool {
return a.Addr == b.Addr && a.ServerName == b.ServerName &&
a.Attributes.Equal(b.Attributes) &&
a.Metadata == b.Metadata
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants