Re: pg_stat_replication in 9.3 - Mailing list pgsql-general

From Torsten Förtsch
Subject Re: pg_stat_replication in 9.3
Date
Msg-id 5415FEED.9000000@gmx.net
Whole thread Raw
In response to Re: pg_stat_replication in 9.3  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 14/09/14 18:55, Tom Lane wrote:
> Are you watching the state in a loop inside a single plpgsql function?
> If so, I wonder whether the problem is that the plpgsql function's
> snapshot isn't changing.  From memory, marking the function VOLATILE
> would help if that's the issue.

The function is VOLATILE. I attached 2 versions of it. fn-old.sql does
not work because once a slave has disconnected it drops out and does not
come back. fn.sql uses dblink to work around the problem. But it
consumes 2 db connections.

The intent of the function is to be called between operations that may
cause slaves to lag behind. If the lag is below a certain limit, it
simply returns. Otherwise, it waits until the lag drops below a second
limit.

If it were a VOLATILE problem, the functions would not be able to see
when a slave drops out nor changes in the data. But it does see these
changes. Only when a slave comes back online, it is not seen in the
current transaction.

Torsten

Attachment

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_stat_replication in 9.3
Next
From: cowwoc
Date:
Subject: Feature request: temporary schemas