Обсуждение: WAL segment switch on pg_start_backup()

Поиск
Список
Период
Сортировка

WAL segment switch on pg_start_backup()

От
"@usernamedt"
Дата:
Hi,

I am currently exploring the pg_start_backup() and pg_stop_backup() functions.

In the documentation (https://www.postgresql.org/docs/9.0/functions-admin.html), it is stated that after calling pg_stop_backup() Postgres switches to the new WAL segment file. But it doesn’t say the same for pg_start_backup().

However, I found the following comment regarding pg_start_backup() in the source code:


* Force an XLOG file switch before the checkpoint, to ensure that the
* WAL segment the checkpoint is written to doesn't contain pages with
* old timeline IDs.  That would otherwise happen if you called
* pg_start_backup() right after restoring from a PITR archive: the
* first WAL segment containing the startup checkpoint has pages in
* the beginning with the old timeline ID.  That can cause trouble at
* recovery: we won't have a history file covering the old timeline if
* pg_wal directory was not included in the base backup and the WAL
* archive was cleared too before starting the backup.

So does it mean that Postgres always switches to the new WAL segment file on pg_start_backup() call too?

If so, as I understood, the newly created WAL segment file should start from the checkpoint and should not contain any WAL records regarding the events that happened before pg_start_backup() call?

Thanks,
Daniil Zakhlystov