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

From Jun Ishiduka
Subject Online base backup from the hot-standby
Date
Msg-id 201105270609.p4R694Lo010621@ccmds32.silk.ntts.co.jp
Whole thread Raw
Responses Re: Online base backup from the hot-standby  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List pgsql-hackers
Hi

I would like to develop function for 'Online base backup from the
hot-standby' in PostgreSQL 9.2.

Todo : Allow hot file system backups on standby servers
(http://wiki.postgresql.org/wiki/Todo)


[GOAL]* Make pg_basebackup to execute to the hot-standby server   and acquire online-base-backup .    - pg_basebackup
canbe executed to only primary server in       PostgreSQL 9.1 .    - But physical-copy(etc) under processing of
pg_basebackup     raises the load of primary server .    - Therefore , this function is necessary .
 

[Problem]
(There is the following problems when hot-standby acquires online-base-backup like executing pg_basebackup to the
primaryserver .)* pg_start_backup() and pg_stop_backup() can't be executed to the   hot-standby server .    -
hot-standbycan't insert backup-end record to WAL-files and       can't operate CHECKPOINT .       - Because hot-standby
can'twrite anything in WAL-files .* hot-standby can't send WAL-files to archive server.    - when pg_stop_backup() is
executedto the primary server ,       it waits for completing sending wal to archive server ,        but hot-standby
can'tdo it.
 

[Policy]
(I create with the following Policy .)    * This function doesn't affect primary server .        - I don't adopt the
waywhich "hot-standby requests primary to         execute pg_basebackup" , because I think about many standbys
isconnected with a primary .
 

[Approach]* When pg_basebackup is executed to the hot-standby server , it   executes RESTARTPOINT instead of CHECKPOINT
.  backup_label is made from the RESTARTPOINT's results , and is sent   to the designated backup server using
pg_basebackupconnection .* Instead of inserting backup-end record , hot-standby writes   backup-end-position in
backup-history-fileand sends to the   designated backup server using pg_basebackup connection .   - In 9.1 , startup
processknows backup-end-position from only      backup-end record . In addition to its logic, startup process      can
knowbackup-end-position from backup-history-file .      As a result , startup process can recovery certainly
withoutbackup-end record .
 

[Precondition]
(As a result of the above-mentioned Policy and Approach , there is the following restrictions .)    * Immediately after
backupstarting of WAL must contain       full page writes . But the above-mentioned Approach can't satisfy       the
restrictionaccording to circumstances . Because       full_page_writes of primary might equal 'off' .      When standby
recoveryWAL which is removed full page writes by pg_lesslog      , it is the same .    * Because recovery starts from
lastCHECKPOINT , it becomes long .    * I has not thought new process that become taking the place of       waiting for
completingsending wal to archive server , yet.
 

[Working Step]STEP1: Make startup process to acquire backup-end-position from        not only backup-end record but
alsobackup-history-file .         * startup process allows to acquire backup-end-position            from
backup-history-file.         * When pg_basebackup is executed , backup-history-file is            sent to the
designatedbackup server .STEP2: Make pg_start_backup() and pg_stop_backup() to be executed        by the hot-standby
server.
[Action until The first CommitFest (on June 15)]
I will create a patch to STEP1 .
(The patch will be able to settle a problem of Omnipitr-backup-slave.)
(a problem of Omnipitr-backup-slave :    http://archives.postgresql.org/pgsql-hackers/2011-03/msg01490.php) * Shedule
ofcreating STEP2 is the next CommitFest (in September 15) 
 



--------------------------------------------
Jun Ishizuka
NTT Software Corporation
TEL:045-317-7018
E-Mail: ishizuka.jun@po.ntts.co.jp
--------------------------------------------




pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Pre-alloc ListCell's optimization
Next
From: Ibrar Ahmed
Date:
Subject: Re: "errno" not set in case of "libm" functions (HPUX)