Skip to content
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

Merged
merged 8 commits into from
Jan 14, 2022

Conversation

jimmyzhai
Copy link
Contributor

@jimmyzhai jimmyzhai commented Dec 17, 2021

  1. To overload member function getChannelName with parameter tag
  2. To use dbId as tag and call getChannelName in producer/consumertable and producer/consumerstatetable

* remove the deprecated tableNameSeparatorMap, always get separator from SonicDBConfig
@jimmyzhai jimmyzhai requested a review from qiluo-msft December 17, 2021 10:36
common/table.h Outdated
@@ -34,34 +31,18 @@ typedef std::map<std::string,TableMap> TableDump;

class TableBase {
public:
#ifndef SWIG
__attribute__((deprecated))
Copy link
Contributor

@qiluo-msft qiluo-msft Dec 18, 2021

Choose a reason for hiding this comment

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

deprecated

Please don't remove deprecated attribute. The reason is we are using dbName to identify a database instead of dbId. And the deprecated ctor is only used in SWIG, and then used by old test code, which we did not migrate completely. #Closed

Copy link
Contributor Author

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"
Copy link
Contributor

@qiluo-msft qiluo-msft Dec 18, 2021

Choose a reason for hiding this comment

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

getChannelName

The dbId is a concept out of TableBase class.
Could you add new parameter dbId, and do not use a member? #Closed

Copy link
Contributor Author

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.

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

As comments

common/table.h Outdated Show resolved Hide resolved
common/table.cpp Outdated Show resolved Hide resolved
common/producertable.cpp Outdated Show resolved Hide resolved
@@ -1,7 +1,7 @@
#include "notificationproducer.h"

swss::NotificationProducer::NotificationProducer(swss::DBConnector *db, const std::string &channel):
Copy link
Contributor

Choose a reason for hiding this comment

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

NotificationProducer

Do you need to change NotificationConsumer accordingly?

Copy link
Contributor Author

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.

@qiluo-msft qiluo-msft requested a review from kcudnik January 6, 2022 07:12
jimmyzhai added a commit to sonic-net/sonic-swss that referenced this pull request Jan 11, 2022
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
@jimmyzhai
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

qiluo-msft
qiluo-msft previously approved these changes Jan 12, 2022
@jimmyzhai
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jimmyzhai
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jimmyzhai jimmyzhai merged commit bd4d0ce into sonic-net:master Jan 14, 2022
qiluo-msft added a commit to qiluo-msft/sonic-swss-common that referenced this pull request Jan 15, 2022
qiluo-msft added a commit that referenced this pull request Jan 15, 2022
jimmyzhai added a commit that referenced this pull request Jan 24, 2022
qiluo-msft pushed a commit that referenced this pull request Jan 25, 2022
…d database ID (#568)" (#574)" (#578)

Reverts #574

The real cause is fixed at sonic-net/sonic-sairedis#995. Continue to commit bd4d0ce again.
dprital pushed a commit to dprital/sonic-swss that referenced this pull request May 8, 2022
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
preetham-singh pushed a commit to preetham-singh/sonic-swss that referenced this pull request Aug 6, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants