Hide Forgot
Created attachment 832906 [details] db migration log Description of problem: Upgrade from 1.3.30 fails to 1.4.14-1 on Centos 6 during the db migrations step Version-Release number of selected component (if applicable): 1.4.14-1 How reproducible: upgrade from 1.3.30 to 1.4.14-1 according to https://fedorahosted.org/katello/wiki/Upgrade13to14 Steps to Reproduce: 1. 2. 3. Actual results: Successfuly finished step: Reconfigure with katello-configure ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Step: Migrate Katello database (12/16) Runs: always Description: This step calls rake db:migrate target to update Katello database schema in the postgresql to the latest version. Do you want to proceed with this step?: [(y)es/(n)o/(s)kip]: Do you want to proceed with this step?: [(y)es/(n)o/(s)kip]: y Starting step Migrate Katello database WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.7.6 ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:migrate NOTICE: ALTER TABLE will create implicit sequence "content_view_version_environments_id_seq" for serial column "content_view_version_environments.id" NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "content_view_version_environments_pkey" for table "content_view_version_environments" NOTICE: ALTER TABLE will create implicit sequence "roles_users_id_seq" for serial column "roles_users.id" NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "roles_users_pkey" for table "roles_users" rake aborted! An error has occurred, this and all later migrations canceled: PGError: ERROR: insert or update on table "changeset_content_views" violates foreign key constraint "changeset_content_views_changeset_id_fk" DETAIL: Key (changeset_id)=(6) is not present in table "changesets". : ALTER TABLE "changeset_content_views" ADD CONSTRAINT "changeset_content_views_changeset_id_fk" FOREIGN KEY ("changeset_id") REFERENCES "changesets"(id) INITIALLY DEFERRED /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/foreigner-1.4.2/lib/foreigner/connection_adapters/sql2003.rb:19:in `add_foreign_key' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:466:in `block in method_missing' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:438:in `block in say_with_time' /opt/rh/ruby193/root/usr/share/ruby/benchmark.rb:280:in `measure' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:438:in `say_with_time' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:458:in `method_missing' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:334:in `method_missing' /usr/share/katello/db/migrate/20130613090036_add_foreign_keys.rb:5:in `add_foreign_key_deferred' /usr/share/katello/db/migrate/20130613090036_add_foreign_keys.rb:34:in `up' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:370:in `up' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:410:in `block (2 levels) in migrate' /opt/rh/ruby193/root/usr/share/ruby/benchmark.rb:280:in `measure' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:410:in `block in migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:123:in `with_connection' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:389:in `migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:528:in `migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:720:in `block (2 levels) in migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:775:in `call' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:775:in `block in ddl_transaction' /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/activerecord-3.2.8/lib/active_record/migration.rb:775:in `ddl_transaction' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:719:in `block in migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:700:in `each' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:700:in `migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:570:in `up' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:551:in `migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:153:in `block (2 levels) in <top (required)>' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in `call' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in `block in execute' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in `each' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in `execute' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:158:in `block in invoke_with_call_chain' /opt/rh/ruby193/root/usr/share/ruby/monitor.rb:211:in `mon_synchronize' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:151:in `invoke_with_call_chain' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:144:in `invoke' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:116:in `invoke_task' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `block (2 levels) in top_level' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `each' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `block in top_level' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in `standard_exception_handling' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:88:in `top_level' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:66:in `block in run' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in `standard_exception_handling' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:63:in `run' /opt/rh/ruby193/root/usr/bin/rake:32:in `<main>' caused by: (PGError) ERROR: insert or update on table "changeset_content_views" violates foreign key constraint "changeset_content_views_changeset_id_fk" DETAIL: Key (changeset_id)=(6) is not present in table "changesets". ... skipped 52 lines caused by: (ActiveRecord::InvalidForeignKey) PGError: ERROR: insert or update on table "changeset_content_views" violates foreign key constraint "changeset_content_views_changeset_id_fk" DETAIL: Key (changeset_id)=(6) is not present in table "changesets". : ALTER TABLE "changeset_content_views" ADD CONSTRAINT "changeset_content_views_changeset_id_fk" FOREIGN KEY ("changeset_id") REFERENCES "changesets"(id) INITIALLY DEFERRED /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/foreigner-1.4.2/lib/foreigner/connection_adapters/sql2003.rb:19:in `add_foreign_key' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:466:in `block in method_missing' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:438:in `block in say_with_time' /opt/rh/ruby193/root/usr/share/ruby/benchmark.rb:280:in `measure' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:438:in `say_with_time' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:458:in `method_missing' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:334:in `method_missing' /usr/share/katello/db/migrate/20130613090036_add_foreign_keys.rb:5:in `add_foreign_key_deferred' /usr/share/katello/db/migrate/20130613090036_add_foreign_keys.rb:34:in `up' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:370:in `up' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:410:in `block (2 levels) in migrate' /opt/rh/ruby193/root/usr/share/ruby/benchmark.rb:280:in `measure' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:410:in `block in migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:123:in `with_connection' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:389:in `migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:528:in `migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:720:in `block (2 levels) in migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:775:in `call' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:775:in `block in ddl_transaction' /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/activerecord-3.2.8/lib/active_record/migration.rb:775:in `ddl_transaction' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:719:in `block in migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:700:in `each' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:700:in `migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:570:in `up' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:551:in `migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:153:in `block (2 levels) in <top (required)>' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in `call' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in `block in execute' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in `each' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in `execute' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:158:in `block in invoke_with_call_chain' /opt/rh/ruby193/root/usr/share/ruby/monitor.rb:211:in `mon_synchronize' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:151:in `invoke_with_call_chain' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:144:in `invoke' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:116:in `invoke_task' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `block (2 levels) in top_level' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `each' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `block in top_level' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in `standard_exception_handling' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:88:in `top_level' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:66:in `block in run' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in `standard_exception_handling' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:63:in `run' /opt/rh/ruby193/root/usr/bin/rake:32:in `<main>' ... skipped 0 lines caused by: (PGError) ERROR: insert or update on table "changeset_content_views" violates foreign key constraint "changeset_content_views_changeset_id_fk" DETAIL: Key (changeset_id)=(6) is not present in table "changesets". ... skipped 52 lines Tasks: TOP => db:migrate == AsyncDefaultInfoApply: migrating ========================================== -- rename_column(:organizations, :task_id, :deletion_task_id) -> 0.0272s -- add_column(:organizations, :apply_info_task_id, :integer) -> 0.0033s == AsyncDefaultInfoApply: migrated (0.0307s) ================================= == AddContentViewToDistributor: migrating ==================================== -- add_column(:distributors, :content_view_id, :integer) -> 0.0022s -- add_index(:distributors, :content_view_id) -> 0.0255s == AddContentViewToDistributor: migrated (0.0279s) =========================== == AddRepositoryContentType: migrating ======================================= -- add_column(:repositories, :content_type, :string, {:null=>false, :default=>"yum"}) -> 0.0782s == AddRepositoryContentType: migrated (0.0783s) ============================== == CandlepinLibraryEnv: migrating ============================================ == CandlepinLibraryEnv: migrated (2.2809s) =================================== == CustomInfoAddDefaultColumn: migrating ===================================== -- add_column(:custom_info, :org_default, :boolean, {:default=>false}) -> 0.0121s == CustomInfoAddDefaultColumn: migrated (0.0122s) ============================ == AddIdsToRelationTables: migrating ========================================= -- add_column(:content_view_version_environments, :id, :primary_key) -> 0.0261s -- add_column(:roles_users, :id, :primary_key) -> 0.0136s -- remove_index(:content_view_version_environments, {:name=>"cvv_env_index"}) -> 0.0028s -- add_index(:content_view_version_environments, [:content_view_version_id, :environment_id], {:name=>"cvv_env_index", :unique=>true}) -> 0.0037s == AddIdsToRelationTables: migrated (0.0466s) ================================ == AddContentViewEnvironmentCpIdIndex: migrating ============================= -- add_index(:content_view_environments, [:environment_id, :content_view_id], {:unique=>true, :name=>:index_cve_eid_cv_id}) -> 0.0046s -- add_index(:content_view_environments, [:cp_id], {:unique=>true, :name=>:index_cve_cp_id}) -> 0.0048s == AddContentViewEnvironmentCpIdIndex: migrated (0.0108s) ==================== == UpdateTaskStatuses: migrating ============================================= -- change_column(:task_statuses, :organization_id, :integer, {:null=>true}) -> 0.0530s == UpdateTaskStatuses: migrated (0.0531s) ==================================== == ConvertDescriptionsToTextFields: migrating ================================ -- change_column(:activation_keys, :description, :text) -> 0.0154s -- change_column(:changesets, :description, :text) -> 0.0220s -- change_column(:distributors, :description, :text) -> 0.0092s -- change_column(:environments, :description, :text) -> 0.0115s -- change_column(:organizations, :description, :text) -> 0.0120s -- change_column(:permissions, :description, :text) -> 0.0233s -- change_column(:products, :description, :text) -> 0.0127s -- change_column(:providers, :description, :text) -> 0.0346s -- change_column(:roles, :description, :text) -> 0.0218s -- change_column(:sync_plans, :description, :text) -> 0.0128s -- change_column(:system_groups, :description, :text) -> 0.0281s -- change_column(:systems, :description, :text) -> 0.0222s == ConvertDescriptionsToTextFields: migrated (0.2263s) ======================= == AddIdsToRelationTables: migrating ========================================= -- add_column(:content_view_version_environments, :id, :primary_key) -> 0.0261s -- add_column(:roles_users, :id, :primary_key) -> 0.0136s -- remove_index(:content_view_version_environments, {:name=>"cvv_env_index"}) -> 0.0028s -- add_index(:content_view_version_environments, [:content_view_version_id, :environment_id], {:name=>"cvv_env_index", :unique=>true}) -> 0.0037s == AddIdsToRelationTables: migrated (0.0466s) ================================ == AddContentViewEnvironmentCpIdIndex: migrating ============================= -- add_index(:content_view_environments, [:environment_id, :content_view_id], {:unique=>true, :name=>:index_cve_eid_cv_id}) -> 0.0046s -- add_index(:content_view_environments, [:cp_id], {:unique=>true, :name=>:index_cve_cp_id}) -> 0.0048s == AddContentViewEnvironmentCpIdIndex: migrated (0.0108s) ==================== == UpdateTaskStatuses: migrating ============================================= -- change_column(:task_statuses, :organization_id, :integer, {:null=>true}) -> 0.0530s == UpdateTaskStatuses: migrated (0.0531s) ==================================== == ConvertDescriptionsToTextFields: migrating ================================ -- change_column(:activation_keys, :description, :text) -> 0.0154s -- change_column(:changesets, :description, :text) -> 0.0220s -- change_column(:distributors, :description, :text) -> 0.0092s -- change_column(:environments, :description, :text) -> 0.0115s -- change_column(:organizations, :description, :text) -> 0.0120s -- change_column(:permissions, :description, :text) -> 0.0233s -- change_column(:products, :description, :text) -> 0.0127s -- change_column(:providers, :description, :text) -> 0.0346s -- change_column(:roles, :description, :text) -> 0.0218s -- change_column(:sync_plans, :description, :text) -> 0.0128s -- change_column(:system_groups, :description, :text) -> 0.0281s -- change_column(:systems, :description, :text) -> 0.0222s == ConvertDescriptionsToTextFields: migrated (0.2263s) ======================= == AddForeignKeys: migrating ================================================= -- execute("delete from providers where organization_id not in (select id from organizations)") -> 0.0012s -- execute("delete from task_statuses where organization_id not in (select id from organizations)") -> 0.0008s -- execute("delete from notices where organization_id not in (select id from organizations)") -> 0.0168s -- execute("delete from user_notices where user_id not in (select id from users)") -> 0.0011s -- execute("delete from user_notices where user_id is null") -> 0.0003s -- execute("delete from user_notices where notice_id not in (select id from notices)") -> 0.0005s -- execute("delete from pools where id in (select pool_id from key_pools where activation_key_id not in (select id from activation_keys))") -> 0.0015s -- execute("delete from key_pools where activation_key_id not in (select id from activation_keys)") -> 0.0004s -- execute("delete from key_system_groups where activation_key_id not in (select id from activation_keys)") -> 0.0006s -- execute("delete from marketing_engineering_products where engineering_product_id not in (select id from products)") -> 0.0009s -- execute("delete from roles_users where role_id not in (select id from roles)") -> 0.0007s -- execute("delete from roles_users where user_id not in (select id from users)") -> 0.0004s -- execute("delete from changeset_content_views where content_view_id not in (select id from content_views)") -> 0.0025s -- execute("delete from changeset_users where user_id not in (select id from users)") -> 0.0889s -- execute("delete from changeset_users where changeset_id not in (select id from changesets)") -> 0.0007s -- add_foreign_key("activation_keys", "content_views", {:name=>"activation_keys_content_view_id_fk", :options=>"INITIALLY DEFERRED"}) -> 0.0059s -- add_foreign_key("activation_keys", "environments", {:name=>"activation_keys_environment_id_fk", :options=>"INITIALLY DEFERRED"}) -> 0.0024s -- add_foreign_key("activation_keys", "organizations", {:name=>"activation_keys_organization_id_fk", :options=>"INITIALLY DEFERRED"}) -> 0.0021s -- add_foreign_key("activation_keys", "users", {:name=>"activation_keys_user_id_fk", :options=>"INITIALLY DEFERRED"}) -> 0.0022s -- add_foreign_key("changeset_content_views", "changesets", {:name=>"changeset_content_views_changeset_id_fk", :options=>"INITIALLY DEFERRED"}) Upgrade script did not return zero, investigate, stop services and re-run upgrade. More info in /var/log/katello/katello_upgrade.log [root@katello1 yum.repos.d]# Expected results: Additional info:
Should be fixed when https://github.com/Katello/katello/pull/3464/files gets merged to 1.4
Moving to Sat6 to be tracked there. Upstream bugs are moving to redmine.
Since this issue was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release.