-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TableBase] Make channel name from both table name and database ID #568
Conversation
jimmyzhai
commented
Dec 17, 2021
•
edited
Loading
edited
- To overload member function getChannelName with parameter tag
- To use dbId as tag and call getChannelName in producer/consumertable and producer/consumerstatetable
* remove the deprecated tableNameSeparatorMap, always get separator from SonicDBConfig
common/table.h
Outdated
@@ -34,34 +31,18 @@ typedef std::map<std::string,TableMap> TableDump; | |||
|
|||
class TableBase { | |||
public: | |||
#ifndef SWIG | |||
__attribute__((deprecated)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks dbId
is widely used to identify a database, and both Id
and Name
are primary properties of database. In database domain hierarchy, table always belongs to one database. To add dbId
member in class TableBase is meaningful to indicate in which database the table is. In ctor internal, table separator is initialized to the separator of database dbId
.
common/table.h
Outdated
@@ -77,12 +58,13 @@ class TableBase { | |||
return m_tableSeparator; | |||
} | |||
|
|||
std::string getChannelName() { return m_tableName + "_CHANNEL"; } | |||
std::string getChannelName() { return m_tableName + "_CHANNEL" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above reply, I thinking adding dbId
as a member is much reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As comments
common/notificationproducer.cpp
Outdated
@@ -1,7 +1,7 @@ | |||
#include "notificationproducer.h" | |||
|
|||
swss::NotificationProducer::NotificationProducer(swss::DBConnector *db, const std::string &channel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Hold on the change of channel name tagged dbId for Notification Producer/Consumer. Some lua scripts like pfc_restore.lua, pfe_detect are using redis PUBLISH
command directly with hardcode channel name.
What I did In p4rt test scripts, bind response consumer to appl_state_db for consistency. Why I did it In p4orch, the relating notification producer for table P4RT_TABLE is on database appl state db How I verified it Run vstest Details if related notification channel name would be tagged dbId - sonic-net/sonic-swss-common#568
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
…se ID (sonic-net#568)" This reverts commit bd4d0ce.
What I did In p4rt test scripts, bind response consumer to appl_state_db for consistency. Why I did it In p4orch, the relating notification producer for table P4RT_TABLE is on database appl state db How I verified it Run vstest Details if related notification channel name would be tagged dbId - sonic-net/sonic-swss-common#568
What I did In p4rt test scripts, bind response consumer to appl_state_db for consistency. Why I did it In p4orch, the relating notification producer for table P4RT_TABLE is on database appl state db How I verified it Run vstest Details if related notification channel name would be tagged dbId - sonic-net/sonic-swss-common#568