Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1024830 - satellite-sync after upgrade to Satellite 5.6 fails with unique constraint violation (RHN_DCM_RELEASE_CAID_OID_UQ)
Summary: satellite-sync after upgrade to Satellite 5.6 fails with unique constraint vi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Upgrades
Version: 560
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Milan Zázrivec
QA Contact: Pavel Studeník
URL:
Whiteboard:
Depends On:
Blocks: sat560-triage
TreeView+ depends on / blocked
 
Reported: 2013-10-30 13:39 UTC by Milan Zázrivec
Modified: 2013-12-12 10:45 UTC (History)
2 users (show)

Fixed In Version: rhn-upgrade-5.6.0.41-1
Doc Type: Bug Fix
Doc Text:
Cause: A bug in schema upgrades and schema migrations for Satellite 5.6 Consequence: After schema upgrade / migration, customers may not be able to succesffully perform satellite-sync and register their clients. Fix: Result: sync / registration now works.
Clone Of: 1024826
Environment:
Last Closed: 2013-12-12 10:45:39 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1828 normal SHIPPED_LIVE Red Hat Satellite rhn-upgrade bug fix update 2013-12-12 15:44:13 UTC

Description Milan Zázrivec 2013-10-30 13:39:33 UTC
This clone is to make sure we fix this problem in rhn-upgrade errata
for customers who are just about to upgrade / migrate to Satellite 5.6.

+++ This bug was initially created as a clone of Bug #1024826 +++

Description of problem:
After upgrade to Satellite 5.6 (using external Oracle), satellite-sync may
fail with the following error:

Exception Handler Information
Traceback (most recent call last):
  File "/usr/bin/satellite-sync", line 139, in main
    return satsync.Runner().main()
  File "/usr/lib/python2.4/site-packages/spacewalk/satellite_tools/satsync.py", line 229, in main
    ret = method()
  File "/usr/lib/python2.4/site-packages/spacewalk/satellite_tools/satsync.py", line 305, in _step_channels
    self.syncer.process_channels()
  File "/usr/lib/python2.4/site-packages/spacewalk/satellite_tools/satsync.py", line 682, in process_channels
    master=OPTIONS.master or None)
  File "/usr/lib/python2.4/site-packages/spacewalk/satellite_tools/sync_handlers.py", line 248, in import_channels
    importer.run()
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/importLib.py", line 647, in run
    self.submit()
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/channelImport.py", line 155, in submit
    self.backend.processChannels(nullParentBatch, True)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backend.py", line 938, in processChannels
    'channel_id', uploadForce=4, ignoreUploaded=1, forceVerify=1)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backend.py", line 1508, in __processObjectCollection
    return self.__processObjectCollection__(objColl, parentTable, childDict, **kwargs)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backend.py", line 1678, in __processObjectCollection__
    return self.__doDML(dml)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backend.py", line 1786, in __doDML
    self.__doInsert(dml.insert, dml.tables)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backend.py", line 1793, in __doInsert
    self.__doInsertTable(tname, dict)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backend.py", line 1807, in __doInsertTable
    insertObj.query(hash)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backendLib.py", line 431, in query
    executeStatement(statement, values, chunksize)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backendLib.py", line 456, in executeStatement
    count += statement.executemany(**tempdict)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 172, in executemany
    return apply(self._execute_wrapper, (self._executemany, ) + p, kw)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/rhnSQL/driver_cx_Oracle.py", line 108, in _execute_wrapper
    retval = apply(function, p, kw)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/rhnSQL/driver_cx_Oracle.py", line 208, in _executemany
    self._real_cursor.executemany(None, arr)
rhnFault: (54, 'ORA-00001: unique constraint (RHNSAT.RHN_DCM_RELEASE_CAID_OID_UQ) violated\n', '\n     Package Upload Failed due to uniqueness constraint violation.\n     Make sure the package does not have any duplicate dependencies or\n     does not already exists on the server\n     ')

Version-Release number of selected component (if applicable):
Satellite 5.6

How reproducible:
Random.

Steps to Reproduce:
1. Satellite 5.5 or earlier, using external Oracle, synchronized RHEL content
   (RHEL-5,6 with child channels).
2. Upgrade the Satellite to version 5.6
3. Run satellite-sync

Actual results:
The satellite-sync may fail with the above traceback.

Expected results:
satellite-sync works.

Additional info:
This problem is caused by the fact that the rhnDistChannelMap table before the
upgrade may contain (release, channel_arch_id) pairs pointing (via
channel_id column) to some RHEL child channels (VT, Cluster, ...).

The upgrade (as well as migration) to Satellite 5.6 contains the following:

delete
  from rhnDistChannelMap a
 where a.rowid > any (
       select b.rowid
         from rhnDistChannelMap b
        where a.release = b.release
          and a.channel_arch_id = b.channel_arch_id
       );

which is supposed to delete duplicate (release, channel_arch_id) pairs
from rhnDistChannelMap table.

As it happens, rowid of the row pointing to a child channel can be
lower than rowid of its parent -> we delete the parent record.

In Satellite 5.6 sat-sync, we no longer process the mappings for child
channels, but still process the parent channel mappings -> sat-sync
tries to insert the (release, channel_arch_id) pair for the parent
channel -> potential conflict with the child record we already have ->
unique constraint violation on Oracle.

To fix this issue, we need to release a schema errata, which would
delete the records pointing to child channels and subsequent
satellite-sync would return the correct mappings back.

Comment 8 errata-xmlrpc 2013-12-12 10:45:39 UTC
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.

http://rhn.redhat.com/errata/RHBA-2013-1828.html


Note You need to log in before you can comment on or make changes to this bug.