sonic-buildimage/dockers
JunhongMao d917c6d169 [VOQ][saidump] Install rdbtools into the docker base related containers. (#16466)
Fix #13561

The existing saidump use https://github.com/sonic-net/sonic-swss-common/blob/master/common/table_dump.lua script which loops the ASIC_DB more than 5 seconds and blocks other processes access.

This solution uses the Redis SAVE command to save the snapshot of DB each time and recover later, instead of looping through each entry in the table.

Related PRs:
sonic-net/sonic-utilities#2972
sonic-net/sonic-sairedis#1288
sonic-net/sonic-sairedis#1298

How did I do it?
To use the Redis-db SAVE option to save the snapshot of DB each time and recover later, instead of looping through each entry in the table and saving it.

1. Updated dockers/docker-base-bullseye/Dockerfile.j2, install Python library rdbtools into the all the docker-base-bullseye containers.

2. Updated sonic-buildimage/src/sonic-sairedis/saidump/saidump.cpp, add a new option -r, which updates the rdbtools's output-JSON files' format.

3. To add a new script file: syncd/scripts/saidump.sh into the sairedis repo. This shell script does the following steps:

  For each ASIC, such as ASIC0,

  3.1. Config Redis consistency directory. 
  redis-cli -h $hostname -p $port CONFIG SET dir $redis_dir > /dev/null

  3.2. Save the Redis data.
  redis-cli -h $hostname -p $port SAVE > /dev/null

  3.3. Run rdb command to convert the dump files into JSON files
    rdb --command json $redis_dir/dump.rdb | tee $redis_dir/dump.json > /dev/null

  3.4.  Run saidump -r to update the JSON files' format as same as the saidump before. 
       Then we can get the saidump's result in standard output."
       saidump -r $redis_dir/dump.json -m 100

  3.5. Clear the temporary files.
   rm -f $redis_dir/dump.rdb
   rm -f $redis_dir/dump.json

4. Update sonic-buildimage/src/sonic-utilities/scripts/generate_dump. To check the asic db size and if it is larger than ROUTE_TAB_LIMIT_DIRECT_ITERATION (with default value 24000) entries, then do with REDIS SAVE, otherwise, to do with old method: looping through each entry of Redis DB.

How to verify it
On T2 setup with more than 96K routes, execute CLI command -- generate_dump
No error should be shown
Download the generate_dump result and verify the saidump file after unpacking it.
2023-11-21 12:34:06 +08:00
..
docker-base Add a config variable to override default container registry instead of dockerhub. (#10166) 2022-03-14 18:09:20 +08:00
docker-base-bullseye [VOQ][saidump] Install rdbtools into the docker base related containers. (#16466) 2023-11-21 12:34:06 +08:00
docker-base-buster [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00
docker-base-stretch [Build] Support j2 template for debian sources (#12557) (#13185) 2022-12-30 09:47:33 +08:00
docker-basic_router [supervisord]: use abspath as supervisord entrypoint (#5995) 2020-11-22 21:18:44 -08:00
docker-config-engine Parallel building of sonic dockers using native dockerd(dood). (#10352) 2022-04-28 08:39:37 +08:00
docker-config-engine-bullseye [Build] Fix the PyYang python package installation issue (#15890) (#15907) 2023-07-19 08:08:35 -07:00
docker-config-engine-buster [Build] Fix the PyYang python package installation issue (#15890) (#15907) 2023-07-19 08:08:35 -07:00
docker-config-engine-stretch Parallel building of sonic dockers using native dockerd(dood). (#10352) 2022-04-28 08:39:37 +08:00
docker-database [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00
docker-dhcp-relay advance dhcprelay to 6a6ce24, add default dhcpv6 dualtor source interface (#15881) 2023-07-19 14:08:48 -07:00
docker-fpm-frr [chassis/multi-asic] Make sure iBGP session established as directly connected (#16777) 2023-10-25 12:32:27 +08:00
docker-fpm-gobgp Parallel building of sonic dockers using native dockerd(dood). (#10352) 2022-04-28 08:39:37 +08:00
docker-iccpd iccpd bullseye migration (#12097) 2022-10-27 22:12:23 +00:00
docker-lldp [chassis][lldp] Fix the lldp error log in host instance which doesn't contain front panel ports (#14814) (#15669) 2023-06-30 13:24:26 -07:00
docker-macsec Update macsec CAK keys in profile for tests to change to type7 encoded format (#16388) (#16499) 2023-09-09 06:23:49 +08:00
docker-mux [mux] Integrate linkmgrd with swss logger (#15392) (#15539) 2023-06-20 09:08:51 +08:00
docker-nat [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00
docker-orchagent [tph]: Detect LAG flaps from APPL_DB (#16879) (#17156) 2023-11-15 11:02:10 -08:00
docker-pde PDE migration to bullseye (#10836) 2022-08-11 23:14:10 +00:00
docker-platform-monitor Chassis: fix pmon docker failure when DEVICE_METADATA is not available (#16527) 2023-09-14 09:29:06 +08:00
docker-ptf [Build] Fix the mirror gpg key expired issue (#14206) 2023-03-16 04:32:36 +08:00
docker-ptf-sai [sai-ptf]Fix sai ptf issue (#12723) 2022-11-16 20:28:30 -08:00
docker-router-advertiser [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00
docker-sflow [sflow] Exception handling for if_nametoindex (#11437) (#14456) 2023-04-18 11:57:44 -07:00
docker-snmp [202205][SNMP][IPv6]: Revert PRs to support SNMP over IPv6 (#16650) 2023-10-11 12:02:33 -07:00
docker-sonic-mgmt Add scapy support for python3 virtual environment in the sonic-mgmt docker container (#10234) 2022-03-16 12:00:51 +08:00
docker-sonic-mgmt-framework [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00
docker-sonic-p4rt [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00
docker-sonic-restapi [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00
docker-sonic-sdk Parallel building of sonic dockers using native dockerd(dood). (#10352) 2022-04-28 08:39:37 +08:00
docker-sonic-sdk-buildenv Parallel building of sonic dockers using native dockerd(dood). (#10352) 2022-04-28 08:39:37 +08:00
docker-sonic-telemetry Fix telemetry.sh passing in null as log level value (#14303) (#14410) 2023-03-25 05:24:23 +08:00
docker-swss-layer-bullseye [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00
docker-swss-layer-buster [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00
docker-teamd [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00
dockerfile-macros.j2 [202205] Remove apt package lists and make macro to clean up apt and python cache (#14377) 2023-03-22 14:51:25 -07:00