Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1793701 - Content View publishing fails after katello_repository_rpms "id" column hits max integer size
Summary: Content View publishing fails after katello_repository_rpms "id" column hits ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Management
Version: 6.6.0
Hardware: All
OS: Linux
unspecified
urgent
Target Milestone: 6.7.0
Assignee: Justin Sherrill
QA Contact: Lai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-21 21:17 UTC by Dylan Gross
Modified: 2023-03-24 16:48 UTC (History)
2 users (show)

Fixed In Version: tfm-rubygem-katello-3.14.0.10-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-14 13:28:34 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
database migration file (147 bytes, text/x-modelica)
2020-01-21 22:30 UTC, Justin Sherrill
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 28831 0 Normal Closed Content View publishing fails after katello_repository_rpms "id" column hits max integer size 2021-01-08 14:43:42 UTC
Red Hat Knowledge Base (Solution) 4760261 0 None None None 2020-01-21 22:37:03 UTC
Red Hat Product Errata RHSA-2020:1454 0 None None None 2020-04-14 13:28:48 UTC

Description Dylan Gross 2020-01-21 21:17:08 UTC
Description of problem:

  Content View publishing fails after katello_repository_rpms "id" column hits max integer size


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

  Red Hat Satellite 6.6  (but I believe all supported versions would be susceptible)

How reproducible:
Steps to Reproduce:
1.   Publish, publish, publish new content until the number of INSERTS (which increment "id" on every new row finally hits Integer max size (or close enough that the next publish would increment it above the Max)


Actual results:

   

Expected results:

   Publishes succeed.

Additional info:

Error in dynflow task:
----------------------------------------------------------------
PG::NumericValueOutOfRange: ERROR:  integer out of range

: INSERT INTO katello_repository_rpms (rpm_id, repository_id, created_at, updated_at) VALUES 
   (494939, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (249613, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (249614, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (393610, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (287208, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (249616, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (397182, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (353289, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (228061, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (383234, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (369162, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (488882, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (365164, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (494940, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (393611, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (430253, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (228062, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (489006, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (228871, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (365425, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (256320, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (420443, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (365426, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (398249, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (431032, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14'), 
   (487077, 751553, '2020-01-21 14:03:14', '2020-01-21 14:03:14')
----------------------------------------------

As neither of the two integers being inserted above (rpm_id, or repository_id) appear to be anywhere close to the integer max size, they're unlikely to be the culprits. 

--------------------------------------------------
foreman=# \d katello_repository_rpms
                                       Table "public.katello_repository_rpms"
    Column     |            Type             |                              Modifiers                               
---------------+-----------------------------+----------------------------------------------------------------------
 id            | integer                     | not null default nextval('katello_repository_rpms_id_seq'::regclass)
 rpm_id        | integer                     | not null
 repository_id | integer                     | 
 created_at    | timestamp without time zone | 
 updated_at    | timestamp without time zone | 
Indexes:
    "katello_repository_rpms_pkey" PRIMARY KEY, btree (id)
    "index_katello_repository_rpms_on_rpm_id_and_repository_id" UNIQUE, btree (rpm_id, repository_id)
    "index_katello_repository_rpms_on_repository_id" btree (repository_id)
Foreign-key constraints:
    "katello_repository_rpms_repository_id_fk" FOREIGN KEY (repository_id) REFERENCES katello_repositories(id)
    "katello_repository_rpms_rpm_id_fk" FOREIGN KEY (rpm_id) REFERENCES katello_rpms(id)

foreman=# 
--------------------------------------------------------------

 Rather, it is the "id" that is incremented on every new row that is hitting the max, and the following shows that it's currently super close.

----------------------------------------------------


foreman=# select MAX(id) from katello_repository_rpms;
    max     
------------
 2147478931
(1 row)

Comment 4 Justin Sherrill 2020-01-21 22:28:23 UTC
Created redmine issue https://projects.theforeman.org/issues/28831 from this bug

Comment 5 Justin Sherrill 2020-01-21 22:30:59 UTC
Created attachment 1654409 [details]
database migration file

Comment 6 Justin Sherrill 2020-01-21 22:32:38 UTC
To apply patch:

Drop the attached file into the /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.12.0.29/db/migrate/ directory, so that it exists as: /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.12.0.29/db/migrate/20200121213430_katello_repository_rpms_id_big_int.rb

Run:

foreman-rake db:migrate
systemctl restart httpd dynflowd

Comment 7 Bryan Kearney 2020-01-21 23:03:00 UTC
Upstream bug assigned to jsherril

Comment 8 Bryan Kearney 2020-01-21 23:03:01 UTC
Upstream bug assigned to jsherril

Comment 9 Bryan Kearney 2020-01-22 15:04:11 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28831 has been resolved.

Comment 12 Lai 2020-02-10 16:31:16 UTC
Steps to retest:

1. Check postgres database table for BIGINT for ID column.

Expected result: id -> bigint

Actual result:
foreman=# \d katello_repository_rpms
                                       Table "public.katello_repository_rpms"
    Column     |            Type             |                              Modifiers                    
           
---------------+-----------------------------+-----------------------------------------------------------
-----------
 id            | bigint                      | not null default nextval('katello_repository_rpms_id_seq':
:regclass)
 rpm_id        | integer                     | not null
 repository_id | integer                     | 
 created_at    | timestamp without time zone | 
 updated_at    | timestamp without time zone | 
Indexes:


Second way of verifying:
1. Create a custom repo
2. Sync repo
3. Create cv and add custom repo from step 1
4. Publish cv
5. Log into postgres database
6. Update id to something above the 2,147,483,647 max. i.e. foreman=# update katello_repository_rpms set id=3147478933 where id in (Select max(id) from katello_repository_rpms);

Expected result:
UPDATE 1

Actual result:
UPDATE 1

Note: For the second way of verifying, if you update above the 2147483647 max, it'll give "ERROR: integer out of range"  IF THE ID DATATYPE was still in "integer".  Switching to "bigint" has a higher max value so it should not give the error message.  In this case, it did not give the error message.

Tested on 6.7.0_011.  Marking issue as verified.

Comment 15 errata-xmlrpc 2020-04-14 13:28:34 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-2020:1454


Note You need to log in before you can comment on or make changes to this bug.