You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2022/08/15 18:45:09 UTC
[airflow] 33/45: Adding mysql index hint to use index on task_instance.state in critical section query (#25673)
This is an automated email from the ASF dual-hosted git repository.
ephraimanierobi pushed a commit to branch v2-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit cf448ea1746a05ddd2cbb6005f7c238e69083d0f
Author: Michael Petro <40...@users.noreply.github.com>
AuthorDate: Fri Aug 12 07:28:55 2022 -0400
Adding mysql index hint to use index on task_instance.state in critical section query (#25673)
(cherry picked from commit 134b5551db67f17b4268dce552e87a154aa1e794)
---
airflow/jobs/scheduler_job.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/airflow/jobs/scheduler_job.py b/airflow/jobs/scheduler_job.py
index 539e6f1eff..888922840b 100644
--- a/airflow/jobs/scheduler_job.py
+++ b/airflow/jobs/scheduler_job.py
@@ -314,6 +314,7 @@ class SchedulerJob(BaseJob):
# and the dag is not paused
query = (
session.query(TI)
+ .with_hint(TI, 'USE INDEX (ti_state)', dialect_name='mysql')
.join(TI.dag_run)
.filter(DR.run_type != DagRunType.BACKFILL_JOB, DR.state == DagRunState.RUNNING)
.join(TI.dag_model)