Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1429660

Summary: [RFE] Need to automatically remove completed tasks from the database
Product: Red Hat Satellite Reporter: Mike McCune <mmccune>
Component: Tasks PluginAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 6.2.7CC: aruzicka, bbuckingham, inecas, jcallaha, sabnave
Target Milestone: UnspecifiedKeywords: FutureFeature, PrioBumpField, 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: 2017-08-22 10:19:55 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 Mike McCune 2017-03-06 19:28:49 UTC
Over time the amount of data in the foreman_tasks* and dynflow* tables can grow very large and cause significant performance issues for Satellite 6. This is most often found via rhsm calls taking longer than expected and causing Passenger and the UI becoming unable to service new requests on Satellites that meet the following criteria:

 * Have 5000 or more live hosts
 * Have been running for more than 6 months

In extreme cases we can get into the multi-million row counts (most I've seen is 6,000,000 rows in dynflow_steps) for these tables with multi-year old Satellites.

We need to ship a cron or some other time based mechanism to automatically remove tasks older than a certain time period, 120 days perhaps to start with but tunable to something smaller. 

This ideally would get included in both 6.1 and 6.2

Comment 1 Mike McCune 2017-03-06 19:29:11 UTC
We often have to resort to raw sql to delete old data, see:

https://gist.github.com/mccun934/0ce3148dbc3c388252d7210659b7c2ea

Comment 5 Adam Ruzicka 2017-08-22 10:19:55 UTC

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