Skip to content

feat(backend): sync git commit metadata into commits tables (#2079) - #2118

Open
felipebergamin wants to merge 5 commits into
kernelci:mainfrom
profusion:feat/2079/sync-commit-metadata
Open

felipebergamin wants to merge 5 commits into
kernelci:mainfrom
profusion:feat/2079/sync-commit-metadata

Conversation

@felipebergamin

@felipebergamin felipebergamin commented Sep 15, 2026

Copy link
Copy Markdown
Member

TL;DR

Fill commits / commit_parents from git objects, not KCIDB. A persistent bare mirror at GIT_MIRROR_DIR fetches allowlisted trees; a second cron ingests the tip delta from that mirror (ancestor closure, not DISTINCT checkouts.git_commit_hash). Does not write checkouts.git_commit_message.

Closes #2109. Part of #2079. Schema #2089 and parse helper #2090 are still on this branch if they have not merged yet.

How to review

Read in this order:

  1. docs/sync-commits.md — decisions (filter probe, kernel.org full packs, no googlesource remap, pack rollback vs keep-on-FAILED).
  2. backend/kernelCI_app/helpers/gitCommit.py — parse + one-shot SHA fetch ([#2079] Fetch commit metadata via SHA-only partial clone on tmpfs #2090).
  3. backend/kernelCI_app/helpers/commitSync.py — mirror fetch + ingest.
  4. sync_commit_mirror.py / sync_commit_ingest.py — two crons (0 4 fetch, 0 10 ingest).
  5. Tests: commitSync_test.py, gitCommit_test.py.

Skip unless you care about ops: compose git-mirror volume, .env*.example, measure_git_mirror.py.

Behavior that changed since the first PR description

  • Two commands, not sync_commits + flags: sync_commit_mirror and sync_commit_ingest.
  • Servers without fetch=filter (git.kernel.org) still fetch; --filter=tree:0 only when advertised. No URL remap.
  • HTTP/1.1 + large postBuffer; keep completed packs on transport FAILED and retry once; kill the git process group on timeout.
  • Ingest watermark: rev-list --remotes with ^sha on stdin. --not --stdin does not exclude tips (that bug re-listed ~1.9M commits every run).
  • --fill-gaps stays on ingest (one-shot SHA, no ancestry).

Risk / rollout

  • First populate: ~6–8 GiB mirror, ~1.9M commits to ingest once. Later runs should be near-zero without a new fetch.
  • Do not run mirror and ingest on the same GIT_MIRROR_DIR at the same time.
  • Recreate the git-mirror volume if an old unfiltered pack slipped in during early runs.
  • Migration 0021 is additive; no checkout column rewrite.

Test plan

  • poetry run pytest kernelCI_app/tests/unitTests/helpers/commitSync_test.py kernelCI_app/tests/unitTests/helpers/gitCommit_test.py
  • manage.py sync_commit_mirror --dry-run then manage.py sync_commit_ingest --dry-run
  • Second ingest without a new fetch logs 0 new commits (known_tips > 0)
  • One failed remote does not abort the rest
  • Skipped intermediate commit between two checkouts still lands with first-parent ord=0

alanpeixinho and others added 5 commits September 9, 2026 16:43
* Add `Commits` model: unique `git_commit_hash`, nullable author/committer/subject/message/`fetched_from_url`
* Add `CommitParents` model: FKs to `commits.id`, `ord` with 0 = first parent, unique `(commit_id, ord)`
* Add migration `0021_commits_and_commit_parents` (`commits`, `commit_parents` tables and indexes)
* Join from `checkouts.git_commit_hash` without new checkout columns

Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
Dump commits and commit_parents in full so git ancestry survives restore.

Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
Add a SHA-only helper for commit author/parents so later sync can reuse parsing without duplicating git format handling.

Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
…nelci#2079)

Fetch allowlisted trees into GIT_MIRROR_DIR and ingest the tip delta into commits / commit_parents (not checkout hashes). Probe filter support, keep kernel.org packs, split mirror vs ingest crons, and exclude stored tips with ^sha on rev-list stdin.

Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
@felipebergamin
felipebergamin force-pushed the feat/2079/sync-commit-metadata branch from 2185f8e to 93ed169 Compare September 18, 2026 19:04
@felipebergamin
felipebergamin marked this pull request as ready for review September 21, 2026 19:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[#2079] Sync mirrored trees into commits

2 participants