Skip to content

xds: Disable Priority LB child policy retention cache#12806

Open
shivaspeaks wants to merge 2 commits into
grpc:masterfrom
shivaspeaks:A-115
Open

xds: Disable Priority LB child policy retention cache#12806
shivaspeaks wants to merge 2 commits into
grpc:masterfrom
shivaspeaks:A-115

Conversation

@shivaspeaks
Copy link
Copy Markdown
Member

@shivaspeaks shivaspeaks requested a review from ejona86 May 13, 2026 07:19
private SubchannelPicker currentPicker;
// Set to true if currently in the process of handling resolved addresses.
private boolean handlingResolvedAddresses;
private boolean isPriorityLbChildPolicyCacheEnabled =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I really want our flags to be static. Having them change can be quite confusing.

And it could be final as well, as it doesn't change. However, it is generally cleaner to change this variable in tests than changing system properties. So I'd favor keeping this non-final, make it package-private, and change the tests to use it.

Part of the trouble with changing the system property is you can get it wrong and not actually be testing any change of behavior (e.g., if the flag is static and not re-computed).

verify(fooBalancer1).shutdown();
verify(barBalancer0, never()).shutdown();
} finally {
System.clearProperty("GRPC_EXPERIMENTAL_ENABLE_PRIORITY_LB_CHILD_POLICY_CACHE");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Really, we want to restore the value. So we'd need to save the current value and either set the old value or clear the value (if it were null). jdcormie did make FlagResetRule, in case you want to avoid the try-finally. It supports restoring fields, not just system poperties.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll restore the prev value in finally.

if (enablePriorityLbChildPolicyCache) {
childLbState.deactivate();
} else {
children.remove(priority);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Just because" let's keep the order of the tearDown+remove lines the same as DeletionTask. Yes, it should work both ways, but we also gain nothing by rearranging it.

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.

2 participants