2023-05-16 09:08:23 |
Diko Parvanov |
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), next part of the code never gets executed: allow_further_connections(zstorm), as activity_result.rowcount is always 0
https://git.launchpad.net/landscape/tree/canonical/landscape/schema/connections.py?h=23.03#n53 |
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 |
|