[Bug][dora] calculateChangeLeadTime loads the whole commits_diffs deployment join into memory
I maintainer di solito rispondono entro 2 giorni
Una pull request collegata è già stata integrata.
- #9281 di @mdelacruz-avantio — integrata
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- go
- Ambito
- backend, data-engineering
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 3.2k
- Fork
- 832
- Merge medio
- 2g 6h
- PR unite (30g)
- 62
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/devlake
-
type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
I maintainer di solito rispondono entro 2 giorni
-
[Bug][claude_code] Incremental collection stops after the first runForse già presa @clementsen l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 32/100
I maintainer di solito rispondono entro 2 giorni
-
type/bug
Difficoltà 3/5 Mezza giornata Idoneità per principianti 73/100
I maintainer di solito rispondono entro 2 giorni
-
[Refactor][Build] Build the core and all plugins into a single binary by defaultForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertacomponent/plugins type/refactor
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
apache/devlake#9276 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di apache/devlake
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
YoanWai/agent-manager#948 ·
I maintainer di solito rispondono entro 1 giorno
-
area: platform priority: normal
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
margince/margince#9851 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Headerless responses block while skipping duplicate status linesForse già presa @mynhe l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
projectdiscovery/rawhttp#554 ·
-
type:chore
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
nightgauge/nightgauge#2793 ·
I maintainer di solito rispondono entro 1 giorno
-
stage-fail
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
siyuan-note/bazaar#2447 ·
I maintainer di solito rispondono entro 1 giorno