Re: pg_basebackup and pg_switch_wal()

From: Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
To: Sergei Kornilov <sk(at)zsrv(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_basebackup and pg_switch_wal()
Date: 2025-07-29 13:11:43
Message-ID: CAA5-nLCgvRdH0YioesxBG8eOtyONtm2SfrZf-853PiRGL77XUQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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(at)zsrv(dot)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
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2025-07-29 13:16:26 Re: Better HINT message for "unexpected data beyond EOF"
Previous Message Tom Lane 2025-07-29 13:06:40 Re: Compilation error with buildtype = release