From 5530e69c2f4e660432dea4003e4158e08827626a Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Thu, 17 Dec 2020 04:09:44 -0800 Subject: [PATCH 01/13] Added changes to handel dependency check in FdbSyncd FpmSyncd for warmreboot --- fdbsyncd/fdbsync.cpp | 69 ++++++++++++++++++++++++++++++- fdbsyncd/fdbsync.h | 14 ++++++- fdbsyncd/fdbsyncd.cpp | 62 ++++++++++++++++++++++++++- fpmsyncd/fpmsyncd.cpp | 57 ++++++++++++++++++++++--- fpmsyncd/routesync.cpp | 28 +++++++++++++ fpmsyncd/routesync.h | 3 ++ warmrestart/warmRestartAssist.cpp | 10 +++++ warmrestart/warmRestartAssist.h | 2 + 8 files changed, 235 insertions(+), 10 deletions(-) diff --git a/fdbsyncd/fdbsync.cpp b/fdbsyncd/fdbsync.cpp index 45915f40e9..4da977ebf2 100644 --- a/fdbsyncd/fdbsync.cpp +++ b/fdbsyncd/fdbsync.cpp @@ -43,6 +43,66 @@ FdbSync::~FdbSync() } } + +// Check if interface entries are restored in kernel +bool FdbSync::isIntfRestoreDone() +{ + vector required_modules = { + "vxlanmgrd", + "intfmgrd", + "vlanmgrd", + "vrfmgrd" + }; + + for(string& module : required_modules) + { + WarmStart::WarmStartState state; + + WarmStart::getWarmStartState(module, state); + if(state == WarmStart::REPLAYED || state == WarmStart::RECONCILED) + { + SWSS_LOG_INFO("Module %s Replayed or Reconciled %d",module.c_str(), (int) state); + } + else + { + SWSS_LOG_INFO("Module %s NOT Replayed or Reconciled %d",module.c_str(), (int) state); + //return false; + //Return true till all the dependant code is checked in + return true; + } + } + + return true; +} + +// Check if vxlan entries are re-conciled to kernel +bool FdbSync::isReadyToReconcile() +{ + vector required_modules = { + "orchagent", + }; + + for(string& module : required_modules) + { + WarmStart::WarmStartState state; + + WarmStart::getWarmStartState(module, state); + if(state == WarmStart::RECONCILED) + { + SWSS_LOG_INFO("Module %s Reconciled %d",module.c_str(), (int) state); + } + else + { + SWSS_LOG_INFO("Module %s NOT Reconciled %d",module.c_str(), (int) state); + //return false; + //Return True untill the dependant orchagent code is commited + return true; + } + } + + return true; +} + void FdbSync::processCfgEvpnNvo() { std::deque entries; @@ -447,6 +507,10 @@ void FdbSync::macDelVxlanDB(string key) fvVector.push_back(t); fvVector.push_back(v); + SWSS_LOG_NOTICE("%sVXLAN_FDB_TABLE: DEL_KEY %s vtep:%s type:%s", + m_AppRestartAssist->isWarmStartInProgress() ? "WARM-RESTART:" : "" , + key.c_str(), vtep.c_str(), type.c_str()); + // If warmstart is in progress, we take all netlink changes into the cache map if (m_AppRestartAssist->isWarmStartInProgress()) { @@ -454,7 +518,6 @@ void FdbSync::macDelVxlanDB(string key) return; } - SWSS_LOG_INFO("VXLAN_FDB_TABLE: DEL_KEY %s vtep:%s type:%s", key.c_str(), vtep.c_str(), type.c_str()); m_fdbTable.del(key); return; @@ -476,6 +539,9 @@ void FdbSync::macAddVxlan(string key, struct in_addr vtep, string type, uint32_t fvVector.push_back(t); fvVector.push_back(v); + SWSS_LOG_INFO("%sVXLAN_FDB_TABLE: ADD_KEY %s vtep:%s type:%s", + m_AppRestartAssist->isWarmStartInProgress() ? "WARM-RESTART:" : "" , + key.c_str(), svtep.c_str(), type.c_str()); // If warmstart is in progress, we take all netlink changes into the cache map if (m_AppRestartAssist->isWarmStartInProgress()) { @@ -483,7 +549,6 @@ void FdbSync::macAddVxlan(string key, struct in_addr vtep, string type, uint32_t return; } - SWSS_LOG_INFO("VXLAN_FDB_TABLE: ADD_KEY %s vtep:%s type:%s", key.c_str(), svtep.c_str(), type.c_str()); m_fdbTable.set(key, fvVector); return; diff --git a/fdbsyncd/fdbsync.h b/fdbsyncd/fdbsync.h index 1d79af95ac..3e5e8d438f 100644 --- a/fdbsyncd/fdbsync.h +++ b/fdbsyncd/fdbsync.h @@ -10,7 +10,16 @@ #include "warmRestartAssist.h" // The timeout value (in seconds) for fdbsyncd reconcilation logic -#define DEFAULT_FDBSYNC_WARMSTART_TIMER 30 +#define DEFAULT_FDBSYNC_WARMSTART_TIMER 600 + +// Time to wait to run fdb reconcillation after fdbsyncd replay +#define FDBSYNC_RECON_TIMER 120 +/* + * This is the MAX time in seconds, fdbsyncd will wait after warm-reboot + * for the interface entries to be recreated in kernel before attempting to + * write the FDB data to kernel + */ +#define WARM_RESTORE_WAIT_TIME_OUT_MAX 180 namespace swss { @@ -43,7 +52,8 @@ class FdbSync : public NetMsg virtual void onMsg(int nlmsg_type, struct nl_object *obj); - bool isFdbRestoreDone(); + bool isIntfRestoreDone(); + bool isReadyToReconcile(); AppRestartAssist *getRestartAssist() { diff --git a/fdbsyncd/fdbsyncd.cpp b/fdbsyncd/fdbsyncd.cpp index eeffeb68c1..710959f6b6 100644 --- a/fdbsyncd/fdbsyncd.cpp +++ b/fdbsyncd/fdbsyncd.cpp @@ -35,6 +35,8 @@ int main(int argc, char **argv) Selectable *temps; int ret; Select s; + SelectableTimer replayCheckTimer(timespec{0, 0}); + SelectableTimer reconCheckTimer(timespec{0, 0}); using namespace std::chrono; @@ -44,8 +46,29 @@ int main(int argc, char **argv) */ if (sync.getRestartAssist()->isWarmStartInProgress()) { + int pasttime = 0; sync.getRestartAssist()->readTablesToMap(); + + while (!sync.isIntfRestoreDone()) + { + if (pasttime++ > WARM_RESTORE_WAIT_TIME_OUT_MAX) + { + SWSS_LOG_INFO("timed-out before all interface data was replayed to kernel!!!"); + break; + } + sleep(1); + } SWSS_LOG_NOTICE("Starting ReconcileTimer"); + sync.getRestartAssist()->startReconcileTimer(s); + replayCheckTimer.setInterval(timespec{1, 0}); + replayCheckTimer.start(); + s.addSelectable(&replayCheckTimer); + + } + else + { + sync.getRestartAssist()->warmStartDisabled(); + sync.m_reconcileDone = true; } netlink.registerGroup(RTNLGRP_LINK); @@ -67,7 +90,7 @@ int main(int argc, char **argv) { s.select(&temps); - if(temps == (Selectable *)sync.getFdbStateTable()) + if (temps == (Selectable *)sync.getFdbStateTable()) { sync.processStateFdb(); } @@ -75,6 +98,43 @@ int main(int argc, char **argv) { sync.processCfgEvpnNvo(); } + else if (temps == &replayCheckTimer) + { + if (sync.getFdbStateTable()->empty() && sync.getCfgEvpnNvoTable()->empty()) + { + sync.getRestartAssist()->appDataReplayed(); + SWSS_LOG_NOTICE("FDB Replay Complete, Start Reconcile Check"); + reconCheckTimer.setInterval(timespec{FDBSYNC_RECON_TIMER, 0}); + reconCheckTimer.start(); + s.addSelectable(&reconCheckTimer); + } + else + { + replayCheckTimer.setInterval(timespec{1, 0}); + // re-start replay check timer + replayCheckTimer.start(); + } + + } + else if (temps == &reconCheckTimer) + { + if (sync.isReadyToReconcile()) + { + if (sync.getRestartAssist()->isWarmStartInProgress()) + { + sync.m_reconcileDone = true; + sync.getRestartAssist()->stopReconcileTimer(s); + sync.getRestartAssist()->reconcile(); + SWSS_LOG_NOTICE("VXLAN FDB VNI Reconcillation Complete (Event)"); + } + } + else + { + reconCheckTimer.setInterval(timespec{1, 0}); + // Restart and check again in 1 sec + reconCheckTimer.start(); + } + } else { /* diff --git a/fpmsyncd/fpmsyncd.cpp b/fpmsyncd/fpmsyncd.cpp index 9f5c9e1a65..1d7daaf59a 100644 --- a/fpmsyncd/fpmsyncd.cpp +++ b/fpmsyncd/fpmsyncd.cpp @@ -16,7 +16,9 @@ using namespace swss; * Default warm-restart timer interval for routing-stack app. To be used only if * no explicit value has been defined in configuration. */ -const uint32_t DEFAULT_ROUTING_RESTART_INTERVAL = 120; +const uint32_t DEFAULT_ROUTING_RESTART_INTERVAL = 600; + +const uint32_t DEFAULT_ROUTING_RECON_CHECK_INTERVAL = 120; // Wait 3 seconds after detecting EOIU reached state // TODO: support eoiu hold interval config @@ -67,6 +69,10 @@ int main(int argc, char **argv) SelectableTimer eoiuCheckTimer(timespec{0, 0}); // After eoiu flags are detected, start a hold timer before starting reconciliation. SelectableTimer eoiuHoldTimer(timespec{0, 0}); + + // Timers to wait for dependent reconcillation + SelectableTimer reconcileCheckTimer(timespec{0, 0}); + SelectableTimer reconcileHoldTimer(timespec{0, 0}); /* * Pipeline should be flushed right away to deal with state pending * from previous try/catch iterations. @@ -85,13 +91,14 @@ int main(int argc, char **argv) { /* Obtain warm-restart timer defined for routing application */ time_t warmRestartIval = sync.m_warmStartHelper.getRestartTimer(); + warmStartTimer.setInterval(timespec{DEFAULT_ROUTING_RESTART_INTERVAL, 0}); if (!warmRestartIval) { - warmStartTimer.setInterval(timespec{DEFAULT_ROUTING_RESTART_INTERVAL, 0}); + reconcileCheckTimer.setInterval(timespec{DEFAULT_ROUTING_RECON_CHECK_INTERVAL, 0}); } else { - warmStartTimer.setInterval(timespec{warmRestartIval, 0}); + reconcileCheckTimer.setInterval(timespec{warmRestartIval, 0}); } /* Execute restoration instruction and kick off warm-restart timer */ @@ -100,6 +107,9 @@ int main(int argc, char **argv) warmStartTimer.start(); s.addSelectable(&warmStartTimer); SWSS_LOG_NOTICE("Warm-Restart timer started."); + reconcileCheckTimer.start(); + s.addSelectable(&reconcileCheckTimer); + SWSS_LOG_NOTICE("reconcileCheckTimer timer started "); } // Also start periodic eoiu check timer, first wait 5 seconds, then check every 1 second @@ -108,6 +118,10 @@ int main(int argc, char **argv) s.addSelectable(&eoiuCheckTimer); SWSS_LOG_NOTICE("Warm-Restart eoiuCheckTimer timer started."); } + else + { + sync.m_warmStartHelper.setState(WarmStart::WSDISABLED); + } while (true) { @@ -122,17 +136,26 @@ int main(int argc, char **argv) * select() loop. * Note: route reconciliation always succeeds, it will not be done twice. */ - if (temps == &warmStartTimer || temps == &eoiuHoldTimer) + if (temps == &warmStartTimer || temps == &eoiuHoldTimer || temps == &reconcileHoldTimer) { + bool readyToReconcile = false; if (temps == &warmStartTimer) { + readyToReconcile = true; SWSS_LOG_NOTICE("Warm-Restart timer expired."); } + else if (temps == &reconcileHoldTimer) + { + readyToReconcile = true; + SWSS_LOG_NOTICE("Warm-Restart reconcile hold timer expired."); + } else { + readyToReconcile = sync.isReadyToReconcile(); SWSS_LOG_NOTICE("Warm-Restart EOIU hold timer expired."); } - if (sync.m_warmStartHelper.inProgress()) + + if (sync.m_warmStartHelper.inProgress() && readyToReconcile) { sync.m_warmStartHelper.reconcile(); SWSS_LOG_NOTICE("Warm-Restart reconciliation processed."); @@ -174,6 +197,30 @@ int main(int argc, char **argv) { s.removeSelectable(&eoiuCheckTimer); } + } + else if (temps == &reconcileCheckTimer) + { + SWSS_LOG_NOTICE("reconcile Check timer Expired "); + if (sync.m_warmStartHelper.inProgress()) + { + if (sync.isReadyToReconcile()) + { + reconcileHoldTimer.setInterval(timespec{2, 0}); + reconcileHoldTimer.start(); + s.addSelectable(&reconcileHoldTimer); + SWSS_LOG_NOTICE("Warm-Restart started reconcile hold timer "); + s.removeSelectable(&reconcileCheckTimer); + continue; + } + // re-start check timer for every 2 seconds now on + reconcileCheckTimer.setInterval(timespec{2, 0}); + reconcileCheckTimer.start(); + SWSS_LOG_NOTICE("Warm-Restart reconcileCheckTimer restarted"); + } + else + { + s.removeSelectable(&reconcileCheckTimer); + } } else if (!warmStartEnabled || sync.m_warmStartHelper.isReconciled()) { diff --git a/fpmsyncd/routesync.cpp b/fpmsyncd/routesync.cpp index bdbbe004f8..b7db8d2ab7 100644 --- a/fpmsyncd/routesync.cpp +++ b/fpmsyncd/routesync.cpp @@ -912,3 +912,31 @@ string RouteSync::getNextHopIf(struct rtnl_route *route_obj) return result; } + +// Check if ependent entries are re-conciled +bool RouteSync::isReadyToReconcile() +{ + vector required_modules = { + "orchagent", + }; + + for(string& module : required_modules) + { + WarmStart::WarmStartState state; + + WarmStart::getWarmStartState(module, state); + if(state == WarmStart::RECONCILED || state == WarmStart::WSDISABLED) + { + SWSS_LOG_INFO("Module %s Reconciled %d",module.c_str(), (int) state); + } + else + { + SWSS_LOG_INFO("Module %s NOT Reconciled %d",module.c_str(), (int) state); + //return false; + //Return true untill dependent module code is commited + return true; + } + } + + return true; +} diff --git a/fpmsyncd/routesync.h b/fpmsyncd/routesync.h index b122a85b66..f65b271aec 100644 --- a/fpmsyncd/routesync.h +++ b/fpmsyncd/routesync.h @@ -26,6 +26,9 @@ class RouteSync : public NetMsg virtual void onMsg(int nlmsg_type, struct nl_object *obj); virtual void onMsgRaw(struct nlmsghdr *obj); + + bool isReadyToReconcile(); + WarmStartHelper m_warmStartHelper; private: diff --git a/warmrestart/warmRestartAssist.cpp b/warmrestart/warmRestartAssist.cpp index ca19398577..863e964e6a 100644 --- a/warmrestart/warmRestartAssist.cpp +++ b/warmrestart/warmRestartAssist.cpp @@ -117,6 +117,16 @@ AppRestartAssist::cache_state_t AppRestartAssist::getCacheEntryState(const std:: throw std::logic_error("cache entry state is invalid"); } +void AppRestartAssist::appDataReplayed() +{ + WarmStart::setWarmStartState(m_appName, WarmStart::REPLAYED); +} + +void AppRestartAssist::warmStartDisabled() +{ + WarmStart::setWarmStartState(m_appName, WarmStart::WSDISABLED); +} + // Read table(s) from APPDB and append stale flag then insert to cachemap void AppRestartAssist::readTablesToMap() { diff --git a/warmrestart/warmRestartAssist.h b/warmrestart/warmRestartAssist.h index 8587d84d4a..72ad7c42d6 100644 --- a/warmrestart/warmRestartAssist.h +++ b/warmrestart/warmRestartAssist.h @@ -79,6 +79,8 @@ class AppRestartAssist void stopReconcileTimer(Select &s); bool checkReconcileTimer(Selectable *s); void readTablesToMap(void); + void appDataReplayed(void); + void warmStartDisabled(void); void insertToMap(std::string tableName, std::string key, std::vector fvVector, bool delete_key); void reconcile(void); bool isWarmStartInProgress(void) From cd04985c055850de884334b066f4e17734bac865 Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Thu, 17 Dec 2020 22:14:46 -0800 Subject: [PATCH 02/13] Fix Warm-boot tc to accepet disabled status for cold reboot case --- tests/test_warm_reboot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_warm_reboot.py b/tests/test_warm_reboot.py index 9cce686c99..13248835c5 100644 --- a/tests/test_warm_reboot.py +++ b/tests/test_warm_reboot.py @@ -46,7 +46,7 @@ def swss_check_RestoreCount(dvs, state_db, restore_count): if fv[0] == "restore_count": assert int(fv[1]) == restore_count[key] + 1 elif fv[0] == "state": - assert fv[1] == "reconciled" + assert fv[1] == "reconciled" or fv[1] == "disabled" def check_port_oper_status(appl_db, port_name, state): portTbl = swsscommon.Table(appl_db, swsscommon.APP_PORT_TABLE_NAME) @@ -76,7 +76,7 @@ def swss_app_check_RestoreCount_single(state_db, restore_count, name): if fv[0] == "restore_count": assert int(fv[1]) == restore_count[key] + 1 elif fv[0] == "state": - assert fv[1] == "reconciled" + assert fv[1] == "reconciled" or fv[1] == "disabled" def swss_app_check_warmstart_state(state_db, name, state): warmtbl = swsscommon.Table(state_db, swsscommon.STATE_WARM_RESTART_TABLE_NAME) From 12d940ac363f0ff2c561a06ac19ef6f1699b5915 Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Fri, 18 Dec 2020 06:19:18 -0800 Subject: [PATCH 03/13] Fix warm-boot testcase to accept disabled state as valid state in cold boot scenario --- tests/test_warm_reboot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_warm_reboot.py b/tests/test_warm_reboot.py index 13248835c5..84f2e57b87 100644 --- a/tests/test_warm_reboot.py +++ b/tests/test_warm_reboot.py @@ -1150,7 +1150,7 @@ def test_routing_WarmRestart(self, dvs, testlog): time.sleep(5) # Verify FSM - swss_app_check_warmstart_state(state_db, "bgp", "") + swss_app_check_warmstart_state(state_db, "bgp", "disabled") # Verify that multiple changes are seen in swss and sairedis logs as there's # no warm-reboot logic in place. From d56fa46a5b6229240f9bf364e4f2bb6e2668d72f Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Wed, 30 Dec 2020 10:34:21 -0800 Subject: [PATCH 04/13] [evpn_warmboot_fdb] Fix review comments --- warmrestart/warmRestartAssist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/warmrestart/warmRestartAssist.cpp b/warmrestart/warmRestartAssist.cpp index 863e964e6a..72c8657519 100644 --- a/warmrestart/warmRestartAssist.cpp +++ b/warmrestart/warmRestartAssist.cpp @@ -119,12 +119,12 @@ AppRestartAssist::cache_state_t AppRestartAssist::getCacheEntryState(const std:: void AppRestartAssist::appDataReplayed() { - WarmStart::setWarmStartState(m_appName, WarmStart::REPLAYED); + WarmStart::setWarmStartState(m_appName, WarmStart::REPLAYED); } void AppRestartAssist::warmStartDisabled() { - WarmStart::setWarmStartState(m_appName, WarmStart::WSDISABLED); + WarmStart::setWarmStartState(m_appName, WarmStart::WSDISABLED); } // Read table(s) from APPDB and append stale flag then insert to cachemap From b5c0e7c0f11510223483086fd047a45a4f7f1f60 Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Wed, 30 Dec 2020 23:21:04 -0800 Subject: [PATCH 05/13] [evpn_warmboot_fdb] Fix as per review comments --- fdbsyncd/fdbsync.cpp | 8 ++++---- fdbsyncd/fdbsyncd.cpp | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fdbsyncd/fdbsync.cpp b/fdbsyncd/fdbsync.cpp index 4da977ebf2..5690d10c0d 100644 --- a/fdbsyncd/fdbsync.cpp +++ b/fdbsyncd/fdbsync.cpp @@ -67,7 +67,7 @@ bool FdbSync::isIntfRestoreDone() { SWSS_LOG_INFO("Module %s NOT Replayed or Reconciled %d",module.c_str(), (int) state); //return false; - //Return true till all the dependant code is checked in + // Return true till all the dependant code is checked in return true; } } @@ -79,8 +79,8 @@ bool FdbSync::isIntfRestoreDone() bool FdbSync::isReadyToReconcile() { vector required_modules = { - "orchagent", - }; + "orchagent", + }; for(string& module : required_modules) { @@ -95,7 +95,7 @@ bool FdbSync::isReadyToReconcile() { SWSS_LOG_INFO("Module %s NOT Reconciled %d",module.c_str(), (int) state); //return false; - //Return True untill the dependant orchagent code is commited + // Return True untill the dependant orchagent code is commited return true; } } diff --git a/fdbsyncd/fdbsyncd.cpp b/fdbsyncd/fdbsyncd.cpp index 710959f6b6..f3ca73e05c 100644 --- a/fdbsyncd/fdbsyncd.cpp +++ b/fdbsyncd/fdbsyncd.cpp @@ -63,7 +63,6 @@ int main(int argc, char **argv) replayCheckTimer.setInterval(timespec{1, 0}); replayCheckTimer.start(); s.addSelectable(&replayCheckTimer); - } else { From 421f8e6698e8a3d4cf65f0156776126a468fe95a Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Thu, 14 Jan 2021 04:18:38 -0800 Subject: [PATCH 06/13] [evpn_warmboot_fdb] Fix as per review comments Fixing alignment issue --- fpmsyncd/fpmsyncd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fpmsyncd/fpmsyncd.cpp b/fpmsyncd/fpmsyncd.cpp index 1d7daaf59a..b56e9295eb 100644 --- a/fpmsyncd/fpmsyncd.cpp +++ b/fpmsyncd/fpmsyncd.cpp @@ -138,10 +138,10 @@ int main(int argc, char **argv) */ if (temps == &warmStartTimer || temps == &eoiuHoldTimer || temps == &reconcileHoldTimer) { - bool readyToReconcile = false; + bool readyToReconcile = false; if (temps == &warmStartTimer) { - readyToReconcile = true; + readyToReconcile = true; SWSS_LOG_NOTICE("Warm-Restart timer expired."); } else if (temps == &reconcileHoldTimer) @@ -151,7 +151,7 @@ int main(int argc, char **argv) } else { - readyToReconcile = sync.isReadyToReconcile(); + readyToReconcile = sync.isReadyToReconcile(); SWSS_LOG_NOTICE("Warm-Restart EOIU hold timer expired."); } From 7fa56befada2210570f135f322b0340d15dfe156 Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Fri, 15 Jan 2021 01:11:05 -0800 Subject: [PATCH 07/13] [evpn_warmboot_fdb] Fix as per review comments Removed the stubbed code for dependency check as other PRs are already merged. Fixed as per other review comments --- fdbsyncd/fdbsync.cpp | 16 ++++++---------- fdbsyncd/fdbsync.h | 4 ++-- fdbsyncd/fdbsyncd.cpp | 10 +++++++--- fpmsyncd/routesync.cpp | 4 +--- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/fdbsyncd/fdbsync.cpp b/fdbsyncd/fdbsync.cpp index a8e730b60b..7b535e5351 100644 --- a/fdbsyncd/fdbsync.cpp +++ b/fdbsyncd/fdbsync.cpp @@ -54,21 +54,19 @@ bool FdbSync::isIntfRestoreDone() "vrfmgrd" }; - for(string& module : required_modules) + for (string& module : required_modules) { WarmStart::WarmStartState state; WarmStart::getWarmStartState(module, state); - if(state == WarmStart::REPLAYED || state == WarmStart::RECONCILED) + if (state == WarmStart::REPLAYED || state == WarmStart::RECONCILED) { SWSS_LOG_INFO("Module %s Replayed or Reconciled %d",module.c_str(), (int) state); } else { SWSS_LOG_INFO("Module %s NOT Replayed or Reconciled %d",module.c_str(), (int) state); - //return false; - // Return true till all the dependant code is checked in - return true; + return false; } } @@ -82,21 +80,19 @@ bool FdbSync::isReadyToReconcile() "orchagent", }; - for(string& module : required_modules) + for (string& module : required_modules) { WarmStart::WarmStartState state; WarmStart::getWarmStartState(module, state); - if(state == WarmStart::RECONCILED) + if (state == WarmStart::RECONCILED) { SWSS_LOG_INFO("Module %s Reconciled %d",module.c_str(), (int) state); } else { SWSS_LOG_INFO("Module %s NOT Reconciled %d",module.c_str(), (int) state); - //return false; - // Return True untill the dependant orchagent code is commited - return true; + return false; } } diff --git a/fdbsyncd/fdbsync.h b/fdbsyncd/fdbsync.h index 8f2a1dd861..e78e728d16 100644 --- a/fdbsyncd/fdbsync.h +++ b/fdbsyncd/fdbsync.h @@ -13,13 +13,13 @@ #define DEFAULT_FDBSYNC_WARMSTART_TIMER 600 // Time to wait to run fdb reconcillation after fdbsyncd replay -#define FDBSYNC_RECON_TIMER 120 +#define FDBSYNC_RECON_WAIT_TIME 120 /* * This is the MAX time in seconds, fdbsyncd will wait after warm-reboot * for the interface entries to be recreated in kernel before attempting to * write the FDB data to kernel */ -#define WARM_RESTORE_WAIT_TIME_OUT_MAX 180 +#define INTF_RESTORE_MAX_WAIT_TIME 180 namespace swss { diff --git a/fdbsyncd/fdbsyncd.cpp b/fdbsyncd/fdbsyncd.cpp index f3ca73e05c..3a99796e6d 100644 --- a/fdbsyncd/fdbsyncd.cpp +++ b/fdbsyncd/fdbsyncd.cpp @@ -46,12 +46,16 @@ int main(int argc, char **argv) */ if (sync.getRestartAssist()->isWarmStartInProgress()) { - int pasttime = 0; sync.getRestartAssist()->readTablesToMap(); + steady_clock::time_point starttime = steady_clock::now(); while (!sync.isIntfRestoreDone()) { - if (pasttime++ > WARM_RESTORE_WAIT_TIME_OUT_MAX) + duration time_span = + duration_cast>(steady_clock::now() - starttime); + int pasttime = int(time_span.count()); + + if (pasttime++ > INTF_RESTORE_MAX_WAIT_TIME) { SWSS_LOG_INFO("timed-out before all interface data was replayed to kernel!!!"); break; @@ -103,7 +107,7 @@ int main(int argc, char **argv) { sync.getRestartAssist()->appDataReplayed(); SWSS_LOG_NOTICE("FDB Replay Complete, Start Reconcile Check"); - reconCheckTimer.setInterval(timespec{FDBSYNC_RECON_TIMER, 0}); + reconCheckTimer.setInterval(timespec{FDBSYNC_RECON_WAIT_TIME, 0}); reconCheckTimer.start(); s.addSelectable(&reconCheckTimer); } diff --git a/fpmsyncd/routesync.cpp b/fpmsyncd/routesync.cpp index 678e81ff85..0cc10bc9b9 100644 --- a/fpmsyncd/routesync.cpp +++ b/fpmsyncd/routesync.cpp @@ -940,9 +940,7 @@ bool RouteSync::isReadyToReconcile() else { SWSS_LOG_INFO("Module %s NOT Reconciled %d",module.c_str(), (int) state); - //return false; - //Return true untill dependent module code is commited - return true; + return false; } } From a3a9d04ad9edf7f6cf7384067fe6ecc82c2fbf2d Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Tue, 19 Jan 2021 23:08:12 -0800 Subject: [PATCH 08/13] [evpn_warmboot_fdb] Addressing review comments --- fdbsyncd/fdbsync.h | 11 +++++++++-- fdbsyncd/fdbsyncd.cpp | 2 +- fpmsyncd/routesync.cpp | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/fdbsyncd/fdbsync.h b/fdbsyncd/fdbsync.h index e78e728d16..e08bc24838 100644 --- a/fdbsyncd/fdbsync.h +++ b/fdbsyncd/fdbsync.h @@ -9,11 +9,18 @@ #include "netmsg.h" #include "warmRestartAssist.h" -// The timeout value (in seconds) for fdbsyncd reconcilation logic +/* + * The timeout value (in seconds) for fdbsyncd reconcilation logic + * This timers avoids indefinite wait for orchagent reconcillation + */ #define DEFAULT_FDBSYNC_WARMSTART_TIMER 600 -// Time to wait to run fdb reconcillation after fdbsyncd replay +/* Time to wait to run fdb reconcillation after fdbsyncd replay. + * fdbsyncd will wait for this time and for orchagnet to reconcile + * before reconciling itself + */ #define FDBSYNC_RECON_WAIT_TIME 120 + /* * This is the MAX time in seconds, fdbsyncd will wait after warm-reboot * for the interface entries to be recreated in kernel before attempting to diff --git a/fdbsyncd/fdbsyncd.cpp b/fdbsyncd/fdbsyncd.cpp index 3a99796e6d..2dfd754802 100644 --- a/fdbsyncd/fdbsyncd.cpp +++ b/fdbsyncd/fdbsyncd.cpp @@ -55,7 +55,7 @@ int main(int argc, char **argv) duration_cast>(steady_clock::now() - starttime); int pasttime = int(time_span.count()); - if (pasttime++ > INTF_RESTORE_MAX_WAIT_TIME) + if (pasttime > INTF_RESTORE_MAX_WAIT_TIME) { SWSS_LOG_INFO("timed-out before all interface data was replayed to kernel!!!"); break; diff --git a/fpmsyncd/routesync.cpp b/fpmsyncd/routesync.cpp index 0cc10bc9b9..8a308bb992 100644 --- a/fpmsyncd/routesync.cpp +++ b/fpmsyncd/routesync.cpp @@ -928,12 +928,12 @@ bool RouteSync::isReadyToReconcile() "orchagent", }; - for(string& module : required_modules) + for (string& module : required_modules) { WarmStart::WarmStartState state; WarmStart::getWarmStartState(module, state); - if(state == WarmStart::RECONCILED || state == WarmStart::WSDISABLED) + if (state == WarmStart::RECONCILED || state == WarmStart::WSDISABLED) { SWSS_LOG_INFO("Module %s Reconciled %d",module.c_str(), (int) state); } From a951e6b0691106c253e227805537491de2253485 Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Sun, 31 Jan 2021 07:41:29 -0800 Subject: [PATCH 09/13] [evpn_warmboot_fdb] Addressing review comments --- fpmsyncd/fpmsyncd.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fpmsyncd/fpmsyncd.cpp b/fpmsyncd/fpmsyncd.cpp index b56e9295eb..da32fd1398 100644 --- a/fpmsyncd/fpmsyncd.cpp +++ b/fpmsyncd/fpmsyncd.cpp @@ -16,9 +16,14 @@ using namespace swss; * Default warm-restart timer interval for routing-stack app. To be used only if * no explicit value has been defined in configuration. */ +const uint32_t DEFAULT_ROUTING_RECON_CHECK_INTERVAL = 120; + +/* + * The timeout value (in seconds) for fpmsyncd reconcilation logic + * This timers avoids indefinite wait for orchagent reconcillation + */ const uint32_t DEFAULT_ROUTING_RESTART_INTERVAL = 600; -const uint32_t DEFAULT_ROUTING_RECON_CHECK_INTERVAL = 120; // Wait 3 seconds after detecting EOIU reached state // TODO: support eoiu hold interval config From a6b55211c770513b918dd4fc374958a6bdb887a4 Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Sun, 7 Feb 2021 00:06:36 -0800 Subject: [PATCH 10/13] [evpn_warmboot_fdb] Addressing review comments When eoiuHoldTimer expires, that means control plane ( BGP ) has converged. So now we just need to wait for orchangent reconcile and proceed once that is done. To implement this restart reconCheck timer when eoiuHoldTimer expires, to check if orchagent has reconciled --- fpmsyncd/fpmsyncd.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fpmsyncd/fpmsyncd.cpp b/fpmsyncd/fpmsyncd.cpp index da32fd1398..7367ce214a 100644 --- a/fpmsyncd/fpmsyncd.cpp +++ b/fpmsyncd/fpmsyncd.cpp @@ -158,6 +158,13 @@ int main(int argc, char **argv) { readyToReconcile = sync.isReadyToReconcile(); SWSS_LOG_NOTICE("Warm-Restart EOIU hold timer expired."); + if(!readyToReconcile) + { + // re-start check timer for every 2 seconds now on + reconcileCheckTimer.stop(); + reconcileCheckTimer.setInterval(timespec{2, 0}); + reconcileCheckTimer.start(); + } } if (sync.m_warmStartHelper.inProgress() && readyToReconcile) @@ -210,7 +217,7 @@ int main(int argc, char **argv) { if (sync.isReadyToReconcile()) { - reconcileHoldTimer.setInterval(timespec{2, 0}); + reconcileHoldTimer.setInterval(timespec{1, 0}); reconcileHoldTimer.start(); s.addSelectable(&reconcileHoldTimer); SWSS_LOG_NOTICE("Warm-Restart started reconcile hold timer "); From 8fbd131dc344d1d27d8510a45417c1df6eef2a18 Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Wed, 17 Feb 2021 04:47:26 -0800 Subject: [PATCH 11/13] [evpn_warmboot_fdb] Addressing review comments Removed the dependency on orchagent reconcillation as per the review discussion and conclusion Also added exception when interfaces are not replayed to kernel in the given time --- fdbsyncd/fdbsync.cpp | 26 ------------------ fdbsyncd/fdbsync.h | 12 ++------ fdbsyncd/fdbsyncd.cpp | 30 ++------------------ fpmsyncd/fpmsyncd.cpp | 62 ++++-------------------------------------- fpmsyncd/routesync.cpp | 26 ------------------ fpmsyncd/routesync.h | 3 -- 6 files changed, 10 insertions(+), 149 deletions(-) diff --git a/fdbsyncd/fdbsync.cpp b/fdbsyncd/fdbsync.cpp index 7b535e5351..30c9e2d54c 100644 --- a/fdbsyncd/fdbsync.cpp +++ b/fdbsyncd/fdbsync.cpp @@ -73,32 +73,6 @@ bool FdbSync::isIntfRestoreDone() return true; } -// Check if vxlan entries are re-conciled to kernel -bool FdbSync::isReadyToReconcile() -{ - vector required_modules = { - "orchagent", - }; - - for (string& module : required_modules) - { - WarmStart::WarmStartState state; - - WarmStart::getWarmStartState(module, state); - if (state == WarmStart::RECONCILED) - { - SWSS_LOG_INFO("Module %s Reconciled %d",module.c_str(), (int) state); - } - else - { - SWSS_LOG_INFO("Module %s NOT Reconciled %d",module.c_str(), (int) state); - return false; - } - } - - return true; -} - void FdbSync::processCfgEvpnNvo() { std::deque entries; diff --git a/fdbsyncd/fdbsync.h b/fdbsyncd/fdbsync.h index e08bc24838..aac0129423 100644 --- a/fdbsyncd/fdbsync.h +++ b/fdbsyncd/fdbsync.h @@ -10,16 +10,9 @@ #include "warmRestartAssist.h" /* - * The timeout value (in seconds) for fdbsyncd reconcilation logic - * This timers avoids indefinite wait for orchagent reconcillation + * Default warm-restart timer interval for routing-stack app */ -#define DEFAULT_FDBSYNC_WARMSTART_TIMER 600 - -/* Time to wait to run fdb reconcillation after fdbsyncd replay. - * fdbsyncd will wait for this time and for orchagnet to reconcile - * before reconciling itself - */ -#define FDBSYNC_RECON_WAIT_TIME 120 +#define DEFAULT_FDBSYNC_WARMSTART_TIMER 120 /* * This is the MAX time in seconds, fdbsyncd will wait after warm-reboot @@ -60,7 +53,6 @@ class FdbSync : public NetMsg virtual void onMsg(int nlmsg_type, struct nl_object *obj); bool isIntfRestoreDone(); - bool isReadyToReconcile(); AppRestartAssist *getRestartAssist() { diff --git a/fdbsyncd/fdbsyncd.cpp b/fdbsyncd/fdbsyncd.cpp index 2dfd754802..661b165732 100644 --- a/fdbsyncd/fdbsyncd.cpp +++ b/fdbsyncd/fdbsyncd.cpp @@ -36,7 +36,6 @@ int main(int argc, char **argv) int ret; Select s; SelectableTimer replayCheckTimer(timespec{0, 0}); - SelectableTimer reconCheckTimer(timespec{0, 0}); using namespace std::chrono; @@ -58,7 +57,7 @@ int main(int argc, char **argv) if (pasttime > INTF_RESTORE_MAX_WAIT_TIME) { SWSS_LOG_INFO("timed-out before all interface data was replayed to kernel!!!"); - break; + throw runtime_error("fdbsyncd: timedout on interface data replay"); } sleep(1); } @@ -106,10 +105,7 @@ int main(int argc, char **argv) if (sync.getFdbStateTable()->empty() && sync.getCfgEvpnNvoTable()->empty()) { sync.getRestartAssist()->appDataReplayed(); - SWSS_LOG_NOTICE("FDB Replay Complete, Start Reconcile Check"); - reconCheckTimer.setInterval(timespec{FDBSYNC_RECON_WAIT_TIME, 0}); - reconCheckTimer.start(); - s.addSelectable(&reconCheckTimer); + SWSS_LOG_NOTICE("FDB Replay Complete"); } else { @@ -117,26 +113,6 @@ int main(int argc, char **argv) // re-start replay check timer replayCheckTimer.start(); } - - } - else if (temps == &reconCheckTimer) - { - if (sync.isReadyToReconcile()) - { - if (sync.getRestartAssist()->isWarmStartInProgress()) - { - sync.m_reconcileDone = true; - sync.getRestartAssist()->stopReconcileTimer(s); - sync.getRestartAssist()->reconcile(); - SWSS_LOG_NOTICE("VXLAN FDB VNI Reconcillation Complete (Event)"); - } - } - else - { - reconCheckTimer.setInterval(timespec{1, 0}); - // Restart and check again in 1 sec - reconCheckTimer.start(); - } } else { @@ -151,7 +127,7 @@ int main(int argc, char **argv) sync.m_reconcileDone = true; sync.getRestartAssist()->stopReconcileTimer(s); sync.getRestartAssist()->reconcile(); - SWSS_LOG_NOTICE("VXLAN FDB VNI Reconcillation Complete (Timer)"); + SWSS_LOG_NOTICE("VXLAN FDB VNI Reconcillation Complete"); } } } diff --git a/fpmsyncd/fpmsyncd.cpp b/fpmsyncd/fpmsyncd.cpp index 7367ce214a..412bfd6c98 100644 --- a/fpmsyncd/fpmsyncd.cpp +++ b/fpmsyncd/fpmsyncd.cpp @@ -16,13 +16,7 @@ using namespace swss; * Default warm-restart timer interval for routing-stack app. To be used only if * no explicit value has been defined in configuration. */ -const uint32_t DEFAULT_ROUTING_RECON_CHECK_INTERVAL = 120; - -/* - * The timeout value (in seconds) for fpmsyncd reconcilation logic - * This timers avoids indefinite wait for orchagent reconcillation - */ -const uint32_t DEFAULT_ROUTING_RESTART_INTERVAL = 600; +const uint32_t DEFAULT_ROUTING_RESTART_INTERVAL = 120; // Wait 3 seconds after detecting EOIU reached state @@ -75,9 +69,6 @@ int main(int argc, char **argv) // After eoiu flags are detected, start a hold timer before starting reconciliation. SelectableTimer eoiuHoldTimer(timespec{0, 0}); - // Timers to wait for dependent reconcillation - SelectableTimer reconcileCheckTimer(timespec{0, 0}); - SelectableTimer reconcileHoldTimer(timespec{0, 0}); /* * Pipeline should be flushed right away to deal with state pending * from previous try/catch iterations. @@ -96,14 +87,13 @@ int main(int argc, char **argv) { /* Obtain warm-restart timer defined for routing application */ time_t warmRestartIval = sync.m_warmStartHelper.getRestartTimer(); - warmStartTimer.setInterval(timespec{DEFAULT_ROUTING_RESTART_INTERVAL, 0}); if (!warmRestartIval) { - reconcileCheckTimer.setInterval(timespec{DEFAULT_ROUTING_RECON_CHECK_INTERVAL, 0}); + warmStartTimer.setInterval(timespec{DEFAULT_ROUTING_RESTART_INTERVAL, 0}); } else { - reconcileCheckTimer.setInterval(timespec{warmRestartIval, 0}); + warmStartTimer.setInterval(timespec{warmRestartIval, 0}); } /* Execute restoration instruction and kick off warm-restart timer */ @@ -112,9 +102,6 @@ int main(int argc, char **argv) warmStartTimer.start(); s.addSelectable(&warmStartTimer); SWSS_LOG_NOTICE("Warm-Restart timer started."); - reconcileCheckTimer.start(); - s.addSelectable(&reconcileCheckTimer); - SWSS_LOG_NOTICE("reconcileCheckTimer timer started "); } // Also start periodic eoiu check timer, first wait 5 seconds, then check every 1 second @@ -141,33 +128,18 @@ int main(int argc, char **argv) * select() loop. * Note: route reconciliation always succeeds, it will not be done twice. */ - if (temps == &warmStartTimer || temps == &eoiuHoldTimer || temps == &reconcileHoldTimer) + if (temps == &warmStartTimer || temps == &eoiuHoldTimer) { - bool readyToReconcile = false; if (temps == &warmStartTimer) { - readyToReconcile = true; SWSS_LOG_NOTICE("Warm-Restart timer expired."); } - else if (temps == &reconcileHoldTimer) - { - readyToReconcile = true; - SWSS_LOG_NOTICE("Warm-Restart reconcile hold timer expired."); - } else { - readyToReconcile = sync.isReadyToReconcile(); SWSS_LOG_NOTICE("Warm-Restart EOIU hold timer expired."); - if(!readyToReconcile) - { - // re-start check timer for every 2 seconds now on - reconcileCheckTimer.stop(); - reconcileCheckTimer.setInterval(timespec{2, 0}); - reconcileCheckTimer.start(); - } } - if (sync.m_warmStartHelper.inProgress() && readyToReconcile) + if (sync.m_warmStartHelper.inProgress()) { sync.m_warmStartHelper.reconcile(); SWSS_LOG_NOTICE("Warm-Restart reconciliation processed."); @@ -209,30 +181,6 @@ int main(int argc, char **argv) { s.removeSelectable(&eoiuCheckTimer); } - } - else if (temps == &reconcileCheckTimer) - { - SWSS_LOG_NOTICE("reconcile Check timer Expired "); - if (sync.m_warmStartHelper.inProgress()) - { - if (sync.isReadyToReconcile()) - { - reconcileHoldTimer.setInterval(timespec{1, 0}); - reconcileHoldTimer.start(); - s.addSelectable(&reconcileHoldTimer); - SWSS_LOG_NOTICE("Warm-Restart started reconcile hold timer "); - s.removeSelectable(&reconcileCheckTimer); - continue; - } - // re-start check timer for every 2 seconds now on - reconcileCheckTimer.setInterval(timespec{2, 0}); - reconcileCheckTimer.start(); - SWSS_LOG_NOTICE("Warm-Restart reconcileCheckTimer restarted"); - } - else - { - s.removeSelectable(&reconcileCheckTimer); - } } else if (!warmStartEnabled || sync.m_warmStartHelper.isReconciled()) { diff --git a/fpmsyncd/routesync.cpp b/fpmsyncd/routesync.cpp index 8a308bb992..d6f8574793 100644 --- a/fpmsyncd/routesync.cpp +++ b/fpmsyncd/routesync.cpp @@ -920,29 +920,3 @@ string RouteSync::getNextHopIf(struct rtnl_route *route_obj) return result; } - -// Check if ependent entries are re-conciled -bool RouteSync::isReadyToReconcile() -{ - vector required_modules = { - "orchagent", - }; - - for (string& module : required_modules) - { - WarmStart::WarmStartState state; - - WarmStart::getWarmStartState(module, state); - if (state == WarmStart::RECONCILED || state == WarmStart::WSDISABLED) - { - SWSS_LOG_INFO("Module %s Reconciled %d",module.c_str(), (int) state); - } - else - { - SWSS_LOG_INFO("Module %s NOT Reconciled %d",module.c_str(), (int) state); - return false; - } - } - - return true; -} diff --git a/fpmsyncd/routesync.h b/fpmsyncd/routesync.h index f65b271aec..b122a85b66 100644 --- a/fpmsyncd/routesync.h +++ b/fpmsyncd/routesync.h @@ -26,9 +26,6 @@ class RouteSync : public NetMsg virtual void onMsg(int nlmsg_type, struct nl_object *obj); virtual void onMsgRaw(struct nlmsghdr *obj); - - bool isReadyToReconcile(); - WarmStartHelper m_warmStartHelper; private: From 787b1b8087e87400cdd0558bab6a057aa144249b Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Mon, 1 Mar 2021 10:57:58 -0800 Subject: [PATCH 12/13] [evpn_warmboot_fdb] Addressing review comments --- fdbsyncd/fdbsyncd.cpp | 14 ++++++++++++-- warmrestart/warmRestartAssist.cpp | 7 +++++++ warmrestart/warmRestartAssist.h | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/fdbsyncd/fdbsyncd.cpp b/fdbsyncd/fdbsyncd.cpp index 661b165732..bc43bc3367 100644 --- a/fdbsyncd/fdbsyncd.cpp +++ b/fdbsyncd/fdbsyncd.cpp @@ -7,6 +7,7 @@ #include "netdispatcher.h" #include "netlink.h" #include "fdbsyncd/fdbsync.h" +#include "warm_restart.h" using namespace std; using namespace swss; @@ -61,8 +62,6 @@ int main(int argc, char **argv) } sleep(1); } - SWSS_LOG_NOTICE("Starting ReconcileTimer"); - sync.getRestartAssist()->startReconcileTimer(s); replayCheckTimer.setInterval(timespec{1, 0}); replayCheckTimer.start(); s.addSelectable(&replayCheckTimer); @@ -106,6 +105,17 @@ int main(int argc, char **argv) { sync.getRestartAssist()->appDataReplayed(); SWSS_LOG_NOTICE("FDB Replay Complete"); + s.removeSelectable(&replayCheckTimer); + + /* Obtain warm-restart timer defined for routing application */ + uint32_t warmRestartIval = WarmStart::getWarmStartTimer("bgp","bgp"); + if (warmRestartIval) + { + sync.getRestartAssist()->setReconcileInterval(warmRestartIval); + } + //Else the interval is already set to default value + SWSS_LOG_NOTICE("Starting ReconcileTimer"); + sync.getRestartAssist()->startReconcileTimer(s); } else { diff --git a/warmrestart/warmRestartAssist.cpp b/warmrestart/warmRestartAssist.cpp index 72c8657519..e8e99add22 100644 --- a/warmrestart/warmRestartAssist.cpp +++ b/warmrestart/warmRestartAssist.cpp @@ -284,6 +284,13 @@ void AppRestartAssist::reconcile() return; } +// set the reconcile interval +void AppRestartAssist::setReconcileInterval(uint32_t time) +{ + m_reconcileTimer = time; + m_warmStartTimer.setInterval(timespec{m_reconcileTimer, 0}); +} + // start the timer, take Select class "s" to add the timer. void AppRestartAssist::startReconcileTimer(Select &s) { diff --git a/warmrestart/warmRestartAssist.h b/warmrestart/warmRestartAssist.h index 72ad7c42d6..e4cac31b6e 100644 --- a/warmrestart/warmRestartAssist.h +++ b/warmrestart/warmRestartAssist.h @@ -75,6 +75,7 @@ class AppRestartAssist DELETE = 3 }; // These functions were used as described in the class description + void setReconcileInterval(uint32_t time); void startReconcileTimer(Select &s); void stopReconcileTimer(Select &s); bool checkReconcileTimer(Selectable *s); From 08a39085e336a6b92db018c3cdc4246ee11e8bba Mon Sep 17 00:00:00 2001 From: Nikhil Kelapure Date: Mon, 1 Mar 2021 22:35:54 -0800 Subject: [PATCH 13/13] [evpn_warmboot_fdb] Addressing review comments --- fdbsyncd/fdbsync.h | 2 +- fdbsyncd/fdbsyncd.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fdbsyncd/fdbsync.h b/fdbsyncd/fdbsync.h index aac0129423..ee6aa0845b 100644 --- a/fdbsyncd/fdbsync.h +++ b/fdbsyncd/fdbsync.h @@ -10,7 +10,7 @@ #include "warmRestartAssist.h" /* - * Default warm-restart timer interval for routing-stack app + * Default timer interval for fdbsyncd reconcillation */ #define DEFAULT_FDBSYNC_WARMSTART_TIMER 120 diff --git a/fdbsyncd/fdbsyncd.cpp b/fdbsyncd/fdbsyncd.cpp index bc43bc3367..41ab5a9824 100644 --- a/fdbsyncd/fdbsyncd.cpp +++ b/fdbsyncd/fdbsyncd.cpp @@ -114,6 +114,8 @@ int main(int argc, char **argv) sync.getRestartAssist()->setReconcileInterval(warmRestartIval); } //Else the interval is already set to default value + + //TODO: Optimise the reconcillation time using eoiu - issue#1657 SWSS_LOG_NOTICE("Starting ReconcileTimer"); sync.getRestartAssist()->startReconcileTimer(s); }