[VoQ][config] Multiasic Supervisor card fails to load config_db#.json in chassis when system is reboot #10106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why I did it
Supervisor card fails to load config_db#.json in chassis when system reboot. The Supervisor card which has 16 ASICs, when it is reboot, the first one or two Instance fail to load the config_db#.json due to unavailable of some instance /var/run/redis#/sonic-db/database_config.json file. This is an intermittent issue. fixes #10105
How I did it
In the multiasic platform, the database.sh starts randomly to create create redis socket and database for a namespace and call the sonic-cfggen to load its config_db#.json file if it is present. Function sonic-cfggen calls load_sonic_global_db_config()->initializeGlobalConfig()->SonicDBConfig_initializeGlobalConfig() to initialize the database config. Function SonicDBConfig_initializeGlobalConfig() always checks the presence of sonic-db/database_config.json file in all instance /var/run/redis# for a single database creation. The /var/run/redis#/sonic-db/database_config.json file is created by the initialization of the database container. When the first instance database is checking the presence of other database_config.json, they has not been created and ready yet. Therefore, the following exception is shown and sonic-cfggen fails load its config_db#.json file.
This commit adds function call waitForAllInstanceDatabaseConfigJsonFilesReady() in to the database.sh. It checks and waits for all instance /var/run/redis#/sonic-db/database_config.json available, then continue to precede to execute SONIC_CFGGEN to load its config_db#.json file
How to verify it
After the supervisor card is reboot, Execute CLI command "show interfaces status". on the supervisor card. The following should be shown:
Which release branch to backport (provide reason below if selected)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)