Skip to content
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

Fix CONFIG_DB_INITIALIZED flag check logic and set/reset flag for warmboot #15685

Merged
merged 9 commits into from
Aug 4, 2023
3 changes: 3 additions & 0 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ function postStartAction()
if [[ ("$BOOT_TYPE" == "warm" || "$BOOT_TYPE" == "fastfast" || "$BOOT_TYPE" == "fast") && -f $WARM_DIR/dump.rdb ]]; then
# retain the dump file from last boot for debugging purposes
mv $WARM_DIR/dump.rdb $WARM_DIR/dump.rdb.old
# CONFIG_DB init flag will be set to 1 at the time when device warm-reboots and old config is loaded on DB
# Reset CONFIG_DB init value to 0 to indicate start of new system. This will be set to "1" after DB migration is completed
$SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "0"
else
# If there is a config_db.json dump file, load it.
if [ -r /etc/sonic/config_db$DEV.json ]; then
Expand Down
1 change: 1 addition & 0 deletions files/image_config/config-setup/config-setup
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ do_config_migration()
echo "Warm reboot detected..."
disable_updategraph
rm -f /tmp/pending_config_migration
sonic-db-cli CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
exit 0
elif check_all_config_db_present; then
echo "Use config_db.json from old system..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function wait_for_database_service()
done

# Wait for configDB initialization
until [[ $(sonic-db-cli CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]];
until [[ $(sonic-db-cli CONFIG_DB GET "CONFIG_DB_INITIALIZED") -eq 1 ]];
do sleep 1;
done

Expand Down
2 changes: 1 addition & 1 deletion files/scripts/swss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function wait_for_database_service()
done

# Wait for configDB initialization
until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]];
until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") -eq 1 ]];
do sleep 1;
done
}
Expand Down
2 changes: 1 addition & 1 deletion files/scripts/syncd_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function wait_for_database_service()
done

# Wait for configDB initialization
until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]];
until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") -eq 1 ]];
do sleep 1;
done
}
Expand Down