Satellite sync failed due to postgres database table locked

Solution Verified - Updated -

Environment

  • Red Hat Satellite 5.6

Issue

  • Satellite-sync is stuck importing RHEL channels.
- The command line shows the following for a long time:
   Importing *relevant* package metadata: rhel-i386-server-5 
   Importing:       ________________________________________

Resolution

  • On satellite server stop satellite service and start, this will remove Locks on rhnchecksum table.
  • Restart satellite service.
# rhn-satellite restart

Root Cause

  • Issue occurred as satellite-sync was interrupted
  • Database table rhnchecksum was locked due to canceling satellite-sync in between

Diagnostic Steps

  • Enable debug=5 in /etc/rhn/rhn.conf and re-run the satellite-sync
  • Check for more details in /var/log/rhn/rhn_server_satellite.log if any database related errors.
rhnSQL/driver_postgresql.convert_named_query_params('New query: lock table rhnChecksum in exclusive mode',)
rhnSQL/driver_postgresql._execute_wrapper('Executing SQL: "lock table rhnChecksum in exclusive mode" with bind params: {}',)
  • Check postgres DB rhnchecksum table and mode whether it's locked or not.
rhnschema=# SELECT relation::regclass, * FROM pg_locks WHERE NOT GRANTED;
relation | locktype | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction | pid | mode | granted
-------------+----------+----------+----------+------+-------+------------+---------------+---------+-------+------------
rhnchecksum | relation | 16384 | 16938 | | | | | | | | 33/7558 | 21796 | ExclusiveLock | f
rhnchecksum | relation | 16384 | 16938 | | | | | | | | 4/2380 | 31746 | RowExclusiveLock | f

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments