Skip to content

Commit 9649a44

Browse files
authored
Revert "Fix for fast/cold-boot: call db_migrator only after old config is loaded (sonic-net#14933)" (sonic-net#15464)
This reverts commit 02b1783. Reverts sonic-net#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 6df7009 commit 9649a44

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

files/build_templates/docker_image_ctl.j2

+4-12
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,10 @@ function postStartAction()
257257
$SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
258258
fi
259259

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

files/image_config/config-setup/config-setup

-13
Original file line numberDiff line numberDiff line change
@@ -304,16 +304,6 @@ check_all_config_db_present()
304304
return 0
305305
}
306306

307-
# DB schema is subject to change between two images
308-
# Perform DB schema migration after loading backup config from previous image
309-
do_db_migration()
310-
{
311-
if [[ -x /usr/local/bin/db_migrator.py ]]; then
312-
# Migrate the DB to the latest schema version if needed
313-
/usr/local/bin/db_migrator.py -o migrate
314-
fi
315-
}
316-
317307
# Perform configuration migration from backup copy.
318308
# - This step is performed when a new image is installed and SONiC switch boots into it
319309
do_config_migration()
@@ -336,19 +326,16 @@ do_config_migration()
336326
if [ x"${WARM_BOOT}" == x"true" ]; then
337327
echo "Warm reboot detected..."
338328
disable_updategraph
339-
do_db_migration
340329
rm -f /tmp/pending_config_migration
341330
exit 0
342331
elif check_all_config_db_present; then
343332
echo "Use config_db.json from old system..."
344333
reload_configdb
345-
do_db_migration
346334
# Disable updategraph
347335
disable_updategraph
348336
elif [ -r ${MINGRAPH_FILE} ]; then
349337
echo "Use minigraph.xml from old system..."
350338
reload_minigraph
351-
do_db_migration
352339
# Disable updategraph
353340
disable_updategraph
354341
else

0 commit comments

Comments
 (0)