Re: BUG #3245: PANIC: failed to re-find shared loc k o b j ect

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Dorochevsky, Michel" <michel(dot)dorochevsky(at)softcon(dot)de>, pgsql-bugs(at)postgresql(dot)org, Dave Page <dpage(at)postgresql(dot)org>
Subject: Re: BUG #3245: PANIC: failed to re-find shared loc k o b j ect
Date: 2007-04-24 11:51:34
Message-ID: 462DEF46.9000302@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-patches

Tom Lane wrote:
> It looks to me like the problem is that AtPrepare_Locks invokes
> LockTagIsTemp, and that goes and reads various system catalogs, which
> can result in new entries in the LOCALLOCK hash table, which might
> result in a bucket split in same, which would result in some entries
> possibly being scanned twice by the hash_seq_search scan.
>
> Not sure about good fix, except that AtPrepare is probably a really
> bad time to be doing fresh catalog searches.

Yep.

A simple fix would be to do the scan in two phases, searching for temp
tables in the first phase, and writing the 2PC records in the second.
We'd still be doing the catalog searches in the 1st phase, and might
therefore split buckets and see some entries twice, but it wouldn't lead
to duplicate 2PC records.

> Also, we have a generic issue that making fresh entries in a hashtable
> might result in a concurrent hash_seq_search scan visiting existing
> entries more than once; that's definitely not something any of the
> existing callers are thinking about.

Ouch. Note that we can also miss some entries altogether, which is
probably even worse.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Magnus Hagander 2007-04-24 12:26:02 Re: BUG #3242: FATAL: could not unlock semaphore: error code 298
Previous Message Simon K 2007-04-24 09:56:06 BUG #3250: Different ResultSets btw JDBC Driver and pgAdmin3

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2007-04-24 12:26:02 Re: BUG #3242: FATAL: could not unlock semaphore: error code 298
Previous Message Marko Kreen 2007-04-24 10:49:56 Re: Fragmentation project

Browse pgsql-patches by date

  From Date Subject
Next Message Heikki Linnakangas 2007-04-24 12:50:17 Re: BUG #3245: PANIC: failed to re-find shared loc k o b j ect
Previous Message Zeugswetter Andreas ADI SD 2007-04-24 08:08:44 Re: [HACKERS] Full page writes improvement, code update