-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[swss]: Update swss.sh script to clean up specific db when start #2223
Conversation
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.
In this case, teamd docker is responsible for cleaning up the state for LAG?
The issue with this approach is that when SWSS is up and old state for lag may still be there. SWSS functions which have dependency on LAG may make decision based on the stale lag state.
@jipanyang yes teamd docker shall be responsible for cleaning up the state of LAG |
how fast is the function? |
Suggest use LUA script to optimize, ideally one transaction for one key pattern. |
I tested this and surprisingly this is very fast. |
can you time it? do you have a measurement? this is critical to fast reboot timing. |
dd76000
to
8a3c367
Compare
LUA script is much faster. The redis command solution will cost roughly 2-3 seconds, while LUA script will consume less than 1 second. |
files/scripts/swss.sh
Outdated
@@ -62,6 +62,20 @@ function wait_for_database_service() | |||
done | |||
} | |||
|
|||
# This function cleans up the state database entries that are dirty across | |||
# two restarts | |||
function clean_up_state_database() |
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.
Maybe useful to provide some paramters.
function clean_up_database()
{
DB=$1
PATTERNS=$2
This script shall not flush all the entries in the state database when it starts up, since there are entries maintained and written by other processes outside this docker. The issue we noticed was that the portchannel states are cleaned up after teamsyncd writes the entries into the database, which causes the IPs failed to be configured because intfmgrd considers the portchannels are not ready yet. Signed-off-by: Shu0T1an ChenG <[email protected]>
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 except the weird indentation.
@qiluo-msft indentation has been fixed |
7919077f Add FEC correctable and uncorrectable port stats (sonic-net#2027) ecb91367 Add CLI to configure YANG config validation (sonic-net#2147) e9ab5235 Add override testcase to verify removal (sonic-net#2288) c6794b55 Fix version in db_migrator for `PORT_QOS_MAP|global` (sonic-net#2289) 92b889b7 [intfutil] Check whether the FEC mode is supported on the platform before configuring it to CONFIG_DB (sonic-net#2223) dab0d065 Transfer organization from Azure to sonic-net (sonic-net#2284) 6de18a1d [watermarkstat] Fix CLI script for unconfigured PG counters (sonic-net#2239) ac2f5530 Improve the way to check port type of RJ45 port (sonic-net#2249) Signed-off-by: Stephen Sun <[email protected]>
7919077f Add FEC correctable and uncorrectable port stats (sonic-net#2027) ecb91367 Add CLI to configure YANG config validation (sonic-net#2147) e9ab5235 Add override testcase to verify removal (sonic-net#2288) c6794b55 Fix version in db_migrator for `PORT_QOS_MAP|global` (sonic-net#2289) 92b889b7 [intfutil] Check whether the FEC mode is supported on the platform before configuring it to CONFIG_DB (sonic-net#2223) dab0d065 Transfer organization from Azure to sonic-net (sonic-net#2284) 6de18a1d [watermarkstat] Fix CLI script for unconfigured PG counters (sonic-net#2239) ac2f5530 Improve the way to check port type of RJ45 port (sonic-net#2249) 142185c9 Fix the issue that sonic_platform is not installed on vs image (sonic-net#2300) ca14133f [crm] add checking for CRM interval range (sonic-net#2293) Signed-off-by: Stephen Sun <[email protected]>
Update sonic-utilities submodule pointer to include the following: * Fix GCU bug when backend service modifying config ([sonic-net#2295](sonic-net/sonic-utilities#2295)) * Fix issues for sonic_installer upgrade-docker and sonic_installer rollback-docker ([sonic-net#2278](sonic-net/sonic-utilities#2278)) * [crm] add checking for CRM interval range ([sonic-net#2293](sonic-net/sonic-utilities#2293)) * Fix the issue that sonic_platform is not installed on vs image ([sonic-net#2300](sonic-net/sonic-utilities#2300)) * Add FEC correctable and uncorrectable port stats ([sonic-net#2027](sonic-net/sonic-utilities#2027)) * Add CLI to configure YANG config validation ([sonic-net#2147](sonic-net/sonic-utilities#2147)) * Add override testcase to verify removal ([sonic-net#2288](sonic-net/sonic-utilities#2288)) * Fix version in db_migrator for ([sonic-net#2289](sonic-net/sonic-utilities#2289)) * [intfutil] Check whether the FEC mode is supported on the platform before configuring it to CONFIG_DB ([sonic-net#2223](sonic-net/sonic-utilities#2223)) * Transfer organization from Azure to sonic-net ([sonic-net#2284](sonic-net/sonic-utilities#2284)) * [watermarkstat] Fix CLI script for unconfigured PG counters ([sonic-net#2239](sonic-net/sonic-utilities#2239)) * Improve the way to check port type of RJ45 port ([sonic-net#2249](sonic-net/sonic-utilities#2249)) Signed-off-by: dprital <[email protected]>
* Advance sonic-utilities pointer 7919077f Add FEC correctable and uncorrectable port stats (#2027) ecb91367 Add CLI to configure YANG config validation (#2147) e9ab5235 Add override testcase to verify removal (#2288) c6794b55 Fix version in db_migrator for `PORT_QOS_MAP|global` (#2289) 92b889b7 [intfutil] Check whether the FEC mode is supported on the platform before configuring it to CONFIG_DB (#2223) dab0d065 Transfer organization from Azure to sonic-net (#2284) 6de18a1d [watermarkstat] Fix CLI script for unconfigured PG counters (#2239) ac2f5530 Improve the way to check port type of RJ45 port (#2249) 142185c9 Fix the issue that sonic_platform is not installed on vs image (#2300) ca14133f [crm] add checking for CRM interval range (#2293) Signed-off-by: Stephen Sun <[email protected]> * Advance swss dc8bc1c [portsorch] Expose supported FEC modes to STABE_DB and check whether FEC mode is supported before setting it (#2333) 6565b50 Revert "[portsorch] Expose supported FEC modes to STABE_DB and check whether FEC mode is supported before setting it (#2333)" (#2396) dc88d55 Revert hwinfo count change (#2383) 75fc965 [DualToR] Handle race condition between tunnel_decap and mux orchestrator (#2397) 525a57f Fix for remote system interface not getting created (#2364) 3161eaa portsorch: initial support for link-training (#2359) dc477fb [swss/cfgmgr] teammgr configure lacp rate (#2121) 2489ad5 Improve pytest speend by grouping 20 tests together. (#2390) 168bd3b [EVPN]Modified tunnel creation logic when creating tunnel in VRF-VNI map creation flow (#2404) 1e1438e [portsorch] Expose supported FEC modes to STABE_DB and check whether FEC mode is supported before setting it (#2400) 9f2e27b [QoS] Fix issue: the WRED profile can not be set if current min > new max or current max < new min (#2379) d36c17d [asan][aclorch] fix a memory leak in the SaiAttrWrapper::swap() (#2382) Signed-off-by: Stephen Sun <[email protected]> * More sonic-utilities PRs be1866fd Fix GCU bug when backend service modifying config (#2295) bcf36eb3 Fix issues for sonic_installer upgrade-docker and sonic_installer rollback-docker (#2278) Signed-off-by: Stephen Sun <[email protected]> Signed-off-by: Stephen Sun <[email protected]>
Update sonic-utilities submodule pointer to include the following: * Fix test failure in dump table test in 202205 ([sonic-net#2307](sonic-net/sonic-utilities#2307)) * Convert IPv6 addresses to lowercase in apply-patch ([sonic-net#2299](sonic-net/sonic-utilities#2299)) * [config][muxcable] add support to enable/disable ycable telemetry ([sonic-net#2297](sonic-net/sonic-utilities#2297)) * Fix GCU bug when backend service modifying config ([sonic-net#2295](sonic-net/sonic-utilities#2295)) * [intfutil] Check whether the FEC mode is supported on the platform before configuring it to CONFIG_DB ([sonic-net#2223](sonic-net/sonic-utilities#2223)) * Improve the way to check port type of RJ45 port ([sonic-net#2249](sonic-net/sonic-utilities#2249)) * sonic-utils: initial support for link-training ([sonic-net#2071](sonic-net/sonic-utilities#2071)) * Support to enable fips for the command sonic_installer (sonic-net#2154) ([sonic-net#2303](sonic-net/sonic-utilities#2303)) Signed-off-by: dprital <[email protected]>
…submodule head Kernel: * 86c4b66 2022-07-28 | [Mellanox] Add new kernel patches from HW-MGMT package V.7.0020.3005 (sonic-net#287) (HEAD -> 202205) [Kebo Liu] * 3a8416a 2022-07-05 | [patch] mlxsw: i2c: Prevent transaction execution for special chip (sonic-net#279) [Stepan Blyshchak] swss: * 3f69944 2022-08-10 | Set internal class state to reflect the actual state (sonic-net#2410) (HEAD -> 202205, tag: foo) [Prince Sunny] * 87e98eb 2022-08-09 | [portsorch] Expose supported FEC modes to STABE_DB and check whether FEC mode is supported before setting it (sonic-net#2400) [Stephen Sun] * e71ab99 2022-07-29 | portsorch: initial support for link-training (sonic-net#2359) [Dante (Kuo-Jung) Su] * ed5e5be 2022-07-08 | Port configuration incremental update support (sonic-net#2305) [Junchao-Mellanox] utilities: * 0df3ba8 2022-08-12 | Revert "Improve the way to check port type of RJ45 port (sonic-net#2249)" (HEAD -> 202205) [Ying Xie] * 9b21903 2022-08-12 | Fix test failure in dump table test in 202205 (sonic-net#2307) (HEAD -> 202205, github/202205) [Stephen Sun] * 750d1db 2022-08-11 | Convert IPv6 addresses to lowercase in apply-patch (sonic-net#2299) (HEAD -> 202205) [dbarashinvd] * 555947e 2022-08-09 | [config][muxcable] add support to enable/disable ycable telemetry (sonic-net#2297) [vdahiya12] * 978f416 2022-08-09 | Fix GCU bug when backend service modifying config (sonic-net#2295) [jingwenxie] * 8fed381 2022-08-02 | [intfutil] Check whether the FEC mode is supported on the platform before configuring it to CONFIG_DB (sonic-net#2223) (github/202205) [Stephen Sun] * a1a09e4 2022-07-29 | Improve the way to check port type of RJ45 port (sonic-net#2249) [Stephen Sun] * 9bdbfb8 2022-05-19 | sonic-utils: initial support for link-training (sonic-net#2071) [Dante (Kuo-Jung) Su] * c088ec4 2022-08-10 | Support to enable fips for the command sonic_installer (sonic-net#2154) (sonic-net#2303) [xumia] platform-daemon: * 767cfb6 2022-08-09 | [ycabled] add capability to enable/disable telemetry (sonic-net#279) (HEAD -> 202205) [vdahiya12] linkmgrd: * cf1ba2b 2022-08-12 | wait for handler to be completed (sonic-net#114) (HEAD -> 202205, github/202205) [Jing Zhang] * e99026c 2022-08-11 | [lgtm]: add uuid-dev to lgtm prepare (sonic-net#112) (HEAD -> 202205) [Jing Zhang] * bd1b7f0 2022-08-11 | Adjust `DbInterfaceRaceConditionCheck` to Wait Longer for Handlers to be executed (sonic-net#111) (HEAD -> 202205, github/202205) [Jing Zhang] * e9dc6b2 2022-08-11 | Backoff mux probing for server down scenario (sonic-net#106) [Jing Zhang] * 0d61171 2022-08-09 | Fix race condition caused by strand `wrap` method (sonic-net#104) [Jing Zhang] * e9ede7d 2022-07-02 | Enforce switch after config mux to active (sonic-net#95) [Longxiang Lyu] * 15dbc30 2022-06-30 | Add unittest to verify mux toggle active (sonic-net#94) [Longxiang Lyu] Signed-off-by: Ying Xie <[email protected]>
…submodule head (#11705) Kernel: * 86c4b66 2022-07-28 | [Mellanox] Add new kernel patches from HW-MGMT package V.7.0020.3005 (#287) (HEAD -> 202205) [Kebo Liu] * 3a8416a 2022-07-05 | [patch] mlxsw: i2c: Prevent transaction execution for special chip (#279) [Stepan Blyshchak] swss: * 3f69944 2022-08-10 | Set internal class state to reflect the actual state (#2410) (HEAD -> 202205, tag: foo) [Prince Sunny] * 87e98eb 2022-08-09 | [portsorch] Expose supported FEC modes to STABE_DB and check whether FEC mode is supported before setting it (#2400) [Stephen Sun] * e71ab99 2022-07-29 | portsorch: initial support for link-training (#2359) [Dante (Kuo-Jung) Su] * ed5e5be 2022-07-08 | Port configuration incremental update support (#2305) [Junchao-Mellanox] utilities: * 0df3ba8 2022-08-12 | Revert "Improve the way to check port type of RJ45 port (#2249)" (HEAD -> 202205) [Ying Xie] * 9b21903 2022-08-12 | Fix test failure in dump table test in 202205 (#2307) (HEAD -> 202205, github/202205) [Stephen Sun] * 750d1db 2022-08-11 | Convert IPv6 addresses to lowercase in apply-patch (#2299) (HEAD -> 202205) [dbarashinvd] * 555947e 2022-08-09 | [config][muxcable] add support to enable/disable ycable telemetry (#2297) [vdahiya12] * 978f416 2022-08-09 | Fix GCU bug when backend service modifying config (#2295) [jingwenxie] * 8fed381 2022-08-02 | [intfutil] Check whether the FEC mode is supported on the platform before configuring it to CONFIG_DB (#2223) (github/202205) [Stephen Sun] * a1a09e4 2022-07-29 | Improve the way to check port type of RJ45 port (#2249) [Stephen Sun] * 9bdbfb8 2022-05-19 | sonic-utils: initial support for link-training (#2071) [Dante (Kuo-Jung) Su] * c088ec4 2022-08-10 | Support to enable fips for the command sonic_installer (#2154) (#2303) [xumia] platform-daemon: * 767cfb6 2022-08-09 | [ycabled] add capability to enable/disable telemetry (#279) (HEAD -> 202205) [vdahiya12] linkmgrd: * cf1ba2b 2022-08-12 | wait for handler to be completed (#114) (HEAD -> 202205, github/202205) [Jing Zhang] * e99026c 2022-08-11 | [lgtm]: add uuid-dev to lgtm prepare (#112) (HEAD -> 202205) [Jing Zhang] * bd1b7f0 2022-08-11 | Adjust `DbInterfaceRaceConditionCheck` to Wait Longer for Handlers to be executed (#111) (HEAD -> 202205, github/202205) [Jing Zhang] * e9dc6b2 2022-08-11 | Backoff mux probing for server down scenario (#106) [Jing Zhang] * 0d61171 2022-08-09 | Fix race condition caused by strand `wrap` method (#104) [Jing Zhang] * e9ede7d 2022-07-02 | Enforce switch after config mux to active (#95) [Longxiang Lyu] * 15dbc30 2022-06-30 | Add unittest to verify mux toggle active (#94) [Longxiang Lyu] Signed-off-by: Ying Xie <[email protected]>
…submodule head (sonic-net#11705) Kernel: * 86c4b66 2022-07-28 | [Mellanox] Add new kernel patches from HW-MGMT package V.7.0020.3005 (sonic-net#287) (HEAD -> 202205) [Kebo Liu] * 3a8416a 2022-07-05 | [patch] mlxsw: i2c: Prevent transaction execution for special chip (sonic-net#279) [Stepan Blyshchak] swss: * 3f69944 2022-08-10 | Set internal class state to reflect the actual state (sonic-net#2410) (HEAD -> 202205, tag: foo) [Prince Sunny] * 87e98eb 2022-08-09 | [portsorch] Expose supported FEC modes to STABE_DB and check whether FEC mode is supported before setting it (sonic-net#2400) [Stephen Sun] * e71ab99 2022-07-29 | portsorch: initial support for link-training (sonic-net#2359) [Dante (Kuo-Jung) Su] * ed5e5be 2022-07-08 | Port configuration incremental update support (sonic-net#2305) [Junchao-Mellanox] utilities: * 0df3ba8 2022-08-12 | Revert "Improve the way to check port type of RJ45 port (sonic-net#2249)" (HEAD -> 202205) [Ying Xie] * 9b21903 2022-08-12 | Fix test failure in dump table test in 202205 (sonic-net#2307) (HEAD -> 202205, github/202205) [Stephen Sun] * 750d1db 2022-08-11 | Convert IPv6 addresses to lowercase in apply-patch (sonic-net#2299) (HEAD -> 202205) [dbarashinvd] * 555947e 2022-08-09 | [config][muxcable] add support to enable/disable ycable telemetry (sonic-net#2297) [vdahiya12] * 978f416 2022-08-09 | Fix GCU bug when backend service modifying config (sonic-net#2295) [jingwenxie] * 8fed381 2022-08-02 | [intfutil] Check whether the FEC mode is supported on the platform before configuring it to CONFIG_DB (sonic-net#2223) (github/202205) [Stephen Sun] * a1a09e4 2022-07-29 | Improve the way to check port type of RJ45 port (sonic-net#2249) [Stephen Sun] * 9bdbfb8 2022-05-19 | sonic-utils: initial support for link-training (sonic-net#2071) [Dante (Kuo-Jung) Su] * c088ec4 2022-08-10 | Support to enable fips for the command sonic_installer (sonic-net#2154) (sonic-net#2303) [xumia] platform-daemon: * 767cfb6 2022-08-09 | [ycabled] add capability to enable/disable telemetry (sonic-net#279) (HEAD -> 202205) [vdahiya12] linkmgrd: * cf1ba2b 2022-08-12 | wait for handler to be completed (sonic-net#114) (HEAD -> 202205, github/202205) [Jing Zhang] * e99026c 2022-08-11 | [lgtm]: add uuid-dev to lgtm prepare (sonic-net#112) (HEAD -> 202205) [Jing Zhang] * bd1b7f0 2022-08-11 | Adjust `DbInterfaceRaceConditionCheck` to Wait Longer for Handlers to be executed (sonic-net#111) (HEAD -> 202205, github/202205) [Jing Zhang] * e9dc6b2 2022-08-11 | Backoff mux probing for server down scenario (sonic-net#106) [Jing Zhang] * 0d61171 2022-08-09 | Fix race condition caused by strand `wrap` method (sonic-net#104) [Jing Zhang] * e9ede7d 2022-07-02 | Enforce switch after config mux to active (sonic-net#95) [Longxiang Lyu] * 15dbc30 2022-06-30 | Add unittest to verify mux toggle active (sonic-net#94) [Longxiang Lyu] Signed-off-by: Ying Xie <[email protected]>
This script shall not flush all the entries in the state database
when it starts up, since there are entries maintained and written
by other processes outside this docker.
The issue we noticed was that the portchannel states are cleaned
up after teamsyncd writes the entries into the database, which
causes the IPs failed to be configured because intfmgrd considers
the portchannels are not ready yet.
Signed-off-by: Shu0T1an ChenG [email protected]