-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added changes to handle dependency check in FdbSyncd and FpmSyncd for warm-boot #1556
Changes from 12 commits
5530e69
cd04985
12d940a
d56fa46
b5c0e7c
486d26a
421f8e6
7fa56be
a3a9d04
a951e6b
a6b5521
8fbd131
787b1b8
08a3908
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,17 @@ | |
#include "netmsg.h" | ||
#include "warmRestartAssist.h" | ||
|
||
// The timeout value (in seconds) for fdbsyncd reconcilation logic | ||
#define DEFAULT_FDBSYNC_WARMSTART_TIMER 30 | ||
/* | ||
* Default warm-restart timer interval for routing-stack app | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change the comment to default timer for fdb reconciliation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure .. will do |
||
*/ | ||
#define DEFAULT_FDBSYNC_WARMSTART_TIMER 120 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned earlier, how is this fdb depending on routing stack? If user configures the routing stack warm-restart timer to a bigger value and it actually took that much time to reconcile for routing stack, what is the consequence? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fdbsyncd reconciliation is dependant on BGP convergence time. Will change it to use the BGP warm-restart timer config value instead of hardcoded value. That way the reconcile is related to the control plane convergence. Same way its done in fpmsyncd too. Further to optimise the reconciliation time, EOIU feature is implemented for fpmsyncd to check for actual protocol convergence. This is not yet validated for fdbsyncd and will be implemented later. For now fdbsyncd will only use the bgp warm-restart timer config value as in fpmsyncd There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fdbsyncd reconciliation is dependant on BGP convergence time. Will change it to use the BGP warm-restart timer config value instead of hardcoded value. That way the reconcile is related to the control plane convergence. Same way its done in fpmsyncd too. Further to optimise the reconciliation time, EOIU feature is implemented for fpmsyncd to check for actual protocol convergence. This is not yet validated for fdbsyncd and will be implemented later. For now fdbsyncd will only use the bgp warm-restart timer config value as in fpmsyncd |
||
|
||
/* | ||
* 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 INTF_RESTORE_MAX_WAIT_TIME 180 | ||
|
||
namespace swss { | ||
|
||
|
@@ -43,7 +52,7 @@ class FdbSync : public NetMsg | |
|
||
virtual void onMsg(int nlmsg_type, struct nl_object *obj); | ||
|
||
bool isFdbRestoreDone(); | ||
bool isIntfRestoreDone(); | ||
|
||
AppRestartAssist *getRestartAssist() | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ int main(int argc, char **argv) | |
Selectable *temps; | ||
int ret; | ||
Select s; | ||
SelectableTimer replayCheckTimer(timespec{0, 0}); | ||
|
||
using namespace std::chrono; | ||
|
||
|
@@ -45,7 +46,31 @@ int main(int argc, char **argv) | |
if (sync.getRestartAssist()->isWarmStartInProgress()) | ||
{ | ||
sync.getRestartAssist()->readTablesToMap(); | ||
|
||
steady_clock::time_point starttime = steady_clock::now(); | ||
while (!sync.isIntfRestoreDone()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
CPU is wasted on waiting. Could you subscribe Redis? #WontFix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this is not a continuous busy wait ( sleep is present), this should not cause the cpu to be continuously busy. Also there is nothing for fdbsyncd to do until the interface info is populated to kernel after system warm-reboot, hence it needs to wait till such time. |
||
{ | ||
duration<double> time_span = | ||
duration_cast<duration<double>>(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!!!"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if intf is not restored after max_wait_time? Shouldn't we abort to avoid more issues? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. System will proceed further. Some mac programming to kernel might fail because underlying interface is not yet created. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we could not restore interface, why we should proceed further and get into some limbo state that may or may not have critical issues. I would suggest we abort to bring user's attention. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interfaces will be eventually restored. The only impact will be that warm-reboot might not be hitless and there will be traffic loss seen. Not sure if we need to go for full abort and impact everything and all traffic. Requesting @prsunny to comment on this too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Some mac programming to kernel might fail because underlying interface is not yet created." so this condition will be recovered by someone later? Again, if it is a critical condition, we should raise/abort so we don't get into limbo state. |
||
throw runtime_error("fdbsyncd: timedout on interface data replay"); | ||
} | ||
sleep(1); | ||
} | ||
SWSS_LOG_NOTICE("Starting ReconcileTimer"); | ||
sync.getRestartAssist()->startReconcileTimer(s); | ||
replayCheckTimer.setInterval(timespec{1, 0}); | ||
replayCheckTimer.start(); | ||
s.addSelectable(&replayCheckTimer); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove extra blank line #Closed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do |
||
else | ||
{ | ||
sync.getRestartAssist()->warmStartDisabled(); | ||
sync.m_reconcileDone = true; | ||
} | ||
|
||
netlink.registerGroup(RTNLGRP_LINK); | ||
|
@@ -67,14 +92,28 @@ int main(int argc, char **argv) | |
{ | ||
s.select(&temps); | ||
|
||
if(temps == (Selectable *)sync.getFdbStateTable()) | ||
if (temps == (Selectable *)sync.getFdbStateTable()) | ||
{ | ||
sync.processStateFdb(); | ||
} | ||
else if (temps == (Selectable *)sync.getCfgEvpnNvoTable()) | ||
{ | ||
sync.processCfgEvpnNvo(); | ||
} | ||
else if (temps == &replayCheckTimer) | ||
{ | ||
if (sync.getFdbStateTable()->empty() && sync.getCfgEvpnNvoTable()->empty()) | ||
{ | ||
sync.getRestartAssist()->appDataReplayed(); | ||
SWSS_LOG_NOTICE("FDB Replay Complete"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removeSelectable for replayCheckTimer? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, since the replaychecktimer and reconciliation timer are in parallel, what is the consequence if reconciliation timer is up, but we haven't replayed? If replay is must, but not yet done after reconciliation timer, we should log the error and raise. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will removeSelectable replayCheckTimer and start recontillation timer after replay is done. |
||
} | ||
else | ||
{ | ||
replayCheckTimer.setInterval(timespec{1, 0}); | ||
// re-start replay check timer | ||
replayCheckTimer.start(); | ||
} | ||
} | ||
else | ||
{ | ||
/* | ||
|
@@ -88,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"); | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FdbSync::isIntfRestoreDone() , FdbSync::isReadyToReconcile() and RouteSync::isReadyToReconcile() are doing similar tasks, it seems we could make them into library calls with different input parameters. Later PR is probably fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure .. will consider in future updates to the code