Re: pg_upgrade failing for 200+ million Large Objects
Magnus Hagander <magnus@hagander.net>
From: Magnus Hagander <magnus@hagander.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robins Tharakan <tharakan@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-03-08T16:35:56Z
Lists: pgsql-hackers
On Mon, Mar 8, 2021 at 5:33 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > > Robins Tharakan <tharakan@gmail.com> writes: > > On Mon, 8 Mar 2021 at 23:34, Magnus Hagander <magnus@hagander.net> wrote: > >> Without looking, I would guess it's the schema reload using > >> pg_dump/pg_restore and not actually pg_upgrade itself. This is a known > >> issue in pg_dump/pg_restore. And if that is the case -- perhaps just > >> running all of those in a single transaction would be a better choice? > >> One could argue it's still not a proper fix, because we'd still have a > >> huge memory usage etc, but it would then only burn 1 xid instead of > >> 500M... > > > (I hope I am not missing something but) When I tried to force pg_restore to > > use a single transaction (by hacking pg_upgrade's pg_restore call to use > > --single-transaction), it too failed owing to being unable to lock so many > > objects in a single transaction. > > It does seem that --single-transaction is a better idea than fiddling with > the transaction wraparound parameters, since the latter is just going to > put off the onset of trouble. However, we'd have to do something about > the lock consumption. Would it be sane to have the backend not bother to > take any locks in binary-upgrade mode? I believe the problem occurs when writing them rather than when reading them, and I don't think we have a binary upgrade mode there. We could invent one of course. Another option might be to exclusively lock pg_largeobject, and just say that if you do that, we don't have to lock the individual objects (ever)? -- Magnus Hagander Me: https://www.hagander.net/ Work: https://www.redpill-linpro.com/
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Count individual SQL commands in pg_restore's --transaction-size mode.
- 81db073a2878 17.0 landed
- 0f1290521504 18.0 landed
-
Reduce number of commands dumpTableSchema emits for binary upgrade.
- b3f0e0503f33 18.0 landed
- 2fa989e6a340 17.0 landed
-
Invent --transaction-size option for pg_restore.
- 959b38d770ba 17.0 landed
-
Rearrange pg_dump's handling of large objects for better efficiency.
- a45c78e3284b 17.0 landed
-
Add temporal PRIMARY KEY and UNIQUE constraints
- 46a0cd4cefb4 17.0 cited
-
Fix typo and case in messages
- 7d7ef075d2b3 17.0 cited