Bug 1581700

Summary: Error deleting manifest. PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_katello_pools_on_cp_id"
Product: Red Hat Satellite Reporter: Nikhil Kathole <nkathole>
Component: Subscription ManagementAssignee: Partha Aji <paji>
Status: CLOSED ERRATA QA Contact: Nikhil Kathole <nkathole>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.4CC: bbuckingham, inecas, jturel, mbacovsk, nkathole, pcreech
Target Milestone: 6.4.0Keywords: Triaged, Upgrades
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-16 19:02:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
screenshot of UI none

Description Nikhil Kathole 2018-05-23 12:37:39 UTC
Created attachment 1440562 [details]
screenshot of UI

Description of problem: Trying to delete manifest after upgrade to satellite 6.4 snap 4 from satellite 6.3.1, gives error  Error deleting manifest. PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_katello_pools_on_cp_id" DETAIL: Key (cp_id)=(8a88f7815e22b340015e22bc74ea0196) already exists. : INSERT INTO "katello_pools" ("cp_id", "created_at", "updated_at", "organization_id") VALUES ($1, $2, $3, $4) RETURNING "id"

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


How reproducible: always


Steps to Reproduce:
1. Upgrade satellite to 6.4 snap 4
2. Upload manifest
3. Try to delete manifest

Actual results:

Error deleting manifest. PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_katello_pools_on_cp_id"

and production.log showed

2018-05-23T08:25:31 [W|app|f29fc] Orphaned Product id 883 found while refreshing/importing manifest.
2018-05-23T08:25:31 [W|app|f29fc] Orphaned Product id 882 found while refreshing/importing manifest.
2018-05-23T08:25:31 [W|app|f29fc] Orphaned Product id 881 found while refreshing/importing manifest.
2018-05-23T08:25:31 [W|app|f29fc] Orphaned Product id 880 found while refreshing/importing manifest.
2018-05-23T08:25:31 [W|app|f29fc] Orphaned Product id 879 found while refreshing/importing manifest.
2018-05-23T08:25:31 [W|app|f29fc] Orphaned Product id 878 found while refreshing/importing manifest.
2018-05-23T08:25:34 [I|aud|] update event for Organization with id 36
2018-05-23T08:30:15 [E|bac|] PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_katello_pools_on_cp_id"
DETAIL:  Key (cp_id)=(8a88f7815e22b340015e22bc74ea0196) already exists.
: INSERT INTO "katello_pools" ("cp_id", "created_at", "updated_at", "organization_id") VALUES ($1, $2, $3, $4) RETURNING "id" (ActiveRecord::RecordNotUnique)
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:614:in `async_exec'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:614:in `block (2 levels) in exec_no_cache'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:46:in `block in permit_concurrent_loads'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/concurrency/share_lock.rb:185:in `yield_shares'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:45:in `permit_concurrent_loads'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:613:in `block in exec_no_cache'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:612:in `block (2 levels) in log'
/opt/rh/rh-ruby24/root/usr/share/ruby/monitor.rb:214:in `mon_synchronize'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:611:in `block in log'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:603:in `log'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:612:in `exec_no_cache'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:601:in `execute_and_clear'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:79:in `exec_query'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:102:in `exec_insert'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:113:in `exec_insert'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:133:in `insert'


Expected results: Manifest delete success.


Additional info:

Comment 7 Brad Buckingham 2018-05-24 12:43:48 UTC
Nikhil,

Does this only occur on an upgraded Satellite?

Comment 8 Brad Buckingham 2018-05-24 12:47:16 UTC
Clearing needinfo.  Sachin mentioned on standup that doesn't happen on new install.

Comment 10 Jonathon Turel 2018-06-14 15:17:32 UTC
Created redmine issue http://projects.theforeman.org/issues/23942 from this bug

Comment 11 Satellite Program 2018-07-09 14:14:39 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/23942 has been resolved.

Comment 12 Nikhil Kathole 2018-07-23 08:13:51 UTC
VERIFIED

Version tested:
Satellite 6.4 snap 13

Upgraded satellite from 6.3.2 to 6.4 snap 13, manifest deletion is successful.

Comment 13 Bryan Kearney 2018-10-16 19:02:36 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.

https://access.redhat.com/errata/RHSA-2018:2927