Bug 12754 - Umstellung auf PostgreSQL 8.3
Summary: Umstellung auf PostgreSQL 8.3
Status: CLOSED FIXED
Alias: None
Product: UCS
Classification: Unclassified
Component: Upstream packages
Version: UCS 2.1
Hardware: All All
: P5 normal
Target Milestone: UCS 2.3
Assignee: Arvid Requate
QA Contact: Daniel Hofmann
URL:
Keywords:
: 15683 (view as bug list)
Depends on:
Blocks: 14429
  Show dependency treegraph
 
Reported: 2008-11-27 15:26 CET by Janis Meybohm
Modified: 2009-12-21 08:47 CET (History)
3 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Meybohm univentionstaff 2008-11-27 15:26:27 CET
Mit der Update auf Lenny sollte ebenfalls die standard PostgreSQL Version aktualisiert werden. Zu beachten sind dabei u.a. auch die Build-Dep. von Bacula (Bug#12753)
Comment 1 Janis Meybohm univentionstaff 2009-02-16 08:07:12 CET
Ich habe im internal Scope ein Integrationspaket, univention-postgresql-8.1 gebaut.
Comment 2 Stefan Gohmann univentionstaff 2009-05-11 15:27:22 CEST
Mit UCS 2.3 sollten wir per Default auf Postgres 8.3 umsteigen. Zusätzlich sollte 7.4 noch gebaut und mitgeliefert werden. In den Release Notes sollte darauf hingewiesen werden, dass das Update manuell durchgeführt werden sollte. Mit UCS 2.4 oder UCS 3.0 wird dann kein 7.4 mehr ausgeliefert.
 
Comment 3 Stefan Gohmann univentionstaff 2009-06-11 16:24:36 CEST
Siehe Bug #14600, postgres-7.4 ist gebaut
Comment 4 Arvid Requate univentionstaff 2009-08-25 14:56:27 CEST
Das Integrationpaket univention-postgresql ist im trunk angepasst und bringt jetzt zusätzlich UCR Templates für /etc/postgresql/8.3/* mit, die von univention-postgresql-8.1 aus dem ucs_2.2-0-internal Scope abgeleitet sind. Es werden drei neue UCR Variablen unterstützt:
 postgresql8/autostart, postgresql8/maxconnections und postgresql8/listenaddress

Die Pre-Dependency wurde von "postgresql, postgresql-7.4" auf "postgresql-8.3 | postgresql-7.4" abgeändert, da postgresql wiederum auf postgresql-8.3 dependet.
Changelog vorhanden.

postgresql-8.3 wurde um den Patch 8.3.7-0lenny1/010.init-script.patch erweitert.
Comment 5 Stefan Gohmann univentionstaff 2009-09-07 08:57:51 CEST
Die Installation von UCS 2.3 läuft nicht durch:


root@master:~# dpkg --configure -a
Richte univention-pkgdb ein (3.0.0-3.87.200906121004) ...
Multifile: /etc/postgresql/7.4/main/pg_hba.conf
psql: could not connect to server: Datei oder Verzeichnis nicht gefunden
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
executing: /usr/sbin/univention-mount-homedir.
executing: /usr/bin/univention-skel.
executing: /usr/share/univention-kde/univention-set-kdedirs.
executing: /usr/sbin/univention-user-quota.
createuser: konnte nicht mit Datenbank postgres verbinden: could not connect to server: Datei oder Verzeichnis nicht gefunden
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
executing: /usr/sbin/univention-mount-homedir.
executing: /usr/bin/univention-skel.
executing: /usr/share/univention-kde/univention-set-kdedirs.
executing: /usr/sbin/univention-user-quota.
psql: could not connect to server: Datei oder Verzeichnis nicht gefunden
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
psql: could not connect to server: Datei oder Verzeichnis nicht gefunden
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
executing: /usr/sbin/univention-mount-homedir.
executing: /usr/bin/univention-skel.
executing: /usr/share/univention-kde/univention-set-kdedirs.
executing: /usr/sbin/univention-user-quota.
createdb: konnte nicht mit Datenbank postgres verbinden: could not connect to server: Datei oder Verzeichnis nicht gefunden
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
executing: /usr/sbin/univention-mount-homedir.
executing: /usr/bin/univention-skel.
executing: /usr/share/univention-kde/univention-set-kdedirs.
executing: /usr/sbin/univention-user-quota.
psql: could not connect to server: Datei oder Verzeichnis nicht gefunden
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
dpkg: Fehler beim Bearbeiten von univention-pkgdb (--configure):
 Unterprozess post-installation script gab den Fehlerwert 2 zurück
Fehler traten auf beim Bearbeiten von:
 univention-pkgdb
Comment 6 Arvid Requate univentionstaff 2009-09-07 11:26:39 CEST
Das Paket univention-pkgdb wurde so angepasst, dass es im postinst per dpkg -l überprüft, ob postgresql-8.3 installiert ist oder postgresql-7.4. Es startet dann das entsprechende init.d Script (Das Paket pre-depended auf die aktuelle Version von univention-postgresql).

Im Changelog ist jetzt zusätzlich beschrieben, wie man beim manuellen Update von 7.4 auf 8.3 den 'default cluster' migiriert (u.a. pkgdb und horde Daten) und dass man danach postgresql-7.4 besser deinstalliert, da es sonst eine Kollision auf Port 5432 gibt.
Comment 7 Arvid Requate univentionstaff 2009-09-11 09:41:32 CEST
Auf im postinst von univention-kolab2-webclient wird jetzt erst getestet ob postgresql-8.3 installiert ist oder postgresql-7.4.
Comment 8 Stefan Gohmann univentionstaff 2009-09-21 08:57:36 CEST
*** Bug 15683 has been marked as a duplicate of this bug. ***
Comment 9 Stefan Gohmann univentionstaff 2009-09-21 09:07:40 CEST
Siehe Bug #15683
Comment 10 Arvid Requate univentionstaff 2009-09-21 12:30:35 CEST
Die pg_*cluster Tools erwarten, dass 'data_directory' in postgresql.conf gesetzt ist. Seit 8.0/8.1 legt pg_createcluster nicht mehr der Symlink 'pgdata' an:

http://www.mail-archive.com/debian-bugs-closed@lists.debian.org/msg146408.html

Das Template in univention-postgresql wurde entsprechend angepasst und das Paket neu gebaut.
Comment 11 Stefan Gohmann univentionstaff 2009-10-08 14:16:29 CEST
Wie gerade besprochen, scheinbar startet Postresql 8.3 nicht richtig während einer UCS Installation mit 2.6.30. Am Ende der Installation wird angezeigt, dass univention-pkgdb nicht richtig installiert wurde.

The following NEW packages will be installed:
  univention-pkgdb
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/28.7kB of archives.
After this operation, 406kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  univention-pkgdb
Authentication warning overridden.
Selecting previously deselected package univention-pkgdb.
(Reading database ... 113621 files and directories currently installed.)
Unpacking univention-pkgdb (from .../univention-pkgdb_3.0.1-3.92.200909230307_all.deb) ...
Create pgsql/pkgdb/network
Create pgsql/pkgdb/netmask
Not updating pkgdb/scan
Setting up univention-pkgdb (3.0.1-3.92.200909230307) ...
Multifile: /etc/postgresql/7.4/main/pg_hba.conf
Multifile: /etc/postgresql/8.3/main/pg_hba.conf
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
executing: /usr/sbin/univention-mount-homedir.
executing: /usr/bin/univention-skel.
executing: /usr/share/univention-kde/univention-set-kdedirs.
executing: /usr/sbin/univention-user-quota.
createuser: could not connect to database postgres: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Comment 12 Arvid Requate univentionstaff 2009-10-08 18:14:28 CEST
Das Template für die postgresql 8.3 Konfiguration wurde nochmal an das aus 7.4 angepasst. Aus dem Changelog:

  * avoid special lc_* locale settings in 8.3 template
  * set datestyle instead according to the 7.4 template
  * set the work_mem according to the 7.4 setting of sort_mem
  * set log_connections and dynamic_library_path like in 7.4
  * include pid in log_line_prefix and comment out default port

Das Paket univention-postgresql ist neu gebaut.
Comment 13 Stefan Gohmann univentionstaff 2009-10-22 09:55:46 CEST
Wenn ich ein UCS 2.3 System aktualisiere, dann habe ich anschließend 7.4 und 8.3:

root@qamaster:~# apt-get remove postgresql-client-8.3 postgresql-8.3
Paketlisten werden gelesen... Fertig
AbhÀngigkeitsbaum wird aufgebaut
Lese Status-Informationen ein... Fertig
Die folgenden Pakete wurden automatisch installiert und werden nicht lÀnger benötigt:
  libavahi-core4
Verwenden Sie »apt-get autoremove«, um sie zu entfernen.
Die folgenden Pakete werden ENTFERNT:
  postgresql postgresql-8.3 postgresql-client postgresql-client-8.3 univention-pkgdb
0 aktualisiert, 0 neu installiert, 5 zu entfernen und 1 nicht aktualisiert.
Nach dieser Operation werden 20,1MB Plattenplatz freigegeben.

Eigentlich sollte 8.3 dann doch gar nicht installiert werden, oder?
Comment 14 Arvid Requate univentionstaff 2009-10-22 15:08:23 CEST
1. Zur Zeit wird postgresql-8.3 mit installiert, startet aber nicht, weil der Port 5432 schon von 7.4 belegt ist.

Man könnte zusätzlich postgres8/autostart im postinst auf no setzen, wenn 7.4 installiert ist.

2. Da das Speicherformat der Postgre Server Versionen nicht kompatibel ist, wird von http://www.postgresql.org/docs/8.3/static/migration.html für die Migration empfohlen, für ein "pg_dumpall | psql -p <port von 8.3>" beide Versionen vorübergehend auf unterschiedlichen Ports laufen zu lassen. Dafür ist es ggf. sinnvoll beide Versionen schon installiert mitzubringen.

Für Debian wird die Verwendung eines Scripts "pg_upgradecluster" empfohlen, das die neue Version automatisch kurz auf einen alternativen Port umkonfiguriert, startet und die Migration durchführt.
Derzeit ist im Changelog die notwendigen Schritte notiert.
Alternativ kann man ein Script hinzufügen, das die Kunden zur Migration aufrufen können und dazu das postgres8/autostart wieder zurücksetzt:

  #!/bin/sh
  ucr unset postgres8/autostart
  pg_dropcluster 8.3 main --stop
  pg_upgradecluster 7.4 main
  ucr commit /etc/postgresql/8.3/pk_hba.conf \
             /etc/postgresql/8.3/pk_ident.conf \
             /etc/postgresql/8.3/postgresql.conf
  DEBIAN_FRONTEND=noninteractive apt-get --yes remove postgresql7.4
  invoke-rc.d postgresql-8.3 restart
Comment 15 Arvid Requate univentionstaff 2009-10-22 19:38:06 CEST
univention-postgresql setzt jetzt bei update postgres8/autostart?no
Informationen zur Migration wurden vom Changelog in die Release Notes verschoben und entsprechend angepasst.
Comment 16 Stefan Gohmann univentionstaff 2009-10-23 08:37:21 CEST
amd64 Testinstallation von heute Nacht (10.203.11.230):

root@ucs-master:~# ls -la /etc/postgresql/8.3/main/postgresql.conf
ls: cannot access /etc/postgresql/8.3/main/postgresql.conf: No such file or directory

Deshalb startet scheinbar der Postgresql-Server nicht.
Comment 17 Arvid Requate univentionstaff 2009-10-23 10:06:05 CEST
Da fehlte die DEBHELPER Zeile im postinst. Ist für i386 neu gebaut.
Comment 18 Stefan Gohmann univentionstaff 2009-10-27 06:21:00 CET
Arvid, mit svn r13241 habe ich ein paar kleine Änderungen am postinst gemacht, da aktuell das Update fehlgeschlagen hat. Bitte kurz prüfen.
Comment 19 Daniel Hofmann univentionstaff 2009-10-27 14:30:15 CET
Migration soweit erfolgreich:

Auf einem von 2.2-2 upgegradeten 2.3-System:

master2232maintained:/usr/share/doc/postgresql-7.4 # dpkg -l postgres\* | grep ^ii
ii  postgresql-7.4             1:7.4.17-0.20.200909230157
ii  postgresql-8.3             8.3.7-0.10.200910161854
ii  postgresql-client-7.4      1:7.4.17-0.20.200909230157
ii  postgresql-client-8.3      8.3.7-0.10.200910161854
ii  postgresql-client-common   94.10.200910270915
ii  postgresql-common          94.10.200910270915

master2232maintained:/usr/share/doc/postgresql-7.4 # su postgres
executing: /usr/sbin/univention-mount-homedir.
executing: /usr/bin/univention-skel.
executing: /usr/share/univention-kde/univention-set-kdedirs.
executing: /usr/sbin/univention-user-quota.
postgres@master2232maintained:/usr/share/doc/postgresql-7.4 > createuser -DA root
CREATE USER
postgres@master2232maintained:/usr/share/doc/postgresql-7.4 > createdb -O root test
CREATE DATABASE
postgres@master2232maintained:/usr/share/doc/postgresql-7.4 > exit
master2232maintained:/usr/share/doc/postgresql-7.4 # psql test
Willkommen bei psql 7.4.17, dem interaktiven PostgreSQL-Terminal.

Geben Sie ein:  \copyright für Urheberrechtsinformationen
                \h für Hilfe über SQL-Anweisungen
                \? für Hilfe über interne Anweisungen
                \g oder Semikolon, um eine Anfrage auszuführen
                \q um zu beenden

test=> create table foo (index int, name varchar);
CREATE TABLE
test=> insert into foo (index, name) values (1, 'eins');
INSERT 17149 1
test=> insert into foo (index, name) values (2, 'zwei');
INSERT 17150 1
test=> select * from foo;
 index | name
-------+------
     1 | eins
     2 | zwei
(2 Zeilen)

test=> \q

master2232maintained:/usr/share/doc/postgresql-7.4 # ucr unset postgres8/autostart
Unsetting postgres8/autostart
master2232maintained:/usr/share/doc/postgresql-7.4 # pg_dropcluster 8.3 main --stop
warning: corrupted cluster: data directory does not exist
Use of uninitialized value $info{"socketdir"} in pattern match (m//) at /usr/bin/pg_dropcluster line 72.
Use of uninitialized value $info{"socketdir"} in rmdir at /usr/bin/pg_dropcluster line 73.
master2232maintained:/usr/share/doc/postgresql-7.4 # pg_upgradecluster 7.4 main
Checking for users and groups with the same name...
Creating new cluster (configuration: /etc/postgresql/8.3/main, data: /var/lib/postgresql/8.3/main)...
Moving configuration file /var/lib/postgresql/8.3/main/postgresql.conf to /etc/postgresql/8.3/main...
Moving configuration file /var/lib/postgresql/8.3/main/pg_hba.conf to /etc/postgresql/8.3/main...
Moving configuration file /var/lib/postgresql/8.3/main/pg_ident.conf to /etc/postgresql/8.3/main...
Configuring postgresql.conf to use port 5433...
Disabling connections to the old cluster during upgrade...
Disabling connections to the new cluster during upgrade...
Re-enabling connections to the old cluster...
Re-enabling connections to the new cluster...
Creating globals...
Fixing hardcoded library paths for stored procedures...
Upgrading database test...
Analyzing database test...
Fixing hardcoded library paths for stored procedures...
Upgrading database template1...
Analyzing database template1...
Fixing hardcoded library paths for stored procedures...
Upgrading database joework...
Analyzing database joework...
Copying old configuration files...
Copying old start.conf...
Stopping target cluster...
Stopping old cluster...
Disabling automatic startup of old cluster...
Configuring old cluster to use a different port (5433)...
Starting target cluster on the original port...
Success. Please check that the upgraded cluster works. If it does,
you can remove the old cluster with

  pg_dropcluster 7.4 main

master2232maintained:/usr/share/doc/postgresql-7.4 # psql test
Dies ist psql 8.3.7, das interaktive PostgreSQL-Terminal.

Geben Sie ein:  \copyright für Urheberrechtsinformationen
                \h für Hilfe über SQL-Anweisungen
                \? für Hilfe über interne Anweisungen
                \g oder Semikolon, um eine Anfrage auszuführen
                \q um zu beenden

test=> select * from foo;
 index | name
-------+------
     1 | eins
     2 | zwei
(2 Zeilen)

test=> \q

master2232maintained:/usr/share/doc/postgresql-7.4 # ucr commit /etc/postgresql/8.3/main/pg_hba.conf /etc/postgresql/8.3/main/pg_ident.conf /etc/postgresql/8.3/main/postgresql.conf
Multifile: /etc/postgresql/8.3/main/pg_hba.conf
Multifile: /etc/postgresql/8.3/main/pg_ident.conf
File: /etc/postgresql/8.3/main/postgresql.conf


REOPEN wegen:
Die Dateinamen in den Releasenotes sind nicht korrekt (Unterordner main fehlt und prefix pg statt pk).
Außerdem fehlt der Bindestrich beim Paket postgresql-7.4:

ucr commit /etc/postgresql/8.3/pk\_hba.conf \
           /etc/postgresql/8.3/pk\_ident.conf \
           /etc/postgresql/8.3/postgresql.conf
apt-get remove postgresql7.4
Comment 20 Arvid Requate univentionstaff 2009-10-27 14:57:40 CET
Anweisungen in den Release Notes sind jetzt entsprechend angepasst.
Comment 21 Daniel Hofmann univentionstaff 2009-10-27 15:21:08 CET
VERIFIED
Comment 22 Stefan Gohmann univentionstaff 2009-12-21 08:47:57 CET
UCS 2.3 wurde veröffentlicht. Sollte der hier beschriebene Bug mit einer neueren Version von UCS erneut auftreten, so sollte der Bug dupliziert werden: "Clone This Bug".