Merge "Fix race condition in backfill_version_column()"
This commit is contained in:
commit
3f8ddff37f
@ -1218,11 +1218,18 @@ class Connection(api.Connection):
|
||||
ids = []
|
||||
for obj in query.slice(0, max_to_migrate):
|
||||
ids.append(obj['id'])
|
||||
query = model_query(model).filter(model.id.in_(ids))
|
||||
|
||||
num_migrated = query.update(
|
||||
{model.version: mapping[model.__name__][0]},
|
||||
synchronize_session=False)
|
||||
num_migrated = (
|
||||
model_query(model).
|
||||
filter(sql.and_(model.id.in_(ids),
|
||||
model.version.is_(None))).
|
||||
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
|
||||
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…
Reference in New Issue
Block a user