Page MenuHomePhabricator

D11355.diff
No OneTemporary

D11355.diff

diff --git a/services/backup/src/database/mod.rs b/services/backup/src/database/mod.rs
--- a/services/backup/src/database/mod.rs
+++ b/services/backup/src/database/mod.rs
@@ -229,14 +229,19 @@
/// Backup log functions
impl DatabaseClient {
- pub async fn put_log_item(&self, log_item: LogItem) -> Result<(), Error> {
+ pub async fn put_log_item(
+ &self,
+ log_item: LogItem,
+ blob_client: &BlobServiceClient,
+ ) -> Result<(), Error> {
let item = log_item.into();
- self
+ let result = self
.client
.put_item()
.table_name(log_table::TABLE_NAME)
.set_item(Some(item))
+ .return_values(ReturnValue::AllOld)
.send()
.await
.map_err(|e| {
@@ -244,6 +249,17 @@
Error::AwsSdk(e.into())
})?;
+ let Some(replaced_log_attrs) = result.attributes else {
+ return Ok(());
+ };
+
+ let Ok(replaced_log) = LogItem::try_from(replaced_log_attrs) else {
+ warn!("Couldn't parse replaced log item");
+ return Ok(());
+ };
+
+ replaced_log.revoke_holders(blob_client);
+
Ok(())
}
diff --git a/services/backup/src/http/handlers/log.rs b/services/backup/src/http/handlers/log.rs
--- a/services/backup/src/http/handlers/log.rs
+++ b/services/backup/src/http/handlers/log.rs
@@ -170,7 +170,7 @@
};
log_item.ensure_size_constraints(&blob_client).await?;
- db_client.put_log_item(log_item).await?;
+ db_client.put_log_item(log_item, &blob_client).await?;
Ok(vec![LogWSResponse::LogUploaded { backup_id, log_id }])
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 2:12 PM (18 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2677654
Default Alt Text
D11355.diff (1 KB)

Event Timeline