From 6b99c49b5e109c160fd80c93725b8aabdb5fe017 Mon Sep 17 00:00:00 2001 From: Junhua Zhai Date: Fri, 21 Oct 2022 17:00:30 +0800 Subject: [PATCH] [gbsyncd] Add asic db prefix for channel NOTIFICATIONS (#1129) Fix #1131. The communication channel between orchagent and gbsyncd needs different from the channel "NOTIFICATIONS" between orchagent and syncd. --- lib/RedisChannel.cpp | 2 +- lib/sairediscommon.h | 12 ++++++++++++ syncd/RedisNotificationProducer.cpp | 2 +- tests/aspell.en.pws | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/RedisChannel.cpp b/lib/RedisChannel.cpp index 93567f45a..17e061e3e 100644 --- a/lib/RedisChannel.cpp +++ b/lib/RedisChannel.cpp @@ -25,7 +25,7 @@ RedisChannel::RedisChannel( m_getConsumer = std::make_shared(m_db.get(), REDIS_TABLE_GETRESPONSE); m_dbNtf = std::make_shared(dbAsic, 0); - m_notificationConsumer = std::make_shared(m_dbNtf.get(), REDIS_TABLE_NOTIFICATIONS); + m_notificationConsumer = std::make_shared(m_dbNtf.get(), REDIS_TABLE_NOTIFICATIONS_PER_DB(dbAsic)); m_runNotificationThread = true; diff --git a/lib/sairediscommon.h b/lib/sairediscommon.h index c095ac472..621e8088e 100644 --- a/lib/sairediscommon.h +++ b/lib/sairediscommon.h @@ -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. */ diff --git a/syncd/RedisNotificationProducer.cpp b/syncd/RedisNotificationProducer.cpp index 3e19a4743..4bfb2cc0e 100644 --- a/syncd/RedisNotificationProducer.cpp +++ b/syncd/RedisNotificationProducer.cpp @@ -13,7 +13,7 @@ RedisNotificationProducer::RedisNotificationProducer( m_db = std::make_shared(dbName, 0); - m_notificationProducer = std::make_shared(m_db.get(), REDIS_TABLE_NOTIFICATIONS); + m_notificationProducer = std::make_shared(m_db.get(), REDIS_TABLE_NOTIFICATIONS_PER_DB(dbName)); } void RedisNotificationProducer::send( diff --git a/tests/aspell.en.pws b/tests/aspell.en.pws index 1ceca3ecd..f85a2541e 100644 --- a/tests/aspell.en.pws +++ b/tests/aspell.en.pws @@ -231,6 +231,7 @@ inseg Inseg INSEG insegs +io ip IP ipc @@ -308,6 +309,7 @@ PORTs pre printf ptr +pubsub qos queueCounterIds queueId