Skip to content

lb: unified the lifetime mechanism of worker load lb 2#45170

Merged
nezdolik merged 4 commits into
envoyproxy:mainfrom
wbpcode:dev-simplify-lb
May 21, 2026
Merged

lb: unified the lifetime mechanism of worker load lb 2#45170
nezdolik merged 4 commits into
envoyproxy:mainfrom
wbpcode:dev-simplify-lb

Conversation

@wbpcode
Copy link
Copy Markdown
Member

@wbpcode wbpcode commented May 20, 2026

Commit Message: lb: unified the lifetime mechanism of worker load lb 2
Additional Description:

Similar to previous #45100 but this PR have updated all left LB.

Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Signed-off-by: wbpcode/wangbaiping <wbphub@gmail.com>
@wbpcode
Copy link
Copy Markdown
Member Author

wbpcode commented May 20, 2026

/retest

@wbpcode wbpcode requested a review from Copilot May 20, 2026 09:23
@wbpcode
Copy link
Copy Markdown
Member Author

wbpcode commented May 20, 2026

/gemini review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns several thread-aware/cluster-provided load balancers with the “refresh in place” lifetime model by disabling worker-local LB recreation on host-set changes and ensuring worker-local LBs update their cached view via priority-set member update callbacks.

Changes:

  • Set recreateOnHostChange() to false for several LB factories so worker-local LBs are not recreated on host updates.
  • Update Redis Cluster and Original DST worker-local LBs to refresh cached topology/host maps via PrioritySet::addMemberUpdateCb.
  • Add unit tests validating that existing worker-local LB instances observe updates after member update callbacks fire.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/extensions/clusters/redis/redis_cluster_lb_test.cc Adds a test ensuring a worker-local Redis LB refreshes its snapshot on member updates (no LB recreation).
test/extensions/clusters/original_dst/original_dst_cluster_test.cc Updates tests for new OriginalDstCluster::LoadBalancer constructor and adds a refresh-on-member-update test.
source/extensions/load_balancing_policies/override_host/load_balancer.h Disables LB recreation on host changes for the override-host LB factory.
source/extensions/clusters/reverse_connection/reverse_connection.h Disables LB recreation on host changes for reverse-connection cluster LB factory.
source/extensions/clusters/redis/redis_cluster_lb.h Refactors Redis worker-local LB to refresh from factory and registers a member-update callback; disables recreation.
source/extensions/clusters/redis/redis_cluster_lb.cc Implements Redis worker-local LB refresh logic and constructs it with priority_set.
source/extensions/clusters/original_dst/original_dst_cluster.h Makes Original DST worker-local LB refresh its cached host map via member-update callback; disables recreation.
source/extensions/clusters/dynamic_modules/cluster.cc Disables LB recreation on host changes for dynamic-modules cluster LB factory.
source/extensions/clusters/dynamic_forward_proxy/cluster.h Disables LB recreation on host changes for dynamic forward proxy cluster LB factory.
source/extensions/clusters/composite/cluster.h Disables LB recreation on host changes for composite cluster LB factory.
source/extensions/clusters/aggregate/cluster.h Disables LB recreation on host changes for aggregate cluster LB factory.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates multiple load balancer implementations to return false for recreateOnHostChange, optimizing performance by avoiding unnecessary re-creations. Specifically, OriginalDstCluster and RedisClusterLoadBalancer now utilize member update callbacks to refresh their internal state. The changes include updates to several cluster extensions and corresponding unit tests. Feedback was provided to improve the safety of the RedisClusterLoadBalancer constructor by avoiding a fragile initialization sequence involving std::move.

Comment thread source/extensions/clusters/redis/redis_cluster_lb.cc Outdated
agrawroh
agrawroh previously approved these changes May 20, 2026
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: code <wbphub@gmail.com>
@wbpcode
Copy link
Copy Markdown
Member Author

wbpcode commented May 20, 2026

/retest

wbpcode added 2 commits May 20, 2026 13:05
Signed-off-by: wbpcode/wangbaiping <wbphub@gmail.com>
@nezdolik nezdolik merged commit acb584a into envoyproxy:main May 21, 2026
29 checks passed
@wbpcode wbpcode deleted the dev-simplify-lb branch May 21, 2026 14:22
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.

4 participants