Bug 1024830 - satellite-sync after upgrade to Satellite 5.6 fails with unique constraint violation (RHN_DCM_RELEASE_CAID_OID_UQ)
satellite-sync after upgrade to Satellite 5.6 fails with unique constraint vi...
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Upgrades (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Milan Zázrivec
Pavel Studeník
Depends On:
Blocks: sat560-triage
  Show dependency treegraph
Reported: 2013-10-30 09:39 EDT by Milan Zázrivec
Modified: 2013-12-12 05:45 EST (History)
2 users (show)

See Also:
Fixed In Version: rhn-upgrade-
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.
Story Points: ---
Clone Of: 1024826
Last Closed: 2013-12-12 05:45:39 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Milan Zázrivec 2013-10-30 09:39:33 EDT
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
  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
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/importLib.py", line 647, in run
  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
  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:

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:

  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 05:45:39 EST
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.


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