Skip to content

xds: Hold parsed service config in CdsUpdate#12828

Open
ejona86 wants to merge 1 commit into
grpc:masterfrom
ejona86:xds-update-holds-parsed-config
Open

xds: Hold parsed service config in CdsUpdate#12828
ejona86 wants to merge 1 commit into
grpc:masterfrom
ejona86:xds-update-holds-parsed-config

Conversation

@ejona86
Copy link
Copy Markdown
Member

@ejona86 ejona86 commented May 26, 2026

This avoids re-parsing the config within CdsLB, as the providers could have changed and the config may no longer be valid.

Many usages of ServiceConfigUtil.unwrapLoadBalancingConfig() were replaced with public API, which should be less brittle to internal changes. Similarly, config.equals() was added for LBs least_request, ring_hash, wrr to use more public APIs in testing. But I've gone out of my way to avoid using equals for XdsClient change detection, by preserving the original "JSON" config.

This fixes a bug in WRR config parsing which prevented it from parsing errorUtilizationPenalty as it assumed it would be a Float, not a Double like our parser actually generates and our API requires. JsonUtil.getNumberAsFloat() was added specifically for WRR and has never worked as JSON Numbers will always be Doubles.

In XdsClusterResource.CdsUpdate, the LB-specific fields like minRingSize were already not used at all, so this commit deletes them as it seems a relevant cleanup.

Fixes #12733

CC @lepistone

@ejona86 ejona86 requested a review from kannanjgithub May 26, 2026 23:57
@ejona86
Copy link
Copy Markdown
Member Author

ejona86 commented May 27, 2026

Whoa. Apparently I was on a really old commit when I started this. I don't really follow, but I'll need to rebase. Closing for the moment; I'll reopen when things are fixed up.

@ejona86 ejona86 closed this May 27, 2026
This avoids re-parsing the config within CdsLB, as the providers could
have changed and the config may no longer be valid.

Many usages of ServiceConfigUtil.unwrapLoadBalancingConfig() were
replaced with public API, which should be less brittle to internal
changes. Similarly, config.equals() was added for LBs least_request,
ring_hash, wrr to use more public APIs in testing. But I've gone out of
my way to avoid using equals for XdsClient change detection, by
preserving the original "JSON" config.

This fixes a bug in WRR config parsing which prevented it from parsing
errorUtilizationPenalty as it assumed it would be a Float, not a Double
like our parser actually generates and our API requires.
JsonUtil.getNumberAsFloat() was added specifically for WRR and has never
worked as JSON Numbers will always be Doubles.

In XdsClusterResource.CdsUpdate, the LB-specific fields like minRingSize
were already not used at all, so this commit deletes them as it seems
a relevant cleanup.

Fixes grpc#12733
@ejona86 ejona86 reopened this May 27, 2026
@ejona86 ejona86 force-pushed the xds-update-holds-parsed-config branch from 3effbb4 to bb91229 Compare May 27, 2026 20:20
@ejona86
Copy link
Copy Markdown
Member Author

ejona86 commented May 27, 2026

Rebased on a recent commit now, instead of something from a year ago.

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.

CdsLoadBalancer2 re-parsing LB config can fail if LoadBalancerRegistry is mutated

1 participant