Skip to content

Commit

Permalink
Use different channel RESTARTQUERY for syncd/gbsyncd
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyzhai committed Oct 9, 2023
1 parent 5450811 commit 4bebd6c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion syncd/RequestShutdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void RequestShutdown::send()

swss::DBConnector db(m_contextConfig->m_dbAsic, 0);

swss::NotificationProducer restartQuery(&db, SYNCD_NOTIFICATION_CHANNEL_RESTARTQUERY);
swss::NotificationProducer restartQuery(&db, SYNCD_NOTIFICATION_CHANNEL_RESTARTQUERY_PER_DB(m_contextConfig->m_dbAsic));

std::vector<swss::FieldValueTuple> values;

Expand Down
12 changes: 12 additions & 0 deletions syncd/RequestShutdown.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@

#define SYNCD_NOTIFICATION_CHANNEL_RESTARTQUERY "RESTARTQUERY"

/**
* @brief Notification channel 'restartquery' per DB scope
*
* In https://redis.io/docs/manual/pubsub/, it says:
* "Pub/Sub has no relation to the key space. It was made to not interfere with
* it on any level, including database numbers."
*/
#define SYNCD_NOTIFICATION_CHANNEL_RESTARTQUERY_PER_DB(dbName) \
((dbName) == "ASIC_DB" ? \
SYNCD_NOTIFICATION_CHANNEL_RESTARTQUERY : \
(dbName) + "_" + SYNCD_NOTIFICATION_CHANNEL_RESTARTQUERY)

namespace syncd
{
class RequestShutdown
Expand Down
2 changes: 1 addition & 1 deletion syncd/Syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Syncd::Syncd(

m_handler->setSwitchNotifications(m_sn.getSwitchNotifications());

m_restartQuery = std::make_shared<swss::NotificationConsumer>(m_dbAsic.get(), SYNCD_NOTIFICATION_CHANNEL_RESTARTQUERY);
m_restartQuery = std::make_shared<swss::NotificationConsumer>(m_dbAsic.get(), SYNCD_NOTIFICATION_CHANNEL_RESTARTQUERY_PER_DB(m_contextConfig->m_dbAsic));

// TODO to be moved to ASIC_DB
m_dbFlexCounter = std::make_shared<swss::DBConnector>(m_contextConfig->m_dbFlex, 0);
Expand Down

0 comments on commit 4bebd6c

Please sign in to comment.