FS#68601 - [postgresql] Database fails to start w/ invalid database version check

Attached to Project: Arch Linux
Opened by Dragoon Aethis (DragoonAethis) - Thursday, 12 November 2020, 22:24 GMT
Last edited by Levente Polyak (anthraxx) - Friday, 13 November 2020, 10:18 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Levente Polyak (anthraxx)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 6
Private No

Details

Description:
After upgrading to postgresql 12.5-1, the postgresql.service no longer starts:

postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2020-11-12 23:16:28 CET; 5s ago
Process: 895764 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=1/FAILURE)

Nov 12 23:16:28 sigurd systemd[1]: Starting PostgreSQL database server...
Nov 12 23:16:28 sigurd postgres[895764]: An old version of the database format was found.
Nov 12 23:16:28 sigurd postgres[895764]: See https://wiki.archlinux.org/index.php/PostgreSQL#Upgrading_PostgreSQL
Nov 12 23:16:28 sigurd systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE
Nov 12 23:16:28 sigurd systemd[1]: postgresql.service: Failed with result 'exit-code'.
Nov 12 23:16:28 sigurd systemd[1]: Failed to start PostgreSQL database server.

According to the latest package commit - https://github.com/archlinux/svntogit-packages/commit/19b0f262e7f1ead2c0ec03d001c20d83fcfefd62 - the postgresql-check-db-dir script checks if the database major version is now 13, but the package contains PostgreSQL 12. Reinitializing the database still creates a 12.x database. Version change in the script should be reverted.

Steps to reproduce:
- Upgrade the postgresql package to 12.5-1
- Initialize and set up your database according to the wiki
- systemctl start postgresql
This task depends upon

Closed by  Levente Polyak (anthraxx)
Friday, 13 November 2020, 10:18 GMT
Reason for closing:  Fixed
Additional comments about closing:  12.5-3
Comment by Dragoon Aethis (DragoonAethis) - Thursday, 12 November 2020, 22:28 GMT
This should probably have severity of normal/high, but I accidentally missed that while creating the ticket...
Comment by xyz (sjon) - Friday, 13 November 2020, 07:55 GMT
There is a work-around in  FS#68602  but this bug should indeed be high prio
Comment by Bjoern Franke (bjo) - Friday, 13 November 2020, 08:18 GMT
I see no workaround in  FS#68602 
Comment by Dragoon Aethis (DragoonAethis) - Friday, 13 November 2020, 08:20 GMT
The workaround is to manually patch /usr/bin/postgresql-check-db-dir -> lines 19 and 21, set PGMAJORVERSION to 12 and PREVMAJORVERSION to 11.
Comment by Levente Polyak (anthraxx) - Friday, 13 November 2020, 08:56 GMT
A fixed version will be released in about an hour. Unfortunately files got a bit mixed up after updating the tree for the final build.

Loading...