paolofacchinetti commented on issue #65350:
URL: https://github.com/apache/airflow/issues/65350#issuecomment-4313904469

   as @florian-meyrueis-al said, can also attest that my migration was stuck at 
line:
   
   ```
   Running upgrade 6709f7a774b9 -> 02ca36b0235b, Fix fab db inconsistencies. 
[alembic.runtime.migration] loc=migration.py:621
   ```
   
   
   Querying pg_stat_activity + pg_blocking_pids() showed the migration blocked 
by an unrelated session that had been idle in transaction for ~28 minutes, 
holding locks from a FAB permission lookup (SELECT joining ab_user, ab_role, 
ab_permission, ab_view_menu). pg_terminate_backend() on the blocking PID 
unblocked the migration and it completed immediately.
   
   ```
   BLOCKED SESSION (migration)
   ─────────────────────────────────────────────────────────────────────────
     pid              : 3089
     user             : postgres
     state            : active
     wait_event_type  : Lock
     wait_event       : relation
     query            : ALTER TABLE ab_permission_view_role
                        DROP CONSTRAINT ab_permission_view_role_role_id_fkey
   
   BLOCKING SESSION
   ─────────────────────────────────────────────────────────────────────────
     pid              : 32659
     user             : postgres
     state            : idle in transaction
     xact_age         : 00:28:43
     query            : SELECT ab_user_1.id         AS ab_user_1_id,
                               ab_role.id          AS ab_role_id,
                               ab_role.name        AS ab_role_name,
                               ab_permission_1.id  AS ab_permission_1_id,
                               ab_permission_1.name AS ab_permission_1_name,
                               ab_view_menu_1.id   AS ...
                        [truncated — FAB permission lookup joining
                         ab_user / ab_role / ab_permission / ab_view_menu]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to