]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Use compare-and-swap for IpamAvailabilityRange
authorPavel Bondar <pbondar@infoblox.com>
Tue, 20 Oct 2015 16:11:30 +0000 (19:11 +0300)
committerPavel Bondar <pbondar@infoblox.com>
Fri, 20 Nov 2015 09:52:35 +0000 (12:52 +0300)
commitd755f7248d324bb4c44b3efc9d200f8eb075066d
treeffd919e33a50c3ebe29121c64aaef1ea3180676f
parent5e34292faa0ab10d7a19470aa00ff10b13e1162b
Use compare-and-swap for IpamAvailabilityRange

Existing locking mechanism 'select for update' causes
deadlocks with galera multi-writers.
Replaced locking rows with compare-and-swap approach.

Compare-and-swap verifies that row is not changed by
another thread before updating/deleting it.
Filter-and-update and filter-and-delete are used.
They return count of affected rows.
If count of affected row is less than expected,
then another thread already changed our row
and RetryRequest is raised.

Change-Id: I514cae0fa43033433ec2982bcf3726e02e6692bf
Closes-Bug: #1494351
neutron/ipam/drivers/neutrondb_ipam/db_api.py
neutron/ipam/drivers/neutrondb_ipam/driver.py
neutron/ipam/exceptions.py
neutron/tests/unit/ipam/drivers/neutrondb_ipam/test_db_api.py
neutron/tests/unit/ipam/drivers/neutrondb_ipam/test_driver.py