#4153 listPackages with_owners gives inconsistent results
Opened by mikem. Modified

Calling listPackages with_owners=True can give a different list than with_owners=False. E.g.

[mikem@localhost koji]$ lkoji call -j listPackages tagID=37 event=1179 inherited=0 with_owners=0| jq '.[]|.package_name'|wc
    296     296    3463
[mikem@localhost koji]$ lkoji call -j listPackages tagID=37 event=1179 inherited=0 with_owners=1| jq '.[]|.package_name'|wc
      0       0       0

This originates from #1473 where we split ownership data into a separate table. This creates the possibility of having packages without matching ownership data in a given query, which complicates the join.

Related

  • https://pagure.io/koji/pull-request/1473
  • https://pagure.io/koji/pull-request/2791

Metadata Update from @mikem:
- Custom field Size adjusted to medium
- Issue tagged with: bug

I see that _pkglist_owner_add is called from _pkglist_add, so the data since koji 1.19 will always have an owner entry matching the package entry in each tag at each event.

However, in my instance, I have data that does not obey this. It seems to stem from the 1.19 schema migration script, which split the ownership data out of tag_packages. It attempts to simplify the ownership history by skipping entries if last_owner = r2.owner. Unfortunately, this does not work as intended, because the last entry still has the same revoke_event.

E.g. on my system, I have:

$ lkoji list-history --tag kernel-kpatch-1.0-24.brew794-build -e --package fake
Mon Oct 31 19:49:16 2016 (eid 1180) package owner mikem set for fake in kernel-kpatch-1.0-24.brew794-build by mikem
Mon Oct 31 19:49:16 2016 (eid 1180) package list entry created: fake in kernel-kpatch-1.0-24.brew794-build by mikem
Mon Oct 31 19:51:47 2016 (eid 1181) package owner mikem revoked for fake in kernel-kpatch-1.0-24.brew794-build by mikem
Mon Oct 31 19:51:47 2016 (eid 1181) package list entry revoked: fake in kernel-kpatch-1.0-24.brew794-build by mikem
Mon Oct 31 19:51:53 2016 (eid 1183) package list entry created: fake in kernel-kpatch-1.0-24.brew794-build by mikem
Sun May  5 10:00:18 2019 (eid 14679) package owner admin set for fake in kernel-kpatch-1.0-24.brew794-build by mikem [still active]
Sun May  5 10:00:18 2019 (eid 14679) package list entry for fake in kernel-kpatch-1.0-24.brew794-build updated by mikem [still active]

The package list entry created at event 1183 was not given a corresponding owner entry because the owner was the same as the previous entry, but that entry was still revoked at 1181. This leaves a period of history where the package has no owner data for in the tag.

Anyway, there's nothing we can really do about this bug in schema-upgrade-1.18-1.19.sql, but the point is that there is historical data out there created by it that can tickle the behavior in the issue description.

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/4153

Please continue any further discussion there.

Metadata