Page MenuHomePhabricator

[native] Download and apply logs
ClosedPublic

Authored by michal on Feb 12 2024, 7:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 5:43 PM
Unknown Object (File)
Oct 15 2024, 2:19 PM
Unknown Object (File)
Oct 15 2024, 2:19 PM
Unknown Object (File)
Oct 15 2024, 2:18 PM
Unknown Object (File)
Oct 15 2024, 2:18 PM
Unknown Object (File)
Oct 15 2024, 2:18 PM
Unknown Object (File)
Oct 15 2024, 2:18 PM
Unknown Object (File)
Oct 15 2024, 2:18 PM
Subscribers

Details

Summary

Update the code to also apply logs. Besides the actual download_and_apply_logs function that handles downloading, decrypting and applying logs there are a few small changes that I merged with this diff. If this makes it hard to review, feel free to request changes.

  • Call triggerBackupFileUpload after C++ created a log file, so that it is uploaded
  • Change SQLiteQueryExecutor code so that it starts numbering from 1 instead of 0 (the networking client expects that it starts with 1)
  • Also store the encryption key for backup logs in UserKeys
  • restoreFromBackupLog has been updated to call resolveUnitFuture/rejectFuture after log is applied so that execution returns to the rust code

Depends on D10987

Test Plan
  • Change StaffUtils::isStaffRelease to true
  • Enabled uploading backups
  • Made a new draft ("compaction draft")
  • Created a new compaction and waited for it to be successfuly uploaded
  • Created a new draft ("log draft")
  • Logged out
  • Logged in, into the same account
  • Checked that the drafts weren't there
  • Restored from backup
  • Restarted the app so redux would refresh
  • Checked that both drafts were restored

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

marcin requested changes to this revision.Feb 12 2024, 7:28 AM
marcin added inline comments.
native/cpp/CommonCpp/DatabaseManagers/NativeSQLiteConnectionManager.cpp
235 ↗(On Diff #36997)

This is not the correct place to call this function. At this point we have no guarantee that transaction captured in this log will actually be commited. You should call this function in BaseDataStore after transaction is committed.

This revision now requires changes to proceed.Feb 12 2024, 7:28 AM

Move the function call to the correct place.

This revision is now accepted and ready to land.Feb 19 2024, 8:12 AM