Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/RedisChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ 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(),
dbAsic == "GB_ASIC_DB" ? REDIS_TABLE_GBNOTIFICATIONS : REDIS_TABLE_NOTIFICATIONS);

m_runNotificationThread = true;

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

/**
* @brief Table which will be used to forward notifications from gbsyncd.
*/
#define REDIS_TABLE_GBNOTIFICATIONS "GBNOTIFICATIONS"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why GB needs different communication channel? channels are based on databases, for example ASIC_DB, so if GB will have different database then it will have separate communication channel for notifications and they will not colide

Copy link
Copy Markdown
Collaborator

@kcudnik kcudnik Sep 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this could be generalizaed by chaning notifications channel name by prefixing it by db name
for example dbAsic + REDIS_TABLE_NOTIFICATIONS, then it would be more generic, and i think this would be proffered way to make this change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The redis channel is global per instance. Do you prefer to the below?

#define REDIS_GB_ASIC_NOTIFICATIONS "GB_ASIC_NOTIFICATIONS"

"NOTIFICATIONS" has been widely referred as asic channel. I'll not rename it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think more preffered way would be to use that asic db prefix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add REDIS_TABLE_NOTIFICATIONS_PER_DB(dbName)


/**
* @brief Table which will be used to send API response from syncd.
*/
Expand Down
3 changes: 2 additions & 1 deletion syncd/RedisNotificationProducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ 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(),
dbName == "GB_ASIC_DB" ? REDIS_TABLE_GBNOTIFICATIONS : REDIS_TABLE_NOTIFICATIONS);
}

void RedisNotificationProducer::send(
Expand Down