Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MultiDB] add MultiDB warmboot support - backing up database #1205

Merged
merged 2 commits into from
Dec 3, 2020

Conversation

dzhangalibaba
Copy link
Contributor

@dzhangalibaba dzhangalibaba commented Nov 2, 2020

Signed-off-by: Dong Zhang d.zhang@alibaba-inc.com

@dzhangalibaba
Copy link
Contributor Author

dzhangalibaba commented Nov 3, 2020

@qiluo-msft These two PRs are for multiDB warmboot support as proposed earlier.

args = parser.parse_args()

if args.target_db:
try:
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        [](start = 0, length = 12)

too much indentation. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

docker exec -i database rm /var/lib/redis/$REDIS_FILE

# move all db data into instances where APPL_DB locates
migrate_warmboot_database APPL_DB
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migrate_warmboot_database [](start = 4, length = 25)

The name is misleading. It is not directly related to warmboot.
Suggestion centralize_database
#Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

dbport = swsssdk.SonicDBConfig.get_port(dbname)
# if the db is on the same instance, no need to migrate
if dbport == target_dbport:
continue
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it enough to determine "the same instance" ? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. hostname plus port is enough to determine the "unique instance" . Updated

# move all db data into instances where APPL_DB locates
migrate_warmboot_database APPL_DB

inst=`/usr/bin/python -c "import swsssdk; print(swsssdk.SonicDBConfig.get_instancename('APPL_DB'))"`
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inst [](start = 4, length = 4)

Instead of using a new process to locate APPL_DB, you may just print it to stdout in above command. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

Copy link
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you point me to the code where the centralized DB are redistributed?

@qiluo-msft qiluo-msft merged commit 9a17108 into sonic-net:master Dec 3, 2020
@dzhangalibaba dzhangalibaba deleted the multidbwb branch December 4, 2020 09:19
qiluo-msft pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Dec 10, 2020
* restoring each database  with all data before warmboot and then flush unused data in each instance, following the multiDB warmboot design at https://github.com/Azure/SONiC/blob/master/doc/database/multi_database_instances.md
  * restore needs to be done in database docker since we need to know the database_config.json in new version
  * copy all data rdb file into each instance restoration location andthen flush unused database
  * other logic is the same as before
*  backing up database part is in another PR at sonic-utilities sonic-net/sonic-utilities#1205, they depend on each other
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants