On Tue, 2010-10-05 at 18:47 +0900, Fujii Masao wrote:
> On Tue, Oct 5, 2010 at 5:49 PM, Heikki Linnakangas
> <heikki.linnakangas@enterprisedb.com> wrote:
> > On 04.10.2010 17:22, Fujii Masao wrote:
> >>
> >> If we make all the transactions wait until specified standbys have
> >> connected to the master, how do we take a base backup from the
> >> master for those standbys? We seem to be unable to do that because
> >> pg_start_backup also waits forever. Is this right?
> >
> > Hmm, pg_start_backup() writes WAL, but it doesn't commit. Only a commit
> > needs to wait for acknowledgment from the standby, so 'wait forever'
> > behavior doesn't necessarily mean that you can't take a base backup. If you
> > run it outside a transaction you get an implicit commit, though, which will
> > wait, so you might need to do something odd like "begin; select
> > pg_start_backup(); rollback".
>
> Yep. Similarly, we would need to enclose also pg_stop_backup with begin
> and rollback.
Presumably we will have an option to *not* wait forever? So we would be
able to set the option prior to running the base backup? So there isn't
any need to do this rollback trick suggested.
pg_start_backup() and pg_stop_backup() have two use cases:
1) ensuring both are sent through to the standby would make it very easy
to allow backups from the standby.
2) make sure we don't wait, so we can take a base backup at any time
So there's no argument here to prevent it being in a table.
-- Simon Riggs www.2ndQuadrant.comPostgreSQL Development, 24x7 Support, Training and Services