Re: Autovacuum breakage from a734fd5d1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Autovacuum breakage from a734fd5d1
Date: 2016-11-28 02:33:59
Message-ID: 3025.1480300439@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> Thanks for digging into this. I failed to notice while reviewing that
> the way we were printing the message had changed a bit in the new
> code, and I just totally overlooked the existing locking hazards.
> Oops.

I pushed a patch to deal with this. I ended up simplifying the previous
commit considerably by getting rid of the commit-multiple-deletions-per-
transaction business. I do not think that this code will get exercised
enough, either in the field or in testing, to justify taking a risk of
additional bugs from that.

Also, another reason for not liking that is that it seems to increase the
risk of deadlock against an incoming session that's taking over the temp
schema belonging to a crashed session. The incoming backend would be
deleting the same tables in (probably) a different order, which is an
obvious deadlock hazard. I think it'd be mostly all right because the
autovac worker should lose deadlock fights, but the incoming session would
see a deadlock_timeout stall if not an error. So that's another reason to
commit immediately after each deletion.

I tested this by dint of turning RemoveTempRelationsCallback into a no-op,
so that things always acted as though sessions had crashed without
cleaning up their temp tables. The code survived quite a few regression
test cycles without visible problems, although I had to tweak rules.sql
to ignore temp views.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-11-28 02:36:07 Re: Autovacuum breakage from a734fd5d1
Previous Message Tsunakawa, Takayuki 2016-11-28 01:26:31 Re: UNDO and in-place update