Re: Online base backup from the hot-standby - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Online base backup from the hot-standby
Date
Msg-id CAHGQGwFHNDModuuGW2RmJ-861UQ_c1FNCv4MGxtSqq3xcpPbaw@mail.gmail.com
Whole thread Raw
In response to Re: Online base backup from the hot-standby  (Jun Ishiduka <ishizuka.jun@po.ntts.co.jp>)
Responses Re: Online base backup from the hot-standby
Remastering using streaming only replication?
Re: Online base backup from the hot-standby
List pgsql-hackers
2011/9/13 Jun Ishiduka <ishizuka.jun@po.ntts.co.jp>:
>
> Update patch.
>
> Changes:
>  * set 'on' full_page_writes by user (in document)
>  * read "FROM: XX" in backup_label (in xlog.c)
>  * check status when pg_stop_backup is executed (in xlog.c)

Thanks for updating the patch.

Before reviewing the patch, to encourage people to comment and
review the patch, I explain what this patch provides:

This patch provides the capability to take a base backup during recovery,
i.e., from the standby server. This is very useful feature to offload the
expense of periodic backups from the master. That backup procedure is
similar to that during normal running, but slightly different:

1. Execute pg_start_backup on the standby. To execute a query on the  standby, hot standby must be enabled.

2. Perform a file system backup on the standby.

3. Copy the pg_control file from the cluster directory on the standby to   the backup as follows:
   cp $PGDATA/global/pg_control /mnt/server/backupdir/global

4. Execute pg_stop_backup on the standby.

The backup taken by the above procedure is available for an archive
recovery or standby server.

If the standby is promoted during a backup, pg_stop_backup() detects
the change of the server status and fails. The data backed up before the
promotion is invalid and not available for recovery.

Taking a backup from the standby by using pg_basebackup is still not
possible. But we can relax that restriction after applying this patch.

To take a base backup during recovery safely, some sort of parameters
must be set properly. Hot standby must be enabled on the standby, i.e.,
wal_level and hot_standby must be enabled on the master and the standby,
respectively. FPW (full page writes) is required for a base backup,
so full_page_writes must be enabled on the master.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: EXPLAIN and nfiltered, take two
Next
From: Peter Eisentraut
Date:
Subject: Re: Is there really no interest in SQL Standard?