pg_basebackup and pg_switch_wal() - Mailing list pgsql-hackers

From Fabrice Chapuis
Subject pg_basebackup and pg_switch_wal()
Date
Msg-id CAA5-nLAG8kPcQLS2a=EFCBy0+xaR4AAUc8G9C3b_O9mYTT0LbA@mail.gmail.com
Whole thread Raw
Responses Re: pg_basebackup and pg_switch_wal()
List pgsql-hackers
Hi,

I read the doc concerning pg_basebackup 

pg_basebackup cannot force the standby to switch to a new WAL file at the end of backup
When you are using -X none, if write activity on the primary is low, pg_basebackup may need to wait a long time for the last WAL file required for the backup to be switched and archived. 
In this case, it may be useful to run pg_switch_wal on the primary in order to trigger an immediate WAL file switch.

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

I didn't find any pg_switch_wal() call in the source code of the pg_basebackup

~/GIT/postgres-18beta1/src/bin/pg_basebackup  (master)$ grep --include="*.c" "switch" *
astreamer_inject.c:     switch (context)
pg_basebackup.c:        switch (pg_check_dir(dirname))
pg_basebackup.c:        switch (GetCopyDataByte(r, copybuf, &cursor))
pg_basebackup.c:                switch (c)
pg_createsubscriber.c:          pg_log_warning_hint("You can use --enable-two-phase switch to enable two_phase.");
pg_createsubscriber.c:          switch (c)
pg_createsubscriber.c:          char       *bad_switch = NULL;
pg_createsubscriber.c:                  bad_switch = "--database";
pg_createsubscriber.c:                  bad_switch = "--publication";
pg_createsubscriber.c:                  bad_switch = "--replication-slot";
pg_createsubscriber.c:                  bad_switch = "--subscription";
pg_createsubscriber.c:          if (bad_switch)
pg_createsubscriber.c:                  pg_log_error("%s cannot be used with -a/--all", bad_switch);
pg_receivewal.c:         * timeline switch, xlogpos points to the beginning of the segment because
pg_receivewal.c:                pg_log_info("switched to timeline %u at %X/%X",
pg_receivewal.c:                switch (c)
pg_recvlogical.c:               switch (c)
pg_recvlogical.c:               switch (reason)

Thanks for your comment

Regards

Fabrice

pgsql-hackers by date:

Previous
From: Lukas Fittl
Date:
Subject: Re: Broken ./configure checks for __cpuid() and __cpuidex()
Next
From: Daniel Gustafsson
Date:
Subject: Re: delimiter inconsistency in generate-wait_event_types.pl