
For subcloud scalability purposes, sqlalchemy will be upgraded from version 1.3 to 1.4. This version change introduces some incompatibilities from the current version: - Session management: When calling model_query without providing a session, a new one would be created inside a context manager. This means that, upon exiting model_query, the query would be executed and any new filtering after would reopen the session. Version 1.3 was more forgiving regarding transactions and this was not an issue. On version 1.4, sessions called after transaction ended will still remain open [1], causing the pool to eventually overflow with sessions stuck in "idle in transaction" state. To fix this, the session creation inside model_query is changed to only start the context manager, which will then be closed only when exiting the db function itself by a decorator. - Changed deprecated methods like the removal of count() method for tables, joinedload_all and how values are accessed in rows [2]. - Writing in read sessions: Although sqlalchemy 1.4 still supports autocommit, it's being deprecated and removed in version 2.0. Since we also need to upversion oslo.db and newer versions disable autocommit by default, this commit replaces all write operations being done inside a read session with a write session. Test plan: - PASS: Build a custom ISO with the changes and deploy a DX system controller and a SX subcloud. Verify the system works as expected. - PASS: Manage a subcloud and verify the sync_status is "in-sync". - PASS: Soak the system and verify there was no connection leak and no sessions stuck in "idle in transaction" state. - PASS: Run DC sanity and regression. - PASS: Run kube-rootca-update orchestration successfully. - PASS: Run subcloud prestage --for-sw-install successfully. - PASS: Create a subcloud backup and then restore it successfully. [1]: https://docs.sqlalchemy.org/en/14/changelog/migration_14.html#session-features-new-autobegin-behavior [2]: https://docs.sqlalchemy.org/en/14/changelog/migration_14.html#rowproxy-is-no-longer-a-proxy-is-now-called-row-and-behaves-like-an-enhanced-named-tuple Story: 2011311 Task: 51731 Change-Id: I97c88d8f668e9cfc1d9c5682d43c233193a823d7 Signed-off-by: Victor Romano <victor.gluzromano@windriver.com>
Description
StarlingX Distributed Cloud
Languages
Python
95.3%
Shell
4.5%
Makefile
0.2%