satellite-sync fails with unique constraint violation on rhn_package_file_pid_cid_uq

Solution Verified - Updated -

Issue

  • satellite-sync fails with unique constraint violation:
rhnFault: (54, 'ORA-00001: unique constraint (RHNSAT.RHN_PACKAGE_FILE_PID_CID_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     ')
  • Upgraded Red Hat Satellite to 5.6 and get IntegrityError: duplicate key value violates unique constraint "rhn_package_file_pid_cid_uq" error when running the command /etc/sysconfig/rhn/satellite-upgrade/scripts/regenerate-repodata --all:
04:38:53 
SYNC ERROR: unhandled exception occurred:

Exception reported from satellite.example.com
Time: Fri Oct 11 04:38:53 2013
Exception type psycopg2.IntegrityError

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 343, in _step_packages
    self._affected_channels = self.syncer.import_packages()
  File "/usr/lib/python2.4/site-packages/spacewalk/satellite_tools/satsync.py", line 1601, in import_packages
    [sources])
  File "/usr/lib/python2.4/site-packages/spacewalk/satellite_tools/satsync.py", line 1575, in _proces_batch
    prompt, nevermorethan, process_function_args)
  File "/usr/lib/python2.4/site-packages/spacewalk/satellite_tools/satsync.py", line 1555, in _processWithProgressBar
    process_function(chunk, *process_function_args)
  File "/usr/lib/python2.4/site-packages/spacewalk/satellite_tools/satsync.py", line 1582, in _import_packages_process
    sync_handlers.import_packages(batch, sources)
  File "/usr/lib/python2.4/site-packages/spacewalk/satellite_tools/sync_handlers.py", line 397, in import_packages
    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/packageImport.py", line 316, in submit
    transactional=self.transactional)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backend.py", line 812, in processPackages
    transactional=transactional)
  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_postgresql.py", line 273, in _execute_wrapper
    retval = apply(function, p, kw)
  File "/usr/lib/python2.4/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 310, in _executemany
    self._real_cursor.executemany(self.sql, all_kwargs)
IntegrityError: duplicate key value violates unique constraint "rhn_package_file_pid_cid_uq"
  • satellite-sync failed with error:
IntegrityError: duplicate key value violates unique constraint "rhn_package_file_pid_cid_uq"

Environment

  • Red Hat Satellite 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In