From 9bbee241e6d936543886624461fdaac764763f16 Mon Sep 17 00:00:00 2001 From: Jasmeet Bagga Date: Fri, 2 Jun 2017 13:32:03 -0700 Subject: [PATCH] Change API between SwSwitch and HwSwitch to indicate HwSwitch might fail some Summary: Depend on D4492997 Currently, we assume that changes applied to HwSwitch always succeed (or the process exits). There is a case where we want to keep moving despite failures: when we get excessive number of route (probably) because of some misconfiguration. This diff is a step towards taking care of such situation. We change the interface between SwSwitch and HwSwitch so that HwSwitch, when asked to apply delta of old and new state, returns either the new state if it succeeds, or returns a "pruned version of new state" if some elements of new state it was not able to apply. SwSwitch now keeps track of two states, a state that has been applied in the hardware, and another one that is desired in hardware. SwSwitch strives to catch applied state to the desired state (while desired state is also changes as move state updates are arriving). One issue with this diff: Warmboot is not preserving "unapplied" routes, i.e., unapplied routes get lost across warmboots. This will be fixed in a seperate diff. One naming issue: I thought about keeping SwSwitch::getState() name intact, but thought that it is not a good idea to keep distinction of states opaque to callers. So, decided to change the name. Reviewed By: ninas Differential Revision: D4405751 fbshipit-source-id: c933b4418445ae49d5b8e21dea95e437a8e1593d --- common/stats/ThreadCachedServiceData.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/stats/ThreadCachedServiceData.h b/common/stats/ThreadCachedServiceData.h index 3658f9dddb..247672e770 100644 --- a/common/stats/ThreadCachedServiceData.h +++ b/common/stats/ThreadCachedServiceData.h @@ -37,6 +37,13 @@ public: void addRepeatedValue(int64_t /*value*/, int64_t /*nsamples*/) {} }; + class TLCounter { + public: + TLCounter(ThreadLocalStatsMap*, folly::StringPiece) {} + void incrementValue(int64_t) {} + + }; + static ThreadCachedServiceData* get() { static ThreadCachedServiceData it; return ⁢