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

Add refillToSync() into ConsumerBase to support warmboot. #2866

Merged
merged 4 commits into from
Oct 15, 2023

Conversation

mint570
Copy link
Contributor

@mint570 mint570 commented Jul 24, 2023

What I did
Add refillToSync() into ConsumerBase to support warmboot.

Why I did it
Add warmboot support for zmq consumer.

How I verified it
This will be useful when we migrate other orchs to use zmq.

Details if related
UT

@lguohan
Copy link
Contributor

lguohan commented Aug 22, 2023

@liuh-80 , i see you comments in #2857 , as @mint570 said, it would be useful to migrate other orchs to zmq. do you see any downside of this code? if it doesn't hurt existing scenario, we should make our code more generic so that people can build other scenario around our code?

@liuh-80
Copy link
Contributor

liuh-80 commented Aug 22, 2023

@liuh-80 , i see you comments in #2857 , as @mint570 said, it would be useful to migrate other orchs to zmq. do you see any downside of this code? if it doesn't hurt existing scenario, we should make our code more generic so that people can build other scenario around our code?

There is no downside of add refillToSync(), I will review this PR and give comments.

{
auto subTable = dynamic_cast<SubscriberStateTable *>(getSelectable());
auto consumertable = dynamic_cast<ConsumerTableBase *>(getSelectable());
Copy link
Contributor

@liuh-80 liuh-80 Aug 22, 2023

Choose a reason for hiding this comment

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

Suggest move this to line 192 to avoid unnecessary convert, also because first if block returned, so line 192 can change from 'else if' to 'if'

#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.

Done

else
{
// The consumerTable should be ZmqConsumerStateTable.
DBConnector db("APPL_DB", 0);
Copy link
Contributor

@liuh-80 liuh-80 Aug 22, 2023

Choose a reason for hiding this comment

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

Please check if the consumerTable is ZmqConsumerStateTable and use getDbConnector() in ZmqConsumerStateTable:

https://github.com/sonic-net/sonic-swss-common/blob/5b6377cd260e5421470263ebd7e27ac8aca42c52/common/zmqconsumerstatetable.h

The reason of this is because the APPL_DB may not in local and may not be 'APPL_DB', the design still under discussion, so if use DBConnector from ZMQ, the code can keep no change when design finalized.

#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.

Done

@mint570 mint570 force-pushed the zmq_warmboot_upstream_master branch from c4973ea to b120b29 Compare August 28, 2023 16:49
auto table = Table(db, tableName);
return refillToSync(&table);
}
DBConnector db("APPL_DB", 0);
auto table = Table(&db, tableName);
return refillToSync(&table);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why need this block? What is the class of getSelectable()? APPL_DB seems a magic choice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the default case if none of the above condition matches. Today, orchagent reads the entries from APPL DB after warm boot. I hear dash is different, but using APPL DB shouldn't be completely unreasonable.

Do you suggest to remove this default case handling? I can do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not get "the class of getSelectable()?" in this case. If you do not either, let's remove this block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@prsunny
Copy link
Collaborator

prsunny commented Sep 18, 2023

@qiluo-msft to approve

@mint570 mint570 force-pushed the zmq_warmboot_upstream_master branch from 436f7c9 to da66678 Compare September 19, 2023 18:43
Change-Id: I29903d43d7b53ddcc92d836ec4e95439dfbda714
@mint570 mint570 force-pushed the zmq_warmboot_upstream_master branch from da66678 to dec6fc1 Compare September 21, 2023 18:14
@mint570
Copy link
Contributor Author

mint570 commented Sep 21, 2023

The vs test failed. Not sure if it relates to this PR or not.

@prsunny
Copy link
Collaborator

prsunny commented Sep 22, 2023

The vs test failed. Not sure if it relates to this PR or not.

no, there is a known issue with submodule PR for sai-redis. will merge this by next week.

@prsunny prsunny merged commit f31ccd0 into sonic-net:master Oct 15, 2023
@mint570 mint570 deleted the zmq_warmboot_upstream_master branch March 19, 2024 20:41
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.

5 participants