diff --git a/compute_tools/src/bin/compute_ctl.rs b/compute_tools/src/bin/compute_ctl.rs index 941a861257..c26492e358 100644 --- a/compute_tools/src/bin/compute_ctl.rs +++ b/compute_tools/src/bin/compute_ctl.rs @@ -65,10 +65,11 @@ fn main() -> Result<()> { let pgbin_default = String::from("postgres"); let pgbin = matches.get_one::("pgbin").unwrap_or(&pgbin_default); - let remote_ext_config = matches - .get_one::("remote-ext-config") - .expect("remote-extension-config is required"); - let remote_storage = init_remote_storage(remote_ext_config)?; + let remote_ext_config = matches.get_one::("remote-ext-config"); + let remote_storage = match remote_ext_config { + Some(x) => Some(init_remote_storage(x)?), + None => None, + }; let rt = Runtime::new().unwrap(); let copy_remote_storage = remote_storage.clone(); diff --git a/compute_tools/src/compute.rs b/compute_tools/src/compute.rs index 3991b27196..63fafa510d 100644 --- a/compute_tools/src/compute.rs +++ b/compute_tools/src/compute.rs @@ -48,7 +48,7 @@ pub struct ComputeNode { /// `Condvar` to allow notifying waiters about state changes. pub state_changed: Condvar, /// S3 extensions configuration variables (JSON) - pub remote_storage: GenericRemoteStorage, + pub remote_storage: Option, } #[derive(Clone, Debug)] diff --git a/compute_tools/src/extension_server.rs b/compute_tools/src/extension_server.rs index 5781f12b5a..3742bb2b19 100644 --- a/compute_tools/src/extension_server.rs +++ b/compute_tools/src/extension_server.rs @@ -65,10 +65,15 @@ pub enum ExtensionType { } pub async fn download_extension( - remote_storage: &GenericRemoteStorage, + remote_storage: &Option, ext_type: ExtensionType, pgbin: &str, ) -> anyhow::Result<()> { + let remote_storage = match remote_storage { + Some(remote_storage) => remote_storage, + None => return Ok(()), + }; + let mut remote_sharedir = get_pg_config("--sharedir", pgbin); remote_sharedir.push_str("/extension"); // let remote_sharedir = get_pg_config("--libdir", pgbin); diff --git a/control_plane/src/bin/neon_local.rs b/control_plane/src/bin/neon_local.rs index 09d644ca84..2cbbb187b6 100644 --- a/control_plane/src/bin/neon_local.rs +++ b/control_plane/src/bin/neon_local.rs @@ -657,9 +657,7 @@ fn handle_endpoint(ep_match: &ArgMatches, env: &local_env::LocalEnv) -> Result<( .get_one::("endpoint_id") .ok_or_else(|| anyhow!("No endpoint ID was provided to start"))?; - let remote_ext_config = sub_args - .get_one::("remote-ext-config") - .context("remote_ext_config is not an optional parameter")?; + let remote_ext_config = sub_args.get_one::("remote-ext-config"); // If --safekeepers argument is given, use only the listed safekeeper nodes. let safekeepers = @@ -1010,7 +1008,7 @@ fn cli() -> Command { .long("remote-ext-config") .num_args(1) .help("Configure the S3 bucket that we search for extensions in.") - .required(true); + .required(false); let lsn_arg = Arg::new("lsn") .long("lsn") diff --git a/control_plane/src/endpoint.rs b/control_plane/src/endpoint.rs index c0d34ec619..71014984df 100644 --- a/control_plane/src/endpoint.rs +++ b/control_plane/src/endpoint.rs @@ -412,7 +412,7 @@ impl Endpoint { &self, auth_token: &Option, safekeepers: Vec, - remote_ext_config: &str, + remote_ext_config: Option<&String>, ) -> Result<()> { if self.status() == "running" { anyhow::bail!("The endpoint is already running"); @@ -496,7 +496,6 @@ impl Endpoint { let mut cmd = Command::new(self.env.neon_distrib_dir.join("compute_ctl")); cmd.args(["--http-port", &self.http_address.port().to_string()]) - .args(["--remote-ext-config", remote_ext_config]) .args(["--pgdata", self.pgdata().to_str().unwrap()]) .args(["--connstr", &self.connstr()]) .args([ @@ -514,6 +513,9 @@ impl Endpoint { .stdin(std::process::Stdio::null()) .stderr(logfile.try_clone()?) .stdout(logfile); + if let Some(remote_ext_config) = remote_ext_config { + cmd.args(["--remote-ext-config", remote_ext_config]); + } let _child = cmd.spawn()?; // Wait for it to start diff --git a/test_runner/fixtures/neon_fixtures.py b/test_runner/fixtures/neon_fixtures.py index b6991ffd41..093d3bb7d8 100644 --- a/test_runner/fixtures/neon_fixtures.py +++ b/test_runner/fixtures/neon_fixtures.py @@ -2353,7 +2353,6 @@ class Endpoint(PgProtocol): hot_standby: bool = False, lsn: Optional[Lsn] = None, config_lines: Optional[List[str]] = None, - remote_ext_config: Optional[str] = None, ) -> "Endpoint": """ Create a new Postgres endpoint. @@ -2406,7 +2405,6 @@ class Endpoint(PgProtocol): http_port=self.http_port, tenant_id=self.tenant_id, safekeepers=self.active_safekeepers, - # TODO it's either start or create, not both that starts compute_ctl remote_ext_config=remote_ext_config, ) self.running = True @@ -2512,7 +2510,6 @@ class Endpoint(PgProtocol): config_lines=config_lines, hot_standby=hot_standby, lsn=lsn, - remote_ext_config=remote_ext_config, ).start(remote_ext_config=remote_ext_config) log.info(f"Postgres startup took {time.time() - started_at} seconds")