pgsql: Make pg_dump emit more accurate dependency information.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make pg_dump emit more accurate dependency information.
Date: 2012-06-26 01:21:37
Message-ID: E1SjKTJ-0003be-8i@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make pg_dump emit more accurate dependency information.

While pg_dump has included dependency information in archive-format output
ever since 7.3, it never made any large effort to ensure that that
information was actually useful. In particular, in common situations where
dependency chains include objects that aren't separately emitted in the
dump, the dependencies shown for objects that were emitted would reference
the dump IDs of these un-dumped objects, leaving no clue about which other
objects the visible objects indirectly depend on. So far, parallel
pg_restore has managed to avoid tripping over this misfeature, but only
by dint of some crude hacks like not trusting dependency information in
the pre-data section of the archive.

It seems prudent to do something about this before it rises up to bite us,
so instead of emitting the "raw" dependencies of each dumped object,
recursively search for its actual dependencies among the subset of objects
that are being dumped.

Back-patch to 9.2, since that code hasn't yet diverged materially from
HEAD. At some point we might need to back-patch further, but right now
there are no known cases where this is actively necessary. (The one known
case, bug #6699, is fixed in a different way by my previous patch.) Since
this patch depends on 9.2 changes that made TOC entries be marked before
output commences as to whether they'll be dumped, back-patching further
would require additional surgery; and as of now there's no evidence that
it's worth the risk.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/2b79c6ffcfd586667c60d04b5df69695915c4ee2

Modified Files
--------------
src/bin/pg_dump/pg_backup_archiver.c | 16 ++-
src/bin/pg_dump/pg_dump.c | 208 ++++++++++++++++++++++++++++------
2 files changed, 182 insertions(+), 42 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2012-06-26 04:52:03 pgsql: Fix pg_upgrade, broken by the xlogid/segno -> 64-bit int refacto
Previous Message Alvaro Herrera 2012-06-25 22:45:44 pgsql: Tighten up includes in sinvaladt.h, twophase.h, proc.h