Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3513510
D13932.id46010.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13932.id46010.diff
View Options
diff --git a/native/native_rust_library/src/backup/file_info.rs b/native/native_rust_library/src/backup/file_info.rs
--- a/native/native_rust_library/src/backup/file_info.rs
+++ b/native/native_rust_library/src/backup/file_info.rs
@@ -4,7 +4,7 @@
lazy_static! {
static ref BACKUP_DATA_FILE_REGEX: Regex = Regex::new(
- r"^backup-(?<backup_id>[^-]*)(?:-log-(?<log_id>\d*))?(?<additional_data>-userkeys|-attachments)?$"
+ r"^backup-(?<backup_id>[^-]*)(-userkeys)?(?:-log-(?<log_id>\d*))?(?<additional_data>-attachments)?$"
)
.expect("Regex compilation failed");
}
diff --git a/native/native_rust_library/src/backup/upload_handler.rs b/native/native_rust_library/src/backup/upload_handler.rs
--- a/native/native_rust_library/src/backup/upload_handler.rs
+++ b/native/native_rust_library/src/backup/upload_handler.rs
@@ -130,36 +130,43 @@
Err(err) => return Err(err.into()),
};
+ let mut compaction_ids = HashSet::new();
+ let mut logs = Vec::new();
+
while let Some(file) = file_stream.next_entry().await? {
let path = file.path();
-
- if logs_waiting_for_confirmation.lock()?.contains(&path) {
- continue;
- }
-
- let Ok(BackupFileInfo {
+ if let Ok(BackupFileInfo {
backup_id,
log_id,
additional_data,
}) = path.clone().try_into()
- else {
- continue;
- };
+ {
+ // Skip additional data files (attachments). They will be
+ // handled when we iterate over the corresponding files with the
+ // main content
+ if additional_data.is_some() {
+ continue;
+ }
- // Skip additional data files (attachments, user keys). They will be
- // handled when we iterate over the corresponding files with the
- // main content
- if additional_data.is_some() {
- continue;
+ match log_id {
+ Some(id) => logs.push((path, backup_id, id)),
+ None => {
+ compaction_ids.insert(backup_id);
+ }
+ }
}
+ }
- if let Some(log_id) = log_id {
- log::upload_files(tx, backup_id, log_id).await?;
- logs_waiting_for_confirmation.lock()?.insert(path);
- } else {
- compaction::upload_files(backup_client, user_identity, backup_id)
- .await?;
+ for backup_id in compaction_ids {
+ compaction::upload_files(backup_client, user_identity, backup_id).await?;
+ }
+
+ for (path, backup_id, log_id) in logs {
+ if logs_waiting_for_confirmation.lock()?.contains(&path) {
+ continue;
}
+ log::upload_files(tx, backup_id, log_id).await?;
+ logs_waiting_for_confirmation.lock()?.insert(path.clone());
}
TRIGGER_BACKUP_FILE_UPLOAD.notified().await;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 12:25 AM (12 h, 24 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692949
Default Alt Text
D13932.id46010.diff (2 KB)
Attached To
Mode
D13932: [backup-client][native_rust_library] refactor uploading files to not ignore User Keys
Attached
Detach File
Event Timeline
Log In to Comment