Skip site navigation (1) Skip section navigation (2)

Re: Online base backup from the hot-standby

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Steve Singer <ssinger_pg(at)sympatico(dot)ca>
Cc: Jun Ishiduka <ishizuka(dot)jun(at)po(dot)ntts(dot)co(dot)jp>, magnus(at)hagander(dot)net, heikki(dot)linnakangas(at)enterprisedb(dot)com, simon(at)2ndquadrant(dot)com, pgsql-hackers(at)postgresql(dot)org, robertmhaas(at)gmail(dot)com, cedric(dot)villemain(dot)debian(at)gmail(dot)com
Subject: Re: Online base backup from the hot-standby
Date: 2012-01-13 08:02:55
Message-ID: CAHGQGwHZFVNGRm2dPsPsZa1y7EA9MyZTySj2GRbSjeNVYs8Pfw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Sorry for the delay.

2011/11/15 Steve Singer <ssinger_pg(at)sympatico(dot)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: standby_online_backup_v12.patch
Description: text/x-diff (40.2 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Dimitri FontaineDate: 2012-01-13 08:55:39
Subject: Re: ERRCODE_READ_ONLY_SQL_TRANSACTION
Previous:From: Fujii MasaoDate: 2012-01-13 07:41:06
Subject: New replication mode: write

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group