From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Autovacuum improvements |
Date: | 2007-01-15 15:27:24 |
Message-ID: | 15470.1168874844@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> I'm cooking a patch for this which seems pretty reasonable, but I'm
> having a problem: what mechanism do we have for waiting until a process
> exits?
None, and I think you probably don't want to sit on the database lock
while waiting, either. I was envisioning a simple sleep loop, viz
for(;;)
{
acquire database lock;
foreach(PGPROC entry in that database)
{
if (it's autovac)
send sigint;
else
fail;
}
if (found any autovacs)
{
release database lock;
sleep(100ms or so);
/* loop back and try again */
}
else
break;
}
Also see Peter's nearby suggestion that we ought to wait instead of fail
for *all* cases of somebody attached to the database. This would adapt
readily enough to that.
I was complaining elsewhere that I didn't want to use a sleep loop
for fixing the fsync-synchronization issue, but CREATE/DROP DATABASE
seems a much heavier-weight operation, so I don't feel that a sleep
is inappropriate here.
> Maybe make autovacuum acquire an LWLock at start, which it then
> keeps until it's gone, but it seems wasteful to have a lwlock just for
> that purpose.
And it doesn't scale to multiple autovacs anyway, much less the wait-for-
everybody variant.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2007-01-15 16:07:30 | Re: Autovacuum Improvements |
Previous Message | Andrew Dunstan | 2007-01-15 15:21:39 | Re: [PATCHES] [HACKERS] [Fwd: Index Advisor] |
From | Date | Subject | |
---|---|---|---|
Next Message | Gurjeet Singh | 2007-01-15 16:58:32 | Re: [PATCHES] [HACKERS] [Fwd: Index Advisor] |
Previous Message | Andrew Dunstan | 2007-01-15 15:21:39 | Re: [PATCHES] [HACKERS] [Fwd: Index Advisor] |