From 7f5c6913b6a9b654d5ddcf99afa2bd2906619067 Mon Sep 17 00:00:00 2001 From: Xiaofei Hu Date: Fri, 23 Aug 2024 09:57:48 -0700 Subject: [PATCH] Add a constexpr var to indicate whether McRefill is enabled for a Router Summary: as title Reviewed By: disylh Differential Revision: D61503306 fbshipit-source-id: edd74112c23088fa512afd36493cb438a23a2f83 --- mcrouter/lib/carbon/example/gen/HelloGoodbyeRouterInfo.h | 1 + mcrouter/lib/carbon/test/gen/ARouterInfo.h | 1 + mcrouter/lib/carbon/test/gen/BRouterInfo.h | 1 + mcrouter/lib/carbon/test/gen/CarbonTestRouterInfo.h | 1 + mcrouter/lib/carbon/test/gen/CarbonThriftTestRouterInfo.h | 1 + mcrouter/lib/network/Memcache.idl | 3 +++ mcrouter/lib/network/gen/MemcacheRouterInfo.cpp | 3 +++ mcrouter/lib/network/gen/MemcacheRouterInfo.h | 1 + 8 files changed, 12 insertions(+) diff --git a/mcrouter/lib/carbon/example/gen/HelloGoodbyeRouterInfo.h b/mcrouter/lib/carbon/example/gen/HelloGoodbyeRouterInfo.h index 3b5bb27e7..da7513883 100644 --- a/mcrouter/lib/carbon/example/gen/HelloGoodbyeRouterInfo.h +++ b/mcrouter/lib/carbon/example/gen/HelloGoodbyeRouterInfo.h @@ -76,6 +76,7 @@ struct HelloGoodbyeRouterInfo { static constexpr const char* name = "HelloGoodbye"; static constexpr const bool bucketization = false; static constexpr const bool useRequestAclChecker = false; + static constexpr const bool hasMcRefillRoute = false; template using RouteHandle = HelloGoodbyeRouteHandle; diff --git a/mcrouter/lib/carbon/test/gen/ARouterInfo.h b/mcrouter/lib/carbon/test/gen/ARouterInfo.h index b46dd1773..c9f4616f9 100644 --- a/mcrouter/lib/carbon/test/gen/ARouterInfo.h +++ b/mcrouter/lib/carbon/test/gen/ARouterInfo.h @@ -79,6 +79,7 @@ struct ARouterInfo { static constexpr const char* name = "A"; static constexpr const bool bucketization = false; static constexpr const bool useRequestAclChecker = false; + static constexpr const bool hasMcRefillRoute = false; template using RouteHandle = ARouteHandle; diff --git a/mcrouter/lib/carbon/test/gen/BRouterInfo.h b/mcrouter/lib/carbon/test/gen/BRouterInfo.h index 1268f435e..81387bc59 100644 --- a/mcrouter/lib/carbon/test/gen/BRouterInfo.h +++ b/mcrouter/lib/carbon/test/gen/BRouterInfo.h @@ -79,6 +79,7 @@ struct BRouterInfo { static constexpr const char* name = "B"; static constexpr const bool bucketization = false; static constexpr const bool useRequestAclChecker = false; + static constexpr const bool hasMcRefillRoute = false; template using RouteHandle = BRouteHandle; diff --git a/mcrouter/lib/carbon/test/gen/CarbonTestRouterInfo.h b/mcrouter/lib/carbon/test/gen/CarbonTestRouterInfo.h index a75d9a6ac..891c7393f 100644 --- a/mcrouter/lib/carbon/test/gen/CarbonTestRouterInfo.h +++ b/mcrouter/lib/carbon/test/gen/CarbonTestRouterInfo.h @@ -79,6 +79,7 @@ struct CarbonTestRouterInfo { static constexpr const char* name = "CarbonTest"; static constexpr const bool bucketization = false; static constexpr const bool useRequestAclChecker = false; + static constexpr const bool hasMcRefillRoute = false; template using RouteHandle = CarbonTestRouteHandle; diff --git a/mcrouter/lib/carbon/test/gen/CarbonThriftTestRouterInfo.h b/mcrouter/lib/carbon/test/gen/CarbonThriftTestRouterInfo.h index 75d036c33..71d49a208 100644 --- a/mcrouter/lib/carbon/test/gen/CarbonThriftTestRouterInfo.h +++ b/mcrouter/lib/carbon/test/gen/CarbonThriftTestRouterInfo.h @@ -82,6 +82,7 @@ struct CarbonThriftTestRouterInfo { static constexpr const char* name = "CarbonThriftTest"; static constexpr const bool bucketization = false; static constexpr const bool useRequestAclChecker = false; + static constexpr const bool hasMcRefillRoute = false; template using RouteHandle = CarbonThriftTestRouteHandle; diff --git a/mcrouter/lib/network/Memcache.idl b/mcrouter/lib/network/Memcache.idl index cfdc769e9..6993df415 100644 --- a/mcrouter/lib/network/Memcache.idl +++ b/mcrouter/lib/network/Memcache.idl @@ -472,6 +472,9 @@ reply McGatsReply with 1: MemcacheReplyCommon { service { additional_requests: []; + additional_route_handles: [ + McRefillRoute @ "mcrouter/routes/McRefillRoute.h" + ]; on_reply_logger: facebook::memcache::mcrouter::AdditionalProxyRequestLogger; enable_shutdown: false; stats: { diff --git a/mcrouter/lib/network/gen/MemcacheRouterInfo.cpp b/mcrouter/lib/network/gen/MemcacheRouterInfo.cpp index 256ae7710..f8220d29c 100644 --- a/mcrouter/lib/network/gen/MemcacheRouterInfo.cpp +++ b/mcrouter/lib/network/gen/MemcacheRouterInfo.cpp @@ -47,6 +47,8 @@ #include +#include "mcrouter/routes/McRefillRoute.h" + using namespace facebook::memcache; using namespace facebook::memcache::mcrouter; @@ -189,6 +191,7 @@ MemcacheRouterInfo::buildRouteMap() { {"OperationSelectorRoute", &makeOperationSelectorRoute}, {"RandomRoute", &makeRandomRoute}, + {"McRefillRoute", &makeMcRefillRoute}, }; return map; } diff --git a/mcrouter/lib/network/gen/MemcacheRouterInfo.h b/mcrouter/lib/network/gen/MemcacheRouterInfo.h index 2fbc3a74c..37b4b8ed2 100644 --- a/mcrouter/lib/network/gen/MemcacheRouterInfo.h +++ b/mcrouter/lib/network/gen/MemcacheRouterInfo.h @@ -139,6 +139,7 @@ struct MemcacheRouterInfo { static constexpr const char* name = "Memcache"; static constexpr const bool bucketization = true; static constexpr const bool useRequestAclChecker = true; + static constexpr const bool hasMcRefillRoute = true; template using RouteHandle = MemcacheRouteHandle;