]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Improve DB operations for quota reservation
authorSalvatore Orlando <salv.orlando@gmail.com>
Tue, 25 Aug 2015 09:21:06 +0000 (02:21 -0700)
committerSalvatore Orlando <salv.orlando@gmail.com>
Mon, 7 Sep 2015 09:32:51 +0000 (02:32 -0700)
commit7da1724d446b6804c6be7a602532fbae58d9f008
treeee0736f36c97f265663063f43d159968e7daeb48
parentfee48aa108ffff25a77a5aeb486cdba1e4302e86
Improve DB operations for quota reservation

This patch deals with the lock wait timeout and the deadlock errors
observed under high concurrency (api_workers >= 4) with the pymysql
driver. It includes the following changes:

- Stop setting dirty status for resource usage when creating
  reservation, as usage of reserved resources is not tracked anymore;
- Add a variable, increasing delay when retrying make_reservation
  upon a DBDeadlock error in order to reduce the chances of further
  collisions;
- Enable transaction retry upon DBDeadlock errors for set_quota_usage;
- Do not resync quota usage while making reservation. This puts a lot
  of stress on the database and is also wasteful since resource usage
  is very likely to change again once the transaction is committed;
- Use autonested_transaction to simplify logic around when the
  nested flag should be used.

Change-Id: I7a335f9ebea3c0d6fee6e6b757554e045a66075c
Closes-Bug: #1486134
Related-Blueprint: better-quotas
neutron/db/quota/api.py
neutron/db/quota/driver.py
neutron/quota/resource.py
neutron/quota/resource_registry.py
neutron/tests/unit/db/quota/test_api.py
neutron/tests/unit/quota/test_resource_registry.py