diff --git a/pageserver/src/config.rs b/pageserver/src/config.rs index 85ff3a27af..658e0ddbff 100644 --- a/pageserver/src/config.rs +++ b/pageserver/src/config.rs @@ -96,8 +96,6 @@ pub mod defaults { pub const DEFAULT_EPHEMERAL_BYTES_PER_MEMORY_KB: usize = 0; - pub const DEFAULT_WALREDO_PROCESS_KIND: &str = crate::walredo::ProcessKind::DEFAULT_TOML; - /// /// Default built-in configuration file. /// @@ -140,8 +138,6 @@ pub mod defaults { #validate_vectored_get = '{DEFAULT_VALIDATE_VECTORED_GET}' -#walredo_process_kind = '{DEFAULT_WALREDO_PROCESS_KIND}' - [tenant_config] #checkpoint_distance = {DEFAULT_CHECKPOINT_DISTANCE} # in bytes #checkpoint_timeout = {DEFAULT_CHECKPOINT_TIMEOUT} @@ -290,8 +286,6 @@ pub struct PageServerConf { /// /// Setting this to zero disables limits on total ephemeral layer size. pub ephemeral_bytes_per_memory_kb: usize, - - pub walredo_process_kind: crate::walredo::ProcessKind, } /// We do not want to store this in a PageServerConf because the latter may be logged @@ -414,8 +408,6 @@ struct PageServerConfigBuilder { validate_vectored_get: BuilderValue, ephemeral_bytes_per_memory_kb: BuilderValue, - - walredo_process_kind: BuilderValue, } impl PageServerConfigBuilder { @@ -501,8 +493,6 @@ impl PageServerConfigBuilder { )), validate_vectored_get: Set(DEFAULT_VALIDATE_VECTORED_GET), ephemeral_bytes_per_memory_kb: Set(DEFAULT_EPHEMERAL_BYTES_PER_MEMORY_KB), - - walredo_process_kind: Set(DEFAULT_WALREDO_PROCESS_KIND.parse().unwrap()), } } } @@ -682,10 +672,6 @@ impl PageServerConfigBuilder { self.ephemeral_bytes_per_memory_kb = BuilderValue::Set(value); } - pub fn get_walredo_process_kind(&mut self, value: crate::walredo::ProcessKind) { - self.walredo_process_kind = BuilderValue::Set(value); - } - pub fn build(self) -> anyhow::Result { let default = Self::default_values(); @@ -741,7 +727,6 @@ impl PageServerConfigBuilder { max_vectored_read_bytes, validate_vectored_get, ephemeral_bytes_per_memory_kb, - walredo_process_kind, } CUSTOM LOGIC { @@ -1034,9 +1019,6 @@ impl PageServerConf { "ephemeral_bytes_per_memory_kb" => { builder.get_ephemeral_bytes_per_memory_kb(parse_toml_u64("ephemeral_bytes_per_memory_kb", item)? as usize) } - "walredo_process_kind" => { - builder.get_walredo_process_kind(parse_toml_from_str("walredo_process_kind", item)?) - } _ => bail!("unrecognized pageserver option '{key}'"), } } @@ -1118,7 +1100,6 @@ impl PageServerConf { ), validate_vectored_get: defaults::DEFAULT_VALIDATE_VECTORED_GET, ephemeral_bytes_per_memory_kb: defaults::DEFAULT_EPHEMERAL_BYTES_PER_MEMORY_KB, - walredo_process_kind: defaults::DEFAULT_WALREDO_PROCESS_KIND.parse().unwrap(), } } } @@ -1355,7 +1336,6 @@ background_task_maximum_delay = '334 s' ), validate_vectored_get: defaults::DEFAULT_VALIDATE_VECTORED_GET, ephemeral_bytes_per_memory_kb: defaults::DEFAULT_EPHEMERAL_BYTES_PER_MEMORY_KB, - walredo_process_kind: defaults::DEFAULT_WALREDO_PROCESS_KIND.parse().unwrap(), }, "Correct defaults should be used when no config values are provided" ); @@ -1427,7 +1407,6 @@ background_task_maximum_delay = '334 s' ), validate_vectored_get: defaults::DEFAULT_VALIDATE_VECTORED_GET, ephemeral_bytes_per_memory_kb: defaults::DEFAULT_EPHEMERAL_BYTES_PER_MEMORY_KB, - walredo_process_kind: defaults::DEFAULT_WALREDO_PROCESS_KIND.parse().unwrap(), }, "Should be able to parse all basic config values correctly" ); diff --git a/pageserver/src/walredo/process.rs b/pageserver/src/walredo/process.rs index 912923e9a0..a8d0cece0e 100644 --- a/pageserver/src/walredo/process.rs +++ b/pageserver/src/walredo/process.rs @@ -9,6 +9,7 @@ use utils::lsn::Lsn; use crate::{config::PageServerConf, walrecord::NeonWalRecord}; +mod live_reconfig; mod no_leak_child; /// The IPC protocol that pageserver and walredo process speak over their shared pipe. mod protocol; @@ -18,20 +19,9 @@ mod process_impl { pub(super) mod process_std; } -#[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - strum_macros::EnumString, - strum_macros::Display, - serde_with::DeserializeFromStr, - serde_with::SerializeDisplay, -)] -#[strum(serialize_all = "kebab-case")] +#[derive(Clone, Copy, Debug, serde::Serialize, serde::Deserialize)] #[repr(u8)] -pub enum Kind { +pub(crate) enum Kind { Sync, Async, } @@ -48,12 +38,7 @@ impl TryFrom for Kind { } } -impl Kind { - pub const DEFAULT: Kind = Kind::Sync; - pub const DEFAULT_TOML: &'static str = "sync"; -} - -static PROCESS_KIND: AtomicU8 = AtomicU8::new(Kind::DEFAULT as u8); +static PROCESS_KIND: AtomicU8 = AtomicU8::new(Kind::Async as u8); pub(crate) fn set_kind(kind: Kind) { PROCESS_KIND.store(kind as u8, std::sync::atomic::Ordering::Relaxed); @@ -125,24 +110,3 @@ impl Process { } } } - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_ensure_defaults_are_eq() { - #[derive(serde::Serialize, serde::Deserialize, Clone, Copy, Debug, PartialEq, Eq)] - struct Doc { - val: Kind, - } - let de = Doc { val: Kind::DEFAULT }; - let default_toml = Kind::DEFAULT_TOML; - let ser = format!( - r#" - val = '{default_toml}' - "# - ); - assert_eq!(de, toml_edit::de::from_str(&ser).unwrap(),); - } -} diff --git a/pageserver/src/walredo/process/live_reconfig.rs b/pageserver/src/walredo/process/live_reconfig.rs new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/pageserver/src/walredo/process/live_reconfig.rs @@ -0,0 +1 @@ +