Problem:
Oracle Linux 8 “Codeready builder” repository sync completes with a warning state
Expected outcome:
The sync completes with a successful state
Foreman and Proxy versions:
foreman-3.2.0-1.el8.noarch
Foreman and Proxy plugin versions:
katello-4.4.0-1.el8.noarch
katello-repos-4.4.0-1.el8.noarch
Distribution and version:
Oracle Linux 8.5
Other relevant data:
Syncing the repository Oracle Linux 8 (x86_64) CodeReady Builder - Unsupported | Oracle, Software. Hardware. Complete. completes with the warning:
PG::CardinalityViolation: ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time
HINT: Ensure that no rows proposed for insertion within the same command have duplicate constrained values.
Backtrace:
2022-04-27T08:23:34 [E|bac|327d8a7f] PG::CardinalityViolation: ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time
327d8a7f | HINT: Ensure that no rows proposed for insertion within the same command have duplicate constrained values.
327d8a7f | (ActiveRecord::StatementInvalid)
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `exec_params'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec_no_cache'
327d8a7f | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
327d8a7f | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
327d8a7f | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec_no_cache'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
327d8a7f | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
327d8a7f | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
327d8a7f | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
327d8a7f | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
327d8a7f | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract_adapter.rb:721:in `block in log'
327d8a7f | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract_adapter.rb:712:in `log'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:673:in `exec_no_cache'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:654:in `execute_and_clear'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/database_statements.rb:153:in `exec_insert_all'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/query_cache.rb:22:in `exec_insert_all'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/insert_all.rb:27:in `execute'
327d8a7f | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/persistence.rb:243:in `upsert_all'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/services/katello/content_unit_indexer.rb:45:in `block in import_all'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/services/katello/pulp3/pulp_content_unit.rb:97:in `yield'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/services/katello/pulp3/pulp_content_unit.rb:97:in `block (2 levels) in pulp_units_batch_for_repo'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/services/katello/pulp3/pulp_content_unit.rb:85:in `loop'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/services/katello/pulp3/pulp_content_unit.rb:85:in `block in pulp_units_batch_for_repo'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/services/katello/content_unit_indexer.rb:27:in `each'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/services/katello/content_unit_indexer.rb:27:in `import_all'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/models/katello/repository.rb:918:in `block (2 levels) in index_content'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/lib/katello/logging.rb:8:in `time'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/models/katello/repository.rb:917:in `block in index_content'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/models/katello/repository.rb:916:in `each'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/models/katello/repository.rb:916:in `index_content'
327d8a7f | /usr/share/gems/gems/katello-4.4.0/app/lib/actions/katello/repository/index_content.rb:22:in `run'