Changes between Version 2 and Version 3 of Ticket #29721, comment 12
- Timestamp:
- Oct 7, 2026, 2:05:37 AM (8 hours ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #29721, comment 12
v2 v3 1 1 After #32374, the bug still happens for migrations that use deferred sql (which is a lot, like CreateModel, AlterField...). Maybe BaseDatabaseSchemaEditor needs to take a record_migration callback so it can always be recorded in the atomic block? The deferred_sql check was kind of deeply coupled. 2 2 3 I believe the most realistic and reliable reproducible reproducer is to add `import os; os.kill(os.getpid(), 9) # simulate an hard crash during migration recording.` to the first line ofrecord_migration. A unrecoverable hard crash can happen at any time, that's why we have transactions.3 I believe the most realistic and reliable reproducible reproducer is to simulate a hard crash during migration recording by adding `import os; os.kill(os.getpid(), 9)` or `import sys; sys.exit()` to the first line of BaseDatabaseSchemaEditor.record_migration. A unrecoverable hard crash can happen at any time, that's why we have transactions. 4 4 5 5 I've reproduced the issue with a deferred_sql migration and tested this fix … … 71 71 }}} 72 72 73 Minimal model to get deferred_sql: 74 75 {{{#!python 76 from django.db import models 77 78 class Foo(models.Model): 79 a = models.ForeignKey('self', on_delete=models.CASCADE) 80 }}} 81