Skip to content

Conversation

@MarceloRobert
Copy link
Collaborator

@MarceloRobert MarceloRobert commented Jan 20, 2026

Changes

  • Alters the behavior of the treeListing db table to store every commit of every tree. This is done so that we can keep the counts of older checkouts since we can receive multiple checkouts to the same commit in any order.
  • Fixes problems with trees that have null values by setting nulls as equals and having better null comparison.

How to test

  • Clear the database (docker compose down -v),
  • Recreate it (docker compose up -d dashboard_db --build),
  • Apply the migrations (poetry run python3 manage.py migrate),
  • Retrieve the submissions and place them in a folder for consumption (submissions here),
  • Also have the trees_name file (here) and place it in backend/volume_data/trees-name.yaml,
  • Consume the submissions (poetry run python3 manage.py monitor_submissions --spool-dir folder/containing/the/submissions --trees-file volume_data/trees-name.yaml),
  • Stop consuming when it reaches 0 files in the spool,
  • Run the processing of pending tests/builds (poetry run python3 manage.py process_pending_aggregations), the processing finishes when everything is consumed,
  • Run a query to update the start_time of the submissions (query here),
  • Run backend and frontend, enter the treeListing to see the old result,
  • Perform a select on the tree_listing table with the same time filter and origin, compare the results.

Known differences

There are still some differences between the new tree listing and the old one. Mainly is the fact that the new treeListing is able to show trees that have null git_repository_url, meaning that - with the provided submissions - there will be 2 more trees in the redhat origin.

Also, in the linaro origin there's an extra tree that seems to have 0 counts but also may be just a different version (different tree_name/url) of the mainline tree, which may have been changed when the data is consumed in the ingester. Since this is an extra tree, there's no effect on the old treeListing counts.

Closes #1703

@MarceloRobert MarceloRobert self-assigned this Jan 20, 2026
@MarceloRobert MarceloRobert added bug Something isn't working Backend Most or all of the changes for this issue will be in the backend code. Database Issue that alters only configs of a database itself labels Jan 20, 2026
@MarceloRobert MarceloRobert marked this pull request as ready for review January 21, 2026 15:04
test_inc = tree_listing.test_inc + %s
WHERE tree_listing.checkout_id = %s
WHERE
-- IS NOT DISTINCT FROM used to treat NULLs as equal
Copy link
Contributor

@AmadeusK525 AmadeusK525 Jan 21, 2026

Choose a reason for hiding this comment

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

This shouldn't be done here, it should be done at the table level by setting NULLS NOT DISTINCT to true

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

NULLS NOT DISTINCT only work at constraint checking level, but when I do this comparison in the query, it considers each comparison as a separate value, and so will consider NULLs as different values. It also doesn't matter if I try to make a comparison between a tuple of those values, the nulls will still not be equal, I tested.

https://www.postgresql.org/docs/current/indexes-unique.html
http://thoughts.davisjeff.com/2009/08/02/what-is-the-deal-with-nulls/

Copy link
Contributor

@gustavobtflores gustavobtflores left a comment

Choose a reason for hiding this comment

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

LGTM

- Fixes problems where trees with null values weren't being correctly compared;
- Also changes behavior of treeListing to keep storing every commit for the trees,
because it is possible to receive multiple checkouts for the same commit.
In case we receive commit A, then commit B, then commit A again,
we should be able to keep the counts from the last commit A checkout.

Closes kernelci#1703
@MarceloRobert MarceloRobert added this pull request to the merge queue Jan 22, 2026
Merged via the queue into kernelci:main with commit e856bb0 Jan 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Most or all of the changes for this issue will be in the backend code. bug Something isn't working Database Issue that alters only configs of a database itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linaro and Redhat trees have wrong counts on new tree listing

3 participants