Promoting a standby during base backup (was Re: Switching timeline over streaming replication)

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Amit Kapila <amit(dot)kapila(at)huawei(dot)com>
Cc: 'PostgreSQL-development' <pgsql-hackers(at)postgreSQL(dot)org>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Subject: Promoting a standby during base backup (was Re: Switching timeline over streaming replication)
Date: 2012-10-04 07:59:54
Message-ID: 506D41FA.4020003@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03.10.2012 18:15, Amit Kapila wrote:
> On Tuesday, October 02, 2012 4:21 PM Heikki Linnakangas wrote:
>> Hmm, should a base backup be aborted when the standby is promoted? Does
>> the promotion render the backup corrupt?
>
> I think currently it does so. Pls refer
> 1.
> do_pg_stop_backup(char *labelfile, bool waitforarchive)
> {
> ..
> if (strcmp(backupfrom, "standby") == 0&& !backup_started_in_recovery)
> ereport(ERROR,
>
> (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> errmsg("the standby was promoted during
> online backup"),
> errhint("This means that the backup being
> taken is corrupt "
> "and should not be used. "
> "Try taking another online
> backup.")));
> ..
>
> }

Okay. I think that check in do_pg_stop_backup() actually already ensures
that you don't end up with a corrupt backup, even if the standby is
promoted while a backup is being taken. Admittedly it would be nicer to
abort it immediately rather than error out at the end.

But I wonder why promoting a standby renders the backup invalid in the
first place? Fujii, Simon, can you explain that?

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit kapila 2012-10-04 10:12:30 Re: BUG #7534: walreceiver takes long time to detect n/w breakdown
Previous Message Heikki Linnakangas 2012-10-04 07:24:19 Re: Re: [WIP] Performance Improvement by reducing WAL for Update Operation