From 356f7d3a7e4f74b257357d6c1ed3a501ff80edde Mon Sep 17 00:00:00 2001 From: Alek Westover Date: Tue, 20 Jun 2023 22:39:02 -0400 Subject: [PATCH] more debugging --- compute_tools/src/bin/compute_ctl.rs | 18 ++++++++++++------ compute_tools/src/extension_server.rs | 17 ++++++++++------- compute_tools/src/http/api.rs | 1 + .../regress/test_download_extensions.py | 9 +++++---- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/compute_tools/src/bin/compute_ctl.rs b/compute_tools/src/bin/compute_ctl.rs index 60f1a94391..34c7463bb4 100644 --- a/compute_tools/src/bin/compute_ctl.rs +++ b/compute_tools/src/bin/compute_ctl.rs @@ -55,6 +55,8 @@ use compute_tools::monitor::launch_monitor; use compute_tools::params::*; use compute_tools::spec::*; +use tokio::runtime::Runtime; + fn main() -> Result<()> { init_tracing_and_logging(DEFAULT_LOG_LEVEL)?; @@ -78,12 +80,16 @@ fn main() -> Result<()> { warn!("you certainly must build changes if you want rust changes to be built"); std::fs::write("alek/yay", remote_ext_bucket.clone())?; - // compute_tools::extension_server::download_file( - // "test_ext.control", - // remote_ext_bucket.into(), - // remote_ext_region.into(), - // ) - // .await?; + let mut rt = Runtime::new().unwrap(); + rt.block_on(async move { + compute_tools::extension_server::download_file( + "test_ext.control", + remote_ext_bucket.into(), + remote_ext_region.into(), + ) + .await + .expect("download should work"); + }); let http_port = *matches .get_one::("http-port") diff --git a/compute_tools/src/extension_server.rs b/compute_tools/src/extension_server.rs index ab012917b4..6ebdeb1ec8 100644 --- a/compute_tools/src/extension_server.rs +++ b/compute_tools/src/extension_server.rs @@ -90,14 +90,17 @@ pub async fn download_extension( let libdir = get_pg_config("--libdir"); let remote_storage = GenericRemoteStorage::from_config(config)?; - // just doing a testing thing - let folder = RemotePath::new(Path::new("public_extensions"))?; - let from_paths = remote_storage.list_files(Some(&folder)).await?; - let some_path = from_paths[0] - .object_name() - .expect("had a problem with somepath in extension server"); - fs::write("alek/SOMEPATH", some_path)?; + std::fs::write("alek/proof", "proof")?; + // // this is just for testing doing a testing thing + // let folder = RemotePath::new(Path::new("public_extensions"))?; + // let from_paths = remote_storage.list_files(Some(&folder)).await?; + // let some_path = from_paths[0] + // .object_name() + // .expect("had a problem with somepath in extension server"); + // fs::write("alek/SOMEPATH", some_path)?; + + // // this is the real thing // match ext_type { // ExtensionType::Shared => { // // 1. Download control files from s3-bucket/public/*.control to SHAREDIR/extension diff --git a/compute_tools/src/http/api.rs b/compute_tools/src/http/api.rs index f3b10f2dee..f8aab17d5d 100644 --- a/compute_tools/src/http/api.rs +++ b/compute_tools/src/http/api.rs @@ -343,6 +343,7 @@ async fn serve(port: u16, state: Arc) { pub fn launch_http_server(port: u16, state: &Arc) -> Result> { let state = Arc::clone(state); + // TODO: remote print statements let xxx = format!("ROUTING port: {port}"); std::fs::write("alek/ROUTES", xxx).expect("routing write file"); diff --git a/test_runner/regress/test_download_extensions.py b/test_runner/regress/test_download_extensions.py index 65f7113c1a..0163e3abbd 100644 --- a/test_runner/regress/test_download_extensions.py +++ b/test_runner/regress/test_download_extensions.py @@ -82,10 +82,11 @@ def test_file_download(neon_env_builder: NeonEnvBuilder): # step 5 attempt 2 # TODO: I'm not even remotely confident this is the correct port - # response = requests.post("http://localhost:8080/extension_server/postgis-3.so") - log.info("*\n" * 100) - log.info("IMPORTANT") - # log.info(response.content) + # response = requests.post("http://localhost:15000/extension_server/postgis-3.so") + # log.info("*\n" * 100) + # log.info("IMPORTANT") + # log.info(str(env.neon_cli.__dict__["env"].__dict__)) + # log.info(response.content.decode("utf-8")) with closing(endpoint.connect()) as conn: with conn.cursor() as cur: