pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jesper Engman <jesper@engman.net>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #6167: pg_dump fails on table lock
Date: Thu, 18 Aug 2011 15:59:57 -0400
Message-ID: <3308.1313697597@sss.pgh.pa.us> (raw)
In-Reply-To: <CABKvdoif5unqWVduEueUHmETqx5oHNZsoW2L5dqxOp5M=XNFgg@mail.gmail.com>
References: <201108180105.p7I15VEk025312@wwwmaster.postgresql.org>
	<CA+U5nMK_7n7eRpzFsC6FMvaDCZAPa8BmGVfhpTo28sxuBjYT2g@mail.gmail.com>
	<CABKvdoif5unqWVduEueUHmETqx5oHNZsoW2L5dqxOp5M=XNFgg@mail.gmail.com>

Jesper Engman <jesper@engman.net> writes:
> I wonder if there is a small time span between when pg_dump starts and
> when all locks have been acquired that may be the problem (if a table
> is dropped during that time span). Is there such a small time of
> vulnerability?

Certainly.  pg_dump has to read pg_class to get the names of the tables,
and then try to lock each one.  If you drop a table during that window,
the lock command will fail.

The window is actually a bit longer than necessary in existing releases,
because pg_dump was doing some other stuff before it got around to
acquiring the locks.  I fixed that recently
http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=68d977a73
but that patch hasn't made it to any released versions yet.  In any case
there's still a nonzero window.

> Excluding tables from the dump is not an option - that will be an
> incomplete backup.

Um ... if you know it's a transient table, why do you care about backing
it up?

			regards, tom lane



view thread (4+ messages)

Message-ID: <3308.1313697597@sss.pgh.pa.us>
Permalink:  ../3308.1313697597@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3308.1313697597@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jesper@engman.net, simon@2ndquadrant.com
  Subject: Re: BUG #6167: pg_dump fails on table lock
  In-Reply-To: <3308.1313697597@sss.pgh.pa.us>
  References: <201108180105.p7I15VEk025312@wwwmaster.postgresql.org> <CA+U5nMK_7n7eRpzFsC6FMvaDCZAPa8BmGVfhpTo28sxuBjYT2g@mail.gmail.com> <CABKvdoif5unqWVduEueUHmETqx5oHNZsoW2L5dqxOp5M=XNFgg@mail.gmail.com> <3308.1313697597@sss.pgh.pa.us>

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

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