Skip to content

Commit

Permalink
xDS stateful session affinity: implement C-core filter (grpc#31788)
Browse files Browse the repository at this point in the history
* stateful session affinity: implement filter

* register filter config parser

* fix unused parameter errors

* remove some FIXMEs that are not longer needed

* clang-tidy

* iwyu

* iwyu

* revert iwyu changes to observability_logging_sink.cc

* generate_projects

* shorten filter name

* don't use absl::optional for path

* fix build

* don't add cookie to trailing metadata unless it's Trailers-Only
  • Loading branch information
markdroth authored Dec 6, 2022
1 parent 1bfc50f commit 5e4d9f4
Show file tree
Hide file tree
Showing 52 changed files with 622 additions and 58 deletions.
4 changes: 3 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ GRPC_XDS_TARGETS = [
"//src/core:grpc_resolver_xds",
"//src/core:grpc_resolver_c2p",
"//src/core:grpc_xds_server_config_fetcher",
"//src/core:grpc_stateful_session_filter",

# Not xDS-specific but currently only used by xDS.
"//src/core:channel_creds_registry_init",
Expand Down Expand Up @@ -3175,11 +3176,12 @@ grpc_cc_library(
"//src/core:channel_init",
"//src/core:channel_stack_type",
"//src/core:context",
"//src/core:for_each",
"//src/core:grpc_message_size_filter",
"//src/core:latch",
"//src/core:map_pipe",
"//src/core:percent_encoding",
"//src/core:pipe",
"//src/core:promise_like",
"//src/core:seq",
"//src/core:slice",
"//src/core:slice_buffer",
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.

4 changes: 4 additions & 0 deletions Makefile

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

4 changes: 4 additions & 0 deletions build_autogenerated.yaml

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

3 changes: 3 additions & 0 deletions config.m4

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

3 changes: 3 additions & 0 deletions config.w32

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

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

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

6 changes: 6 additions & 0 deletions gRPC-Core.podspec

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

4 changes: 4 additions & 0 deletions grpc.gemspec

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

2 changes: 2 additions & 0 deletions grpc.gyp

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

4 changes: 4 additions & 0 deletions package.xml

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

52 changes: 44 additions & 8 deletions src/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1903,7 +1903,6 @@ grpc_cc_library(
"absl/types:optional",
],
deps = [
"grpc_sockaddr",
"iomgr_port",
"status_helper",
"//:event_engine_base_hdrs",
Expand Down Expand Up @@ -2393,7 +2392,6 @@ grpc_cc_library(
language = "c++",
deps = [
"dual_ref_counted",
"error",
"grpc_service_config",
"ref_counted",
"service_config_parser",
Expand Down Expand Up @@ -2425,7 +2423,6 @@ grpc_cc_library(
"channel_args",
"channel_fwd",
"context",
"error",
"grpc_server_config_selector",
"grpc_service_config",
"status_helper",
Expand Down Expand Up @@ -3350,6 +3347,49 @@ grpc_cc_library(
],
)

grpc_cc_library(
name = "grpc_stateful_session_filter",
srcs = [
"ext/filters/stateful_session/stateful_session_filter.cc",
"ext/filters/stateful_session/stateful_session_service_config_parser.cc",
],
hdrs = [
"ext/filters/stateful_session/stateful_session_filter.h",
"ext/filters/stateful_session/stateful_session_service_config_parser.h",
],
external_deps = [
"absl/status",
"absl/status:statusor",
"absl/strings",
"absl/types:optional",
],
language = "c++",
deps = [
"arena",
"arena_promise",
"basic_seq",
"channel_args",
"channel_fwd",
"context",
"grpc_service_config",
"json",
"json_args",
"json_object_loader",
"latch",
"seq",
"service_config_parser",
"slice",
"time",
"try_concurrently",
"unique_type_name",
"validation_errors",
"//:config",
"//:gpr",
"//:grpc_base",
"//:grpc_trace",
],
)

grpc_cc_library(
name = "grpc_lb_policy_grpclb",
srcs = [
Expand Down Expand Up @@ -3717,7 +3757,6 @@ grpc_cc_library(
"channel_args",
"channel_args_preconditioning",
"channel_fwd",
"error",
"grpc_server_config_selector",
"grpc_server_config_selector_filter",
"grpc_service_config",
Expand All @@ -3729,7 +3768,6 @@ grpc_cc_library(
"match",
"resolved_address",
"slice_refcount",
"status_helper",
"unique_type_name",
"//:config",
"//:debug_location",
Expand Down Expand Up @@ -3963,7 +4001,6 @@ grpc_cc_library(
"lb_policy_factory",
"lb_policy_registry",
"pollset_set",
"ref_counted",
"subchannel_interface",
"time",
"validation_errors",
Expand Down Expand Up @@ -4250,7 +4287,6 @@ grpc_cc_library(
"lb_policy_factory",
"lb_policy_registry",
"pollset_set",
"ref_counted",
"subchannel_interface",
"time",
"validation_errors",
Expand Down Expand Up @@ -4291,7 +4327,6 @@ grpc_cc_library(
"lb_policy_factory",
"lb_policy_registry",
"pollset_set",
"ref_counted",
"subchannel_interface",
"time",
"validation_errors",
Expand Down Expand Up @@ -4888,6 +4923,7 @@ grpc_cc_library(
"//:gpr",
"//:gpr_platform",
"//:grpc_base",
"//:grpc_public_hdrs",
"//:hpack_encoder",
"//:hpack_parser",
],
Expand Down
1 change: 0 additions & 1 deletion src/core/ext/filters/client_channel/config_selector.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <grpc/slice.h>
#include <grpc/support/log.h>

#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/ref_counted.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/validation_errors.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/validation_errors.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/validation_errors.h"
Expand Down
1 change: 0 additions & 1 deletion src/core/ext/filters/client_channel/subchannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include <stddef.h>

#include <deque>
#include <functional>
#include <map>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include <inttypes.h>

#include <cstdint>
#include <functional>
#include <memory>
#include <utility>
Expand All @@ -43,9 +42,10 @@
#include "src/core/lib/compression/message_compress.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/promise/context.h"
#include "src/core/lib/promise/for_each.h"
#include "src/core/lib/promise/detail/promise_like.h"
#include "src/core/lib/promise/latch.h"
#include "src/core/lib/promise/map_pipe.h"
#include "src/core/lib/promise/pipe.h"
#include "src/core/lib/promise/promise.h"
#include "src/core/lib/promise/seq.h"
#include "src/core/lib/promise/try_concurrently.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"

#include <grpc/impl/codegen/grpc_types.h>

#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/dual_ref_counted.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/service_config/service_config.h"
#include "src/core/lib/service_config/service_config_parser.h"
#include "src/core/lib/transport/metadata_batch.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/promise/arena_promise.h"
#include "src/core/lib/promise/context.h"
#include "src/core/lib/promise/promise.h"
Expand Down
Loading

0 comments on commit 5e4d9f4

Please sign in to comment.