Re: pg_basebackup and pg_switch_wal()

Sergei Kornilov <sk@zsrv.org>

From: Sergei Kornilov <sk@zsrv.org>
To: Fabrice Chapuis <fabrice636861@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-07-29T10:15:30Z
Lists: pgsql-hackers
Hello

> This is not the case also when the backup is made from the primary?

On primary it is handled in do_pg_backup_stop function (called from perform_base_backup after basebackup was transferred), without explicitly called pg_switch_wal from pg_basebackup. pg_basebackup can change this behavior using options to the BASE_BACKUP replication command.

regards, Sergei