Is autovacuum doing a wraparound-avoiding VACUUM?

Lists: pgsql-patches
From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: List pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Is autovacuum doing a wraparound-avoiding VACUUM?
Date: 2008-07-16 16:55:39
Message-ID: 1216227339.19656.364.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Is autovacuum doing a wraparound-avoiding VACUUM?
Currently, no easy way to tell.

Patch to change message of autovac in pg_stat_activity when we are
performing an anti-wraparound VACUUM.

We will then be able to explain why an autovacuum process doesn't get
cancelled, like we might otherwise hope it would be.

That way we can tell difference between hung and just important.

Perhaps message should say "non-automatically cancelled VACUUM
<tablename>", but that sounded more obscure than the phrase I selected.

Discuss...

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

Attachment Content-Type Size
wraparound_msg.v1.patch text/x-patch 2.8 KB

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: List pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Is autovacuum doing a wraparound-avoiding VACUUM?
Date: 2008-07-17 21:10:44
Message-ID: 20080717211044.GR3934@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Simon Riggs wrote:
>
> Is autovacuum doing a wraparound-avoiding VACUUM?
> Currently, no easy way to tell.
>
> Patch to change message of autovac in pg_stat_activity when we are
> performing an anti-wraparound VACUUM.

I just obsoleted this patch. The new patch should be easier to do
though -- just a one line change I think.

I don't like your wording though; it feels too verbose (and you're
losing the ANALYZE in case it's doing both things). How about

snprintf(activity, MAX_AUTOVAC_ACTIV_LEN,
"autovacuum: VACUUM%s%s", vac
tab->at_doanalyze ? " ANALYZE" : "",
tab->at_wraparound ? " (wraparound)" : "");

You're not proposing it for 8.3 right?

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: List pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Is autovacuum doing a wraparound-avoiding VACUUM?
Date: 2008-07-17 23:02:09
Message-ID: 1216335729.19656.683.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


On Thu, 2008-07-17 at 17:10 -0400, Alvaro Herrera wrote:
> Simon Riggs wrote:
> >
> > Is autovacuum doing a wraparound-avoiding VACUUM?
> > Currently, no easy way to tell.
> >
> > Patch to change message of autovac in pg_stat_activity when we are
> > performing an anti-wraparound VACUUM.
>
> I just obsoleted this patch. The new patch should be easier to do
> though -- just a one line change I think.
>
> I don't like your wording though; it feels too verbose (and you're
> losing the ANALYZE in case it's doing both things). How about
>
> snprintf(activity, MAX_AUTOVAC_ACTIV_LEN,
> "autovacuum: VACUUM%s%s", vac
> tab->at_doanalyze ? " ANALYZE" : "",
> tab->at_wraparound ? " (wraparound)" : "");

Yes, looks good.

Losing the ANALYZE was conscious, but in retrospect is something we
might live to regret. Yours is better.

> You're not proposing it for 8.3 right?

I think I am. It's an important diagnostic for your other fix.

We need to be able to tell the difference between a wraparound and other
weird situations.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, List pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Is autovacuum doing a wraparound-avoiding VACUUM?
Date: 2008-07-18 05:44:38
Message-ID: 10642.1216359878@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
> On Thu, 2008-07-17 at 17:10 -0400, Alvaro Herrera wrote:
>> I don't like your wording though; it feels too verbose (and you're
>> losing the ANALYZE in case it's doing both things). How about
>>
>> snprintf(activity, MAX_AUTOVAC_ACTIV_LEN,
>> "autovacuum: VACUUM%s%s", vac
>> tab->at_doanalyze ? " ANALYZE" : "",
>> tab->at_wraparound ? " (wraparound)" : "");

> Yes, looks good.

May I suggest "(to prevent wraparound)" or something like that?
Otherwise, +1.

>> You're not proposing it for 8.3 right?

> I think I am. It's an important diagnostic for your other fix.

I agree, this is important for visibility into what's happening.
The string isn't getting translated so I don't see any big downside
to applying the patch in back branches.

regards, tom lane


From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, List pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Is autovacuum doing a wraparound-avoiding VACUUM?
Date: 2008-07-19 08:04:08
Message-ID: 1216454648.19656.798.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


On Fri, 2008-07-18 at 01:44 -0400, Tom Lane wrote:
> Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
> > On Thu, 2008-07-17 at 17:10 -0400, Alvaro Herrera wrote:
> >> I don't like your wording though; it feels too verbose (and you're
> >> losing the ANALYZE in case it's doing both things). How about
> >>
> >> snprintf(activity, MAX_AUTOVAC_ACTIV_LEN,
> >> "autovacuum: VACUUM%s%s", vac
> >> tab->at_doanalyze ? " ANALYZE" : "",
> >> tab->at_wraparound ? " (wraparound)" : "");
>
> > Yes, looks good.
>
> May I suggest "(to prevent wraparound)" or something like that?
> Otherwise, +1.
>
> >> You're not proposing it for 8.3 right?
>
> > I think I am. It's an important diagnostic for your other fix.
>
> I agree, this is important for visibility into what's happening.
> The string isn't getting translated so I don't see any big downside
> to applying the patch in back branches.

Patches for 8.3 and CVS HEAD.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

Attachment Content-Type Size
wraparound_msg.v2.CVS_HEAD.patch text/x-patch 1.0 KB
wraparound_msg.v2.REL8_3_STABLE.patch text/x-patch 2.8 KB

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, List pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Is autovacuum doing a wraparound-avoiding VACUUM?
Date: 2008-07-21 15:28:30
Message-ID: 20080721152830.GF5842@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Simon Riggs wrote:

> On Fri, 2008-07-18 at 01:44 -0400, Tom Lane wrote:
> > I agree, this is important for visibility into what's happening.
> > The string isn't getting translated so I don't see any big downside
> > to applying the patch in back branches.
>
> Patches for 8.3 and CVS HEAD.

Applied, thanks.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.