Repository navigation
Conversation
The image page answers at most the newest 1,000 tags and 1,000 manifests (#240), but browse_images still loaded the whole image on every request: oci_dao::image_manifests had no LIMIT, aggregated every tag and ran a children subquery per manifest, and the server built an item and the digest map for every row before it truncated; a group did so once per serving member. oci_dao::image_listing reads, of each repository serving the image, its newest 1,000 tagged manifests with their tags and its newest 1,000 manifests, through a new index (repository, image, push time), and the rest by key from them: the children an index is sized by, and for a group's lower priority member the tags and digests the members before it hide. oci_dao::image_totals counts the image from its index entries for tags_total and manifests_total. The page of an image within the bounds is what it was. Fixes #561 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJXrgzr2cNFuUgGtMFj
schmitch
added this pull request to the merge queue
Nov 17, 2026
Any commits made after this event will not be merged.
This branch has not been deployed
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.
Fixes #561
The problem
The image page (
GET /browse/images/{repo}/{*image}) answers at most the newest 1,000 tags and 1,000 manifests (#240), butbrowse_imagesstill loaded the whole image on every request:oci_dao::image_manifestshad noLIMIT, aggregated every tag and ran a children subquery per manifest, and the server built an item and the digest map for every row before it truncated. A group did so once per serving member.The change
oci_dao::image_listingreplacesimage_manifests(its only caller was the image page). Of one repository serving the image it returns the newest 1,000 tagged manifests with their tags (untagged_since IS NULL, whichset_tag/delete_tagkeep exact) and the newest 1,000 manifests. Everything else is read by key from those rows: the tags, an index's children, and the children's summaries (an index is sized by children the listing may have no room for, so the handler no longer needs every row for its digest map).oci_dao::image_totalscounts the image fortags_totalandmanifests_total.0020addsoci_manifest_newest_idx (repository_id, image, created_at DESC, digest). No index knew a manifest's age, so "the newest N" could only be found by reading the image. The migration builds it in its transaction, which blocks pushes of manifests while it runs on a large table.list_tags(the bounding and badging of Image detail page matches every tag against every manifest and pages nothing, so a large image blocks a runtime thread for seconds per request #240) is unchanged; it is now given the newest instead of everything.What the page answers
MAX_DETAIL_TAGSsays so.Query plans
PostgreSQL 18, one image of 50,000 manifests, each tagged, 4,000 child references, in a table of 180,000 manifests:
GroupAggregate, a children subplan per manifest, sortIndex Scans onoci_manifest_newest_idxstopped byLIMIT, then nested loops by key (oci_tag_manifest_idx,oci_manifest_ref_pkey, the unique(repository_id, image, digest))Index Only Scanof the image's entries (no heap fetches), 28 ms for the 50,000. This part still grows with the image, as the issue'sCOUNT(*)does.oci_manifest, and the planner hash-joined them to a sequential scan of the whole table. The lookups are lateral subqueries now, so they can only run once per listed row.Tests
crates/db/tests/oci_image_page.rs(real Postgres): listing 1,000 of 30,000 manifests reads fewer than 10,000oci_manifestrows and index entries and returns the newest with their tags; the totals; a lower priority repository lists and counts only what it adds, with an index's children read across both. It is a test binary of its own because the 30,000-manifest image changes the plansoci_images.rscounts rows of.crates/server/tests/registry.rs: an image past the bounds over HTTP (totals, the newest 1,000 tags by name, their manifests newest first, an index sized by children that are not listed, an image with 3 old tags and 1,500 newer untagged manifests), and a group over two members past the bounds (shared tag, shared digests, totals, sources).Run locally, all passing:
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo xtask unused,cargo xtask doc-check,cargo xtask changelog --check,cargo xtask docs --check,cargo sqlx prepare --check --workspace,cargo test -p forge-dbandcargo test -p forge-server(Postgres 18 and versitygw throughmirror.gcr.io). After the rebase onto #902 I re-ran the lints, the sqlx check,forge-dband the server'sregistrybinary, not the whole server suite.Not run locally: the other crates' suites,
forge-e2e, and the web checks (no file underweb/changes; the response's shape is the same).Generated by Claude Code