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 2024/06/04 13:32:04 UTC
(airflow) 08/50: Remove unused index `idx_last_scheduling_decision` on `dag_run` table (#39275)
This is an automated email from the ASF dual-hosted git repository.
ephraimanierobi pushed a commit to branch v2-9-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 2e612ba99c66ae4422152d6d40c00304b78408d2
Author: Pankaj Koti <pa...@gmail.com>
AuthorDate: Wed May 1 01:27:41 2024 +0530
Remove unused index `idx_last_scheduling_decision` on `dag_run` table (#39275)
(cherry picked from commit 92ffab60049723a4a82fce7f256892fcd6a980d5)
---
...1_2_9_2_remove_idx_last_scheduling_decision_.py | 46 ++++++++++++++++++++++
airflow/models/dagrun.py | 1 -
airflow/utils/db.py | 1 +
docs/apache-airflow/img/airflow_erd.sha256 | 2 +-
docs/apache-airflow/img/airflow_erd.svg | 4 +-
docs/apache-airflow/migrations-ref.rst | 5 ++-
6 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/airflow/migrations/versions/0141_2_9_2_remove_idx_last_scheduling_decision_.py b/airflow/migrations/versions/0141_2_9_2_remove_idx_last_scheduling_decision_.py
new file mode 100644
index 0000000000..70923a4780
--- /dev/null
+++ b/airflow/migrations/versions/0141_2_9_2_remove_idx_last_scheduling_decision_.py
@@ -0,0 +1,46 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# 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
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Remove ``idx_last_scheduling_decision`` index on last_scheduling_decision in dag_run table
+
+Revision ID: bff083ad727d
+Revises: 677fdbb7fc54
+Create Date: 2024-04-26 12:58:00.594762
+
+"""
+
+from alembic import op
+
+
+# revision identifiers, used by Alembic.
+revision = "bff083ad727d"
+down_revision = "1949afb29106"
+branch_labels = None
+depends_on = None
+airflow_version = "2.9.2"
+
+
+def upgrade():
+ """Apply Remove idx_last_scheduling_decision index on last_scheduling_decision in dag_run table"""
+ op.drop_index("idx_last_scheduling_decision", table_name="dag_run")
+
+
+def downgrade():
+ """Unapply Remove idx_last_scheduling_decision index on last_scheduling_decision in dag_run table"""
+ op.create_index("idx_last_scheduling_decision", "dag_run", ["last_scheduling_decision"],
+ unique=False)
diff --git a/airflow/models/dagrun.py b/airflow/models/dagrun.py
index 20d92cfa95..522cb3e055 100644
--- a/airflow/models/dagrun.py
+++ b/airflow/models/dagrun.py
@@ -159,7 +159,6 @@ class DagRun(Base, LoggingMixin):
Index("dag_id_state", dag_id, _state),
UniqueConstraint("dag_id", "execution_date", name="dag_run_dag_id_execution_date_key"),
UniqueConstraint("dag_id", "run_id", name="dag_run_dag_id_run_id_key"),
- Index("idx_last_scheduling_decision", last_scheduling_decision),
Index("idx_dag_run_dag_id", dag_id),
Index(
"idx_dag_run_running_dags",
diff --git a/airflow/utils/db.py b/airflow/utils/db.py
index b7997498bb..2e30d84ffd 100644
--- a/airflow/utils/db.py
+++ b/airflow/utils/db.py
@@ -91,6 +91,7 @@ _REVISION_HEADS_MAP = {
"2.8.0": "10b52ebd31f7",
"2.8.1": "88344c1d9134",
"2.9.0": "1949afb29106",
+ "2.9.2": "bff083ad727d",
}
diff --git a/docs/apache-airflow/img/airflow_erd.sha256 b/docs/apache-airflow/img/airflow_erd.sha256
index 6f92939625..69c772e5b1 100644
--- a/docs/apache-airflow/img/airflow_erd.sha256
+++ b/docs/apache-airflow/img/airflow_erd.sha256
@@ -1 +1 @@
-17599c5958628056a2277267adf5320e4e09107d1ed8824fbb81fba937d0bf55
\ No newline at end of file
+00b4a76587ea1f5f2f317a555a083a0b4964c727d0a3c8c2044ac4f19c58abd4
\ No newline at end of file
diff --git a/docs/apache-airflow/img/airflow_erd.svg b/docs/apache-airflow/img/airflow_erd.svg
index 2dec3838a9..2b338b6d51 100644
--- a/docs/apache-airflow/img/airflow_erd.svg
+++ b/docs/apache-airflow/img/airflow_erd.svg
@@ -1361,7 +1361,7 @@
<g id="edge41" class="edge">
<title>task_instance--xcom</title>
<path fill="none" stroke="#7f7f7f" stroke-dasharray="5,2" d="M1198.1,-805.22C1228.72,-801.45 1260.55,-798.25 1290.36,-795.96"/>
-<text text-anchor="start" x="1259.36" y="-784.76" font-family="Times,serif" font-size="14.00">0..N</text>
+<text text-anchor="start" x="1280.36" y="-784.76" font-family="Times,serif" font-size="14.00">1</text>
<text text-anchor="start" x="1198.1" y="-794.02" font-family="Times,serif" font-size="14.00">1</text>
</g>
<!-- task_instance--xcom -->
@@ -1375,7 +1375,7 @@
<g id="edge43" class="edge">
<title>task_instance--xcom</title>
<path fill="none" stroke="#7f7f7f" stroke-dasharray="5,2" d="M1198.1,-831.83C1228.72,-828.75 1260.55,-825.32 1290.36,-821.86"/>
-<text text-anchor="start" x="1280.36" y="-825.66" font-family="Times,serif" font-size="14.00">1</text>
+<text text-anchor="start" x="1259.36" y="-825.66" font-family="Times,serif" font-size="14.00">0..N</text>
<text text-anchor="start" x="1198.1" y="-835.63" font-family="Times,serif" font-size="14.00">1</text>
</g>
<!-- task_instance--xcom -->
diff --git a/docs/apache-airflow/migrations-ref.rst b/docs/apache-airflow/migrations-ref.rst
index e8faea6d0d..6d60470a01 100644
--- a/docs/apache-airflow/migrations-ref.rst
+++ b/docs/apache-airflow/migrations-ref.rst
@@ -39,7 +39,10 @@ Here's the list of all the Database Migrations that are executed via when you ru
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
| Revision ID | Revises ID | Airflow Version | Description |
+=================================+===================+===================+==============================================================+
-| ``1949afb29106`` (head) | ``ee1467d4aa35`` | ``2.9.0`` | update trigger kwargs type and encrypt |
+| ``bff083ad727d`` (head) | ``1949afb29106`` | ``2.9.2`` | Remove ``idx_last_scheduling_decision`` index on |
+| | | | last_scheduling_decision in dag_run table |
++---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
+| ``1949afb29106`` | ``ee1467d4aa35`` | ``2.9.0`` | update trigger kwargs type and encrypt |
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
| ``ee1467d4aa35`` | ``b4078ac230a1`` | ``2.9.0`` | add display name for dag and task instance |
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+