Project

General

Profile

Actions

Bug #12367

closed

ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "katello_system_errata_eid_sid"

Added by Vladimir Stackov over 8 years ago. Updated about 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Description:

Actions::Katello::System::GenerateApplicability often causes
ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "katello_system_errata_eid_sid"

Actual results:

Action:

Actions::Katello::System::GenerateApplicability

Input:

{"services_checked"=>["pulp", "pulp_auth"],
 "system_ids"=>[244],
 "locale"=>"ru"}

Output:

{}

Exception:

ActiveRecord::StatementInvalid: PGError: ОШИБКА:  повторяющееся значение ключа нарушает ограничение уникальности "katello_system_errata_eid_sid" 
DETAIL:  Ключ "(erratum_id, system_id)=(3096, 244)" уже существует.
: INSERT INTO katello_system_errata (erratum_id, system_id) VALUES (3096, 244), (3139, 244), (3751, 244), (3953, 244), (4327, 244), (5912, 244), (5655, 244), (6042, 244), (11266, 244), (11454, 244), (7807, 244), (11669, 244), (11671, 244), (11672, 244), (7905, 244), (7952, 244), (7989, 244), (8038, 244), (8097, 244), (8310, 244), (8356, 244), (8384, 244), (11351, 244), (8985, 244), (9210, 244), (9320, 244), (9248, 244), (9327, 244), (9328, 244), (9730, 244), (9675, 244), (9724, 244), (9760, 244), (9775, 244), (9780, 244), (9811, 244), (9818, 244), (9819, 244), (9846, 244), (9864, 244), (9878, 244), (10190, 244), (8362, 244), (15832, 244), (15963, 244), (11485, 244), (10400, 244), (13452, 244), (7703, 244), (11637, 244), (11641, 244), (11650, 244), (11651, 244), (14520, 244), (11634, 244), (7776, 244)

Backtrace:

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:654:in `async_exec'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:654:in `block in execute'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:653:in `execute'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.3.1/app/models/katello/system.rb:374:in `insert_errata_applicability'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.3.1/app/models/katello/system.rb:361:in `block (2 levels) in import_applicability'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.3.1/app/models/katello/system.rb:350:in `block in import_applicability'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.3.1/app/lib/katello/util/support.rb:78:in `active_record_retry'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.3.1/app/models/katello/system.rb:349:in `import_applicability'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.3.1/app/lib/actions/katello/system/generate_applicability.rb:14:in `block in finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/relation/delegation.rb:6:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/relation/delegation.rb:6:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.3.1/app/lib/actions/katello/system/generate_applicability.rb:13:in `finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/action.rb:528:in `block (2 levels) in execute_finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/stack.rb:26:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware.rb:16:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/action/progress.rb:30:in `with_progress_calculation'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/action/progress.rb:22:in `finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware.rb:16:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.3.1/app/lib/actions/middleware/keep_locale.rb:15:in `block in finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.3.1/app/lib/actions/middleware/keep_locale.rb:22:in `with_locale'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.3.1/app/lib/actions/middleware/keep_locale.rb:15:in `finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/world.rb:30:in `execute'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/action.rb:527:in `block in execute_finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/action.rb:419:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/action.rb:419:in `block in with_error_handling'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/action.rb:419:in `catch'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/action.rb:419:in `with_error_handling'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/action.rb:526:in `execute_finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/action.rb:260:in `execute'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:9:in `block (2 levels) in execute'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/execution_plan/steps/abstract.rb:155:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/execution_plan/steps/abstract.rb:155:in `with_meta_calculation'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:8:in `block in execute'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:22:in `open_action'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:7:in `execute'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/sequential_manager.rb:72:in `run_step'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/sequential_manager.rb:57:in `dispatch'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/sequential_manager.rb:64:in `block in run_in_sequence'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/sequential_manager.rb:64:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/sequential_manager.rb:64:in `all?'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/sequential_manager.rb:64:in `run_in_sequence'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/sequential_manager.rb:53:in `dispatch'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/sequential_manager.rb:28:in `block (2 levels) in finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/stack.rb:26:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware.rb:16:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware.rb:45:in `finalize_phase'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware.rb:16:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware.rb:45:in `finalize_phase'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/middleware/world.rb:30:in `execute'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/sequential_manager.rb:27:in `block in finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/transaction_adapters/active_record.rb:5:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/sequential_manager.rb:24:in `finalize'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/worker.rb:18:in `block in on_message'
/opt/rh/ruby193/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matchers/abstract.rb:74:in `block in assigns'
/opt/rh/ruby193/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matchers/abstract.rb:73:in `tap'
/opt/rh/ruby193/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matchers/abstract.rb:73:in `assigns'
/opt/rh/ruby193/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matching.rb:56:in `match_value'
/opt/rh/ruby193/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matching.rb:36:in `block in match?'
/opt/rh/ruby193/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matching.rb:35:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matching.rb:35:in `match?'
/opt/rh/ruby193/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matching.rb:23:in `match'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/executors/parallel/worker.rb:12:in `on_message'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/context.rb:47:in `on_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/executes_context.rb:7:in `on_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/abstract.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.8.5/lib/dynflow/actor.rb:26:in `on_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/abstract.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/awaits.rb:15:in `on_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/abstract.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/sets_results.rb:14:in `on_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/abstract.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/buffer.rb:38:in `process_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/buffer.rb:31:in `process_envelopes?'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/buffer.rb:20:in `on_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/abstract.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/termination.rb:55:in `on_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/abstract.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/removes_child.rb:10:in `on_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/abstract.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/behaviour/sets_results.rb:14:in `on_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/core.rb:161:in `process_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/core.rb:95:in `block in on_envelope'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/core.rb:118:in `block (2 levels) in schedule_execution'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/synchronization/monitor_object.rb:17:in `block in synchronize'
/opt/rh/ruby193/root/usr/share/ruby/monitor.rb:211:in `mon_synchronize'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/synchronization/monitor_object.rb:17:in `synchronize'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-edge-0.1.0/lib/concurrent/actor/core.rb:115:in `block in schedule_execution'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/serialized_execution.rb:19:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/serialized_execution.rb:19:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/serialized_execution.rb:97:in `work'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/serialized_execution.rb:78:in `block in call_job'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/ruby_thread_pool_executor.rb:332:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/ruby_thread_pool_executor.rb:332:in `run_task'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `block (3 levels) in create_worker'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/ruby_thread_pool_executor.rb:303:in `loop'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/ruby_thread_pool_executor.rb:303:in `block (2 levels) in create_worker'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/ruby_thread_pool_executor.rb:302:in `catch'
/opt/rh/ruby193/root/usr/share/gems/gems/concurrent-ruby-0.9.0/lib/concurrent/executor/ruby_thread_pool_executor.rb:302:in `block in create_worker'
/opt/rh/ruby193/root/usr/share/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
caused by: (PGError) ОШИБКА:  повторяющееся значение ключа нарушает ограничение уникальности "katello_system_errata_eid_sid" 
DETAIL:  Ключ "(erratum_id, system_id)=(3096, 244)" уже существует.

    ... skipped 115 lines

Expected results:

No errors

Additional info:

Failing task:

 Name: Generate applicability
 Owner: foreman_admin

Package versions:

rubygem-hammer_cli_katello-0.0.17-2.el7.noarch
katello-selinux-2.2.1-1.el7.noarch
katello-server-ca-1.0-2.noarch
katello-service-2.3.0-6.el7.noarch
katello-2.3.0-6.el7.noarch
katello-default-ca-1.0-1.noarch
katello-certs-tools-2.3.0-4.el7.noarch
katello-installer-2.3.1-6.el7.noarch
katello-common-2.3.0-6.el7.noarch
katello-agent-2.3.1-4.el7.noarch
katello-installer-base-2.3.1-6.el7.noarch
ruby193-rubygem-katello-2.3.1-2.el7.noarch
pulp-katello-0.4-2.el7.noarch
katello-debug-2.3.0-6.el7.noarch

Actions

Also available in: Atom PDF