deb-cinder/cinder/db
Gorka Eguileor d060e8ae13 Add ordering possibilities to conditional update
Some DBs' update method are order dependent, and they behave differently
depending on the order of the values, example on a volume with
'available' status:

   UPDATE volumes SET previous_status=status, status='retyping'
   WHERE id='44f284f9-877d-4fce-9eb4-67a052410054';

Will result in a volume with 'retyping' status and 'available'
previous_status both on SQLite and MariaDB, but

   UPDATE volumes SET status='retyping', previous_status=status
       WHERE id='44f284f9-877d-4fce-9eb4-67a052410054';

Will yield the same result in SQLite but will result in a volume with
status and previous_status set to 'retyping' in MariaDB, which is not
what we want, so order must be taken into consideration.

This patch will allow conditional update to auto order the update
including the possibility of accepting a spefic ordering that takes
precedence over the automatic ordering.

Automatic order is as follow:

 1- Order specified in argument order
 2- Values that refer to other ORM field (simple and using operations,
    like size + 10)
 3- Values that use Case clause (since they may be using fields as well)
 4- All other values

Specs: https://review.openstack.org/232599/

Depends-On: I7de421252330fa27b0ad3cadbc4395a8f28a9dad
Implements: blueprint cinder-volume-active-active-support
Change-Id: Ic3a42a5bd2c7436328dc3bf449d463e170d9f807
2016-05-05 11:27:50 +02:00
..
sqlalchemy Add ordering possibilities to conditional update 2016-05-05 11:27:50 +02:00
__init__.py Enable flake8 H303,H304 checking 2014-04-15 09:16:01 +00:00
api.py Add ordering possibilities to conditional update 2016-05-05 11:27:50 +02:00
base.py Fix sqlalchemy reuse in multi-backend children 2015-03-12 09:49:48 -06:00
migration.py Remove downgrade migrations 2015-12-18 14:04:16 +02:00