diff --git a/pageserver/src/walredo.rs b/pageserver/src/walredo.rs index 5b8cad062d..5437acc28f 100644 --- a/pageserver/src/walredo.rs +++ b/pageserver/src/walredo.rs @@ -165,7 +165,7 @@ impl PostgresRedoManager { } } // last batch - let res = if batch_neon { + if batch_neon { self.apply_batch_neon(key, lsn, img, &records[batch_start..]) } else { self.apply_batch_postgres( @@ -177,11 +177,7 @@ impl PostgresRedoManager { self.conf.wal_redo_timeout, pg_version, ) - }; - if res.is_ok() { - *(self.last_successful_redo_at.lock().unwrap()) = Some(Instant::now()); } - res } } @@ -230,6 +226,32 @@ impl PostgresRedoManager { records: &[(Lsn, NeonWalRecord)], wal_redo_timeout: Duration, pg_version: u32, + ) -> anyhow::Result { + let res = self.apply_batch_postgres0( + key, + lsn, + base_img, + base_img_lsn, + records, + wal_redo_timeout, + pg_version, + ); + if res.is_ok() { + *self.last_successful_redo_at.lock().unwrap() = Some(Instant::now()); + } + res + } + + #[allow(clippy::too_many_arguments)] + fn apply_batch_postgres0( + &self, + key: Key, + lsn: Lsn, + base_img: Option, + base_img_lsn: Lsn, + records: &[(Lsn, NeonWalRecord)], + wal_redo_timeout: Duration, + pg_version: u32, ) -> anyhow::Result { let (rel, blknum) = key_to_rel_block(key).context("invalid record")?; const MAX_RETRY_ATTEMPTS: u32 = 1;