Prevent duplicate SG rules in 'concurrent requests' case
Problem: The process of transaction is too short.
In case of concurrent requests, both requests can pass all tests
and going to write to database. Sometimes the transaction of first
request closed before the transaction of the second request has been
open, because of the above problem. So both of them can access the
latest data (revision number), then passing the StaleDataError and
writing to database successfully.
This patch moved the _check_for_duplicate_rules_in_db into transaction
to prevent race condition.
Reviewed: https:/ /review. openstack. org/345978 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=fb375bd7a40 f6ff86ac1db2134 466d0183690f7e
Committed: https:/
Submitter: Jenkins
Branch: master
commit fb375bd7a40f6ff 86ac1db2134466d 0183690f7e
Author: Anh Tran <email address hidden>
Date: Fri Jul 22 17:59:03 2016 +0700
Prevent duplicate SG rules in 'concurrent requests' case
Problem: The process of transaction is too short.
In case of concurrent requests, both requests can pass all tests
and going to write to database. Sometimes the transaction of first
request closed before the transaction of the second request has been
open, because of the above problem. So both of them can access the
latest data (revision number), then passing the StaleDataError and
writing to database successfully.
This patch moved the _check_ for_duplicate_ rules_in_ db into transaction
to prevent race condition.
Change-Id: I9ff2bf830c0c9d 1114833d3360362 2f447ee7ca2
Closes-bug: #1532696