This commit is contained in:
John Spray
2023-08-29 15:35:52 +01:00
parent fd836d8c45
commit 980d3ba8b0
3 changed files with 7 additions and 8 deletions

View File

@@ -55,7 +55,7 @@ impl Generation {
if self.0 == Self::NONE {
"".into()
} else {
format!("-{:08x}", self.0).into()
format!("-{:08x}", self.0)
}
}
}

View File

@@ -660,7 +660,7 @@ impl RemoteTimelineClient {
// makes that are unexpectedly missing from our metadata.
let with_generations: Vec<_> = names
.iter()
.map(|name| {
.filter_map(|name| {
// Remove from latest_files, learning the file's remote generation in the process
let meta = upload_queue.latest_files.remove(name);
@@ -672,11 +672,10 @@ impl RemoteTimelineClient {
None
} else {
upload_queue.latest_files_changes_since_metadata_upload_scheduled += 1;
let generation = meta.map(|m| m.generation).flatten();
let generation = meta.and_then(|m| m.generation);
Some((name, generation))
}
})
.filter_map(|i| i)
.collect();
if upload_queue.latest_files_changes_since_metadata_upload_scheduled > 0 {
@@ -689,7 +688,7 @@ impl RemoteTimelineClient {
file_kind: RemoteOpFileKind::Layer,
layer_file_name: name.clone(),
scheduled_from_timeline_delete: false,
generation: generation,
generation,
});
self.calls_unfinished_metric_begin(&op);
upload_queue.queued_operations.push_back(op);
@@ -1577,7 +1576,7 @@ mod tests {
runtime: tokio::runtime::Handle::current(),
tenant_id: harness.tenant_id,
timeline_id: TIMELINE_ID,
generation: generation,
generation,
storage_impl: storage,
upload_queue: Mutex::new(UploadQueue::Uninitialized),
metrics: Arc::new(RemoteTimelineClientMetrics::new(

View File

@@ -173,8 +173,8 @@ pub fn is_temp_download_file(path: &Path) -> bool {
}
/// List timelines of given tenant in remote storage
pub async fn list_remote_timelines<'a>(
storage: &'a GenericRemoteStorage,
pub async fn list_remote_timelines(
storage: &GenericRemoteStorage,
tenant_id: TenantId,
) -> anyhow::Result<HashSet<TimelineId>> {
let remote_path = remote_timelines_path(&tenant_id);