Skip to content

Commit b7c85ca

Browse files
authored
[gbsyncd] Add asic db prefix for channel NOTIFICATIONS (sonic-net#1129)
Fix sonic-net#1131. The communication channel between orchagent and gbsyncd needs different from the channel "NOTIFICATIONS" between orchagent and syncd.
1 parent 2585a1f commit b7c85ca

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

lib/RedisChannel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RedisChannel::RedisChannel(
2525
m_getConsumer = std::make_shared<swss::ConsumerTable>(m_db.get(), REDIS_TABLE_GETRESPONSE);
2626

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

3030
m_runNotificationThread = true;
3131

lib/sairediscommon.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@
6767
*/
6868
#define REDIS_TABLE_NOTIFICATIONS "NOTIFICATIONS"
6969

70+
/**
71+
* @brief Table which will be used to forward notifications per DB scope
72+
*
73+
* In https://redis.io/docs/manual/pubsub/, it says:
74+
* "Pub/Sub has no relation to the key space. It was made to not interfere with
75+
* it on any level, including database numbers."
76+
*/
77+
#define REDIS_TABLE_NOTIFICATIONS_PER_DB(dbName) \
78+
((dbName) == "ASIC_DB" ? \
79+
REDIS_TABLE_NOTIFICATIONS : \
80+
(dbName) + "_" + REDIS_TABLE_NOTIFICATIONS)
81+
7082
/**
7183
* @brief Table which will be used to send API response from syncd.
7284
*/

syncd/RedisNotificationProducer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RedisNotificationProducer::RedisNotificationProducer(
1313

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

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

1919
void RedisNotificationProducer::send(

tests/aspell.en.pws

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ inseg
231231
Inseg
232232
INSEG
233233
insegs
234+
io
234235
ip
235236
IP
236237
ipc
@@ -308,6 +309,7 @@ PORTs
308309
pre
309310
printf
310311
ptr
312+
pubsub
311313
qos
312314
queueCounterIds
313315
queueId

0 commit comments

Comments
 (0)