Dev-iL commented on code in PR #59218:
URL: https://github.com/apache/airflow/pull/59218#discussion_r2646634110


##########
airflow-core/src/airflow/utils/db.py:
##########
@@ -1340,58 +1498,108 @@ def __str__(self):
 
 
 @contextlib.contextmanager
-def create_global_lock(
-    session: Session,
-    lock: DBLocks,
-    lock_timeout: int = 1800,
+def _create_global_lock_mysql(lock: DBLocks, lock_timeout: int) -> 
Generator[None, None, None]:
+    """
+    Create a global advisory lock for MySQL.
+
+    Uses a dedicated AUTOCOMMIT connection because:
+    - GET_LOCK is session-level, not transaction-level
+    - DDL operations cause implicit commits that would break transaction 
wrappers
+    """
+    server_version = settings.get_engine().dialect.server_version_info
+    if not (server_version and server_version >= (5, 6)):

Review Comment:
   Fixed.



##########
airflow-core/src/airflow/utils/db.py:
##########
@@ -1256,14 +1406,16 @@ def _handle_fab_downgrade(*, session: Session) -> None:
             fab_version,
         )
         return
-    connection = settings.get_engine().connect()
-    insp = inspect(connection)
-    if not fab_version and insp.has_table("ab_user"):
-        log.info(
-            "FAB migration version not found, but FAB tables exist. "
-            "FAB provider is not required for downgrade.",
-        )
-        return
+
+    # Use context manager to ensure connection is closed

Review Comment:
   Fixed



-- 
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