HomePhabricator
Diffusion Comm 41d737831d21

[native] Notify backup uploader after compaction creation

Description

[native] Notify backup uploader after compaction creation

Summary: After JS schedules new backup compaction creation we want to keep track of the promise_id so we can resolve/reject it after the operation. But the logic is split Rust -> C++ (compaction creation) -> Rust (upload to backup service) so we need to keep a map from backupID to the promise id.

Test Plan:
Tested with the later diff but things that touch this code in particular:

  • tested that the promise resolved after successful upload
  • tested that the promise rejected with a correct message after an error on the Rust side
  • tested that the promise rejected with a correct message after an error on the C++ side

The testing code looks roughly like this:

if let Err(err) = rust_op_that_can_fail().await {
  compaction_upload_promises::resolve(&backup_id, Err(err));
  return;
}

let (future_id, future) = future_manager::new_future::<()>().await;
cpp_that_can_fail(future_id);
if let Err(err) = future.await {
  compaction_upload_promises::resolve(&backup_id, Err(err));
  return;
}

compaction_upload_promises::resolve(&backup_id, Ok(()));

Reviewers: marcin, bartek, kamil

Reviewed By: marcin, bartek, kamil

Subscribers: ashoat, tomek

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

Details

Provenance
Michal Gniadek <michal.gniadek@swmansion.com>Authored on Jan 17 2024, 8:39 AM
Reviewer
marcin
Differential Revision
D10858: [native] Notify backup uploader after compaction creation
Parents
rCOMM6b1b41cd1e3d: [backup] Namespace log id in db
Branches
Unknown
Tags
Unknown