From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: pg_dump and premature optimizations for objects not to be dumped |
Date: | 2016-01-13 00:20:14 |
Message-ID: | 17765.1452644414@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I wrote:
> I looked into Karsten Hilbert's report here
> http://www.postgresql.org/message-id/20160108114529.GB22446@hermes.hilbert.loc
> of being unable to run pg_upgrade on a database containing the pg_trgm
> extension. After some investigation, the problem is explained like this:
> ...
> The thing that seems possibly most robust to me is to pull in the
> extension membership data *first* and incorporate it into the initial
> selectDumpableObject tests, thus getting us back to the pre-9.1 state
> of affairs where the initial settings of the object dump flags could
> be trusted. This might be expensive though; and it would certainly add
> a good chunk of work to the race-condition window where we've taken
> pg_dump's transaction snapshot but not yet acquired lock on any of
> the tables.
Attached is a draft patch that does things this way. Some simple testing
suggests it's just about exactly the same speed as 9.5 pg_dump, which
means that the "expensive" objection is dismissible. It's hard to tell
though whether the pre-table-lock race-condition window has gotten
meaningfully wider.
In addition to fixing Karsten's problem, this deals with the bugs I noted
earlier about event triggers and transforms being dumped unconditionally.
I was also able to get rid of some unsightly special cases for procedural
languages, FDWs, and foreign servers, in favor of setting their dump
flags according to standard rules up front.
If we were to put a test rejecting initdb-created objects (those with
OID < FirstNormalObjectId) into selectDumpableObject, it'd be possible
to get rid of selectDumpableDefaultACL, selectDumpableCast, and/or
selectDumpableProcLang, since those would then have various subsets
of the selectDumpableObject rules. I'm not sure if this would be an
improvement or just confusing; any thoughts?
I'm not very sure what to do with this patch. I think it should
definitely go into 9.5: it applies cleanly there and it will fix our two
new-in-9.5 bugs with event triggers and transforms. I'm less enthused
about back-porting it further. In principle, the extension membership
issues exist all the way back to 9.1, but we haven't had complaints before,
and there's a nonzero chance of changing corner-case behaviors. (I think
any such changes would likely be for the better, but nonetheless they
would be changes.) Back-porting it further than about 9.4 would also
be quite a lot of work :-(
Comments?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
fix-pg_dump-extension-membership-behaviors.patch | text/x-diff | 60.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Dan Langille | 2016-01-13 01:23:27 | PGCon 2016 CFP - one week left |
Previous Message | Tom Lane | 2016-01-12 23:00:10 | Re: Weird behavior during CREATE EXTENSION |