From 8cb8c8d7b50d2b4079f04ef45575b4f96b2c3889 Mon Sep 17 00:00:00 2001 From: Arthur Petukhovsky Date: Wed, 24 Jan 2024 19:48:56 +0300 Subject: [PATCH] Allow remove_wal.rs to run on inactive timelines (#6462) Temporary enable it on staging to help with https://github.com/neondatabase/neon/issues/6403 Can be also deployed to prod if will work well on staging. --- safekeeper/src/remove_wal.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/safekeeper/src/remove_wal.rs b/safekeeper/src/remove_wal.rs index 87c3ecaf60..9dce06a886 100644 --- a/safekeeper/src/remove_wal.rs +++ b/safekeeper/src/remove_wal.rs @@ -7,6 +7,8 @@ use tracing::*; use crate::{GlobalTimelines, SafeKeeperConf}; +const ALLOW_INACTIVE_TIMELINES: bool = true; + pub async fn task_main(conf: SafeKeeperConf) -> anyhow::Result<()> { let wal_removal_interval = Duration::from_millis(5000); loop { @@ -15,10 +17,13 @@ pub async fn task_main(conf: SafeKeeperConf) -> anyhow::Result<()> { let tlis = GlobalTimelines::get_all(); for tli in &tlis { - if !tli.is_active().await { + let is_active = tli.is_active().await; + if is_active { + active_timelines += 1; + } + if !ALLOW_INACTIVE_TIMELINES && !is_active { continue; } - active_timelines += 1; let ttid = tli.ttid; async { if let Err(e) = tli.maybe_persist_control_file().await {