Project

General

Profile

Bug #1436

Postgresql schema 19 migration with an empty channel buffer crashes core.

Added by ephemer0l almost 7 years ago. Updated over 3 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
05/24/2017
Due date:
% Done:

0%

Estimated time:
Version:
0.12.4
OS:
Linux

Description

I had to dig to figure this out, and with the help of romibi and digitalcircuit it was overcome. I was running git builds and went to restart my core after an update. The core would not come online. I had to 'su - quassel -s /bin/bash' and launch the core manually and look for output, as nothing was being put in the logs. After seeing the following:

$quasselcore -c .
("QSQLITE", "QMYSQL", "QMYSQL3", "QPSQL", "QPSQL7")
Installed Schema (version 19) is not up to date. Upgrading to version 21...
unhandled Error in QSqlQuery!
last Query:
ALTER TABLE buffer
ADD COLUMN lastmsgid integer NOT NULL DEFAULT 0
executed Query:

bound Values:
Error Number: 42701
Error Message: ERROR: column "lastmsgid" of relation "buffer" already exists
(42701) QPSQL: Unable to create query
Driver Message: QPSQL: Unable to create query
DB Message: ERROR: column "lastmsgid" of relation "buffer" already exists
(42701)
Unable to upgrade Logging Backend!
Upgrade failed...
FATAL: Selected storage backend is not available: "PostgreSQL"

With help we determined via logging into postgresql, selecting the quassel database, and running 'ALTER TABLE buffer RENAME COLUMN lastmsgid TO lastmsgidbackup;' was able to over come that error that lead to discovering:

("QSQLITE", "QMYSQL", "QMYSQL3", "QPSQL", "QPSQL7")
Installed Schema (version 19) is not up to date. Upgrading to version 21...
unhandled Error in QSqlQuery!
last Query:
SELECT populate_lastmsgid()
executed Query:

bound Values:
Error Number: 23502
Error Message: ERROR: null value in column "lastmsgid" violates not-null constraint
DETAIL: Failing row contains (43, 1, null, 3, #channel, #channel, 2, 131231814, 86047596, null, t, 0, null).
CONTEXT: SQL statement "UPDATE buffer
SET lastmsgid = (
SELECT backlog.messageid
FROM backlog
WHERE backlog.bufferid = i.bufferid
ORDER BY messageid DESC LIMIT 1
)
WHERE buffer.bufferid = i.bufferid"
PL/pgSQL function populate_lastmsgid() line 7 at SQL statement
(23502) QPSQL: Unable to create query
Driver Message: QPSQL: Unable to create query
DB Message: ERROR: null value in column "lastmsgid" violates not-null constraint
DETAIL: Failing row contains (43, 1, null, 3, #channel, #channel, 2, 131231814, 86047596, null, t, 0, null).
CONTEXT: SQL statement "UPDATE buffer
SET lastmsgid = (
SELECT backlog.messageid
FROM backlog
WHERE backlog.bufferid = i.bufferid
ORDER BY messageid DESC LIMIT 1
)
WHERE buffer.bufferid = i.bufferid"
PL/pgSQL function populate_lastmsgid() line 7 at SQL statement
(23502)
Unable to upgrade Logging Backend!
Upgrade failed...
FATAL: Selected storage backend is not available: "PostgreSQL"

In the above the buffer number 43 was found to be empty with the query 'SELECT backlog.messageid FROM backlog WHERE backlog.bufferid = 43;'

It was solved by running 'INSERT INTO backlog (time, bufferid, type, flags, senderid, message) SELECT time, 43, type, flags, senderid, message FROM backlog ORDER BY messageid DESC LIMIT 1 RETURNING messageid;'

If you encounter this, adapt as necessary by changing the buffer group number to overcome the issues and upgrade.

Thanks all!

Be well.

Also available in: Atom PDF