Dcdbsync uses reflection to get the schema of a keystone table.
Following SQLAlchemy upversion to 1.4, it was possible to access a
table metadata before it was loaded, resulting in the absence of
columns in that object and a wrong query to be executed. This commit
fixes this by introducing a mutex when accessing and writing to the
metadata object, guaranteeing tables will be properly loaded before
executing a query.
Test plan:
- PASS: Apply the fix in a system where the concurrent issue was
happening and verify all queries were correctly executed and
all columns were loaded.
- PASS: Verify in a large scale lab that no performance degradation
was introduced by this change.
Closes-bug: 2107969
Change-Id: Ida998b206eaeabffffda66cbb59cdad8e0ad49d2
Signed-off-by: Victor Romano <victor.gluzromano@windriver.com>