#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
     Reporter:  Jayden Kneller  |                    Owner:  Augusto Pontes
         Type:  Bug             |                   Status:  assigned
    Component:  Migrations      |                  Version:  dev
     Severity:  Normal          |               Resolution:
     Keywords:  squashed        |             Triage Stage:  Accepted
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

 So, after getting the test project down to 3 apps and 7 total migrations,
 I've tracked the issue down to the order that
 `self.graph.remove_replaced_nodes(key, migration.replaces)` gets called,
 which is determined by the order of `self.replacements.items()`, which is
 determined by the order of `migration_names`.  If the second migration in
 app_one is added to `self.replacements` before the first migration, since
 dictionaries are now ordered by default, then a cyclic dependency error
 occurs 100% of the time.  To confirm this you can rename migration
 `0002_squashed_initial`  to `0000_squashed_initial` and call `show_issue
 --use-fixed`.

 If it is possible to mock the results that `self.replacements.items()`
 returns, then I we could have a test that guarantees the results of either
 a pass or CircularDependencyError based on the order of the migrations we
 return, but with the migration names being a set right now, that mock
 would still be susceptible to it only giving the result we want 50% of the
 time.  So, how do we write a test that will fail if the migration names is
 a set?

 Or, perhaps a better fix than making the migration names into a list,
 would be for self.replacements to be added to in the order that migrations
 would run.  But, I'm not sure how easy that would be.

 Any ideas for how to do a test?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:24>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070199e875d51e-b9fe87eb-cae6-4f88-93b5-1c88ff47f6f6-000000%40eu-central-1.amazonses.com.

Reply via email to