Page MenuHomePhabricator

[backup] Log download endpoint
ClosedPublic

Authored by michal on Dec 22 2023, 8:08 AM.
Tags
None
Referenced Files
F2205314: D10457.id35391.diff
Sat, Jul 6, 8:29 PM
Unknown Object (File)
Mon, Jul 1, 7:41 PM
Unknown Object (File)
Fri, Jun 28, 2:24 AM
Unknown Object (File)
Thu, Jun 27, 9:48 AM
Unknown Object (File)
Tue, Jun 25, 10:09 AM
Unknown Object (File)
Tue, Jun 25, 5:55 AM
Unknown Object (File)
Tue, Jun 25, 3:58 AM
Unknown Object (File)
Mon, Jun 24, 7:39 PM
Subscribers

Details

Summary

ENG-5330 : Add endpoint for downloading logs

Log download logic. Each request specifies (optional) index from which the fetch should start which allows us to paginate the results. The final message sent by the backup service contains the id from which should the next fetch be started or None of we have already fetched all logs for a given backup.

Depends on D10456

Test Plan
  • Created a 100 logs for 3 backups, half of which were bigger than the dynamodb maximum storage size (so they were stored in blob service)
  • Run this code (simplified):
tx.send(DownloadLogsRequest { from_id: None });

'outer: loop {
  loop {
    match rx.next().await {
      Some(Ok(LogWSResponse::LogDownload {
        log_id,
        content,
        attachments,
      })) => {
        // Make sure that content and attachments match the expected values
        // for this specific logs
        // ...
      }
      Some(Ok(LogWSResponse::LogDownloadFinished { last_log_id })) => {
        if let Some(last_log_id) = last_log_id {
          tx.send(DownloadLogsRequest {
            from_id: Some(last_log_id),
          });
        } else {
          break 'outer;
        }
      }
    };
  }
}
  • Got all 100 logs for the correct backup with correct data (and in correct order, although final backup service client won't depend on this)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable