[Bug][dora] calculateChangeLeadTime loads the whole commits_diffs deployment join into memory
Les mainteneurs répondent en général sous 2 jours
Une pull request liée a déjà été fusionnée.
- #9281 par @mdelacruz-avantio — fusionnée
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 25/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- go
- Domaine
- backend, data-engineering
Piste de recherche
Start with batchFetchDeployments in backend/plugins/dora/tasks/change_lead_time_calculator.go and inspect how the second phase joins cicd_deployment_commits with commits_diffs. The issue proposes streaming rows into a three-column struct while preserving the joins, filters, ordering, and first-wins tie-break; an open pull request already tracks this work. Done means memory scales with distinct merge commits and the tie-break has an end-to-end test.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Search before asking
- I had searched in the issues and found no similar issues.
What happened
batchFetchDeployments in backend/plugins/dora/tasks/change_lead_time_calculator.go resolves merge commits to deployments in two phases. The second phase joins cicd_deployment_commits with commits_diffs, loads every joined row into a slice of full CicdDeploymentCommit structs with db.All, and only then keeps the first row per merge commit in Go.
Memory therefore grows with the size of the join, not with the number of merge commits. The join has one row per commit between a production deployment and its previous successful one, for every merge commit in that range. On a project where deployments are far apart in commit history, or where a deployment job records a commit from a second repository with a long history, the join becomes very large.
On our instance the query returns about 936,000 rows for 14,088 distinct merge commits (1,693 production deployment commits). The lake container peaks at about 1.7 GiB in this subtask, is OOMKilled at a 2 GiB limit on every nightly run, and then crash loops because each restart resumes the same pipeline at the same subtask. The row count grows every week.
What do you expect to happen
The memory used by this subtask stays proportional to the number of distinct merge commits, as the first phase already does, whatever the size of the commits_diffs join.
How to reproduce
- A project with a few hundred production deployment commits where consecutive deployments are thousands of commits apart, so
commits_diffsholds many rows per deployment pair. - Run the DORA pipeline and watch the lake container memory during
calculateChangeLeadTime, or count the rows the second phase loads:
SELECT COUNT(*), COUNT(DISTINCT cd.commit_sha)
FROM cicd_deployment_commits dc
LEFT JOIN cicd_deployment_commits p ON dc.prev_success_deployment_commit_id = p.id
INNER JOIN commits_diffs cd ON cd.new_commit_sha = dc.commit_sha AND cd.old_commit_sha = COALESCE(p.commit_sha, '')
LEFT JOIN project_mapping pm ON pm.table = 'cicd_scopes' AND pm.row_id = dc.cicd_scope_id
WHERE dc.prev_success_deployment_commit_id <> '' AND dc.environment = 'PRODUCTION' AND dc.result = 'SUCCESS' AND pm.project_name = '<project>';
The first number is what the subtask materialises, the second is what it keeps.
Anything else
Streaming the second phase with db.Cursor and db.Fetch into a three-column struct and keeping the first row per merge commit, with the same joins, filters and ordering, makes the memory independent of the join size. I will open a pull request with that change and an e2e case for the first-wins tie-break.
Raising the container memory limit and setting GOMEMLIMIT is a stopgap only, the peak keeps growing with the join.
Version
v1.0.3-beta18. The function is unchanged on main at 625e512a4.
- Langage dominant
- Go
- Étoiles
- 3.2k
- Forks
- 832
- Merge moyen
- 2 j 6 h
- PR mergées (30 j)
- 62
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/devlake
-
type/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 60/100
Les mainteneurs répondent en général sous 2 jours
-
[Bug][claude_code] Incremental collection stops after the first runPeut-être pris @clementsen l’a pris il y a 1 jour. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 32/100
Les mainteneurs répondent en général sous 2 jours
-
type/bug
Difficulté 3/5 Une demi-journée Accessibilité débutants 73/100
Les mainteneurs répondent en général sous 2 jours
-
[Refactor][Build] Build the core and all plugins into a single binary by defaultPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouvertecomponent/plugins type/refactor
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
apache/devlake#9276 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de apache/devlake
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
lognorman20/monaco#7428 ·
-
docs(prompts): IF BLOCKED workflow-scope branch says to comment on the issue on jira/local trackersOuverteagent-butler-finding bug
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
jordansmall/spindrift#6238 ·
Les mainteneurs répondent en général sous 1 jour
-
bug: microcks test get swallows test failure details and operation results in text output modeOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
microcks/microcks-cli#608 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug from-studio
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
esengine/DeepSeek-Reasonix#14868 ·
Les mainteneurs répondent en général sous 1 jour