Re: tuple concurrently updated

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Curt Sampson <cjs(at)cynic(dot)net>
Cc: "Kangmo, Kim" <ilvsusie(at)hanafos(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: tuple concurrently updated
Date: 2002-07-28 16:32:36
Message-ID: 11307.1027873956@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Curt Sampson <cjs(at)cynic(dot)net> writes:
> On Thu, 25 Jul 2002, Tom Lane wrote:
>> "Kangmo, Kim" <ilvsusie(at)hanafos(dot)com> writes:
> If the index on the same class,
> two concurrent CREATE INDEX command can update pg_class.relpages
> at the same time.
>>
>> Or try to, anyway. The problem here is that the code that updates
>> system catalogs is not prepared to cope with concurrent updates
>> to the same tuple.

> I see. So the error is basically harmless, and can be rectified anyway
> with an ANALYZE, right?

Other than the fact that the second CREATE INDEX fails and rolls back,
there's no problem ;-)

I was thinking that it might help to have UpdateStats not try to update
the pg_class tuple if the correct value is already present. This will
just narrow the window for failure, not eliminate it; but it'd be a
simple change and would probably help some. Another thing to look at
is merging that routine with setRelhasindex so that a CREATE INDEX
involves only one update to the table's pg_class row, not two.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Curt Sampson 2002-07-28 16:39:09 Re: tuple concurrently updated
Previous Message Peter Eisentraut 2002-07-28 15:21:31 Re: [PATCHES] prepareable statements