HomePhabricator
Diffusion Comm d0fb20607662

Implement restore from backup logs

Description

Implement restore from backup logs

Summary: This differential implements restore from backup log function on web and native. Backup logs aren't decrypted - I agreed with @michal that log decryption will take place in rust just after downloading log.

Test Plan:

  1. Temporarily disable backup log encryption. Replace encryptedLogBytes with logBytes in NativeConnectionManager.cpp in persistLog.
  2. Build native app.
  3. Use the app, create some drafts.
  4. Download backup logs from XCode.
  5. Apply this patch to web: https://gist.github.com/marcinwasowicz/1fd0e17c4808d72467ecf11dca9e0ca3
  6. Find the first log that creates draft and use button introduced by the patch above to trigger restoration.
  7. Refresh web app. Ensure draft created on native is there.

To test native:

  1. Comment out removing backup directory in DatabaseManager::clearSensitiveData().
  2. Comment out code that encrypts logs.
  3. Add a call that creates main compaction restore_backup in backup.rs.
  4. Build the app.
  5. Create compaction by pressing button in backup menu.
  6. Create some drafts.
  7. Log out.
  8. Download app Documents container from XCode and see how many logs are there.
  9. Change restore_backup to restore from all logs files that affect drafts.
  10. Build the app. Log in.
  11. Press button in backup menu to restore from logs
  12. See that drafts are recreated.

In order to test conflict handler repeat steps above but do not restore from all logs in step 9. Basically skip log that inserts draft and apply only those that modify it. Ensure no drafts are created but logs in the XCode console appear informing that conflict occurred.

Reviewers: kamil, michal

Reviewed By: kamil, michal

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D10905

Details

Provenance
marcinAuthored on Jan 31 2024, 2:38 PM
Reviewer
kamil
Differential Revision
D10905: Implement restore from backup logs
Parents
rCOMM948c295368ca: Implement log encryption using native AES utilities
Branches
Unknown
Tags
Unknown