Bug 2226667

Summary: Repository sync failed with error: Subtask Failed Exception A sub task failed and ActiveRecord::InvalidForeignKey
Product: Red Hat Satellite Reporter: Amit Agarwal <amiagarw>
Component: RepositoriesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: high Docs Contact:
Priority: high    
Version: 6.14.0CC: ahumbe, bgajjava, rlavi, sabhasin, sajha
Target Milestone: 6.14.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-11 12:02:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Amit Agarwal 2023-07-26 07:29:36 UTC
Description of the problem:

I have enabled the following repositories and initiated a product content advanced sync:

Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs 8

Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8

Red Hat Enterprise Linux 9 for x86_64 - AppStream RPMs 9

Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs 9

Red Hat Satellite Client 6 for RHEL 8 x86_64 RPMs

Red Hat Satellite Client 6 for RHEL 9 x86_64 RPMs

However,'Synchronize: Skip Metadata Check synchronize: skip metadata check; repository 'Red Hat Satellite Client 6 for RHEL 9 x86_64 RPMs'; product 'Red Hat Enterprise Linux for x86_64 shows with the following error message: 

~~
Dynflow::Action::WithSubPlans::SubtaskFailedException

A sub task failed
~~~


Further doing with detailed Dynflow steps repository "Synchronize: Skip Metadata Check repository 'Red Hat Enterprise Linux 9 for x86_64 - AppStream RPMs 9'; product 'Red Hat Enterprise Linux for x86_64'; organization 'RedHat' sync got failed" with below error message -->


Error:

PG::ForeignKeyViolation: ERROR:  insert or update on table "katello_repository_rpms" violates foreign key constraint "fk_rails_39a260fd51"
DETAIL:  Key (rpm_id)=(66914) is not present in table "katello_rpms"..


Re-synchronizing 'Red Hat Enterprise Linux 9 for x86_64 - AppStream RPMs 9'' did resolved the issue.

Comment 1 Ashish Humbe 2023-07-27 04:35:14 UTC
Looks like this is a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=2224031

Comment 7 Brad Buckingham 2023-08-11 12:02:56 UTC
Amit,  

Thanks for retesting this on the latest snap.  Based upon the feedback, I am going to proceed with closing this one as a duplicate of bug 2224031 mentioned in comment 1.   If there are any concerns, please feel free to reopen with appropriate details.

*** This bug has been marked as a duplicate of bug 2224031 ***