Skip to content

Commit

Permalink
[gbsyncd] Add asic db prefix for channel NOTIFICATIONS (#1129)
Browse files Browse the repository at this point in the history
Fix #1131. The communication channel between orchagent and gbsyncd needs different from
the channel "NOTIFICATIONS" between orchagent and syncd.
  • Loading branch information
jimmyzhai authored Oct 21, 2022
1 parent 2585a1f commit b7c85ca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/RedisChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RedisChannel::RedisChannel(
m_getConsumer = std::make_shared<swss::ConsumerTable>(m_db.get(), REDIS_TABLE_GETRESPONSE);

m_dbNtf = std::make_shared<swss::DBConnector>(dbAsic, 0);
m_notificationConsumer = std::make_shared<swss::NotificationConsumer>(m_dbNtf.get(), REDIS_TABLE_NOTIFICATIONS);
m_notificationConsumer = std::make_shared<swss::NotificationConsumer>(m_dbNtf.get(), REDIS_TABLE_NOTIFICATIONS_PER_DB(dbAsic));

m_runNotificationThread = true;

Expand Down
12 changes: 12 additions & 0 deletions lib/sairediscommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@
*/
#define REDIS_TABLE_NOTIFICATIONS "NOTIFICATIONS"

/**
* @brief Table which will be used to forward notifications 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 REDIS_TABLE_NOTIFICATIONS_PER_DB(dbName) \
((dbName) == "ASIC_DB" ? \
REDIS_TABLE_NOTIFICATIONS : \
(dbName) + "_" + REDIS_TABLE_NOTIFICATIONS)

/**
* @brief Table which will be used to send API response from syncd.
*/
Expand Down
2 changes: 1 addition & 1 deletion syncd/RedisNotificationProducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RedisNotificationProducer::RedisNotificationProducer(

m_db = std::make_shared<swss::DBConnector>(dbName, 0);

m_notificationProducer = std::make_shared<swss::NotificationProducer>(m_db.get(), REDIS_TABLE_NOTIFICATIONS);
m_notificationProducer = std::make_shared<swss::NotificationProducer>(m_db.get(), REDIS_TABLE_NOTIFICATIONS_PER_DB(dbName));
}

void RedisNotificationProducer::send(
Expand Down
2 changes: 2 additions & 0 deletions tests/aspell.en.pws
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ inseg
Inseg
INSEG
insegs
io
ip
IP
ipc
Expand Down Expand Up @@ -308,6 +309,7 @@ PORTs
pre
printf
ptr
pubsub
qos
queueCounterIds
queueId
Expand Down

0 comments on commit b7c85ca

Please sign in to comment.