Skip to content

Commit b622315

Browse files
vaibhavhdmssonicbld
authored andcommitted
Revert "Fix for fast/cold-boot: call db_migrator only after old config is loaded (#14933)" (#15464)
This reverts commit 02b1783. Reverts #14933 The earlier commit caused a race condition that particularly broke cross branch warm upgrade. Issue happens when db_migrator is still migrating the DB and finalizer is checking DB for list of components to reconcile. If migration is not complete, finalizer get an empty list to wait for. Due to this, finalizer concludes warmboot (deletes system wide warmboot flag) and cause all the services to do cold restart. ADO: 24274591
1 parent 8195e33 commit b622315

2 files changed

Lines changed: 4 additions & 25 deletions

File tree

files/build_templates/docker_image_ctl.j2

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -255,18 +255,10 @@ function postStartAction()
255255
$SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
256256
fi
257257

258-
if [ -e /tmp/pending_config_migration ]; then
259-
# this is first boot to a new image, config-setup execution is pending.
260-
# For fast/cold reboot case, DB contains nothing at this point
261-
# Call db_migrator after config-setup loads the config (from old config or minigraph)
262-
echo "Delaying db_migrator until config migration is over"
263-
else
264-
# this is not a first time boot to a new image. Datbase container starts w/ old pre-existing config
265-
if [[ -x /usr/local/bin/db_migrator.py ]]; then
266-
# Migrate the DB to the latest schema version if needed
267-
if [ -z "$DEV" ]; then
268-
/usr/local/bin/db_migrator.py -o migrate
269-
fi
258+
if [[ -x /usr/local/bin/db_migrator.py ]]; then
259+
# Migrate the DB to the latest schema version if needed
260+
if [ -z "$DEV" ]; then
261+
/usr/local/bin/db_migrator.py -o migrate
270262
fi
271263
fi
272264
# Add redis UDS to the redis group and give read/write access to the group

files/image_config/config-setup/config-setup

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,6 @@ check_all_config_db_present()
300300
return 0
301301
}
302302

303-
# DB schema is subject to change between two images
304-
# Perform DB schema migration after loading backup config from previous image
305-
do_db_migration()
306-
{
307-
if [[ -x /usr/local/bin/db_migrator.py ]]; then
308-
# Migrate the DB to the latest schema version if needed
309-
/usr/local/bin/db_migrator.py -o migrate
310-
fi
311-
}
312-
313303
# Perform configuration migration from backup copy.
314304
# - This step is performed when a new image is installed and SONiC switch boots into it
315305
do_config_migration()
@@ -332,19 +322,16 @@ do_config_migration()
332322
if [ x"${WARM_BOOT}" == x"true" ]; then
333323
echo "Warm reboot detected..."
334324
disable_updategraph
335-
do_db_migration
336325
rm -f /tmp/pending_config_migration
337326
exit 0
338327
elif check_all_config_db_present; then
339328
echo "Use config_db.json from old system..."
340329
reload_configdb
341-
do_db_migration
342330
# Disable updategraph
343331
disable_updategraph
344332
elif [ -r ${MINGRAPH_FILE} ]; then
345333
echo "Use minigraph.xml from old system..."
346334
reload_minigraph
347-
do_db_migration
348335
# Disable updategraph
349336
disable_updategraph
350337
else

0 commit comments

Comments
 (0)