agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix unsafe order of operations in foreign-table DDL commands.
Date: Sun, 14 Aug 2011 19:41:00 +0000
Message-ID: <E1QsgYO-0005S3-OZ@gemulon.postgresql.org> (raw)

Fix unsafe order of operations in foreign-table DDL commands.

When updating or deleting a system catalog tuple, it's necessary to acquire
RowExclusiveLock on the catalog before looking up the tuple; otherwise a
concurrent VACUUM FULL on the catalog might move the tuple to a different
TID before we can apply the update.  Coding patterns that find the tuple
via a table scan aren't at risk here, but when obtaining the tuple from a
catalog cache, correct ordering is important; and several routines in
foreigncmds.c got it wrong.  Noted while running the regression tests in
parallel with VACUUM FULL of assorted system catalogs.

For consistency I moved all the heap_open calls to the starts of their
functions, including a couple for which there was no actual bug.

Back-patch to 8.4 where foreigncmds.c was added.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/148f321eb4fe9030378ad21ba1be132084a9ab8f

Modified Files
--------------
src/backend/commands/foreigncmds.c |   39 ++++++++++++++++-------------------
1 files changed, 18 insertions(+), 21 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1QsgYO-0005S3-OZ@gemulon.postgresql.org>
Permalink:  ../E1QsgYO-0005S3-OZ@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1QsgYO-0005S3-OZ@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix unsafe order of operations in foreign-table DDL commands.
  In-Reply-To: <E1QsgYO-0005S3-OZ@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox