mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-24 00:20:37 +00:00
WIP debug shared_libs
This commit is contained in:
@@ -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)?;
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user