@@ -243,6 +243,19 @@ function wait_for_pre_shutdown_complete_or_fail()
243
243
function backup_database()
244
244
{
245
245
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
+
246
259
# Dump redis content to a file 'dump.rdb' in warmboot directory
247
260
mkdir -p $WARM_DIR
248
261
# 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
753
766
wait_for_pre_shutdown_complete_or_fail
754
767
fi
755
768
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
-
770
769
fi
771
770
done
772
771
772
+ backup_database
773
+
773
774
# Stop the docker container engine. Otherwise we will have a broken docker storage
774
775
systemctl stop docker.service || debug " Ignore stopping docker service error $? "
775
776
0 commit comments