pg_stats_recovery view

Lists: pgsql-hackers
From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_stats_recovery view
Date: 2012-01-15 07:50:00
Message-ID: CAJKUy5jkCT_xUOVF0Tqd_ofYSuiWjC7dFMxVB+D_wbw5HxKYJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

Attached is a patch thats implements a pg_stat_recovery view that
keeps counters about processed wal records. I just notice that it
still lacks documentation but i will add it during the week.

Because it tracks redo time this introduces to GetCurrentTimestamp()
calls to the redo main loop, so i add a track_recovery GUC so only the
people that wants the view has to spent time in those calls.

Probably the most controversial part of the patch will be the addition
of a new column in RmgrData that is a pointer to a new function for
*_short_desc() these functions are similar to the *_desc functions
that already exists and that is called via rm_desc but instead of
giving full details about the record being processed it just inform of
the type of the record, for example the 2 first columns will look
something like:

rmgr: XLOG
wal_record_type: xlog switch

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación

Attachment Content-Type Size
stats_recovery.v1.patch text/x-patch 58.0 KB

From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-01-26 09:03:06
Message-ID: F6CCF53DFEC00FDA8C186B18@apophis.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

--On 15. Januar 2012 02:50:00 -0500 Jaime Casanova <jaime(at)2ndquadrant(dot)com>
wrote:

> Attached is a patch thats implements a pg_stat_recovery view that
> keeps counters about processed wal records. I just notice that it
> still lacks documentation but i will add it during the week.

Hi Jaime,

do you have an updated patch? The current v1 patch doesn't apply cleanly
anymore, and before i go and rebase the patch i thought i'm asking...

--
Thanks

Bernd


From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Bernd Helmle <mailings(at)oopsware(dot)de>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-01-26 21:01:58
Message-ID: CAJKUy5j30qvQp478Rue3i_YO5i5gp3o_YK_X2EyW1oZ8YV4ipw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jan 26, 2012 at 4:03 AM, Bernd Helmle <mailings(at)oopsware(dot)de> wrote:
>
>
> --On 15. Januar 2012 02:50:00 -0500 Jaime Casanova <jaime(at)2ndquadrant(dot)com>
> wrote:
>
>> Attached is a patch thats implements a pg_stat_recovery view that
>> keeps counters about processed wal records. I just notice that it
>> still lacks documentation but i will add it during the week.
>
>
> Hi Jaime,
>
> do you have an updated patch? The current v1 patch doesn't apply cleanly
> anymore, and before i go and rebase the patch i thought i'm asking...
>

here's the patch rebased to this morning's HEAD

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación

Attachment Content-Type Size
stats_recovery.v1.rebased.patch text/x-patch 57.2 KB

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-02-02 02:18:08
Message-ID: CAHGQGwG9WFnOMbQ8pa81BN4CQinKgsmVN4TjtH-_aXGiV0X5CQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jan 27, 2012 at 6:01 AM, Jaime Casanova <jaime(at)2ndquadrant(dot)com> wrote:
> On Thu, Jan 26, 2012 at 4:03 AM, Bernd Helmle <mailings(at)oopsware(dot)de> wrote:
>>
>>
>> --On 15. Januar 2012 02:50:00 -0500 Jaime Casanova <jaime(at)2ndquadrant(dot)com>
>> wrote:
>>
>>> Attached is a patch thats implements a pg_stat_recovery view that
>>> keeps counters about processed wal records. I just notice that it
>>> still lacks documentation but i will add it during the week.
>>
>>
>> Hi Jaime,
>>
>> do you have an updated patch? The current v1 patch doesn't apply cleanly
>> anymore, and before i go and rebase the patch i thought i'm asking...
>>
>
> here's the patch rebased to this morning's HEAD

Before reviewing the patch, I'd like to know: what's the purpose of this view?
It's only debug purpose? ISTM that most users don't care about this view at all.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-02-02 07:26:26
Message-ID: CAJKUy5inYZPcOeRy1TgdRiFPonQ-_Xcv90qnHtcJ8PE9q5StBg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Feb 1, 2012 at 9:18 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>>
>>> --On 15. Januar 2012 02:50:00 -0500 Jaime Casanova <jaime(at)2ndquadrant(dot)com>
>>> wrote:
>>>
>>>> Attached is a patch thats implements a pg_stat_recovery view that
>>>> keeps counters about processed wal records. I just notice that it
>>>> still lacks documentation but i will add it during the week.
>>>
>>>
>
> Before reviewing the patch, I'd like to know: what's the purpose of this view?
> It's only debug purpose? ISTM that most users don't care about this view at all.
>

yeah! you're right. most users won't care about it... did i tell that
i added a track_recovery GUC so only users that wanted pay for it? i
probably did not tell that :D

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-02-02 07:32:46
Message-ID: CABUevEyfUgjkr+6f7Xf+rijLw6_GS_TGkvhiy=d-qaQ4NSzVMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Feb 2, 2012 at 08:26, Jaime Casanova <jaime(at)2ndquadrant(dot)com> wrote:
> On Wed, Feb 1, 2012 at 9:18 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>>>
>>>> --On 15. Januar 2012 02:50:00 -0500 Jaime Casanova <jaime(at)2ndquadrant(dot)com>
>>>> wrote:
>>>>
>>>>> Attached is a patch thats implements a pg_stat_recovery view that
>>>>> keeps counters about processed wal records. I just notice that it
>>>>> still lacks documentation but i will add it during the week.
>>>>
>>>>
>>
>> Before reviewing the patch, I'd like to know: what's the purpose of this view?
>> It's only debug purpose? ISTM that most users don't care about this view at all.
>>
>
> yeah! you're right. most users won't care about it... did i tell that
> i added a track_recovery GUC so only users that wanted pay for it? i
> probably did not tell that :D

I haven't looked through the code in detail, but one direct comment:
do we really need/want to send this through the stats collector? It
will only ever have one sender - perhaps we should just either store
it in shared memory or store it locally and only send it on demand?

(apologies if it already does the on-demand thing, I only spent about
30 seconds looking for it and noticed it did go through the stats
collector...)

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-02-02 08:12:11
Message-ID: CAHGQGwFhXiJoAOGw+RKVR5yjv_t+i4KD+fhVqhSob6ZnGX-kEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Feb 2, 2012 at 4:26 PM, Jaime Casanova <jaime(at)2ndquadrant(dot)com> wrote:
> On Wed, Feb 1, 2012 at 9:18 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>>>
>>>> --On 15. Januar 2012 02:50:00 -0500 Jaime Casanova <jaime(at)2ndquadrant(dot)com>
>>>> wrote:
>>>>
>>>>> Attached is a patch thats implements a pg_stat_recovery view that
>>>>> keeps counters about processed wal records. I just notice that it
>>>>> still lacks documentation but i will add it during the week.
>>>>
>>>>
>>
>> Before reviewing the patch, I'd like to know: what's the purpose of this view?
>> It's only debug purpose? ISTM that most users don't care about this view at all.
>>
>
> yeah! you're right. most users won't care about it... did i tell that
> i added a track_recovery GUC so only users that wanted pay for it? i
> probably did not tell that :D

If only core developer is interested in this view, ISTM that short
description for
each WAL record is not required because he or she can know the meaning of each
WAL record by reading the source code. No? Adding short descriptions for every
WAL records seems to be overkill.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Jaime Casanova <jaime(at)2ndquadrant(dot)com>, Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-02-02 08:24:55
Message-ID: CAHGQGwHGTs+nd_My1irEeiNmoFxpZ9ecmxyepzhbGMEZvi90Aw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Feb 2, 2012 at 4:32 PM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> On Thu, Feb 2, 2012 at 08:26, Jaime Casanova <jaime(at)2ndquadrant(dot)com> wrote:
>> On Wed, Feb 1, 2012 at 9:18 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>>>>
>>>>> --On 15. Januar 2012 02:50:00 -0500 Jaime Casanova <jaime(at)2ndquadrant(dot)com>
>>>>> wrote:
>>>>>
>>>>>> Attached is a patch thats implements a pg_stat_recovery view that
>>>>>> keeps counters about processed wal records. I just notice that it
>>>>>> still lacks documentation but i will add it during the week.
>>>>>
>>>>>
>>>
>>> Before reviewing the patch, I'd like to know: what's the purpose of this view?
>>> It's only debug purpose? ISTM that most users don't care about this view at all.
>>>
>>
>> yeah! you're right. most users won't care about it... did i tell that
>> i added a track_recovery GUC so only users that wanted pay for it? i
>> probably did not tell that :D
>
> I haven't looked through the code in detail, but one direct comment:
> do we really need/want to send this through the stats collector? It
> will only ever have one sender - perhaps we should just either store
> it in shared memory or store it locally and only send it on demand?

Agreed. I think we should either.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-02-02 21:08:35
Message-ID: 1CF2DED1B9CCC3579917EB9E@apophis.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

--On 2. Februar 2012 17:12:11 +0900 Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:

> If only core developer is interested in this view, ISTM that short
> description for
> each WAL record is not required because he or she can know the meaning of each
> WAL record by reading the source code. No? Adding short descriptions for every
> WAL records seems to be overkill.

Yes, for a developer option alone adding all these *_short_desc functions looks
too much code for too less benefit. However, if someone with less code affinity
is interested to debug his server during recovery, it might be easier for him
to interpret the statistic counters.

Unfortunately i didn't manage to do it this week, but what i'm also interested
in is how large the performance regression is if the track_recovery variable is
activated. Not sure wether it really makes a big difference, but maybe
debugging recovery from a large archive could slow down to a degree, where you
want the GUC but can't afford it?

And, for display purposes, when this is intended for developers only, shouldn't
it be treated like all the other debug options as a DEVELOPER_OPTION, too?

--
Thanks

Bernd


From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-02-14 07:10:58
Message-ID: CAJKUy5i05BKO=yPtCNFKiNwEe6WnYihkpBFH1+dAvXuYbhXagw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Feb 2, 2012 at 2:32 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>
> I haven't looked through the code in detail, but one direct comment:
> do we really need/want to send this through the stats collector? It
> will only ever have one sender - perhaps we should just either store
> it in shared memory or store it locally and only send it on demand?
>

fyi, i intend to send a reworked patch later today, it will store the
info locally and send it on demand.
about the _short_desc functions, i added that because i wanted to
understand what was happening during recovery and the wal_record_type
(xl_info) being a number is not that clear

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Bernd Helmle <mailings(at)oopsware(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-02-14 11:40:35
Message-ID: 1329219548-sup-6185@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Excerpts from Jaime Casanova's message of mar feb 14 04:10:58 -0300 2012:
> On Thu, Feb 2, 2012 at 2:32 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> >
> > I haven't looked through the code in detail, but one direct comment:
> > do we really need/want to send this through the stats collector? It
> > will only ever have one sender - perhaps we should just either store
> > it in shared memory or store it locally and only send it on demand?
> >
>
> fyi, i intend to send a reworked patch later today, it will store the
> info locally and send it on demand.
> about the _short_desc functions, i added that because i wanted to
> understand what was happening during recovery and the wal_record_type
> (xl_info) being a number is not that clear

Maybe it'd be clearer if you display it in hex and filter out just the
bits that are interesting for this use? IIRC xl_info carries some other
bits than the ones to identify the record type, which could be
confusing.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-03-09 12:20:33
Message-ID: CAHGQGwHHtvSgtTkxN=e+ZgqhnFt8tdMcW1WuWwhs_VwxEX0Vbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Feb 14, 2012 at 4:10 PM, Jaime Casanova <jaime(at)2ndquadrant(dot)com> wrote:
> On Thu, Feb 2, 2012 at 2:32 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>>
>> I haven't looked through the code in detail, but one direct comment:
>> do we really need/want to send this through the stats collector? It
>> will only ever have one sender - perhaps we should just either store
>> it in shared memory or store it locally and only send it on demand?
>>
>
> fyi, i intend to send a reworked patch later today, it will store the
> info locally and send it on demand.

Jaime,
are you planning to submit the updated version of the patch?

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Jaime Casanova <jaime(at)2ndquadrant(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stats_recovery view
Date: 2012-03-15 22:17:04
Message-ID: CA+TgmobqmDUr-JpSB=Es8FHPtn=Z4mjNhKAEDG6nPjp_n66qZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Mar 9, 2012 at 7:20 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> On Tue, Feb 14, 2012 at 4:10 PM, Jaime Casanova <jaime(at)2ndquadrant(dot)com> wrote:
>> On Thu, Feb 2, 2012 at 2:32 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>>>
>>> I haven't looked through the code in detail, but one direct comment:
>>> do we really need/want to send this through the stats collector? It
>>> will only ever have one sender - perhaps we should just either store
>>> it in shared memory or store it locally and only send it on demand?
>>>
>>
>> fyi, i intend to send a reworked patch later today, it will store the
>> info locally and send it on demand.
>
> Jaime,
> are you planning to submit the updated version of the patch?

Hearing no response, I have marked this patch Returned with Feedback.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company