[Pkg-postgresql-public] Bug#764705: Bug#764705: Bug#764705: Bug#764705: Bug#764705: Bug#764705: postgresql-9.4: ERROR: The database format changed between beta 2 and 3. Please dump, but how?

Christoph Berg myon at debian.org
Tue Oct 14 15:35:21 UTC 2014


Re: James Cloos 2014-10-13 <m3bnpfmzy7.fsf at carbon.jhcloos.org>
> >> This is a rather awkward position for upgraders to be in, as we
> >> essentially cannot automate this robustly.
> 
> Is it really that much of a problem to do something like:
> 
>   su -s /bin/sh -c 'pg_dumpall -c' - postgres >/var/tmp/old_pg94.sql
>   pg_dropcluster 9.4 main --stop
>   ...
>   pg_createcluster 9.4 main
>   service postgres start
>   su -s /bin/sh -c 'psql -f /var/tmp/old_pg94.sql template1' - postgres
> 
> after checking the size of the data directory vs the amount of free disk
> space, what 9.4 clusters exist, which ports they each use, et cetera,
> with the upgrade occuring at the ... point?

The problem is the "et cetera". I thought about putting code like that
into the pre and postinst, but it seems to fragile to actually try.
It's true it'll work for 90% of the standard installations, but I fear
90% of the code needed would have to deal with the "interesting" other
cases.

I've now put a nice NEWS message in postgresql-9.4.NEWS, and updated
the preinst failure message to show a similar message. The text is:

postgresql-9.4 (9.4~beta3-1) unstable; urgency=medium

  The on-disk format of the PostgreSQL 9.4 data files has changed between
  beta2 and beta3 (and as a consequence, the catalog version number). For that
  reason, existing PostgreSQL 9.4 clusters need to be dumped using the old
  package version, and reloaded after upgrading the packages.

  The postgresql-9.4 package will refuse to upgrade if any version 9.4
  clusters exist on the system.

  To resolve the situation, before upgrading, execute:
  # su - postgres
  $ pg_lsclusters
  $ pg_ctlcluster 9.4 main start
  $ pg_dumpall --cluster 9.4/main | gzip > 9.4-main.dump.gz
  $ cp -a /etc/postgresql/9.4/main 9.4-main.config
  $ pg_dropcluster 9.4 main --stop

  Then after the upgrade, execute:
  # su - postgres
  $ pg_createcluster 9.4 main
  $ cp 9.4-main.config/* /etc/postgresql/9.4/main
  $ pg_ctlcluster 9.4 main start
  $ zcat 9.4-main.dump.gz | psql -q
  $ rm -rf 9.4-main.config 9.4-main.dump.gz

  If you have other clusters besides the default "main", repeat the above
  steps appropriately.

 -- Christoph Berg <christoph.berg at credativ.de>  Tue, 14 Oct 2014 16:33:09 +0200

If no one objects, I'll upload that tomorrow evening.

> I can imagine that it could be quite an ordeal for some users.

Yeah. I'm sorry my plan didn't work out as well as thought...

Christoph
-- 
cb at df7cb.de | http://www.df7cb.de/



More information about the Pkg-postgresql-public mailing list