/usr/bin/landscape-schema fails with database is not currently accepting connections

Bug #2019828 reported by Diko Parvanov
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Landscape Server
New
Undecided
Unassigned

Bug Description

Running a migration from 19.10, bionic, pgsql 10 to 23.03, pgsql 12, focal trying to run the /usr/bin/landscape-schema script fails with exceptions that all dbs are "not currently accepting connections", as in:

Traceback (most recent call last):
  File "/opt/canonical/landscape/canonical/landscape/scripts/schema.py", line 327, in run
    main_schema.check(main_store)
  File "/usr/lib/python3/dist-packages/storm/schema/schema.py", line 143, in check
    raise UnappliedPatchesError(unapplied_versions)
storm.schema.schema.UnappliedPatchesError: [477, 478, 479, 480, 481, 482, 483]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/storm/exceptions.py", line 165, in wrap_exceptions
    yield
  File "/usr/lib/python3/dist-packages/storm/database.py", line 187, in wrapper
    return attr(*args, **kwargs)
psycopg2.errors.ObjectNotInPrerequisiteState: database "landscape-resource-1" is not currently accepting connections
CONTEXT: parallel worker

seems that if it's charm installed (and in my case it is), the following code is ran locking all dbs in https://git.launchpad.net/landscape/tree/canonical/landscape/scripts/schema.py?h=23.03#n333

if is_charm_deployment():
    try:
      ensure_no_other_connections(zstorm)

but because there are no connections made to any db prior to that (my testing indicates that with SELECT * FROM pg_stat_activity), this raises an error above and doesn't continue the schema upgrade

Diko Parvanov (dparv)
description: updated
Revision history for this message
Diko Parvanov (dparv) wrote :

Commenting out the ensure_no_other_connections(zstorm) and adding pass the schema upgrade works just fine.

Diko Parvanov (dparv)
information type: Proprietary → Public
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.