There are functions that are wrapped with a `wrap_db_retry` because they
are part of a transaction happening at a higher level inside Neutron. The
problem with wrapping it with that decorator is that without specifying
an `exception_checker` then it only handles `RetryRequests` and not
other types of exceptions that are expected to be received (ie:
`DBDeadLock`). This was an oversight that allowed the related bug to
ocurr and lead to errors reaching Neutron when they could have been
handled at a lower level. In addition to this problem, some of the
functions tried to retry without a proper `SAVEPOINT` or transaction
that would allow the retry. Moreover, the retries were often made at a
very low level, when it should have been at a higher level where the
operation is retried as a whole and not "atomic" operations.
This patch allows the inclusion of an `exception_checker` based on the
Neutron library that handles these DB exceptions + a MySQL issue that
is triggered by `DBDeadLock`s happening (see neutron bug #1590298). It
also keeps the handling of these exceptions at the networking_odl
level because we need to do a best effort of allowing to succeed without
having to trigger a rollback of the Neutron action which would be much
costly performance wise. This retry, however is done whenever possible
at the highest level that makes sense, including `SAVEPOINT`s and
transactions depending on the need.
Also, fixes some issues where some of the operations that the driver
does were not able to be retried because of incorrect handling of
exceptions.
Change-Id: I31085cf73618df48f55f3169e071d2cb64c9b018
Closes-Bug: #1714898
(cherry picked from commit 75c8962918d47978ca3fcf7fbfcfcb40a156d802)
Reviewed: https:/ /review. openstack. org/516001 /git.openstack. org/cgit/ openstack/ networking- odl/commit/ ?id=7f9a439aea1 5f02c2c2822231f 6604c5f7435bc8
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit 7f9a439aea15f02 c2c2822231f6604 c5f7435bc8
Author: Michel Peterson <email address hidden>
Date: Mon Sep 4 17:45:38 2017 +0300
Fixes error handling of DB calls
There are functions that are wrapped with a `wrap_db_retry` because they
are part of a transaction happening at a higher level inside Neutron. The
problem with wrapping it with that decorator is that without specifying
an `exception_checker` then it only handles `RetryRequests` and not
other types of exceptions that are expected to be received (ie:
`DBDeadLock`). This was an oversight that allowed the related bug to
ocurr and lead to errors reaching Neutron when they could have been
handled at a lower level. In addition to this problem, some of the
functions tried to retry without a proper `SAVEPOINT` or transaction
that would allow the retry. Moreover, the retries were often made at a
very low level, when it should have been at a higher level where the
operation is retried as a whole and not "atomic" operations.
This patch allows the inclusion of an `exception_checker` based on the
Neutron library that handles these DB exceptions + a MySQL issue that
is triggered by `DBDeadLock`s happening (see neutron bug #1590298). It
also keeps the handling of these exceptions at the networking_odl
level because we need to do a best effort of allowing to succeed without
having to trigger a rollback of the Neutron action which would be much
costly performance wise. This retry, however is done whenever possible
at the highest level that makes sense, including `SAVEPOINT`s and
transactions depending on the need.
Also, fixes some issues where some of the operations that the driver
does were not able to be retried because of incorrect handling of
exceptions.
Change-Id: I31085cf73618df 48f55f3169e071d 2cb64c9b018 8ca3fcf7fbfcfcb 40a156d802)
Closes-Bug: #1714898
(cherry picked from commit 75c8962918d4797