Skip to content
Snippets Groups Projects
Commit 88648e76 authored by Michael Paquier's avatar Michael Paquier
Browse files

pg_rep_state: Take into account ready_to_display for WAL receiver

This flag will be set to true only once the data of the WAL receiver can
be displayed to the user, so return NULL if this is not the case yet in
the function showing the WAL receiver status. In Postgres 10, there is
already an in-core function doing this work, perhaps I should just plug in
this module into that, or simply remove it...
parent 0ba12d68
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -154,6 +154,7 @@ pg_wal_receiver_state(PG_FUNCTION_ARGS)
TimeLineID receiveStartTLI, receivedTLI;
TimestampTz lastMsgSendTime, lastMsgReceiptTime, latestWalEndTime;
char *slotname;
bool ready_to_display;
WalRcvState walRcvState;
 
if (!superuser())
Loading
Loading
@@ -175,10 +176,11 @@ pg_wal_receiver_state(PG_FUNCTION_ARGS)
latestWalEndTime = walrcv->latestWalEndTime;
walRcvState = walrcv->walRcvState;
slotname = pstrdup(walrcv->slotname);
ready_to_display = walrcv->ready_to_display;
SpinLockRelease(&walrcv->mutex);
 
/* Leave if no WAL receiver */
if (pid == 0)
if (pid == 0 || !ready_to_display)
PG_RETURN_NULL();
 
/* Initialise values and NULL flags arrays */
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment