Re: pg_basebackup and pg_switch_wal()
Fabrice Chapuis <fabrice636861@gmail.com>
From: Fabrice Chapuis <fabrice636861@gmail.com>
To: Sergei Kornilov <sk@zsrv.org>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-07-29T13:11:43Z
Lists: pgsql-hackers
Thanks for answering Sergei. ok in file postgres/src/backend/access/transam/xlog.c function void do_pg_backup_stop(BackupState *state, bool waitforarchive) there is /* * Force a switch to a new xlog segment file, so that the backup is * valid as soon as archiver moves out the current segment file. */ RequestXLogSwitch(false); But I do not understand this error with the barman wrapper: Backup completed (start time: 2025-07-26 21:45:07.238223, elapsed time: 19 seconds) Waiting for the WAL file 0000000300000B3F0000000C from server 'x_service' (max: 600 seconds) Processing xlog segments from streaming for x_service 0000000300000B3F0000000A Processing xlog segments from streaming for x_service 0000000300000B3F0000000B ERROR: The WAL file 0000000300000B3F0000000C has not been received in 600 seconds Regards, Fabrice On Tue, Jul 29, 2025 at 12:15 PM Sergei Kornilov <sk@zsrv.org> wrote: > 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 >