Re: How to reliably detect if it's a promoting standby - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: How to reliably detect if it's a promoting standby
Date
Msg-id 20101020.233201.856152966586118390.t-ishii@sraoss.co.jp
Whole thread Raw
In response to Re: How to reliably detect if it's a promoting standby  (Tatsuo Ishii <ishii@sraoss.co.jp>)
Responses Re: How to reliably detect if it's a promoting standby
List pgsql-hackers
>> pg_is_in_recovery() returns a bool, are you proposing to change that?
> 
> No. I just thought about adding more condition when it returns true.

Here is the patch. Comments are welcome!

*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 5604,5610 **** GetLatestXTime(void) Datum pg_is_in_recovery(PG_FUNCTION_ARGS) {
!     PG_RETURN_BOOL(RecoveryInProgress()); }  /*
--- 5604,5613 ---- Datum pg_is_in_recovery(PG_FUNCTION_ARGS) {
!     /* use volatile pointer to prevent code rearrangement */
!     volatile WalRcvData *walrcv = WalRcv;
! 
!     PG_RETURN_BOOL(RecoveryInProgress() && walrcv->walRcvState == WALRCV_RUNNING); }  /*


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_rawdump
Next
From: Tom Lane
Date:
Subject: Re: Extensions, this time with a patch