From e5a397cf9612d32b17a1599ae032b93f68b33380 Mon Sep 17 00:00:00 2001 From: Anastasia Lubennikova Date: Tue, 29 Aug 2023 20:30:24 +0300 Subject: [PATCH] Form archive_path for remote extensions on the fly --- compute_tools/src/compute.rs | 3 ++- compute_tools/src/http/api.rs | 7 ++++++- libs/compute_api/src/spec.rs | 19 +++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/compute_tools/src/compute.rs b/compute_tools/src/compute.rs index 595ecb453e..03ae39f79f 100644 --- a/compute_tools/src/compute.rs +++ b/compute_tools/src/compute.rs @@ -1078,7 +1078,8 @@ LIMIT 100", let mut download_tasks = Vec::new(); for library in &libs_vec { - let (ext_name, ext_path) = remote_extensions.get_ext(library, true)?; + let (ext_name, ext_path) = + remote_extensions.get_ext(library, true, &self.build_tag, &self.pgversion)?; download_tasks.push(self.download_extension(ext_name, ext_path)); } let results = join_all(download_tasks).await; diff --git a/compute_tools/src/http/api.rs b/compute_tools/src/http/api.rs index 841e533a3a..a571628770 100644 --- a/compute_tools/src/http/api.rs +++ b/compute_tools/src/http/api.rs @@ -169,7 +169,12 @@ async fn routes(req: Request, compute: &Arc) -> Response anyhow::Result<(String, RemotePath)> { let mut real_ext_name = ext_name; if is_library { @@ -105,10 +107,19 @@ impl RemoteExtSpec { } match self.extension_data.get(real_ext_name) { - Some(ext_data) => Ok(( - real_ext_name.to_string(), - RemotePath::from_string(&ext_data.archive_path)?, - )), + Some(_ext_data) => { + // Construct the path to the extension archive + // BUILD_TAG/PG_MAJOR_VERSION/extensions/EXTENSION_NAME.tar.zst + // + // Keep it in sync with path generation in + // https://github.com/neondatabase/build-custom-extensions/tree/main + let archive_path_str = + format!("{build_tag}/{pg_major_version}/extensions/{real_ext_name}.tar.zst"); + Ok(( + real_ext_name.to_string(), + RemotePath::from_string(&archive_path_str)?, + )) + } None => Err(anyhow::anyhow!( "real_ext_name {} is not found", real_ext_name