From b63a21b419040506df091854c45654dadbf822f2 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 11 Dec 2023 13:36:14 -0800 Subject: [PATCH] [inproc] Call out requirements for inproc transport experiment (#35267) Closes #35267 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35267 from ctiller:cg-experiment-requires 242a3cd21a28257266b128a6ab7074615c2ed78e PiperOrigin-RevId: 589932835 --- bazel/experiments.bzl | 2 +- src/core/lib/experiments/experiments.cc | 57 ++++++++++++++--------- src/core/lib/experiments/experiments.h | 16 +++---- src/core/lib/experiments/experiments.yaml | 1 + 4 files changed, 46 insertions(+), 30 deletions(-) diff --git a/bazel/experiments.bzl b/bazel/experiments.bzl index 4bac512e438..a1b5860a9c6 100644 --- a/bazel/experiments.bzl +++ b/bazel/experiments.bzl @@ -36,10 +36,10 @@ EXPERIMENT_ENABLES = { "pending_queue_cap": "pending_queue_cap", "pick_first_happy_eyeballs": "pick_first_happy_eyeballs", "promise_based_client_call": "promise_based_client_call", - "promise_based_inproc_transport": "promise_based_inproc_transport", "promise_based_server_call": "promise_based_server_call", "red_max_concurrent_streams": "red_max_concurrent_streams", "registered_method_lookup_in_transport": "registered_method_lookup_in_transport", + "promise_based_inproc_transport": "promise_based_client_call,promise_based_inproc_transport,promise_based_server_call,registered_method_lookup_in_transport", "registered_methods_map": "registered_methods_map", "rfc_max_concurrent_streams": "rfc_max_concurrent_streams", "round_robin_delegate_to_pick_first": "round_robin_delegate_to_pick_first", diff --git a/src/core/lib/experiments/experiments.cc b/src/core/lib/experiments/experiments.cc index 0639dd28155..a49b5554e88 100644 --- a/src/core/lib/experiments/experiments.cc +++ b/src/core/lib/experiments/experiments.cc @@ -93,9 +93,6 @@ const char* const description_promise_based_client_call = "If set, use the new gRPC promise based call code when it's appropriate " "(ie when all filters in a stack are promise based)"; const char* const additional_constraints_promise_based_client_call = "{}"; -const char* const description_promise_based_inproc_transport = - "Use promises for the in-process transport."; -const char* const additional_constraints_promise_based_inproc_transport = "{}"; const char* const description_promise_based_server_call = "If set, use the new gRPC promise based call code when it's appropriate " "(ie when all filters in a stack are promise based)"; @@ -108,6 +105,14 @@ const char* const description_registered_method_lookup_in_transport = "Change registered method's lookup point to transport"; const char* const additional_constraints_registered_method_lookup_in_transport = "{}"; +const char* const description_promise_based_inproc_transport = + "Use promises for the in-process transport."; +const char* const additional_constraints_promise_based_inproc_transport = "{}"; +const uint8_t required_experiments_promise_based_inproc_transport[] = { + static_cast(grpc_core::kExperimentIdPromiseBasedClientCall), + static_cast(grpc_core::kExperimentIdPromiseBasedServerCall), + static_cast( + grpc_core::kExperimentIdRegisteredMethodLookupInTransport)}; const char* const description_registered_methods_map = "Use absl::flat_hash_map for registered methods."; const char* const additional_constraints_registered_methods_map = "{}"; @@ -222,10 +227,6 @@ const ExperimentMetadata g_experiment_metadata[] = { additional_constraints_pick_first_happy_eyeballs, nullptr, 0, true, true}, {"promise_based_client_call", description_promise_based_client_call, additional_constraints_promise_based_client_call, nullptr, 0, false, true}, - {"promise_based_inproc_transport", - description_promise_based_inproc_transport, - additional_constraints_promise_based_inproc_transport, nullptr, 0, false, - false}, {"promise_based_server_call", description_promise_based_server_call, additional_constraints_promise_based_server_call, nullptr, 0, false, true}, {"red_max_concurrent_streams", description_red_max_concurrent_streams, @@ -235,6 +236,10 @@ const ExperimentMetadata g_experiment_metadata[] = { description_registered_method_lookup_in_transport, additional_constraints_registered_method_lookup_in_transport, nullptr, 0, true, true}, + {"promise_based_inproc_transport", + description_promise_based_inproc_transport, + additional_constraints_promise_based_inproc_transport, + required_experiments_promise_based_inproc_transport, 3, false, false}, {"registered_methods_map", description_registered_methods_map, additional_constraints_registered_methods_map, nullptr, 0, false, true}, {"rfc_max_concurrent_streams", description_rfc_max_concurrent_streams, @@ -352,9 +357,6 @@ const char* const description_promise_based_client_call = "If set, use the new gRPC promise based call code when it's appropriate " "(ie when all filters in a stack are promise based)"; const char* const additional_constraints_promise_based_client_call = "{}"; -const char* const description_promise_based_inproc_transport = - "Use promises for the in-process transport."; -const char* const additional_constraints_promise_based_inproc_transport = "{}"; const char* const description_promise_based_server_call = "If set, use the new gRPC promise based call code when it's appropriate " "(ie when all filters in a stack are promise based)"; @@ -367,6 +369,14 @@ const char* const description_registered_method_lookup_in_transport = "Change registered method's lookup point to transport"; const char* const additional_constraints_registered_method_lookup_in_transport = "{}"; +const char* const description_promise_based_inproc_transport = + "Use promises for the in-process transport."; +const char* const additional_constraints_promise_based_inproc_transport = "{}"; +const uint8_t required_experiments_promise_based_inproc_transport[] = { + static_cast(grpc_core::kExperimentIdPromiseBasedClientCall), + static_cast(grpc_core::kExperimentIdPromiseBasedServerCall), + static_cast( + grpc_core::kExperimentIdRegisteredMethodLookupInTransport)}; const char* const description_registered_methods_map = "Use absl::flat_hash_map for registered methods."; const char* const additional_constraints_registered_methods_map = "{}"; @@ -481,10 +491,6 @@ const ExperimentMetadata g_experiment_metadata[] = { additional_constraints_pick_first_happy_eyeballs, nullptr, 0, true, true}, {"promise_based_client_call", description_promise_based_client_call, additional_constraints_promise_based_client_call, nullptr, 0, false, true}, - {"promise_based_inproc_transport", - description_promise_based_inproc_transport, - additional_constraints_promise_based_inproc_transport, nullptr, 0, false, - false}, {"promise_based_server_call", description_promise_based_server_call, additional_constraints_promise_based_server_call, nullptr, 0, false, true}, {"red_max_concurrent_streams", description_red_max_concurrent_streams, @@ -494,6 +500,10 @@ const ExperimentMetadata g_experiment_metadata[] = { description_registered_method_lookup_in_transport, additional_constraints_registered_method_lookup_in_transport, nullptr, 0, true, true}, + {"promise_based_inproc_transport", + description_promise_based_inproc_transport, + additional_constraints_promise_based_inproc_transport, + required_experiments_promise_based_inproc_transport, 3, false, false}, {"registered_methods_map", description_registered_methods_map, additional_constraints_registered_methods_map, nullptr, 0, false, true}, {"rfc_max_concurrent_streams", description_rfc_max_concurrent_streams, @@ -611,9 +621,6 @@ const char* const description_promise_based_client_call = "If set, use the new gRPC promise based call code when it's appropriate " "(ie when all filters in a stack are promise based)"; const char* const additional_constraints_promise_based_client_call = "{}"; -const char* const description_promise_based_inproc_transport = - "Use promises for the in-process transport."; -const char* const additional_constraints_promise_based_inproc_transport = "{}"; const char* const description_promise_based_server_call = "If set, use the new gRPC promise based call code when it's appropriate " "(ie when all filters in a stack are promise based)"; @@ -626,6 +633,14 @@ const char* const description_registered_method_lookup_in_transport = "Change registered method's lookup point to transport"; const char* const additional_constraints_registered_method_lookup_in_transport = "{}"; +const char* const description_promise_based_inproc_transport = + "Use promises for the in-process transport."; +const char* const additional_constraints_promise_based_inproc_transport = "{}"; +const uint8_t required_experiments_promise_based_inproc_transport[] = { + static_cast(grpc_core::kExperimentIdPromiseBasedClientCall), + static_cast(grpc_core::kExperimentIdPromiseBasedServerCall), + static_cast( + grpc_core::kExperimentIdRegisteredMethodLookupInTransport)}; const char* const description_registered_methods_map = "Use absl::flat_hash_map for registered methods."; const char* const additional_constraints_registered_methods_map = "{}"; @@ -740,10 +755,6 @@ const ExperimentMetadata g_experiment_metadata[] = { additional_constraints_pick_first_happy_eyeballs, nullptr, 0, true, true}, {"promise_based_client_call", description_promise_based_client_call, additional_constraints_promise_based_client_call, nullptr, 0, false, true}, - {"promise_based_inproc_transport", - description_promise_based_inproc_transport, - additional_constraints_promise_based_inproc_transport, nullptr, 0, false, - false}, {"promise_based_server_call", description_promise_based_server_call, additional_constraints_promise_based_server_call, nullptr, 0, false, true}, {"red_max_concurrent_streams", description_red_max_concurrent_streams, @@ -753,6 +764,10 @@ const ExperimentMetadata g_experiment_metadata[] = { description_registered_method_lookup_in_transport, additional_constraints_registered_method_lookup_in_transport, nullptr, 0, true, true}, + {"promise_based_inproc_transport", + description_promise_based_inproc_transport, + additional_constraints_promise_based_inproc_transport, + required_experiments_promise_based_inproc_transport, 3, false, false}, {"registered_methods_map", description_registered_methods_map, additional_constraints_registered_methods_map, nullptr, 0, false, true}, {"rfc_max_concurrent_streams", description_rfc_max_concurrent_streams, diff --git a/src/core/lib/experiments/experiments.h b/src/core/lib/experiments/experiments.h index bf17ee2ce3b..2e680ac8ead 100644 --- a/src/core/lib/experiments/experiments.h +++ b/src/core/lib/experiments/experiments.h @@ -91,11 +91,11 @@ inline bool IsPendingQueueCapEnabled() { return true; } #define GRPC_EXPERIMENT_IS_INCLUDED_PICK_FIRST_HAPPY_EYEBALLS inline bool IsPickFirstHappyEyeballsEnabled() { return true; } inline bool IsPromiseBasedClientCallEnabled() { return false; } -inline bool IsPromiseBasedInprocTransportEnabled() { return false; } inline bool IsPromiseBasedServerCallEnabled() { return false; } inline bool IsRedMaxConcurrentStreamsEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; } +inline bool IsPromiseBasedInprocTransportEnabled() { return false; } inline bool IsRegisteredMethodsMapEnabled() { return false; } inline bool IsRfcMaxConcurrentStreamsEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST @@ -154,11 +154,11 @@ inline bool IsPendingQueueCapEnabled() { return true; } #define GRPC_EXPERIMENT_IS_INCLUDED_PICK_FIRST_HAPPY_EYEBALLS inline bool IsPickFirstHappyEyeballsEnabled() { return true; } inline bool IsPromiseBasedClientCallEnabled() { return false; } -inline bool IsPromiseBasedInprocTransportEnabled() { return false; } inline bool IsPromiseBasedServerCallEnabled() { return false; } inline bool IsRedMaxConcurrentStreamsEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; } +inline bool IsPromiseBasedInprocTransportEnabled() { return false; } inline bool IsRegisteredMethodsMapEnabled() { return false; } inline bool IsRfcMaxConcurrentStreamsEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST @@ -217,11 +217,11 @@ inline bool IsPendingQueueCapEnabled() { return true; } #define GRPC_EXPERIMENT_IS_INCLUDED_PICK_FIRST_HAPPY_EYEBALLS inline bool IsPickFirstHappyEyeballsEnabled() { return true; } inline bool IsPromiseBasedClientCallEnabled() { return false; } -inline bool IsPromiseBasedInprocTransportEnabled() { return false; } inline bool IsPromiseBasedServerCallEnabled() { return false; } inline bool IsRedMaxConcurrentStreamsEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; } +inline bool IsPromiseBasedInprocTransportEnabled() { return false; } inline bool IsRegisteredMethodsMapEnabled() { return false; } inline bool IsRfcMaxConcurrentStreamsEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST @@ -266,10 +266,10 @@ enum ExperimentIds { kExperimentIdPendingQueueCap, kExperimentIdPickFirstHappyEyeballs, kExperimentIdPromiseBasedClientCall, - kExperimentIdPromiseBasedInprocTransport, kExperimentIdPromiseBasedServerCall, kExperimentIdRedMaxConcurrentStreams, kExperimentIdRegisteredMethodLookupInTransport, + kExperimentIdPromiseBasedInprocTransport, kExperimentIdRegisteredMethodsMap, kExperimentIdRfcMaxConcurrentStreams, kExperimentIdRoundRobinDelegateToPickFirst, @@ -364,10 +364,6 @@ inline bool IsPickFirstHappyEyeballsEnabled() { inline bool IsPromiseBasedClientCallEnabled() { return IsExperimentEnabled(kExperimentIdPromiseBasedClientCall); } -#define GRPC_EXPERIMENT_IS_INCLUDED_PROMISE_BASED_INPROC_TRANSPORT -inline bool IsPromiseBasedInprocTransportEnabled() { - return IsExperimentEnabled(kExperimentIdPromiseBasedInprocTransport); -} #define GRPC_EXPERIMENT_IS_INCLUDED_PROMISE_BASED_SERVER_CALL inline bool IsPromiseBasedServerCallEnabled() { return IsExperimentEnabled(kExperimentIdPromiseBasedServerCall); @@ -380,6 +376,10 @@ inline bool IsRedMaxConcurrentStreamsEnabled() { inline bool IsRegisteredMethodLookupInTransportEnabled() { return IsExperimentEnabled(kExperimentIdRegisteredMethodLookupInTransport); } +#define GRPC_EXPERIMENT_IS_INCLUDED_PROMISE_BASED_INPROC_TRANSPORT +inline bool IsPromiseBasedInprocTransportEnabled() { + return IsExperimentEnabled(kExperimentIdPromiseBasedInprocTransport); +} #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHODS_MAP inline bool IsRegisteredMethodsMapEnabled() { return IsExperimentEnabled(kExperimentIdRegisteredMethodsMap); diff --git a/src/core/lib/experiments/experiments.yaml b/src/core/lib/experiments/experiments.yaml index 54b3ea6ff15..d42e14ee34a 100644 --- a/src/core/lib/experiments/experiments.yaml +++ b/src/core/lib/experiments/experiments.yaml @@ -169,6 +169,7 @@ owner: ctiller@google.com test_tags: [] allow_in_fuzzing_config: false # experiment currently crashes if enabled + requires: [promise_based_client_call, promise_based_server_call, registered_method_lookup_in_transport] - name: promise_based_server_call description: If set, use the new gRPC promise based call code when it's appropriate