Merge "Explicitly use a session for DB version check"

This commit is contained in:
Zuul 2023-05-24 16:44:19 +00:00 committed by Gerrit Code Review
commit 250bdaa10c
2 changed files with 15 additions and 5 deletions

View File

@ -1798,7 +1798,8 @@ class Connection(api.Connection):
# compatible with its (old) DB representation.
# NOTE(rloo): .notin_ does not handle null:
# http://docs.sqlalchemy.org/en/latest/core/sqlelement.html#sqlalchemy.sql.operators.ColumnOperators.notin_
query = model_query(model.version).filter(
with _session_for_read() as session:
query = session.query(model.version).filter(
sql.or_(model.version == sql.null(),
model.version.notin_(supported_versions)))
if query.count():

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Fixes an issue where the database upgrade can hang on Python 3.10.
This was because open transactions could become orphaned awaiting
the Python runtime to clean up their memory references due to the
way the overall database query was being intiiated to pre-flight
check the upgrade. We have structurally changed the behavior
to remedy this case.