From e948d021bc8855cf6b6e684752967ecd91186a67 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 20 Nov 2018 11:23:30 -0800 Subject: [PATCH] Optimize warm-reboot speed on dumping and rebooting (#380) * Optimize warm-reboot speed on dumping and rebooting Signed-off-by: Qi Luo * Keep wtmp Signed-off-by: Qi Luo --- scripts/fast-reboot | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/fast-reboot b/scripts/fast-reboot index a3e666f7c3ff..079c784dd1d3 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -145,17 +145,25 @@ if [[ "$REBOOT_TYPE" = "warm-reboot" ]]; then mkdir -p $WARM_DIR # Note: requiring redis-dump-load # Save applDB in /host/warm-reboot/appl_db.json - $DUMP_CMD -d 0 -o $WARM_DIR/appl_db.json + local pids=() + $DUMP_CMD -d 0 -o $WARM_DIR/appl_db.json & + pids+=($!) # Save configDB in /host/warm-reboot/config_db.json - $DUMP_CMD -d 4 -o $WARM_DIR/config_db.json + $DUMP_CMD -d 4 -o $WARM_DIR/config_db.json & + pids+=($!) # Save stateDB (only FDB_TABLE and WARM_RESTART_TABLE) in /host/warm-reboot/state_db.json # WARNING WARNING WARNING: a trick to dump both FDB_TABLE|* and WARM_RESTA* # TODO: replace it with readable mechanism to dump multiple key patterns into one single json file - $DUMP_CMD -d 6 -k "[FW][DA][BR][_M][T_][AR][BE][LS][ET][|A]*" -o $WARM_DIR/state_db.json + $DUMP_CMD -d 6 -k "[FW][DA][BR][_M][T_][AR][BE][LS][ET][|A]*" -o $WARM_DIR/state_db.json & + pids+=($!) # Save asicDB in /host/warm-reboot/asic_db.json - $DUMP_CMD -d 1 -o $WARM_DIR/asic_db.json + $DUMP_CMD -d 1 -o $WARM_DIR/asic_db.json & + pids+=($!) # Save loglevelDB in /host/warm-reboot/loglevel_db.json - $DUMP_CMD -d 3 -o $WARM_DIR/loglevel_db.json + $DUMP_CMD -d 3 -o $WARM_DIR/loglevel_db.json & + pids+=($!) + + wait ${pids[@]} fi # Kill other containers to make the reboot faster