airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-3001) Accumulative tis slow allocation of new schedule
Date Mon, 10 Sep 2018 08:16:00 GMT

    [ https://issues.apache.org/jira/browse/AIRFLOW-3001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16608853#comment-16608853
] 

ASF GitHub Bot commented on AIRFLOW-3001:
-----------------------------------------

ubermen closed pull request #3840: [AIRFLOW-3001] Add task_instance table index 'ti_dag_date'
URL: https://github.com/apache/incubator-airflow/pull/3840
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/migrations/versions/e3a246e0dc1_current_schema.py b/airflow/migrations/versions/e3a246e0dc1_current_schema.py
index 6c63d0a9dd..22624a4c8d 100644
--- a/airflow/migrations/versions/e3a246e0dc1_current_schema.py
+++ b/airflow/migrations/versions/e3a246e0dc1_current_schema.py
@@ -7,9 +7,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #   http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -176,6 +176,12 @@ def upgrade():
             ['dag_id', 'state'],
             unique=False
         )
+        op.create_index(
+            'ti_dag_date',
+            'task_instance',
+            ['dag_id', 'execution_date'],
+            unique=False
+        )
         op.create_index(
             'ti_pool',
             'task_instance',
@@ -269,6 +275,7 @@ def downgrade():
     op.drop_index('ti_state_lkp', table_name='task_instance')
     op.drop_index('ti_pool', table_name='task_instance')
     op.drop_index('ti_dag_state', table_name='task_instance')
+    op.drop_index('ti_dag_date', table_name='task_instance')
     op.drop_table('task_instance')
     op.drop_table('slot_pool')
     op.drop_table('sla_miss')
diff --git a/airflow/models.py b/airflow/models.py
index 2096785b41..c41f2a9dbe 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -880,6 +880,7 @@ class TaskInstance(Base, LoggingMixin):
 
     __table_args__ = (
         Index('ti_dag_state', dag_id, state),
+        Index('ti_dag_date', dag_id, execution_date),
         Index('ti_state', state),
         Index('ti_state_lkp', dag_id, task_id, execution_date, state),
         Index('ti_pool', pool, state, priority_weight),


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


> Accumulative tis slow allocation of new schedule
> ------------------------------------------------
>
>                 Key: AIRFLOW-3001
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3001
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: scheduler
>    Affects Versions: 1.10.0
>            Reporter: Jason Kim
>            Assignee: Jason Kim
>            Priority: Major
>
> I have created very long term schedule in short interval. (2~3 years as 10 min interval)
> So, dag could be bigger and bigger as scheduling goes on.
> Finally, at critical point (I don't know exactly when it is), the allocation of new task_instances
get slow and then almost stop.
> I found that in this point, many slow query logs had occurred. (I was using mysql as
meta repository)
> queries like this
> "SELECT * FROM task_instance WHERE dag_id = 'some_dag_id' AND execution_date = ''2018-09-01
00:00:00"
> I could resolve this issue by adding new index consists of dag_id and execution_date.
> So, I wanted 1.10 branch to be modified to create task_instance table with the index.
> Thanks.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message