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 CAHGQGwHZFVNGRm2dPsPsZa1y7EA9MyZTySj2GRbSjeNVYs8Pfw@mail.gmail.com
Whole thread Raw
In response to Re: Online base backup from the hot-standby  (Steve Singer <ssinger_pg@sympatico.ca>)
Responses Re: Online base backup from the hot-standby  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
Sorry for the delay.

2011/11/15 Steve Singer <ssinger_pg@sympatico.ca>:
> Here is my stab at reviewing this version of this version of the patch.

Thanks for the review!

> This version of the patch is NOT intended to allow SQL calls to
> pg_start_backup() on slaves to work.   This patch lays the infrastructure
> for another patch (which I haven't seen) to allow pg_basebackup to do a base
> backup from a slave assuming fpw=on has been set on the master (my
> understanding of this patch is that it puts into place all of the pieces
> required for the pg_basebackup patch to detect if fpw!=on and abort).

The amount of code changes to allow pg_basebackup to make a backup from
the standby seems to be small. So I ended up merging that changes and the
infrastructure patch. WIP patch attached. But I'd happy to split the patch again
if you want.

> In pg_ctl.c
>
> !             if (stat(recovery_file, &statbuf) != 0)
> !                 print_msg(_("WARNING: online backup mode is active\n"
> !                             "Shutdown will not complete until
> pg_stop_backup() is called.\n\n"));
> !             else
> !                 print_msg(_("WARNING: online backup mode is active if you
> can connect as a superuser to server\n"
> !                             "If so, shutdown will not complete until
> pg_stop_backup() is called.\n\n"));
>
> I am having difficulty understanding what this error message is trying to
> tell me.   I think it is telling me (based on the code comments) that if I
> can't connect to the server because the server is not yet accepting
> connections then I shouldn't worry about anything.   However if the server
> is accepting connections then I need to login and call pg_stop_backup().
>
> Maybe
> "WARNING:  online backup mode is active.  If your server is accepting
> connections then you must connect as superuser and run pg_stop_backup()
> before shutdown will complete"

The reason why the above change of pg_ctl.c was required is that new
backup_label can be created by standby-only backup during recovery.
But, now, we decided to disallow pg_start_backup() and pg_stop_backup()
to be called during recovery again, and allow only pg_basebackup to make
a base backup from the standby, which means that backup_label will not be
created during recovery. So the above change of pg_ctl.c has not been
required now. I excluded that change from the patch.

Regards,

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

Attachment

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: New replication mode: write
Next
From: Dimitri Fontaine
Date:
Subject: Re: ERRCODE_READ_ONLY_SQL_TRANSACTION