You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/08/04 10:46:00 UTC

[GitHub] [airflow] feluelle commented on a change in pull request #10151: Acquire lock on db for the time of migration

feluelle commented on a change in pull request #10151:
URL: https://github.com/apache/airflow/pull/10151#discussion_r464960841



##########
File path: airflow/migrations/env.py
##########
@@ -98,7 +98,19 @@ def run_migrations_online():
         )
 
         with context.begin_transaction():
+            if connection.dialect.name == 'mysql' and \
+                    connection.dialect.server_version_info[0] == 5 and \
+                    connection.dialect.server_version_info[1] == 7:

Review comment:
       ```suggestion
                       connection.dialect.server_version_info >= (5, 6):
   ```

##########
File path: airflow/migrations/env.py
##########
@@ -98,7 +98,19 @@ def run_migrations_online():
         )
 
         with context.begin_transaction():
+            if connection.dialect.name == 'mysql' and \
+                    connection.dialect.server_version_info[0] == 5 and \
+                    connection.dialect.server_version_info[1] == 7:
+                connection.execute(
+                    "select GET_LOCK('alembic',1800);"
+                )
             context.run_migrations()
+            if connection.dialect.name == 'mysql' and \
+                    connection.dialect.server_version_info[0] == 5 and \
+                    connection.dialect.server_version_info[1] == 7:

Review comment:
       ```suggestion
                       connection.dialect.server_version_info >= (5, 6):
   ```




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org