Changes between Initial Version and Version 1 of Ticket #29721, comment 12


Ignore:
Timestamp:
Oct 7, 2026, 1:52:57 AM (8 hours ago)
Author:
Gavin Wahl(vendor)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29721, comment 12

    initial v1  
    11After #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
     3I 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 of record_migration. A unrecoverable hard crash can happen at any time, that's why we have transactions.
     4
     5I've reproduced the issue with a deferred_sql migration and tested this fix
     6Before: table created but migration not recorded. Migration "half applied" in inconsistent state.
     7After: The whole transaction rolled back, tables not created and migration not recorded. Migration correct "not applied", consistent state.
    28
    39
Back to Top