Skip to content

Commit

Permalink
[LB policy API] change metadata mutation API to handle discarded picks (
Browse files Browse the repository at this point in the history
grpc#36968)

Previously, metadata mutations were made by the picker directly, which meant that they would be applied even if the channel winds up discarding the pick due to the returned subchannel having been disconnected by the time the pick result is returned.  This changes the API such that pickers return metadata mutations along with the pick result, so that the mutations won't get applied unless the pick result is actually used.

Closes grpc#36968

COPYBARA_INTEGRATE_REVIEW=grpc#36968 from markdroth:lb_metadata_api 2765da6
PiperOrigin-RevId: 645451869
  • Loading branch information
markdroth authored and sourabhsinghs committed Sep 26, 2024
1 parent c3a1279 commit f1d602f
Show file tree
Hide file tree
Showing 40 changed files with 355 additions and 259 deletions.
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3818,6 +3818,7 @@ grpc_cc_library(
"//src/core:iomgr_fwd",
"//src/core:json",
"//src/core:latch",
"//src/core:lb_metadata",
"//src/core:lb_policy",
"//src/core:lb_policy_registry",
"//src/core:loop",
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Package.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion build_autogenerated.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config.m4

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config.w32

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions gRPC-C++.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions gRPC-Core.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion grpc.gemspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions src/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3456,6 +3456,7 @@ grpc_cc_library(
hdrs = ["load_balancing/lb_policy.h"],
external_deps = [
"absl/base:core_headers",
"absl/container:inlined_vector",
"absl/status",
"absl/status:statusor",
"absl/strings",
Expand Down Expand Up @@ -3525,6 +3526,21 @@ grpc_cc_library(
],
)

grpc_cc_library(
name = "lb_metadata",
srcs = ["client_channel/lb_metadata.cc"],
hdrs = ["client_channel/lb_metadata.h"],
external_deps = [
"absl/log:log",
"absl/strings",
"absl/types:optional",
],
deps = [
"lb_policy",
"metadata_batch",
],
)

grpc_cc_library(
name = "subchannel_interface",
hdrs = ["load_balancing/subchannel_interface.h"],
Expand Down Expand Up @@ -5009,6 +5025,7 @@ grpc_cc_library(
"slice_refcount",
"status_helper",
"time",
"upb_utils",
"uuid_v4",
"validation_errors",
"//:backoff",
Expand Down Expand Up @@ -5039,14 +5056,13 @@ grpc_cc_library(
grpc_cc_library(
name = "upb_utils",
hdrs = [
"xds/grpc/upb_utils.h",
"util/upb_utils.h",
],
external_deps = [
"absl/strings",
"@com_google_protobuf//upb:base",
],
language = "c++",
deps = ["//:gpr_platform"],
)

grpc_cc_library(
Expand Down
Loading

0 comments on commit f1d602f

Please sign in to comment.