@@ -256,15 +256,16 @@ function postStartAction()
256
256
# set the key to expire in 3 minutes
257
257
$SONIC_DB_CLI STATE_DB SET " FAST_REBOOT|system" " 1" " EX" " 180"
258
258
fi
259
-
260
- $SONIC_DB_CLI CONFIG_DB SET " CONFIG_DB_INITIALIZED" " 1"
261
259
fi
262
260
263
261
if [ -e /tmp/pending_config_migration ]; then
264
262
# this is first boot to a new image, config-setup execution is pending.
263
+ # for warmboot case, DB is loaded but migration is still pending
265
264
# For fast/cold reboot case, DB contains nothing at this point
266
- # Call db_migrator after config-setup loads the config (from old config or minigraph)
265
+ # Call db_migrator and set CONFIG_DB_INITIALIZED after config-setup loads the config (from old config or minigraph)
267
266
echo " Delaying db_migrator until config migration is over"
267
+ # unset CONFIG_DB_INITIALIZED to indicate pending config load and migration
268
+ $SONIC_DB_CLI CONFIG_DB SET " CONFIG_DB_INITIALIZED" " 0"
268
269
else
269
270
# this is not a first time boot to a new image. Datbase container starts w/ old pre-existing config
270
271
if [[ -x /usr/local/bin/db_migrator.py ]]; then
@@ -273,6 +274,8 @@ function postStartAction()
273
274
/usr/local/bin/db_migrator.py -o migrate
274
275
fi
275
276
fi
277
+ # set CONFIG_DB_INITIALIZED to indicate end of config load and migration
278
+ $SONIC_DB_CLI CONFIG_DB SET " CONFIG_DB_INITIALIZED" " 1"
276
279
fi
277
280
# Add redis UDS to the redis group and give read/write access to the group
278
281
REDIS_SOCK=" /var/run/redis${DEV} /redis.sock"
0 commit comments