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

Ignore keepalive file when restoring backup #318

Merged
merged 1 commit into from
Dec 25, 2020
Merged

Conversation

matthew-white
Copy link
Member

@matthew-white matthew-white commented Dec 24, 2020

Right now lib/bin/restore.js quits with the following error message when restoring a backup downloaded from /v1/backup:

Required parameter undefined missing.
'keepalive local key'

This PR modifies the restore process so that it ignores keepalive.

I had trouble writing a test for this change. Ideally, we would test the result of calling decryptFromArchive() on a .zip file that contains both encrypted files and a keepalive file. encryptToArchive() returns a .zip files with encrypted files, but I didn't see an easy way to insert a keepalive file into it. Instead, I verified this change as follows:

  • I downloaded a .zip file locally using the "Download backup now" button.
  • I modified restore.js so that it expands the zip into a persistent directory and decrypts encrypted files, but doesn't run pgrestore().
  • I ran restore.js. It did not show the error message and expanded a number of files.
  • I committed those files to a Git repo.
  • Next, I ran lib/bin/backup.js, uploading a backup to Google Drive.
  • I downloaded that file and ran the modified restore.js on it. I moved the resulting files into the Git repo, comparing to the immediate backup.
  • The only file that was different was toc.dat, a binary file.

Copy link
Member

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

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

Looks right to me! Have you had a chance to try it as a sanity check?

@matthew-white
Copy link
Member Author

Yes, just added some notes above about how I tried to verify!

@issa-tseng issa-tseng merged commit a33bc6f into master Dec 25, 2020
@issa-tseng issa-tseng deleted the ignore-keepalive branch December 25, 2020 18:33
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.

None yet

3 participants