Re: pg_basebackup and pg_switch_wal() - Mailing list pgsql-hackers

From Fabrice Chapuis
Subject Re: pg_basebackup and pg_switch_wal()
Date
Msg-id CAA5-nLCgvRdH0YioesxBG8eOtyONtm2SfrZf-853PiRGL77XUQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_basebackup and pg_switch_wal()  (Sergei Kornilov <sk@zsrv.org>)
Responses Re: pg_basebackup and pg_switch_wal()
List 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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Compilation error with buildtype = release
Next
From: Robert Haas
Date:
Subject: Re: Better HINT message for "unexpected data beyond EOF"