← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1964575] [NEW] [DB] Migration to SQLAlchemy 2.0

 

Public bug reported:

This is a container for the efforts to be done in Neutron, neutron-lib
and plugins projects to migrate to SQLAlchemy 2.0.

There is currently a patch in neutron-lib to disable the session
"__autocommit" flag, that will be optional in SQLAlchemy 1.4 and
mandatory in SQLAlchemy 2.0 [1]. We have found problems with how the
session transactions are now handled by SQLAlchemy.

In Neutron there are many places where we make a database call running
on an implicit transaction, that means we don't explicitly create a
reader/writer context. With "autocommit=True", this transaction is
discarded immediately; under non-autocommit sessions, the transaction
created remains open. That is leading to database errors as seen in the
tempest tests.

In [2], as recommended by Mike Bayer (main maintainer and author of
SQLAlchemy), we have enabled again the "autocommit" flag and create a
log message to track when Neutron tries to execute a command with
session with an inactive transaction.

The goal of this bug is to move all Neutron database interactions to be
SQLAlchemy 2.0 compliant.


[1]https://review.opendev.org/c/openstack/neutron-lib/+/828738
[2]https://review.opendev.org/c/openstack/neutron-lib/+/833103

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1964575

Title:
  [DB] Migration to SQLAlchemy 2.0

Status in neutron:
  New

Bug description:
  This is a container for the efforts to be done in Neutron, neutron-lib
  and plugins projects to migrate to SQLAlchemy 2.0.

  There is currently a patch in neutron-lib to disable the session
  "__autocommit" flag, that will be optional in SQLAlchemy 1.4 and
  mandatory in SQLAlchemy 2.0 [1]. We have found problems with how the
  session transactions are now handled by SQLAlchemy.

  In Neutron there are many places where we make a database call running
  on an implicit transaction, that means we don't explicitly create a
  reader/writer context. With "autocommit=True", this transaction is
  discarded immediately; under non-autocommit sessions, the transaction
  created remains open. That is leading to database errors as seen in
  the tempest tests.

  In [2], as recommended by Mike Bayer (main maintainer and author of
  SQLAlchemy), we have enabled again the "autocommit" flag and create a
  log message to track when Neutron tries to execute a command with
  session with an inactive transaction.

  The goal of this bug is to move all Neutron database interactions to
  be SQLAlchemy 2.0 compliant.

  
  [1]https://review.opendev.org/c/openstack/neutron-lib/+/828738
  [2]https://review.opendev.org/c/openstack/neutron-lib/+/833103

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



Follow ups