Re: Online base backup from the hot-standby

From: Jun Ishiduka <ishizuka(dot)jun(at)po(dot)ntts(dot)co(dot)jp>
To: masao(dot)fujii(at)gmail(dot)com
Cc: magnus(at)hagander(dot)net, heikki(dot)linnakangas(at)enterprisedb(dot)com, ssinger_pg(at)sympatico(dot)ca, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Online base backup from the hot-standby
Date: 2011-07-04 09:25:12
Message-ID: 201107040925.p649PIRn024250@ccmds32.silk.ntts.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> When the standby restarts after it crashes during recovery, it always
> checks whether recovery has reached the backup end location by
> using minRecoveryPoint even though the standby doesn't start from
> the backup. This looks odd.

Certainly.

But, in this case, the state before recovery starts is lost.
Therefore, postgres can not see that the backup got from whether
standby server or master.

What should?
Should use pg_control?
Ex.
* Add 'Where to get backup' to pg_control. (default 'none')
* When recovery starts, it checks it whether 'none'.
* When minRecoveryPoint equals 0/0, change 'master'.
* When minRecoveryPoint do not equals 0/0, change 'slave'.
* When it reached the end of recovery, change 'none' .

> - XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
> + (XLogRecPtrIsInvalid(ControlFile->backupStartPoint) ||
> + reachedControlMinRecoveryPoint == true))

> The flag 'reachedControlMinRecoveryPoint' is really required? When recovery
> reaches minRecoveryPoint, ControlFile->backupStartPoint is reset to zero. So
> we can check whether recovery has reached minRecoveryPoint or not by only
> doing XLogRecPtrIsInvalid(ControlFile->backupStartPoint). No?

Yes.
'reachedControlMinRecoveryPoint' is unnecessary.

> We should check if recovery has reached minRecoveryPoint before calling
> CheckRecoveryConsistency() after reading new WAL record? Otherwise,
> even if recovery has reached minRecoveryPoint, the standby cannot think
> that it's in consistent state until it reads new WAL record.

This is a same sequence with a case of backup end location.
It should be no changed.

> + if (XLByteLT(ControlFile->minRecoveryPoint, EndRecPtr))
> + ControlFile->minRecoveryPoint = EndRecPtr;

> Why does ControlFile->minRecoveryPoint need to be set to EndRecPtr?

Yes.
I delete it.

--------------------------------------------
Jun Ishizuka
NTT Software Corporation
TEL:045-317-7018
E-Mail: ishizuka(dot)jun(at)po(dot)ntts(dot)co(dot)jp
--------------------------------------------

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2011-07-04 09:28:52 Re: flex on win64 - workaround for "flex: fatal internal error, exec failed"
Previous Message Simon Riggs 2011-07-04 09:24:15 Re: Cascade replication