Skip to content

Commit d5d674e

Browse files
authored
Revert "Fix for fast/cold-boot: call db_migrator only after old config is loaded (#14933)" (#15464) (#15517)
1 parent 2d436cc commit d5d674e

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
@@ -246,18 +246,10 @@ function postStartAction()
246246
$SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
247247
fi
248248

249-
if [ -e /tmp/pending_config_migration ]; then
250-
# this is first boot to a new image, config-setup execution is pending.
251-
# For fast/cold reboot case, DB contains nothing at this point
252-
# Call db_migrator after config-setup loads the config (from old config or minigraph)
253-
echo "Delaying db_migrator until config migration is over"
254-
else
255-
# this is not a first time boot to a new image. Datbase container starts w/ old pre-existing config
256-
if [[ -x /usr/local/bin/db_migrator.py ]]; then
257-
# Migrate the DB to the latest schema version if needed
258-
if [ -z "$DEV" ]; then
259-
/usr/local/bin/db_migrator.py -o migrate
260-
fi
249+
if [[ -x /usr/local/bin/db_migrator.py ]]; then
250+
# Migrate the DB to the latest schema version if needed
251+
if [ -z "$DEV" ]; then
252+
/usr/local/bin/db_migrator.py -o migrate
261253
fi
262254
fi
263255
# 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)