Skip to content

Commit

Permalink
pass distribution set configs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Lenar Fatikhov authored and facebook-github-bot committed May 11, 2024
1 parent 4896c1f commit 2d38cfd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion mcrouter/ProxyConfig-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ ProxyConfig<RouterInfo>::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 =
Expand All @@ -143,7 +149,9 @@ ProxyConfig<RouterInfo>::ProxyConfig(
RootRouteRolloutOpts{
.enableDeleteDistribution = enableDeleteDistribution,
.enableCrossRegionDeleteRpc = enableCrossRegionDeleteRpc,
.enableAsyncDlBroadcast = enableAsyncDlBroadcast});
.enableAsyncDlBroadcast = enableAsyncDlBroadcast,
.enableSetDistribution = enableSetDistribution,
.enableCrossRegionSetRpc = enableCrossRegionSetRpc});
serviceInfo_ = std::make_shared<ServiceInfo<RouterInfo>>(proxy, *this);
}

Expand Down
8 changes: 7 additions & 1 deletion mcrouter/routes/RootRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ struct RootRouteRolloutOpts {
bool enableDeleteDistribution = false;
bool enableCrossRegionDeleteRpc = true;
bool enableAsyncDlBroadcast = false;
bool enableSetDistribution = false;
bool enableCrossRegionSetRpc = true;
};

template <class RouterInfo>
Expand All @@ -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 <class Request>
bool traverse(
Expand Down Expand Up @@ -131,6 +135,8 @@ class RootRoute {
bool enableDeleteDistribution_;
bool enableCrossRegionDeleteRpc_;
bool enableAsyncDlBroadcast_;
bool enableSetDistribution_;
bool enableCrossRegionSetRpc_;

template <class Request>
FOLLY_ALWAYS_INLINE ReplyT<Request> getTargetsAndRoute(
Expand Down

0 comments on commit 2d38cfd

Please sign in to comment.