From 2d38cfd69ea4767cbd2bed2137dcf04dc4dc4345 Mon Sep 17 00:00:00 2001 From: Lenar Fatikhov Date: Fri, 10 May 2024 21:36:38 -0700 Subject: [PATCH] pass distribution set configs Summary: `enable_set_distribution` - enable distribution of cross-region set requests. `enable_cross_region_set_rpc` - disable cross-region set RPC. Can be only disabled if distribution is enabled. Reviewed By: stuclar Differential Revision: D56885372 fbshipit-source-id: 0e908c343d4bbf87d6d248315c595c0b8e154e06 --- mcrouter/ProxyConfig-inl.h | 10 +++++++++- mcrouter/routes/RootRoute.h | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mcrouter/ProxyConfig-inl.h b/mcrouter/ProxyConfig-inl.h index 18d081851..393ec7ffa 100644 --- a/mcrouter/ProxyConfig-inl.h +++ b/mcrouter/ProxyConfig-inl.h @@ -128,6 +128,12 @@ ProxyConfig::ProxyConfig( bool enableAsyncDlBroadcast = readBool("enable_async_dl_broadcast", false); + bool enableCrossRegionSetRpc = readBool("enable_cross_region_set_rpc", true); + bool enableSetDistribution = readBool("enable_set_distribution", false); + checkLogic( + enableSetDistribution || enableCrossRegionSetRpc, + "ProxyConfig: cannot disable cross-region set rpc if set distribution is disabled"); + proxy.router().runtimeFeatures_.enableOdslScuba = readBool("enable_odsl_scuba", false); proxy.router().runtimeFeatures_.enableOdslODS = @@ -143,7 +149,9 @@ ProxyConfig::ProxyConfig( RootRouteRolloutOpts{ .enableDeleteDistribution = enableDeleteDistribution, .enableCrossRegionDeleteRpc = enableCrossRegionDeleteRpc, - .enableAsyncDlBroadcast = enableAsyncDlBroadcast}); + .enableAsyncDlBroadcast = enableAsyncDlBroadcast, + .enableSetDistribution = enableSetDistribution, + .enableCrossRegionSetRpc = enableCrossRegionSetRpc}); serviceInfo_ = std::make_shared>(proxy, *this); } diff --git a/mcrouter/routes/RootRoute.h b/mcrouter/routes/RootRoute.h index 67dce7fc6..3425a2853 100644 --- a/mcrouter/routes/RootRoute.h +++ b/mcrouter/routes/RootRoute.h @@ -30,6 +30,8 @@ struct RootRouteRolloutOpts { bool enableDeleteDistribution = false; bool enableCrossRegionDeleteRpc = true; bool enableAsyncDlBroadcast = false; + bool enableSetDistribution = false; + bool enableCrossRegionSetRpc = true; }; template @@ -52,7 +54,9 @@ class RootRoute { defaultRoute_(opts_.default_route), enableDeleteDistribution_(rolloutOpts.enableDeleteDistribution), enableCrossRegionDeleteRpc_(rolloutOpts.enableCrossRegionDeleteRpc), - enableAsyncDlBroadcast_(rolloutOpts.enableAsyncDlBroadcast) {} + enableAsyncDlBroadcast_(rolloutOpts.enableAsyncDlBroadcast), + enableSetDistribution_(rolloutOpts.enableSetDistribution), + enableCrossRegionSetRpc_(rolloutOpts.enableCrossRegionSetRpc) {} template bool traverse( @@ -131,6 +135,8 @@ class RootRoute { bool enableDeleteDistribution_; bool enableCrossRegionDeleteRpc_; bool enableAsyncDlBroadcast_; + bool enableSetDistribution_; + bool enableCrossRegionSetRpc_; template FOLLY_ALWAYS_INLINE ReplyT getTargetsAndRoute(