Repository navigation
Conversation
Loading a repository version for the solver bound one query parameter per content unit, scanned the version's content twice for packages, fetched fields nothing reads, wrote per-package decision dumps for every copy because SOLVER_DEBUG_LOGS defaulted to true, rebuilt the pool provides index once per module and default, and loaded a repeated version again for every config entry. Copy-all also resolved child content even though every child is already selected, which dominated a 46k-unit copy on the Katello box. Load packages, modules and defaults through the database-side unnest subquery, stop fetching unused fields and running no-op conversions, build the provides index once per load phase, load each version once, skip child resolution for copy-all, default the debug dumps off, and use RepositoryVersion.get_content() for version scoping. Measured on a 40,986-unit version: load is 3.5% faster with filelists and 6.5% faster without. Co-Authored-By: Claude Code <noreply@anthropic.com>
Dependency solving loaded every source and destination version into the solver even when the copy selected a handful of units, so the cost was paid whether or not the destination could satisfy the selection. Split the solver into a dependency resolver and a libsolv policy, and expose each repository version through a content source with three modes: the whole version, the selection, or an installed capability index. Load only the selected units, fetch providers of the capabilities the destination cannot satisfy on demand, follow rich-dependency operands and arch-qualified capabilities, link modular packages to their modules, and fall back to the full load for anything the partial pool cannot resolve faithfully. The index migration depends on the previous rpm migration alone, not on a core migration newer than the oldest supported pulpcore, so it applies on 3.118 deployments. Measured on a 40,986-unit version with a three-package selection and a full destination: the lazy attempt takes 7% of the full load's time (1.3 s vs 18.0 s) and builds 8 solvables instead of 70,711, resolving identical units. Co-Authored-By: Claude Code <noreply@anthropic.com>
A lazy attempt issued one provider lookup per capability per source. Scoping each lookup through the version's content-id array hashed that array per statement (42 ms per 50 capabilities at 9.5k units, 122 ms at 22k), and a second version-scoped strategy above a size threshold had to be kept in step for no benefit. Look providers up against the domain, filtered to the version by its id set, with the local domain column keeping the planner on the package table. Index the capability names of provides so a whole batch of names and provides is answered by one query, cache the units a lookup builds, defer path capabilities to one file scan per round, and price provider queries and module rows by measured cost in the work budget so an attempt that cannot beat the full load abandons early. One lookup path serves every version size: the membership set costs an order of magnitude less than the rows a full load would convert (6.8 MB vs 750 MB at 22k units). Resolve ids before materializing rows in name groups and installed lookups, which were reading every same-name package in the domain. Add a coverage map over the resolver transitions and input shapes, with meta-tests that fail when one loses its test or exclusion, and the transition tests that were missing. Drop the dead helpers the single path left behind. Measured on Alma 9 (two sources): systemd 90% faster (0.18 s vs 1.9 s), 389-ds-base + dnf 72% faster (1.5 s vs 5.3 s), a module + dnf selection 70% faster (1.6 s vs 5.3 s), with identical membership; worker peak RSS for a lazy selective copy is 54% lower (194 MB vs 418 MB) at 9.4k units. Co-Authored-By: Claude Code <noreply@anthropic.com>
When dependency solving is enabled, the resolver keys its candidates by source repository version: two entries sharing a source but targeting different destinations silently lost one destination, and two entries sharing the source and destination but selecting different content kept only the last selection. Normalize the config before resolving: entries sharing a source, destination and base version become one entry holding the union of their selections (an entry without a selection still copies everything), and a source paired with more than one destination is rejected. The viewset runs the same normalization so the request fails with a validation error before a task is dispatched. Co-Authored-By: Claude Code <noreply@anthropic.com>
pablomh
marked this pull request as draft
December 2, 2026 12:46
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.
Problem
Dependency solving loads every source and destination repository version into
libsolv before it can resolve anything, so a copy that selects a handful of units
pays for the full versions. The load path also bound one query parameter per
content unit, fetched fields nothing reads, rebuilt the provides index per module,
wrote per-package debug dumps by default, and reloaded a repeated version for
every config entry. Provider lookups were issued one capability at a time, and
copy entries that shared a source overwrote each other when solving was enabled.
Change
Four commits, each self-contained:
defaults through the database-side unnest subquery; drop unused fields and
no-op conversions; build the provides index once per load phase; load each
version once; skip child resolution for copy-all; default the debug dumps off.
libsolv policy; expose each version through a source with three modes (full
version, selection, installed capability index); fetch only providers the
destination cannot satisfy; follow rich-dependency operands and
arch-qualified capabilities; link modular packages to their modules; fall back
to the full load whenever the partial pool cannot resolve faithfully.
domain with the version id set as a filter; index the capability names of
provides so a batch of names and provides is one query; cache built units;
defer path capabilities to one file scan per round; price provider queries and
module rows in a work budget so an attempt that cannot beat the full load
abandons early; one lookup path for every version size. Add a coverage map
over resolver transitions and input shapes, with meta-tests that fail when a
transition loses its test or exclusion.
destination and base version become one entry with the union of their
selections; a source paired with more than one destination is rejected with a
validation error before a task is dispatched.
Migration
0075_package_provides_ginadds a concurrent expression GIN index over thecapability names of
provides(jsonb_path_query_array+jsonb_ops). Itdepends only on the previous rpm migration, so it applies on the oldest
supported pulpcore (3.118).
Results
The RSS figures compare the worker peak for the same selective copy. For the
22k-unit probe the full solve peaks at 750 MB and the lazy resolver at 285 MB;
the membership set itself is 6.8 MB, against the 750 MB of rows a full load
converts.
Every lazy result matched the full solve in the Katello end-to-end run, and the
differential check (
SOLVER_DIFFERENTIAL_CHECK) remains available as an opt-inverification. Budgets fall back to the full load rather than returning a partial
resolution.
Tests
Notes
source/destination/base match, reject when one source targets two
destinations.
dependency_solving=Falseis unchanged.#4680touches the same file; this branch will be rebased onto main after itlands (one import-block conflict).
🤖 Generated with Claude Code