Re: Autovacuum breakage from a734fd5d1 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Autovacuum breakage from a734fd5d1
Date
Msg-id 3025.1480300439@sss.pgh.pa.us
Whole thread Raw
In response to Re: Autovacuum breakage from a734fd5d1  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Autovacuum breakage from a734fd5d1  (Michael Paquier <michael.paquier@gmail.com>)
Re: Autovacuum breakage from a734fd5d1  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.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



pgsql-hackers by date:

Previous
From: "Tsunakawa, Takayuki"
Date:
Subject: Re: UNDO and in-place update
Next
From: Michael Paquier
Date:
Subject: Re: Autovacuum breakage from a734fd5d1