Re: Cache lookup failure for index during pg_dump - Mailing list pgsql-bugs

From Euler Taveira de Oliveira
Subject Re: Cache lookup failure for index during pg_dump
Date
Msg-id 4B7F3FEB.3070700@timbira.com
Whole thread Raw
In response to Re: Cache lookup failure for index during pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Cache lookup failure for index during pg_dump
List pgsql-bugs
Tom Lane escreveu:
> The window for this sort of thing isn't very large, because the first
> thing pg_dump does is acquire AccessShareLock on every table it intends
> to dump, and past that point it won't be possible for anyone to modify
> the table's DDL.  But it can happen.
>
I did not see it documented anywhere. Should we at least add a comment at the
top of pg_dump documenting this behavior? Attached is a proposed patch using
your own words.


--
  Euler Taveira de Oliveira
  http://www.timbira.com/
*** src/bin/pg_dump/pg_dump.c.orig    2010-02-19 23:22:56.000000000 -0200
--- src/bin/pg_dump/pg_dump.c    2010-02-19 23:43:08.000000000 -0200
***************
*** 11,16 ****
--- 11,27 ----
   *    script that reproduces the schema in terms of SQL that is understood
   *    by PostgreSQL
   *
+  *    Note that pg_dump runs in a serializable transaction, so it sees a
+  *    consistent snapshot of the database including system catalogs.
+  *    However, it relies in part on various specialized backend functions
+  *    like pg_get_indexdef(), and those things tend to run on SnapshotNow
+  *    time, ie they look at the currently committed state.  So it is
+  *    possible to get 'cache lookup failed' error if someone performs DDL
+  *    changes while a dump is happening. The window for this sort of thing
+  *    is from the beginning of the serializable transaction to
+  *    getSchemaData() (when pg_dump acquires AccessShareLock on every
+  *    table it intends to dump). It isn't very large but it can happen.
+  *
   * IDENTIFICATION
   *      $PostgreSQL$
   *

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Cache lookup failure for index during pg_dump
Next
From: Robert Haas
Date:
Subject: Re: BUG #5015: MySQL migration wizard does not start