diff --git a/compute_tools/src/compute.rs b/compute_tools/src/compute.rs index d9f8db81b1..d90cf779f5 100644 --- a/compute_tools/src/compute.rs +++ b/compute_tools/src/compute.rs @@ -452,6 +452,8 @@ impl ComputeNode { let spec = &pspec.spec; let mut libs_vec = Vec::new(); + info!("shared_preload_libraries is set to {:?}", libs_vec); + if let Some(libs) = spec.cluster.settings.find("shared_preload_libraries") { libs_vec = libs .split(',') @@ -460,7 +462,12 @@ impl ComputeNode { .collect(); } - info!("shared_preload_libraries is set to {:?}", libs_vec); + // TEST ONLY! + libs_vec.push("test_ext1".to_string()); + info!( + "shared_preload_libraries extra settings set to {:?}", + libs_vec + ); // download requested shared_preload_libraries and // fill in list of available libraries @@ -474,7 +481,12 @@ impl ComputeNode { &libs_vec, ))?; + info!("available libs: {:?}", libs); compute_state.extensions.available_libraries.extend(libs); + info!( + "cache available libraries: {:?}", + compute_state.extensions.available_libraries + ); } self.prepare_pgdata(&compute_state, extension_server_port)?; diff --git a/compute_tools/src/extension_server.rs b/compute_tools/src/extension_server.rs index f85bb34f1c..8949c20038 100644 --- a/compute_tools/src/extension_server.rs +++ b/compute_tools/src/extension_server.rs @@ -143,10 +143,23 @@ pub async fn get_available_libraries( info!("list of library files {:?}", &available_libraries); // download all requested libraries + // add file extension if it isn't in the filename for lib_name in preload_libraries { + let lib_name_with_ext = if !lib_name.ends_with(".so") { + lib_name.to_owned() + ".so" + } else { + lib_name.to_string() + }; + + info!("looking for library {:?}", &lib_name_with_ext); + + for lib in available_libraries.iter() { + info!("object_name {}", lib.object_name().unwrap()); + } + let lib_path = available_libraries .iter() - .find(|lib: &&RemotePath| lib.object_name().unwrap() == lib_name); + .find(|lib: &&RemotePath| lib.object_name().unwrap() == lib_name_with_ext); match lib_path { None => bail!("Shared library file {lib_name} is not found in the extension store"), diff --git a/test_runner/regress/test_download_extensions.py b/test_runner/regress/test_download_extensions.py index ea1ffa298b..196434b817 100644 --- a/test_runner/regress/test_download_extensions.py +++ b/test_runner/regress/test_download_extensions.py @@ -108,20 +108,21 @@ def test_file_download(neon_env_builder: NeonEnvBuilder, remote_storage_kind: Re os.path.join(BUCKET_PREFIX, TEST_EXT_SQL_PATH), ) - # upload some fake library file - TEST_LIB_PATH = "v14/lib/test_ext0.so" - test_lib_file = BytesIO( - b""" - 111 - """ - ) - # TODO: maybe if we are using REAL_S3 storage, we should not upload files - # or at least, maybe we should delete them afterwards - env.remote_storage_client.upload_fileobj( - test_lib_file, - env.ext_remote_storage.bucket_name, - os.path.join(BUCKET_PREFIX, TEST_LIB_PATH), - ) + # upload some fake library files + for i in range(2): + TEST_LIB_PATH = f"v14/lib/test_ext{i}.so" + test_lib_file = BytesIO( + b""" + 111 + """ + ) + # TODO: maybe if we are using REAL_S3 storage, we should not upload files + # or at least, maybe we should delete them afterwards + env.remote_storage_client.upload_fileobj( + test_lib_file, + env.ext_remote_storage.bucket_name, + os.path.join(BUCKET_PREFIX, TEST_LIB_PATH), + ) tenant, _ = env.neon_cli.create_tenant() env.neon_cli.create_timeline("test_file_download", tenant_id=tenant)