From 027cf226638d2bf7cc1fa65968cd86b305a452bf Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Mon, 14 Nov 2022 10:50:01 -0500 Subject: [PATCH] fix layer download during reconcile_with_remote reconcile_with_remote, in this PR, is supposed to download all the layer files synchronously. I don't know why, but, download_missing was 1. not doing the download at all for DeltaLayer 2. not using the right RelativePath for image layer This patch fixes both. --- pageserver/src/tenant/timeline.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index 06df8f76ea..f8ec3f6b30 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -1014,7 +1014,7 @@ impl Timeline { }); // Are we missing some files that are present in remote storage? - // Create RemoteLayers to represent them, and add to the layer map + // Download them now. // TODO Downloading many files this way is not efficient. // Better to use FuturesUnordered. Maybe keep as is because: // a) inplace download is a throw-away code, on-demand patch doesnt need that @@ -1041,14 +1041,9 @@ impl Timeline { } remote_client - .download_layer_file( - &RelativePath::from_local_path( - &self.conf.timeline_path(&self.timeline_id, &self.tenant_id), - path, - )?, - &layer_metadata, - ) - .await?; + .download_layer_file(&RelativePath::from_filename(path), &layer_metadata) + .await + .context("download image layer")?; let image_layer = ImageLayer::new(self.conf, self.timeline_id, self.tenant_id, &imgfilename); @@ -1073,6 +1068,11 @@ impl Timeline { continue; } + remote_client + .download_layer_file(&RelativePath::from_filename(path), &layer_metadata) + .await + .context("download delta layer")?; + let delta_layer = DeltaLayer::new(self.conf, self.timeline_id, self.tenant_id, &deltafilename);