Re: [Django] #34697: Migration serializer for sets results in non-deterministic order.

8 views
Skip to first unread message

Django

unread,
Jul 11, 2023, 1:44:36 PM7/11/23
to django-...@googlegroups.com
#34697: Migration serializer for sets results in non-deterministic order.
--------------------------------------+------------------------------------
Reporter: Yury V. Zaytsev | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Yury V. Zaytsev):

Thank you for your thoughts, Simon!

> I'm curious of where you experience the flip-flop though. Are you
generating the same migrations over and over again?

Yes, your assessment is correct. We are only having these problems in the
projects, in which we are using Django as a static site or configuration
generator. In these projects we basically have the databases in YAML
fixtures with changes workflow controlled by GitHub pull requests.

If we change the code of the generator itself (and specifically Django
models), then we re-create the migrations completely, because keeping
migration history just doesn't make sense. There is no "real" database to
migrate in the first place, they just bloat the repository and slow the
generators down... It's working quite nicely and the diffs are very
readable, if it weren't for annoying flip-flop hunks, which one always has
to remember to discard from the checkout before committing the changes.

I guess not many people use Django like this, but it seems that we are not
completely alone, and by the way... did I already mention that Django is
awesome?

> I think this is something that should be considered in another ticket
but that we could ultimately do. The fact they are currently stored in a
list today provides a false sense that their ordering is meaningful while
it's not actually the case.

I've had a look at the code after I voiced the idea, and I agree with you,
that if this is to be done, then better in a different ticket.
Unfortunately, this part of the class is templated in a different fashion
than all the rest, and just turning dependencies into a set and hoping
that my new serializer with take care of that won't fly. It seems that
it's actually quite some work to do it properly... but I agree, that
generally it's desirable, because I like your point of having the types to
convey the semantic.

If there is anything else I can do that would be helpful to you according
to Django process to get this in, please feel free to ping me.

--
Ticket URL: <https://code.djangoproject.com/ticket/34697#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 11, 2023, 1:51:50 PM7/11/23
to django-...@googlegroups.com
#34697: Migration serializer for sets results in non-deterministic order.
--------------------------------------+------------------------------------
Reporter: Yury V. Zaytsev | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Yury V. Zaytsev):

[https://github.com/django/django/pull/17066 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/34697#comment:6>

Django

unread,
Jul 11, 2023, 2:47:22 PM7/11/23
to django-...@googlegroups.com
#34697: Migration serializer for sets results in non-deterministic order.
--------------------------------------+------------------------------------
Reporter: Yury V. Zaytsev | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Simon Charette):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/34697#comment:7>

Django

unread,
Jul 12, 2023, 2:36:56 AM7/12/23
to django-...@googlegroups.com
#34697: Migration serializer for sets results in non-deterministic order.
-------------------------------------+-------------------------------------

Reporter: Yury V. Zaytsev | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Migrations | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/34697#comment:8>

Django

unread,
Jul 12, 2023, 8:32:09 AM7/12/23
to django-...@googlegroups.com
#34697: Migration serializer for sets results in non-deterministic order.
-------------------------------------+-------------------------------------
Reporter: Yury V. Zaytsev | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Migrations | Version: 4.2
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"02966a30dd31d2b9d35f8c481a448b9bf377895e" 02966a3]:
{{{
#!CommitTicketReference repository=""
revision="02966a30dd31d2b9d35f8c481a448b9bf377895e"
Fixed #34697 -- Fixed non-deterministic order of dependencies and
sets/frozensets in migrations.

Co-authored-by: Dakota Hawkins <dakota...@gmail.com>
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34697#comment:9>

Reply all
Reply to author
Forward
0 new messages