Re: [HACKERS] Breakage with VACUUM ANALYSE + partitions - Mailing list pgsql-bugs

From Andres Freund
Subject Re: [HACKERS] Breakage with VACUUM ANALYSE + partitions
Date
Msg-id 20160411165054.r35o4fjicdg4avs7@alap3.anarazel.de
Whole thread Raw
In response to Re: Breakage with VACUUM ANALYSE + partitions  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [HACKERS] Breakage with VACUUM ANALYSE + partitions  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-bugs
On 2016-04-04 12:45:25 -0400, Robert Haas wrote:
> Well, I agree that it's pretty strange that _mdfd_getseg() makes no
> such check, but I still don't think I understand what's going on here.
> Backends shouldn't be requesting nonexistent blocks from a relation -
> higher-level safeguards, like holding AccessExclusiveLock before
> trying to complete a DROP or TRUNCATE - are supposed to prevent that.

I don't think that's really true: We write blocks back without holding
any sort of relation level locks; and thus do _mdfd_getseg() type
accesses as well.

And we're not really "requesting nonexistant blocks" - the segments are
just opened to get the associated file descriptor, and they're opened
with EXTENSION_RETURN_NULL. It turns out to be important
performance-wise to reuse fd's when triggering kernel writeback.

> If this patch is causing us to hold onto smgr references to a relation
> on which we no longer hold locks, I think that's irretrievably broken
> and should be reverted.  I really doubt this will be the only thing
> that goes wrong if you do that.

As we already have done that for writes for a long time, I'm a bit
surprised about that statement.

Greetings,

Andres Freund



pgsql-bugs by date:

Previous
From: Noah Misch
Date:
Subject: Re: BUG #14028: FATAL: cannot perform encoding conversion outside a transaction
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] Breakage with VACUUM ANALYSE + partitions