Skip to content

Commit

Permalink
Save teamsyncd data reconciliation state to stateDB for observabilit…
Browse files Browse the repository at this point in the history
…y. (sonic-net#832)

Signed-off-by: Jipan Yang <jipan.yang@alibaba-inc.com>
  • Loading branch information
jipanyang authored and lguohan committed Apr 24, 2019
1 parent 9b52f2f commit 624c599
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions teamsyncd/teamsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ TeamSync::TeamSync(DBConnector *db, DBConnector *stateDb, Select *select) :
m_lagMemberTable(db, APP_LAG_MEMBER_TABLE_NAME),
m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME)
{
WarmStart::initialize("teamsyncd", "teamd");
WarmStart::checkWarmStart("teamsyncd", "teamd");
WarmStart::initialize(TEAMSYNCD_APP_NAME, "teamd");
WarmStart::checkWarmStart(TEAMSYNCD_APP_NAME, "teamd");
m_warmstart = WarmStart::isWarmStart();

if (m_warmstart)
{
m_start_time = steady_clock::now();
auto warmRestartIval = WarmStart::getWarmStartTimer("teamsyncd", "teamd");
auto warmRestartIval = WarmStart::getWarmStartTimer(TEAMSYNCD_APP_NAME, "teamd");
m_pending_timeout = warmRestartIval ? warmRestartIval : DEFAULT_WR_PENDING_TIMEOUT;
m_lagTable.create_temp_view();
m_lagMemberTable.create_temp_view();
WarmStart::setWarmStartState(TEAMSYNCD_APP_NAME, WarmStart::INITIALIZED);
SWSS_LOG_NOTICE("Starting in warmstart mode");
}
}
Expand All @@ -49,6 +50,7 @@ void TeamSync::periodic()
{
applyState();
m_warmstart = false; // apply state just once
WarmStart::setWarmStartState(TEAMSYNCD_APP_NAME, WarmStart::RECONCILED);
}
}

Expand Down
1 change: 1 addition & 0 deletions teamsyncd/teamsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "netmsg.h"
#include <team.h>

#define TEAMSYNCD_APP_NAME "teamsyncd"
// seconds
const uint32_t DEFAULT_WR_PENDING_TIMEOUT = 70;

Expand Down
2 changes: 1 addition & 1 deletion teamsyncd/teamsyncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using namespace swss;

int main(int argc, char **argv)
{
swss::Logger::linkToDbNative("teamsyncd");
swss::Logger::linkToDbNative(TEAMSYNCD_APP_NAME);
DBConnector db(APPL_DB, DBConnector::DEFAULT_UNIXSOCKET, 0);
DBConnector stateDb(STATE_DB, DBConnector::DEFAULT_UNIXSOCKET, 0);
Select s;
Expand Down

0 comments on commit 624c599

Please sign in to comment.