Re: Function and view to retrieve WAL receiver status

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>, Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Function and view to retrieve WAL receiver status
Date: 2016-01-06 06:04:02
Message-ID: CAB7nPqT=W_Tqeydko-R+WJwAkOyiHN85nLeboVYbJp4M128Kfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 6, 2016 at 8:14 AM, Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com> wrote:
> Following are my observations on the latest patch.

Thanks for your review.

> + If no WAL receiver is present on the server queried,
> + a single tuple filled with <literal>NULL</> values is returned instead.
> + </para>
>
> The above documentation change is not required if we change the system
> view.

Affirmative.

> + s.received_up_to_lsn,
>
> The column name can be changed as "received_lsn" similar to "received_tli".
> up_to may not be required.
>
> + XLogRecPtr received_up_lsn;
> + TimeLineID received_up_tli;
>
> same as like above comment.

Indeed, let's make the variable names more simple and consistent by
removing this _up_ portion everywhere.

> + /* lock? */
>
> I find out that walrcv data is updated only under mutex. it is better
> to take that mutex to provide a consistent snapshot data to user.

The lock is taken, the comment is just incorrect:
+ /* lock? */
+ SpinLockAcquire(&walrcv->mutex);
[...]
+ SpinLockRelease(&walrcv->mutex);

I also found out that the description of those fields was not clear
enough actually: received_tli and received _lsn are related to what
has been received *and* flushed to disk, with an initial value being
their start equivalent. This deserves a clear description with all
those things addressed.

Attached is an updated patch.
--
Michael

Attachment Content-Type Size
wal_receiver_view_v2.patch application/x-patch 14.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sudhir Lonkar-2 2016-01-06 06:21:14 Re: [PROPOSAL] VACUUM Progress Checker.
Previous Message Haribabu Kommi 2016-01-06 04:07:01 Re: Multi-tenancy with RLS