Bug 528934

Summary: Unique constraint (kickstart_id, position) on rhnKickstartPackage table required
Product: Red Hat Satellite 5 Reporter: Milan Zázrivec <mzazrivec>
Component: ServerAssignee: Tomas Lestach <tlestach>
Status: CLOSED CURRENTRELEASE QA Contact: Miroslav Suchý <msuchy>
Severity: medium Docs Contact:
Priority: low    
Version: 530CC: cperry, jhutar, msuchy, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: Fixed in the 5.4.0 Release - GA'd 2010-10-27
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-28 15:03:28 UTC Type: ---
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: 487678    

Description Milan Zázrivec 2009-10-14 12:20:06 UTC
Description of problem:
Experience from bug #527724 shows that it would be desirable to create
unique constraint for rhnKickstartPackage table on (kickstart_id, position).

This way, problem described in bug #527724 would be revealed much sooner:
very likely during schema upgrade testing. Additionally, the application
layer itself expects linear ordering of packages in every kickstart profile.

Version-Release number of selected component (if applicable):
spacewalk-schema-0.5.20-23 / Satellite 5.3.0

How reproducible:
Always

Steps to Reproduce:
1. Create a new kickstart profile, put several packages into %packages section
2. With sqlplus connect to your database
3. SQL> update rhnKickstartPackage set position = 0 where kickstart_id = :ksid;
(replace :ksid with actual kickstart id you just created)
4. SQL> commit;
  
Actual results:
Update succeeds, every package in this kickstart profile has zero position,
information about user ordering is lost.

Expected results:
Update fails with unique constraint violated oracle error.

Additional info:
https://bugzilla.redhat.com/show_bug.cgi?id=462239
https://bugzilla.redhat.com/show_bug.cgi?id=527724

Comment 1 Tomas Lestach 2010-02-19 14:08:43 UTC
Unique constraint was added in

spacewalk.git/SPACEWALK-0.8:

 de3e61bd40178507c2884069e6f6e626371fd6a0
 a2c33bd4064655a4a77a1a929b866488b51ebfad

Upgrade fix that prevents having multiple non-unique entries before creating the constraint:

spacewalk.git/SPACEWALK-0.8:
 bfbacb945ac058b9544576a6acaf1094d7785e87

Comment 3 Miroslav Suchý 2010-10-11 07:54:19 UTC
SQL> update rhnKickstartPackage set position = 0 where kickstart_id = 1;                                                                          
update rhnKickstartPackage set position = 0 where kickstart_id = 1                                                                                
*                                                                                                                                                 
ERROR at line 1:                                                                                                                                  
ORA-00001: unique constraint (RHNSAT.RHN_KSPACKAGE_POS_UQ) violated

Comment 4 Clifford Perry 2010-10-28 15:03:28 UTC
The 5.4.0 RHN Satellite and RHN Proxy release has occurred. This issue has been resolved with this release. 


RHEA-2010:0801 - RHN Satellite Server 5.4.0 Upgrade
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10332

RHEA-2010:0803 - RHN Tools enhancement update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10333

RHEA-2010:0802 - RHN Proxy Server 5.4.0 bug fix update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10334

RHEA-2010:0800 - RHN Satellite Server 5.4.0
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10335

Docs are available:

http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/index.html 

Regards,
Clifford