Project

Profile

Help

Story #4871

closed

When changing unit_key_fields, the relevant DB units may need to be prepared during migration BEFORE indexes are applied

Added by quba42 almost 5 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
2.20.0
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
Pulp 2
Sprint:
Sprint 53
Quarter:

Description

pulp-manage-db currently creates indexes before migrations are run.
In most cases this is desirable behaviour since it ensures Mongo will enforce uniqueness constraints (see https://pulp.plan.io/issues/4055).

However, when dropping a field from the unit_key_fields of a DB model, this means that the new key is applied (as an index) BEFORE the migration has had a chance to prepare the existing units for the new key.
This can easily turn previously unique units into duplicates, thus breaking any attempt to migrate them.
This makes it essentially impossible to change a unit key in this way.

Also available in: Atom PDF