Skip to content

Conversation

@jlsherrill
Copy link
Member

@jlsherrill jlsherrill commented Dec 4, 2025

summary:

Pulp added a new column on repo versions "Content_ids" which should make querying versions for content faster. They did not, however, update previous versions to include these ids, leaving that column null.

This change checks to see if any of the repo versions wanting to be searched have a null content_ids column. If so we use the old method for searching. If not we use the new method. This does take an extra small query to figure it out, but is much simpler than trying to do it all in a single query.

The code was also written in a way that hopefully will be easy to clean up after ~August 1st, 2026

To Test:

  1. add this to your go.mod
replace github.com/content-services/tang => /path/to/pr/tang/

run:

go get ./...
make repos-import-rhel9
make process-repos
rm release/content-sources
make run
  1. let them snapshot and grab the UUIDs of the snapshots, either from the db or rest api:
select uuid from snapshots
  1. Query the snapshots
curl -X POST --location "http://localhost:8000/api/content-sources/v1.0/snapshots/rpms/names" \
    -H "x-rh-identity: eyJpZGVudGl0eSI6eyJvcmdfaWQiOiI5IiwgInR5cGUiOiJVc2VyIiwidXNlciI6eyJ1c2VybmFtZSI6ImZvbyJ9LCJhY2NvdW50X251bWJlciI6ImZvbyIsImludGVybmFsIjp7Im9yZ19pZCI6IjkifX19Cg==" \
    -H "Content-Type: application/json" \
    -H "User-Agent: IntelliJ HTTP Client/GoLand 2025.2.2" \
    -H "Accept-Encoding: br, deflate, gzip, x-gzip" \
    -H "Accept: */*" \
    -d '{
        	"search": "vim",
        	"uuids": [
        		"d4ea24b6-54a2-43c1-98e0-a05fd4f5e6ec"
        	]
        }'
  1. connect to pulp and clear the content_ids (password is password):
psql --host localhost --port 5432  -U pulp

# update core_repositoryversion set content_ids = null;
  1. re-run the curl command to see the same results.

You can also turn on debug logging to see the queries being run and confirm they are different.

@jlsherrill jlsherrill changed the title use older method for finding content ids if they are null HMS-9620: use older method for finding content ids if they are null Dec 5, 2025
Copy link
Contributor

@xbhouse xbhouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested and works well! ack!

@xbhouse xbhouse self-assigned this Dec 9, 2025
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.

2 participants