From 7acd0284c572b568f0e16142bab4c1a3e787ff6d Mon Sep 17 00:00:00 2001 From: Junhua Zhai Date: Thu, 9 Nov 2023 08:20:45 +0800 Subject: [PATCH] [gbsyncd] Add asic db prefix for channel RESTARTQUERY (#1302) * Use different channel RESTARTQUERY for syncd/gbsyncd * change restartquery to restartQuery due to aspell error --- syncd/RequestShutdown.cpp | 2 +- syncd/RequestShutdown.h | 12 ++++++++++++ syncd/Syncd.cpp | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/syncd/RequestShutdown.cpp b/syncd/RequestShutdown.cpp index 444fa742d..2daf2cc6e 100644 --- a/syncd/RequestShutdown.cpp +++ b/syncd/RequestShutdown.cpp @@ -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 values; diff --git a/syncd/RequestShutdown.h b/syncd/RequestShutdown.h index 5688763a7..833f57efe 100644 --- a/syncd/RequestShutdown.h +++ b/syncd/RequestShutdown.h @@ -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 diff --git a/syncd/Syncd.cpp b/syncd/Syncd.cpp index 2e560d5d1..791cb166a 100644 --- a/syncd/Syncd.cpp +++ b/syncd/Syncd.cpp @@ -161,7 +161,7 @@ Syncd::Syncd( m_handler->setSwitchNotifications(m_sn.getSwitchNotifications()); - m_restartQuery = std::make_shared(m_dbAsic.get(), SYNCD_NOTIFICATION_CHANNEL_RESTARTQUERY); + m_restartQuery = std::make_shared(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(m_contextConfig->m_dbFlex, 0);