From dec25013c8f9fb7659d5cb1e28457955ca2b1634 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 16 Jun 2024 00:45:49 +0200 Subject: [PATCH] haumea/zrepl: create pg checkpoint before taking snapshot Creating a checkpoint flushes all memory to disk, and applies all WAL files to persistent storage, forward-paying the cost of WAL replay, but on the other hand making snapshots much cheaper. https://zrepl.github.io/master/configuration/snapshotting.html#job-hook-type-postgres-checkpoint https://www.postgresql.org/docs/current/sql-checkpoint.html https://www.postgresql.org/docs/current/wal-configuration.html --- delft/haumea/zrepl.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/delft/haumea/zrepl.nix b/delft/haumea/zrepl.nix index 481a5dc3..bccc1e6b 100644 --- a/delft/haumea/zrepl.nix +++ b/delft/haumea/zrepl.nix @@ -24,6 +24,12 @@ type = "periodic"; interval = "5m"; prefix = "zrepl_snap_"; + hooks = [ { + # https://zrepl.github.io/master/configuration/snapshotting.html#postgres-checkpoint-hook + type = "postgres-checkpoint"; + dsn = "host=/run/postgresql user=root sslmode=disable"; + filesystems."rpool/safe/postgres" = true; + } ]; }; pruning = { keep_sender = [