From 9796aeaada5591839f6d2542cff72cc14ed6ed14 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Wed, 27 Sep 2023 16:35:00 +0200 Subject: [PATCH] Revert "load_tenant_config: fail if there is no config" This reverts commit 4ce39ee55e1bfeecb6e16846d05793747f59ea5d. --- pageserver/src/tenant.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index ad3e5e7409..47bfd4a8ef 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -2108,14 +2108,6 @@ where Ok(result) } -#[derive(Debug, thiserror::Error)] -pub(super) enum LoadTenantConfigError { - #[error("tenant config file does not exist")] - ConfigFileDoesNotExist, - #[error(transparent)] - Other(#[from] anyhow::Error), -} - impl Tenant { pub fn tenant_specific_overrides(&self) -> TenantConfOpt { *self.tenant_conf.read().unwrap() @@ -2360,15 +2352,19 @@ impl Tenant { pub(super) fn load_tenant_config( conf: &'static PageServerConf, tenant_id: &TenantId, - ) -> Result { + ) -> anyhow::Result { let target_config_path = conf.tenant_config_path(tenant_id); let target_config_display = target_config_path.display(); info!("loading tenantconf from {target_config_display}"); + // FIXME If the config file is not found, assume that we're attaching + // a detached tenant and config is passed via attach command. + // https://github.com/neondatabase/neon/issues/1555 + // OR: we're loading after incomplete deletion that managed to remove config. if !target_config_path.exists() { info!("tenant config not found in {target_config_display}"); - return Err(LoadTenantConfigError::ConfigFileDoesNotExist); + return Ok(TenantConfOpt::default()); } // load and parse file @@ -2388,7 +2384,8 @@ impl Tenant { format!("Failed to parse config from file '{target_config_display}' as pageserver config") })?; } - _ => return Err(LoadTenantConfigError::Other(anyhow::anyhow!("config file {target_config_display} has unrecognized pageserver option '{key}'"))), + _ => bail!("config file {target_config_display} has unrecognized pageserver option '{key}'"), + } }