Project

General

Profile

Bug #23781

content_source_id value is not migrated during upgrade

Added by Stephen Benjamin about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Category:
Upgrades
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1584874

Description of problem:
When upgrading from 6.2 to 6.3 the content_source_id parameter from hosts is moved from the hosts table to the katello_content_facets table. As seen in the satellite.log form an upgrade here:

---
-- add_column(:katello_content_facets, :content_source_id, :integer)
-- add_index(:katello_content_facets, :content_source_id)
-- add_foreign_key(:katello_content_facets, :smart_proxies, {:name=>"katello_content_facets_content_source_id_fk", :column=>"content_source_id"})
-- remove_foreign_key(:hosts, {:name=>"hosts_content_source_id_fk"})
-- remove_index(:hosts, :content_source_id)
-- remove_column(:hosts, :content_source_id)
---

The problem here is that it doesn't appear that the value set for the content_source_id parameter in the hosts table is migrated to the katello_content_facets table when the new column is created. All values in the new column are blank.

For example: ===
6.2.14 (before upgrade)
foreman=# select count(id) from hosts where content_source_id is null;
count
-------
24
(1 row)

foreman=# select count(id) from hosts where content_source_id is not null;
count
-------
105
(1 row) ===
6.3.1 (after upgrade)
foreman=# select count(id) from katello_content_facets where content_source_id is null;
count
-------
117
(1 row)

foreman=# select count(id) from katello_content_facets where content_source_id is not null;
count
-------
0
(1 row) ===

Actual results:
Table values are not migrated

Expected results:
Table values are migrated and kept


Related issues

Related to Katello - Bug #23841: hosts table still contains content_view_id and lifecycle_environment_idClosed

Associated revisions

Revision ced737ab (diff)
Added by Stephen Benjamin about 3 years ago

fixes #23781 - migrate content_source_id correctly

By the time the migration runs, host.content_source_id is delegated to
the content facet, so the move fails, as content_source_id will always
be nil. Uses read_attribute instead to read the db column.

History

#1 Updated by The Foreman Bot about 3 years ago

  • Assignee set to Stephen Benjamin
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/7413 added

#2 Updated by Stephen Benjamin about 3 years ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

#3 Updated by John Mitsch about 3 years ago

  • Legacy Backlogs Release (now unused) set to 338
  • Subject changed from content_source_id value is not migrated during upgrade to content_source_id value is not migrated during upgrade

#4 Updated by Stephen Benjamin about 3 years ago

  • Related to Bug #23841: hosts table still contains content_view_id and lifecycle_environment_id added

Also available in: Atom PDF