Skip to content

More LB policy API improvements.#19049

Merged
markdroth merged 1 commit intogrpc:masterfrom
markdroth:lb_policy_api_cleanups
May 29, 2019
Merged

More LB policy API improvements.#19049
markdroth merged 1 commit intogrpc:masterfrom
markdroth:lb_policy_api_cleanups

Conversation

@markdroth
Copy link
Copy Markdown
Member

@markdroth markdroth commented May 16, 2019

  • Move output parameters out of PickArgs and into PickResult. Pick() now takes the PickArgs parameter by value and returns PickResult. The error is now part of PickResult.
  • Add CallState abstraction to allow LB policies to allocate memory via the call arena. Use this to eliminate the PickArgs::lb_token_mdelem_storage field. (CallState will also be used in future PRs to provide access to backend metric data.)
  • Simplify the API for an LB policy to intercept recv_trailing_metadata. Now the LB policy gets a simple synchronous callback and is no longer responsible for chaining back up the stack.
  • Move LB policy config class inside of LoadBalancingPolicy class.

This change is Reviewable

@markdroth markdroth added the release notes: no Indicates if PR should not be in release notes label May 16, 2019
@markdroth markdroth force-pushed the lb_policy_api_cleanups branch from 66e0e3a to 31ec9a7 Compare May 28, 2019 21:23
Copy link
Copy Markdown
Contributor

@AspirinSJL AspirinSJL left a comment

Choose a reason for hiding this comment

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

Great work! The code is easier to understand.

Reviewed 15 of 15 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @apolcyn and @markdroth)


src/core/ext/filters/client_channel/lb_policy.h, line 105 at r1 (raw file):

    /// An interface for accessing call state.  Can be used to allocate
    /// data associated with the call in an efficient way.
    CallState* call_state;

This should be initialized to null.

Copy link
Copy Markdown
Member Author

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @apolcyn and @AspirinSJL)


src/core/ext/filters/client_channel/lb_policy.h, line 105 at r1 (raw file):

Previously, AspirinSJL (Juanli Shen) wrote…

This should be initialized to null.

I don't think that's necessary, since it will be set unconditionally by the channel.

@markdroth
Copy link
Copy Markdown
Member Author

Known issues: #19005 #13727 #19170 #18967

@markdroth markdroth merged commit 9ecce9f into grpc:master May 29, 2019
@markdroth markdroth deleted the lb_policy_api_cleanups branch May 29, 2019 14:12
Copy link
Copy Markdown
Contributor

@AspirinSJL AspirinSJL left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @apolcyn and @markdroth)


src/core/ext/filters/client_channel/client_channel.cc, line 1337 at r1 (raw file):

  }
  LoadBalancingPolicy::PickResult result =
      picker_->Pick(LoadBalancingPolicy::PickArgs());

But here we don't get call_state initialized?


src/core/ext/filters/client_channel/lb_policy.h, line 105 at r1 (raw file):

Previously, markdroth (Mark D. Roth) wrote…

I don't think that's necessary, since it will be set unconditionally by the channel.

It seems uninitialized in DoPingLocked().

Copy link
Copy Markdown
Member Author

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @apolcyn, @AspirinSJL, and @markdroth)


src/core/ext/filters/client_channel/lb_policy.h, line 105 at r1 (raw file):

Previously, AspirinSJL (Juanli Shen) wrote…

It seems uninitialized in DoPingLocked().

Yeah, but I'm not worried about that. That code-path is only ever executed from tests; there is no public API by which users can trigger it. And the tests that use it only use pick_first, and we know that pick_first doesn't use call state object.

Basically, the ping code-path is kind of a hack for tests and not very well supported anyway, so I don't feel the need to provide any real guarantees about the API in that case.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release notes: no Indicates if PR should not be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants