Merge "Fix race condition in backfill_version_column()"
This commit is contained in:
commit
3f8ddff37f
@ -1218,11 +1218,18 @@ class Connection(api.Connection):
|
|||||||
ids = []
|
ids = []
|
||||||
for obj in query.slice(0, max_to_migrate):
|
for obj in query.slice(0, max_to_migrate):
|
||||||
ids.append(obj['id'])
|
ids.append(obj['id'])
|
||||||
query = model_query(model).filter(model.id.in_(ids))
|
num_migrated = (
|
||||||
|
model_query(model).
|
||||||
num_migrated = query.update(
|
filter(sql.and_(model.id.in_(ids),
|
||||||
{model.version: mapping[model.__name__][0]},
|
model.version.is_(None))).
|
||||||
synchronize_session=False)
|
update({model.version: mapping[model.__name__][0]},
|
||||||
|
synchronize_session=False))
|
||||||
|
else:
|
||||||
|
num_migrated = (
|
||||||
|
model_query(model).
|
||||||
|
filter(model.version.is_(None)).
|
||||||
|
update({model.version: mapping[model.__name__][0]},
|
||||||
|
synchronize_session=False))
|
||||||
|
|
||||||
total_migrated += num_migrated
|
total_migrated += num_migrated
|
||||||
max_to_migrate -= num_migrated
|
max_to_migrate -= num_migrated
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes an issue when running ``ironic-dbsync online_data_migrations``. The
|
||||||
|
value of an object's new ``version`` column might have been incorrectly
|
||||||
|
changed from a newer object version to an older object version, due to a
|
||||||
|
race condition. This is no longer the case.
|
Loading…
x
Reference in New Issue
Block a user