-
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
Re-write sonic-db-cli with c++ for sonic startup performance issue #607
Merged
liuh-80
merged 21 commits into
sonic-net:master
from
liuh-80:dev/liuh/rewrite-sonic-cli
May 26, 2022
Merged
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
db9a17f
Add sonic-db-cli files
liuh-80 ee1d0a2
Add make file
liuh-80 0da2adb
Improve build issue
liuh-80 593e2be
Fix build deb issue
liuh-80 3f9a015
Fix build issue
liuh-80 5110fdc
Fix build issue on amd64
liuh-80 e88e1cb
Fix build issue on amd64
liuh-80 5a5a932
Fix build issue on amd64
liuh-80 f33addf
Fix build issue on amd64
liuh-80 8bba4a4
Merge branch 'Azure:master' into dev/liuh/rewrite-sonic-cli
liuh-80 e2cc763
Improve code by PR comments
9db138b
Improve performance with std::async
1b46b5c
Add UT and fix code bug, keep output same with python version
1b6437f
Fix PR comments
d09ed85
Fix redis command build issue
5692aff
Add UT and fix code bug.
f3a21bd
Fix output format issue
7871bbe
Change install folder
0d2101d
Fix coredump issue
f95fa13
Fix PR comments
0b1d293
Fix PR comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
SUBDIRS = common pyext tests | ||
SUBDIRS = common pyext sonic-db-cli tests | ||
|
||
ACLOCAL_AMFLAGS = -I m4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,9 +92,12 @@ class RedisReply | |
/* Check that the status is QUEUED, throw exception otherwise */ | ||
void checkStatusQueued(); | ||
|
||
std::string to_string(); | ||
|
||
private: | ||
void checkStatus(const char *status); | ||
void checkReply(); | ||
std::string to_string(redisReply *reply); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
redisReply *m_reply; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
usr/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
usr/bin/sonic-db-cli | ||
liuh-80 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
INCLUDES = -I $(top_srcdir) | ||
|
||
if DEBUG | ||
DBGFLAGS = -ggdb -DDEBUG | ||
else | ||
DBGFLAGS = -g -DNDEBUG | ||
endif | ||
|
||
lib_LTLIBRARIES = libsonicdbcli.la | ||
libsonicdbcli_la_SOURCES = sonic-db-cli.cpp | ||
libsonicdbcli_la_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) | ||
libsonicdbcli_la_CPPFLAGS = $(DBGFLAGS) $(AM_CPPFLAGS) $(CFLAGS_COMMON) | ||
libsonicdbcli_la_LDFLAGS = -L$(top_srcdir)/common -lswsscommon -lpthread | ||
|
||
bin_PROGRAMS = sonic-db-cli | ||
sonic_db_cli_SOURCES = sonic-db-cli.cpp main.cpp | ||
sonic_db_cli_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) | ||
sonic_db_cli_CPPFLAGS = $(DBGFLAGS) $(AM_CPPFLAGS) $(CFLAGS_COMMON) | ||
sonic_db_cli_LDFLAGS = -L$(top_srcdir)/common -lswsscommon -lpthread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "sonic-db-cli.h" | ||
#include "common/dbconnector.h" | ||
|
||
using namespace swss; | ||
using namespace std; | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
auto initializeGlobalConfig = []() | ||
{ | ||
SonicDBConfig::initializeGlobalConfig(SonicDBConfig::DEFAULT_SONIC_DB_GLOBAL_CONFIG_FILE); | ||
}; | ||
|
||
auto initializeConfig = []() | ||
{ | ||
SonicDBConfig::initialize(SonicDBConfig::DEFAULT_SONIC_DB_CONFIG_FILE); | ||
}; | ||
|
||
return sonic_db_cli( | ||
argc, | ||
argv, | ||
initializeGlobalConfig, | ||
initializeConfig); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 am not sure if it will introduce ambiguity. Seems like you can remove
std::
.Not a big issue.