Skip site navigation (1) Skip section navigation (2)

pgsql: Fix dynahash.c to suppress hash bucket splits while a

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix dynahash.c to suppress hash bucket splits while a
Date: 2007-04-26 23:25:48
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committers
Log Message:
Fix dynahash.c to suppress hash bucket splits while a hash_seq_search() scan
is in progress on the same hashtable.  This seems the least invasive way to
fix the recently-recognized problem that a split could cause the scan to
visit entries twice or (with much lower probability) miss them entirely.
The only field-reported problem caused by this is the "failed to re-find
shared lock object" PANIC in COMMIT PREPARED reported by Michel Dorochevsky,
which was caused by multiply visited entries.  However, it seems certain
that mdsync() is vulnerable to missing required fsync's due to missed
entries, and I am fearful that RelationCacheInitializePhase2() might be at
risk as well.  Because of that and the generalized hazard presented by this
bug, back-patch all the supported branches.

Along the way, fix pg_prepared_statement() and pg_cursor() to not assume
that the hashtables they are examining will stay static between calls.
This is risky regardless of the newly noted dynahash problem, because
hash_seq_search() has never promised to cope with deletion of table entries
other than the just-returned one.  There may be no bug here because the only
supported way to call these functions is via ExecMakeTableFunctionResult()
which will cycle them to completion before doing anything very interesting,
but it seems best to get rid of the assumption.  This affects 8.2 and HEAD
only, since those functions weren't there earlier.


Modified Files:
        xact.c (r1.135.2.3 -> r1.135.2.4)
        dynahash.c (r1.45 -> r1.45.2.1)
        hsearch.h (r1.27 -> r1.27.2.1)

pgsql-committers by date

Next:From: Bruce MomjianDate: 2007-04-27 00:22:01
Subject: Re: Re: [HACKERS] [COMMITTERS] pgsql: Add GUC temp_tablespaces to provide a default location for
Previous:From: Tom LaneDate: 2007-04-26 23:25:41
Subject: pgsql: Fix dynahash.c to suppress hash bucket splits while a

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group