Re: BUG #5856: pg_attribute.attinhcount is not correct.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Naoya Anzai <anzai-naoya(at)mxu(dot)nes(dot)nec(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: BUG #5856: pg_attribute.attinhcount is not correct.
Date: 2011-04-14 01:19:47
Message-ID: BANLkTi=r=nLGo5FNxfDz3f+4MeNE=6fqcw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Sun, Apr 10, 2011 at 5:23 AM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> On Sun, Apr 10, 2011 at 07:35:53AM -0400, Robert Haas wrote:
>> On Sun, Apr 10, 2011 at 6:36 AM, Noah Misch <noah(at)leadboat(dot)com> wrote:
>> > 3. Make AlterTableCreateToastTable acquire only ShareUpdateExclusiveLock and
>> > remove the pass-usage heuristic from ATRewriteCatalogs.  For this to be valid,
>> > toast_insert_or_update() must behave reasonably in the face of a relation
>> > concurrently acquiring a TOAST table.  Since it takes reltoastrelid from the
>> > relcache, toast_insert_or_update() will not act on the change in the middle of a
>> > single call.  Even if it did, I don't see any risks.
>> >
>> > I'd lean toward #3 if someone else is also confident in its correctness.
>> > Otherwise, #1 seems like the way to go.  Preferences?  Other ideas?
>>
>> I haven't scrutinized the code but I would prefer #3 if it's viable
>> without too much of a code footprint.
>
> It's certainly compact; patch attached.

Thanks. Committed.

It occurred to me to worry that it would be quite unsafe if a TOAST
table got *removed* while holding less than AccessExclusiveLock, but
it appears we're safe enough from that; I believe it can only happen
on a table rewrite, and there's not much chance of that ever requiring
a lesser lock strength.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Fujii Masao 2011-04-14 05:25:02 Re: 9.1 doesn't start when died mid-backup
Previous Message Tom Lane 2011-04-13 23:41:55 Re: BUG #5974: UNION construct type cast gives poor error message

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-04-14 01:30:50 Re: POSIX shared memory redux
Previous Message A.M. 2011-04-14 01:11:43 Re: POSIX shared memory redux