Testcase derived:

$ sudo -u postgres psql -c 'CREATE DATABASE test;'
$ sudo -u postgres psql -d test -c 'CREATE PROCEDURE test() LANGUAGE plpgsql AS 
$$ BEGIN ROLLBACK; END; $$;';
$ sudo -u postgres psql -c 'DROP DATABASE test;'


Good:
CREATE DATABASE
CREATE PROCEDURE
DROP DATABASE

Bad:
CREATE DATABASE
2021-08-16 16:04:30.556 GMT [23081] ERROR:  could not load library 
"/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: 
undefined symbol: EnsurePortalSnapshotExists
2021-08-16 16:04:30.556 GMT [23081] STATEMENT:  CREATE PROCEDURE test() 
LANGUAGE plpgsql AS $$ BEGIN ROLLBACK; END; $$;
ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": 
/usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: 
EnsurePortalSnapshotExists
DROP DATABASE

And I can switch in/out of the bad state by making the on-disk plpgsql.so to 
mismatch the running one.
$ v=12.2-4; apt install postgresql-12=$v postgresql-client-12=$v libpq5=$v
$ v=12.8-0ubuntu0.20.04.1; apt install postgresql-12=$v postgresql-client-12=$v 
libpq5=$v

I'll set this to confirmed and I'm happy that we know the root cause.
But there isn't much more we can do.

In qemu we have had a similar issue, the answer would be per-build
directories that have to stay after upgrade/remove and cleared on e.g.
reboot. This can get very messy and the underlying issue is true to each
and every program that we SRU.

I think no action has to be taken - if anything then I'd want to have 
postgresql to keep the .so in memory - because even if I successfully load it 
on the old version, post upgrade it will fail.
So it did not keep the .so loaded. That probably is due to spawned off worker 
threads I guess but there might be an efficiency gain just by not-loading libs 
every time (independent to being slightly safer on upgrades).

I'll ping a few pstgresq people on this what they think about it.

** Changed in: postgresql-12 (Ubuntu)
       Status: New => Confirmed

** Changed in: postgresql-12 (Ubuntu)
   Importance: Undecided => Wishlist

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1939898

Title:
  Unnatended postgresql-12 upgrade caused MAAS internal error

To manage notifications about this bug go to:
https://bugs.launchpad.net/maas/+bug/1939898/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to