From c580a136547873b5b8924fdc5bdac1bc093ed0ea Mon Sep 17 00:00:00 2001 From: Hua Liu <58683130+liuh-80@users.noreply.github.com> Date: Wed, 1 Jun 2022 08:05:53 +0800 Subject: [PATCH] [swsscommon] Add c++ version sonic-db-cli from sonic-swss-common (#10825) Fix sonic-db-cli high CPU usage on SONiC startup issue: https://github.com/Azure/sonic-buildimage/issues/10218 ETA of this issue will be 2022/05/31 Re-write sonic-cli with c++ in sonic-swss-common: https://github.com/Azure/sonic-swss-common/pull/607 Modify swss-common rules and slave.mk to install c++ version sonic-db-cli. Pass all E2E test scenario. - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 Build and install c++ version sonic-db-cli from swss-common. --- files/build_templates/sonic_debian_extension.j2 | 4 ++++ rules/docker-config-engine-buster.mk | 3 ++- rules/docker-config-engine-stretch.mk | 4 +++- rules/docker-config-engine.mk | 2 ++ rules/docker-database.mk | 3 +++ rules/swss-common.mk | 3 +++ slave.mk | 1 + src/sonic-swss-common | 2 +- 8 files changed, 19 insertions(+), 3 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 9de87339f105..14a35d07ee70 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -309,6 +309,10 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noni {% endfor %} {% endif %} +# Install sonic-db-cli +sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-db-cli_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # Install custom-built monit package and SONiC configuration files sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/monit_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f diff --git a/rules/docker-config-engine-buster.mk b/rules/docker-config-engine-buster.mk index f3df95c36d74..079fc6dd074c 100644 --- a/rules/docker-config-engine-buster.mk +++ b/rules/docker-config-engine-buster.mk @@ -7,7 +7,8 @@ $(DOCKER_CONFIG_ENGINE_BUSTER)_DEPENDS += $(LIBSWSSCOMMON) \ $(LIBYANG) \ $(LIBYANG_CPP) \ $(LIBYANG_PY3) \ - $(PYTHON3_SWSSCOMMON) + $(PYTHON3_SWSSCOMMON) \ + $(SONIC_DB_CLI) $(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SWSSSDK_PY3) $(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) \ $(SONIC_YANG_MGMT_PY3) \ diff --git a/rules/docker-config-engine-stretch.mk b/rules/docker-config-engine-stretch.mk index 7e90c1587a9d..8644102abed3 100644 --- a/rules/docker-config-engine-stretch.mk +++ b/rules/docker-config-engine-stretch.mk @@ -2,7 +2,9 @@ DOCKER_CONFIG_ENGINE_STRETCH = docker-config-engine-stretch.gz $(DOCKER_CONFIG_ENGINE_STRETCH)_PATH = $(DOCKERS_PATH)/docker-config-engine-stretch -$(DOCKER_CONFIG_ENGINE_STRETCH)_DEPENDS += $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) +$(DOCKER_CONFIG_ENGINE_STRETCH)_DEPENDS += $(LIBSWSSCOMMON) \ + $(PYTHON_SWSSCOMMON) \ + $(SONIC_DB_CLI) $(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2) $(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2) diff --git a/rules/docker-config-engine.mk b/rules/docker-config-engine.mk index 518e73415a6b..3923a970b4d6 100644 --- a/rules/docker-config-engine.mk +++ b/rules/docker-config-engine.mk @@ -2,6 +2,8 @@ DOCKER_CONFIG_ENGINE = docker-config-engine.gz $(DOCKER_CONFIG_ENGINE)_PATH = $(DOCKERS_PATH)/docker-config-engine +$(DOCKER_CONFIG_ENGINE)_DEPENDS += $(LIBSWSSCOMMON) \ + $(SONIC_DB_CLI) $(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2) $(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2) diff --git a/rules/docker-database.mk b/rules/docker-database.mk index d7ce311110ee..8d1183e08d25 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -4,6 +4,9 @@ DOCKER_DATABASE_STEM = docker-database DOCKER_DATABASE = $(DOCKER_DATABASE_STEM).gz DOCKER_DATABASE_DBG = $(DOCKER_DATABASE_STEM)-$(DBG_IMAGE_MARK).gz +$(DOCKER_DATABASE)_DEPENDS += $(LIBSWSSCOMMON) \ + $(SONIC_DB_CLI) + $(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/$(DOCKER_DATABASE_STEM) $(DOCKER_DATABASE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) diff --git a/rules/swss-common.mk b/rules/swss-common.mk index bbc37a8d632f..9ab49b672b6c 100644 --- a/rules/swss-common.mk +++ b/rules/swss-common.mk @@ -32,6 +32,9 @@ $(LIBSWSSCOMMON_DBG)_DEPENDS += $(LIBSWSSCOMMON) $(LIBSWSSCOMMON_DBG)_RDEPENDS += $(LIBSWSSCOMMON) $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DBG))) +SONIC_DB_CLI = sonic-db-cli_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(SONIC_DB_CLI))) + # The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} # are archived into debug one image to facilitate debugging. # diff --git a/slave.mk b/slave.mk index 7bc977088f00..93ec096bc986 100644 --- a/slave.mk +++ b/slave.mk @@ -976,6 +976,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(SMARTMONTOOLS) \ $(PYTHON_SWSSCOMMON) \ $(PYTHON3_SWSSCOMMON) \ + $(SONIC_DB_CLI) \ $(SONIC_UTILITIES_DATA) \ $(SONIC_HOST_SERVICES_DATA) \ $(BASH) \ diff --git a/src/sonic-swss-common b/src/sonic-swss-common index a1abaa83c032..4a1edffba46c 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit a1abaa83c0326e3fa65ac70d394ef9db3554d43d +Subproject commit 4a1edffba46c7c78b7063c548230a283c9dc99cf