* Using "passive_deletes=True" when configuring relationships
with SQLAlchemy significantly reduces memory footprint when
deleting a graph of objects (e.g. root workflow execution
with all dependent tasks, actions and sub workflows) from DB.
This happens because in this case SQLAlchemy doesn't load
those dependent objects that are not yet in the session and
rather relies on cascading mechanisms of databases which are
activated by the proper configuration of foreign key columns.
For example, "ON DELETE CASCADE" clause in the foreign key
definition in case of for MySQL.
Particularly, this change reduces memory footprint of API
processes when deleting large graphs of executions and
execution expiration policy mechanism where the same happens
but on the engine side.
* Added a test to make sure that cascaded deletion works well
with this new property.
Reviewed: https:/ /review. openstack. org/568566 /git.openstack. org/cgit/ openstack/ mistral/ commit/ ?id=00b405b072d d8bdf2e4c80bf61 abdd6996395e62
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 00b405b072dd8bd f2e4c80bf61abdd 6996395e62
Author: Renat Akhmerov <email address hidden>
Date: Mon May 14 17:09:29 2018 +0700
Use "passive_ deletes= True" in ORM relationships
* Using "passive_ deletes= True" when configuring relationships
with SQLAlchemy significantly reduces memory footprint when
deleting a graph of objects (e.g. root workflow execution
with all dependent tasks, actions and sub workflows) from DB.
This happens because in this case SQLAlchemy doesn't load
those dependent objects that are not yet in the session and
rather relies on cascading mechanisms of databases which are
activated by the proper configuration of foreign key columns.
For example, "ON DELETE CASCADE" clause in the foreign key
definition in case of for MySQL.
Particularly, this change reduces memory footprint of API
processes when deleting large graphs of executions and
execution expiration policy mechanism where the same happens
but on the engine side.
* Added a test to make sure that cascaded deletion works well
with this new property.
Related-Bug: #1757966 95094ef98958b8a a151208fadb
Change-Id: I36988817fb8e76