[stable-only] Use a separate transaction for reading after race
As part of data migration code to ensure a Project/User record,
integrated placement creates a record if it does not exist. However,
during a race situation, the logic to read back a record written by
a racing request fails because a change written in a separate
transaction will not be reflected in the current transaction when the
isolation level is REPEATABLE_READ (the default):
This changes the read after catching DBDuplicateEntry to occur in a
separate transaction so it can pick up the change written by the racing
parallel request.
Note: this is a stable-only change because the placement code
containing the bug was temporary data-transitioning code that no longer
exists in placement after Queens.
Reviewed: https:/ /review. opendev. org/756637 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=d696a636bbd 8c07bd8c609abfc b513453757b1fc
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit d696a636bbd8c07 bd8c609abfcb513 453757b1fc
Author: melanie witt <email address hidden>
Date: Thu Oct 8 02:41:02 2020 +0000
[stable-only] Use a separate transaction for reading after race
As part of data migration code to ensure a Project/User record,
integrated placement creates a record if it does not exist. However,
during a race situation, the logic to read back a record written by
a racing request fails because a change written in a separate
transaction will not be reflected in the current transaction when the
isolation level is REPEATABLE_READ (the default):
https:/ /dev.mysql. com/doc/ refman/ 8.0/en/ innodb- transaction- isolation- levels. html
This changes the read after catching DBDuplicateEntry to occur in a
separate transaction so it can pick up the change written by the racing
parallel request.
Note: this is a stable-only change because the placement code
containing the bug was temporary data-transitioning code that no longer
exists in placement after Queens.
Closes-Bug: #1731668
Change-Id: Ic90beaaa9848a4 f39f4223f31a55c d2c681959cd