AutoVacuum starvation from sinval messages

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: AutoVacuum starvation from sinval messages
Date: 2012-11-08 20:36:23
Message-ID: CAMkU=1w2nsTsqu7nurg+CGPMHmfWpxs837SrK1w4yopm47WSOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While doing a rather contrived test of something else, using:

perl -le 'print "create table foo (x serial); drop table foo;"
foreach (1..1e6)'|psql

I noticed starvation of autovacuum launcher process and bloating of catalogs.

Basically the WaitLatch in autovacuum.c line 602 (in head) never returns.

This was introduced by a180776f7a1c4554f214b, "Teach unix_latch.c to
use poll() where available"

When the poll() gets EINTR by SIGUSR1 for the invalidation, it
restarts at the full timeout (60 seconds in this case) with no
accounting for the time already waited.

It does not seem outrageous to me that there would be real-world
conditions in which invalidations would be sent more than once a
minute over prolonged periods, so this total starvation seems like a
bug.

Should gettimeofday be called before and after the poll() and then the
difference deducted from timeout?

Cheers,

Jeff

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-11-08 21:13:23 Re: Proof of concept: auto updatable views [Review of Patch]
Previous Message Dean Rasheed 2012-11-08 20:29:22 Re: Proof of concept: auto updatable views [Review of Patch]