Fix total_entries inflation in GET /api/v2/importErrors when file has multiple DAGs#67640
Open
GayathriSrividya wants to merge 3 commits into
Open
Fix total_entries inflation in GET /api/v2/importErrors when file has multiple DAGs#67640GayathriSrividya wants to merge 3 commits into
GayathriSrividya wants to merge 3 commits into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
Pedrinhonitz
suggested changes
May 28, 2026
| @@ -0,0 +1 @@ | |||
| Fixed ``total_entries`` inflation in ``GET /api/v2/importErrors`` when one file contains multiple DAGs. | |||
Contributor
There was a problem hiding this comment.
We don't need this for this type of correction; please remove or revert. Check newsfragment PR number / check-newsfragment-pr-number (pull_request)
Please also ensure that all quality tests are completed successfully. (Tests (AMD) / CI image checks / Static checks (pull_request))
added 3 commits
May 30, 2026 17:53
… multiple DAGs When a single import-error file mapped to N DAGs, the previous query JOINed ParseImportError with file_dags_cte producing N rows per error. paginated_select then counted those N rows, inflating total_entries and applying LIMIT/OFFSET against joined rows rather than distinct errors. Fix uses a two-query approach: 1. dedup_stmt with DISTINCT - one row per import error for correct count and pagination via paginated_select 2. import_errors_stmt - full join only for the paginated IDs to gather dag_id associations for authorization/stacktrace redaction Closes apache#67525
92898f2 to
5fbc84e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a single import-error file mapped to N DAGs, `GET /api/v2/importErrors` returned an inflated `total_entries` (N× the real count) and incorrect pagination behaviour.
Root cause: The query JOINed `ParseImportError` with `file_dags_cte` (one row per DAG per file), producing N rows per import error. `paginated_select` counted those N rows and applied `LIMIT`/`OFFSET` against joined rows rather than distinct import-error objects.
Fix: Two-query approach:
Tests: Added regression test `test_total_entries_counts_distinct_import_errors_when_file_has_multiple_dags` that creates one `ParseImportError` with three associated `DagModel` rows and asserts `total_entries == 1` and the list endpoint returns exactly one entry with `limit=1`.
closes: #67525
Was generative AI tooling used to co-author this PR?
Generated-by: GitHub Copilot (Claude Sonnet 4.6) following the guidelines