Red Hat Satellite 6 failed to publish content view throwing error PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_katello_docker_meta_tags_on_schema1_id_and_schema2_id" DETAIL: Key (schema1_id, schema2_id)

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.7

Issue

  • Red Hat Satellite 6 failed to publish content view throwing following error:

    PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_katello_docker_meta_tags_on_schema1_id_and_schema2_id" DETAIL: Key (schema1_id, schema2_id)
    

Resolution

  • This issue is tracked through Red Hat Bugzilla This content is not included.RHBZ#1854026.

  • As a workaround, we remove the orphaned Katello::DockerMetaTag records using below steps:
    (Note: For security, please make a snapshot of the Satellite before proceeding.)

    foreman-rake console
    Katello::DockerMetaTag.where("id not in (?)", Katello::RepositoryDockerMetaTag.pluck(:docker_meta_tag_id)).delete_all
    exit
    

For more KB articles/solutions related to Red Hat Satellite 6.x Content View Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Content View Issues

Diagnostic Steps

  • Check for below error in postgresql logs on Satellite:

    2020-08-25 18:04:36 UTC ERROR:  duplicate key value violates unique constraint "index_katello_docker_meta_tags_on_schema1_id_and_schema2_id"
    2020-08-25 18:04:36 UTC DETAIL:  Key (schema1_id, schema2_id)=(7302, 7301) already exists.
    2020-08-25 18:04:36 UTC STATEMENT:  INSERT INTO "katello_docker_meta_tags" ("schema1_id", "schema2_id", "name") VALUES ($1, $2, $3) RETURNING "id"
    
SBR
Product(s)
Components
Category

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.