> 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.


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?
   * 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?

'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?

I delete it.

Jun Ishizuka
NTT Software Corporation
E-Mail: ishizuka....@po.ntts.co.jp

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to