Bug 1456719
| Summary: | ISS of repo synced into two organizations: null value in column "package_id" violates not-null constraint | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Satellite 5 | Reporter: | Jan Hutař <jhutar> | ||||||
| Component: | Satellite Synchronization | Assignee: | Michael Mráka <mmraka> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | Martin Korbel <mkorbel> | ||||||
| Severity: | low | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | 580 | CC: | jdobes, mkorbel, rdrazny, tlestach | ||||||
| Target Milestone: | --- | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | spacewalk-backend-2.5.3-153-sat | Doc Type: | If docs needed, set a value | ||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2017-10-19 11:57:19 UTC | Type: | Bug | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Bug Depends On: | |||||||||
| Bug Blocks: | 1450111 | ||||||||
| Attachments: |
|
||||||||
This bug is reproducible with channel dumps as well. Channel dump of "bz1444519-2" looks perfectly sane. # vim dump/errata/5/rhn-erratum-19555.xml.gz # some whitespaces added by me <?xml version="1.0" encoding="UTF-8"?> <rhn-satellite generation="2" version="3.7"> <rhn-errata> <rhn-erratum advisory="FEDORA-EPEL-2011-0073-200" org_id="6" channels="bz1444519-2" cve-names="" packages="rhn-package-1443 rhn-package-1444 rhn-package-1445 rhn-package-1447" id="rhn-erratum-19555"> <rhn-erratum-advisory-name>FEDORA-EPEL-2011-0073</rhn-erratum-advisory-name> <rhn-erratum-advisory-rel>200</rhn-erratum-advisory-rel> <rhn-erratum-advisory-type>Bug Fix Advisory</rhn-erratum-advisory-type> <rhn-erratum-product>Fedora EPEL 6</rhn-erratum-product> <rhn-erratum-description>Add missing freealut package into EPEL-6</rhn-erratum-description> <rhn-erratum-synopsis>freealut-1.1.0-11.el6</rhn-erratum-synopsis> <rhn-erratum-topic>freealut-1.1.0-11.el6 bugfix update</rhn-erratum-topic> <rhn-erratum-solution> </rhn-erratum-solution> <rhn-erratum-refers-to></rhn-erratum-refers-to> <rhn-erratum-notes></rhn-erratum-notes> <rhn-erratum-errata-from>updates</rhn-erratum-errata-from> <rhn-erratum-issue-date>1295137438</rhn-erratum-issue-date> <rhn-erratum-update-date>1295137438</rhn-erratum-update-date> <rhn-erratum-last-modified>1496129856</rhn-erratum-last-modified> <rhn-erratum-keywords/> <rhn-erratum-bugs> <rhn-erratum-bug> <rhn-erratum-bug-id>533599</rhn-erratum-bug-id> <rhn-erratum-bug-summary>freealut bad dependency</rhn-erratum-bug-summary> <rhn-erratum-bug-href>https://bugzilla.redhat.com/show_bug.cgi?id=533599</rhn-erratum-bug-href> </rhn-erratum-bug> </rhn-erratum-bugs> <rhn-erratum-files/> </rhn-erratum> </rhn-errata> </rhn-satellite> and these packages seems to be present: dump/packages/43/rhn-package-1443.xml.gz [...] So maybe the problem is on the import side of the process? Hmm, I'm basically taking 2 channels from 2 organizations and syncing both these channels into one organization. Created attachment 1283391 [details]
It should be possible to reproduce with this dump
Hmm, now I can reproduce with RHN Tools channels: [root@satellite580 ~]# satellite-sync --iss-parent satellite580ora.example.com -c rhn-tools-rhel-x86_64-* --no-packages 08:38:14 Red Hat Satellite - live synchronization 08:38:14 url: https://satellite580ora.example.com 08:38:14 debug/output level: 1 08:38:15 db: rhnuser/<password>@rhnschema [...] 08:38:19 Downloading kickstartable trees files 08:38:19 Retrieving / parsing kickstart tree files: rhn-tools-rhel-x86_64-server-5 (NONE RELEVANT) 08:38:19 Retrieving / parsing kickstart tree files: rhn-tools-rhel-x86_64-server-6 (NONE RELEVANT) 08:38:19 Retrieving / parsing kickstart tree files: rhn-tools-rhel-x86_64-server-7 (NONE RELEVANT) 08:38:19 08:38:19 Importing channel errata 08:38:19 Importing *relevant* errata: rhn-tools-rhel-x86_64-server-5 (60) ________________________________________ Downloading:####################ERROR: Encountered IntegrityError: null value in column "package_id" violates not-null constraint DETAIL: Failing row contains (14766, null, 2017-05-30 08:38:25.288237-04, 2017-05-30 08:38:25.288237-04). consider removing satellite-sync cache at /var/cache/rhn/satsync/* and re-run satellite-sync with same options. If this error persits after removing cache, please contact Red Hat support. And without "--no-packages" it works. I've reproduced the issue with just satellite-sync -c bz1444519-2 -m dump from the attached dump even without syncing bz1444519 channel first. Interesting... First run failed with 15:32:15 Importing channel errata 15:32:18 Importing *relevant* errata: bz1444519-2 (4095) ________________________________________ Downloading:#############################ERROR: Encountered IntegrityError: null value in column "package_id" violates not-null constraint DETAIL: Failing row contains (3040, null, 2017-05-30 15:32:22.812305+02, 2017-05-30 15:32:22.812305+02). The second one 15:41:42 Importing channel errata 15:41:43 Importing *relevant* errata: bz1444519-2 (1095) ________________________________________ Downloading:ERROR: Encountered IntegrityError: null value in column "package_id" violates not-null constraint DETAIL: Failing row contains (3090, null, 2017-05-30 15:41:41.801254+02, 2017-05-30 15:41:41.801254+02). But(!) neither 3040 or 3090 errata is part of bz1444519-2 channel. zgrep -E '3040|3090' dump/channels/bz1444519-2/channel.xml.gz <no output> Michal, you are right, it is possible to reproduce on 5.7.0 with the dump attached to this BZ: [root@elisha ~]# satellite-sync -m dump -c bz1444519-2 [...] 05:19:25 Importing channel errata 05:19:31 Importing *relevant* errata: bz1444519-2 (4095) ________________________________________ Downloading:#############################ERROR: Encountered IntegrityError: null value in column "package_id" violates not-null constraint DETAIL: Failing row contains (59975, null, 2017-06-01 05:19:39.112821-04, 2017-06-01 05:19:39.112821-04). consider removing satellite-sync cache at /var/cache/rhn/satsync/* and re-run satellite-sync with same options. If this error persits after removing cache, please contact Red Hat support. Created attachment 1312045 [details]
1456719 - save the package to the same org as erratum
Patch for the bug. Intentionally not committed to spacewalk git before 2.7 branch.
Patch from comment #9 added to spacewalk.git(master): 0cd0fd20fdfabf7deb5ea3e3dcd8b6dcbd22f683 fixing some pylint issues, spacewalk.git(master): 976bd0a2b935147c2310c7eb9b5645a25fbb9b44 Comment #14 issue fixed in spacewalk git by commit e4339d5a19f6ad02d3a01927709a2e6f7b2f46cb 1456719 - don't move NULL org packages to the current org VERIFIED on spacewalk-backend-2.5.3-153 reproducer via comment 14 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2017:2915 |
Description of problem: There is a IntegrityError when you sync channels via ISS or dump where one repo was synced into two organizations on the source satellite: null value in column "package_id" violates not-null constraint Version-Release number of selected component (if applicable): spacewalk-backend-2.5.3-137.el6sat.noarch How reproducible: always Steps to Reproduce: 1. In source channel in main org create repo: Repo URL: http://dl.fedoraproject.org/pub/epel/6Server/x86_64/ Filters: +freealut* 2. Create channel bz1444519, assign the repo to it, sync 3. Now in different organization create same setup (just channel name&label have to be different, so I have used "bz1444519-2") 4. Setup ISS with slave satellite 5. On slave satellite first sync "bz1444519", then "bz1444519-2" # satellite-sync --iss-parent satellite580ora.example.com -c bz1444519 # satellite-sync --iss-parent satellite580ora.example.com -c bz1444519-2 Actual results: Last sync will fail with: [root@satellite580 ~]# satellite-sync --iss-parent satellite580ora.example.com -c bz1444519-2 04:10:42 Red Hat Satellite - live synchronization 04:10:42 url: https://satellite580ora.example.com 04:10:42 debug/output level: 1 04:10:42 db: rhnuser/<password>@rhnschema [...] 04:10:44 Importing channel errata 04:10:46 Importing *relevant* errata: bz1444519-2 (4095) ________________________________________ Downloading:#############################ERROR: Encountered IntegrityError: null value in column "package_id" violates not-null constraint DETAIL: Failing row contains (4101, null, 2017-05-30 04:10:52.840844-04, 2017-05-30 04:10:52.840844-04). consider removing satellite-sync cache at /var/cache/rhn/satsync/* and re-run satellite-sync with same options. If this error persits after removing cache, please contact Red Hat support. This is in PostgreSQL log: ==> /var/opt/rh/rh-postgresql95/lib/pgsql/data/pg_log/postgresql-Tue.log <== 2017-05-30 04:10:04.747 EDT ERROR: null value in column "package_id" violates not-null constraint 2017-05-30 04:10:04.747 EDT DETAIL: Failing row contains (4101, null, 2017-05-30 04:10:03.764783-04, 2017-05-30 04:10:03.764783-04). 2017-05-30 04:10:04.747 EDT STATEMENT: insert into rhnErrataPackage (errata_id, package_id) values (4101, NULL) Expected results: Should work Additional info: This bug is probably related to bug 1444519 and although I suspect it a regression against 5.7.0, I believe on 5.7.0 sync itself would work, but because of bug 1444519, it would be syncing incorrect data (errata moving from org to org).