Skip to content

Commit f376fa1

Browse files
[fast-reboot] Backup database after syncd/swss stopped
Signed-off-by: Stepan Blyschak <[email protected]>
1 parent d5287d4 commit f376fa1

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

scripts/fast-reboot

+15-14
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,19 @@ function wait_for_pre_shutdown_complete_or_fail()
243243
function backup_database()
244244
{
245245
debug "Backing up database ..."
246+
247+
if [[ "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then
248+
# Advanced reboot: dump state to host disk
249+
sonic-db-cli ASIC_DB FLUSHDB > /dev/null
250+
sonic-db-cli COUNTERS_DB FLUSHDB > /dev/null
251+
sonic-db-cli FLEX_COUNTER_DB FLUSHDB > /dev/null
252+
fi
253+
254+
if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
255+
# Flush RESTAP_DB in fast-reboot to avoid stale status
256+
sonic-db-cli RESTAPI_DB FLUSHDB > /dev/null
257+
fi
258+
246259
# Dump redis content to a file 'dump.rdb' in warmboot directory
247260
mkdir -p $WARM_DIR
248261
# Delete keys in stateDB except FDB_TABLE|*, MIRROR_SESSION_TABLE|*, WARM_RESTART_ENABLE_TABLE|*, FG_ROUTE_TABLE|*
@@ -753,23 +766,11 @@ for service in ${SERVICES_TO_STOP}; do
753766
wait_for_pre_shutdown_complete_or_fail
754767
fi
755768
756-
if [[ "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then
757-
# Advanced reboot: dump state to host disk
758-
sonic-db-cli ASIC_DB FLUSHDB > /dev/null
759-
sonic-db-cli COUNTERS_DB FLUSHDB > /dev/null
760-
sonic-db-cli FLEX_COUNTER_DB FLUSHDB > /dev/null
761-
fi
762-
763-
if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
764-
# Flush RESTAP_DB in fast-reboot to avoid stale status
765-
sonic-db-cli RESTAPI_DB FLUSHDB > /dev/null
766-
fi
767-
768-
backup_database
769-
770769
fi
771770
done
772771
772+
backup_database
773+
773774
# Stop the docker container engine. Otherwise we will have a broken docker storage
774775
systemctl stop docker.service || debug "Ignore stopping docker service error $?"
775776

0 commit comments

Comments
 (0)