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


##########
airflow-core/src/airflow/utils/db.py:
##########
@@ -1345,18 +1490,59 @@ def create_global_lock(
     lock: DBLocks,
     lock_timeout: int = 1800,
 ) -> Generator[None, None, None]:
-    """Contextmanager that will create and teardown a global db lock."""
-    bind = session.get_bind()
-    if hasattr(bind, "connect"):
-        conn = bind.connect()
-    else:
-        conn = bind
+    """
+    Contextmanager that will create and teardown a global db 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
+
+    For PostgreSQL, uses transactional advisory locks as before.
+    """
     dialect_name = get_dialect_name(session)
-    try:
-        if dialect_name == "postgresql":
+
+    if dialect_name == "mysql":

Review Comment:
   Fixed locally, changes will be visible after the next rebase.



##########
airflow-core/src/airflow/utils/db_manager.py:
##########
@@ -48,6 +49,24 @@ def __init__(self, session):
         super().__init__()
         self.session = session
 
+    def _is_mysql(self) -> bool:
+        """Check if the database is MySQL."""
+        return get_dialect_name(self.session) == "mysql"
+
+    def _release_metadata_locks(self) -> None:

Review Comment:
   Fixed locally, changes will be visible after the next rebase.



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