From 143db153e257f90d73e9f40e7007d8341a3398a4 Mon Sep 17 00:00:00 2001 From: zcx5674 Date: Sun, 9 Aug 2026 15:51:52 +0900 Subject: [PATCH 1/2] Fix Grid view failing to load large Dags on MySQL --- .../airflow/api_fastapi/core_api/routes/ui/grid.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py index 13326f68a33db..edcfdf051d69b 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py @@ -84,14 +84,12 @@ def _get_latest_serdag(dag_id, session): - serdag = session.scalar( - select(SerializedDagModel) - .where( - SerializedDagModel.dag_id == dag_id, - ) - .order_by(SerializedDagModel.id.desc()) - .limit(1) - ) + # Reuse latest_item_select_object: selecting the whole SerializedDagModel pulls the large + # data/data_compressed blob columns, and on MySQL the ORDER BY makes filesort load each + # candidate row (blob included) into the sort buffer, overflowing it with "Out of sort memory" + # for large serialized Dags. + # See https://github.com/apache/airflow/pull/55589 + serdag = session.scalar(SerializedDagModel.latest_item_select_object(dag_id)) if not serdag: raise HTTPException( status.HTTP_404_NOT_FOUND, From 47995a1b26a81475b53a171f9778ff8399876fbe Mon Sep 17 00:00:00 2001 From: zcx5674 Date: Mon, 10 Aug 2026 16:33:41 +0900 Subject: [PATCH 2/2] Remove unnecessary comment --- .../src/airflow/api_fastapi/core_api/routes/ui/grid.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py index edcfdf051d69b..48bd5971461c1 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py @@ -84,11 +84,6 @@ def _get_latest_serdag(dag_id, session): - # Reuse latest_item_select_object: selecting the whole SerializedDagModel pulls the large - # data/data_compressed blob columns, and on MySQL the ORDER BY makes filesort load each - # candidate row (blob included) into the sort buffer, overflowing it with "Out of sort memory" - # for large serialized Dags. - # See https://github.com/apache/airflow/pull/55589 serdag = session.scalar(SerializedDagModel.latest_item_select_object(dag_id)) if not serdag: raise HTTPException(