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 2021/06/07 15:50:55 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #16311: Prevent running `airflow db init` migrations and setup in parallel.

uranusjr commented on a change in pull request #16311:
URL: https://github.com/apache/airflow/pull/16311#discussion_r646723245



##########
File path: airflow/utils/db.py
##########
@@ -561,10 +571,21 @@ def create_default_connections(session=None):
     )
 
 
-def initdb():
+@provide_session
+def initdb(session=None):
     """Initialize Airflow database."""
+    if session.connection().dialect.name == 'postgresql':
+        log.info('Acquiring lock on database')
+    session.connection().execute('select PG_ADVISORY_LOCK(1);')

Review comment:
       Shouldn’t this be inside the block instead? (Indented one level in.)




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