implement restore for incremental backup #634
Open
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.
This diff adds the restore for incremental backup, in order not to change the api name, I use a flag in restoreDBFromS3 in admin_handler to distinguish from the previous restore.
It will first check the latest timestamp for the db from the restore request, and download all the files from the latest backup.
Then, it will download all the missing files from previous backup corresponding to the map in backup descriptor. Finally, add the db.
There is one problem about lock. For example, if someone is removing the db and it is incrementally backuping the db, it will cause some problem. I did not find a good way to share a lock between db_manager and the backup_manager. Furthermore, it is better to have a fine-grained lock for each db. Otherwise, the system will be inefficient (every operation will acquire the only one lock).