-
Notifications
You must be signed in to change notification settings - Fork 265
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
[sonic-cli] Fix sonic-db-cli output format not backward compatible with python version issue. #631
Conversation
Some UT failed, but seems not related with code change because also failed in another PR which only change code coverafe rate: test_MirrorSessionAddModifyAndDelete failed (1 runs remaining out of 2). |
Still need this test PR to verify the cli change not break any E2E test case: sonic-net/sonic-buildimage#11130 |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
common/replyformatter.cpp
Outdated
|
||
result << ")"; | ||
|
||
return result.str(); |
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.
I found some discussion about boost join and stringstream, seems stringstream has better performance: https://stackoverflow.com/questions/23551653/boostjoin-and-boosttransformed
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.
Good to know. Actually I found some functions in common/stringutility.h. Could you try reuse or add common functions there?
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.
Fixed, add new method to stringutility.h and improve code to use it.
@@ -165,7 +168,8 @@ int executeCommands( | |||
based on our usage in SONiC, None and list type output from python API needs to be modified | |||
with these changes, it is enough for us to mimic redis-cli in SONiC so far since no application uses tty mode redis-cli output | |||
*/ | |||
cout << reply.to_string() << endl; | |||
auto commandName = getCommandName(commands); | |||
cout << RedisReply::to_string(reply.getContext(), commandName) << endl; |
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.
It's not easy because RedisCommand can handle a format string as parameter, for example: "hgetall %s %d".
So, if we move this method to RedisCommand the logic will be much complex, because we need parse user input as before.
Following test randomly failed, not related with code change in this PR, seems hardware timer issue: tests: tests.cpp:843: void test_watchdog_timer_clock_rollback(): Assertion `settimeofday(¤tTime, NULL) == 0' failed. |
@kcudnik, could you please check if my fix for your review comments is OK? |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Need wait for this PR merge first, which fix the merge validation failed issue: |
Could you merge latest master? |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
…th python version issue. (sonic-net#631) #### Why I did it Fix sonic-db-cli output format not backward compatible with python version issue. Which break some E2E test. #### How I did it Re-write redis reply format method, keep same format with redis-py. #### How to verify it Add c++ unit test to cover all code. Pass all E2E test scenario. #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 #### Description for the changelog Re-write sonic-cli with c++ for sonic startup performance issue #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration. --> #### A picture of a cute animal (not mandatory but encouraged)
…th python version issue. (#631) (#637) #### Why I did it Fix sonic-db-cli output format not backward compatible with python version issue. Which break some E2E test. #### How I did it Re-write redis reply format method, keep same format with redis-py. #### How to verify it Add c++ unit test to cover all code. Pass all E2E test scenario. #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 #### Description for the changelog Re-write sonic-cli with c++ for sonic startup performance issue #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration. --> #### A picture of a cute animal (not mandatory but encouraged)
…th python version issue. (sonic-net#631) #### Why I did it Fix sonic-db-cli output format not backward compatible with python version issue. Which break some E2E test. #### How I did it Re-write redis reply format method, keep same format with redis-py. #### How to verify it Add c++ unit test to cover all code. Pass all E2E test scenario. #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 #### Description for the changelog Re-write sonic-cli with c++ for sonic startup performance issue #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration. --> #### A picture of a cute animal (not mandatory but encouraged)
…th python version issue. (#631) #### Why I did it Fix sonic-db-cli output format not backward compatible with python version issue. Which break some E2E test. #### How I did it Re-write redis reply format method, keep same format with redis-py. #### How to verify it Add c++ unit test to cover all code. Pass all E2E test scenario. #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 #### Description for the changelog Re-write sonic-cli with c++ for sonic startup performance issue #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration. --> #### A picture of a cute animal (not mandatory but encouraged)
Why I did it
Fix sonic-db-cli output format not backward compatible with python version issue. Which break some E2E test.
How I did it
Re-write redis reply format method, keep same format with redis-py.
How to verify it
Add c++ unit test to cover all code.
Pass all E2E test scenario.
Which release branch to backport (provide reason below if selected)
Description for the changelog
Re-write sonic-cli with c++ for sonic startup performance issue
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)