Project

General

Profile

Feature #12163

Add ability to expire facts based on fact name.

Added by Ryan Sabatini over 7 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Facts
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

Currently there isn't a way to expire old facts that are no longer being collected from the database. This feature adds a rake task similar to reports:expire to delete facts based on the provided fact name.


Related issues

Related to Foreman - Bug #16576: Structured facts importer is extremely slowClosed2016-09-15
Has duplicate Foreman - Feature #18479: Add a rake task to cleanup facts that are not used anymoreDuplicate2017-02-13

Associated revisions

Revision 89d84f63 (diff)
Added by Marek Hulán about 6 years ago

Fixes #12163 - add a rake task to clean up orphaned facts

History

#1 Updated by Ohad Levy over 7 years ago

  • Status changed from New to Need more information

once new facts comes in, old facts (e.g. facts that dont exists in the new facts set) gets deleted automatically.

#2 Updated by Ryan Sabatini over 7 years ago

Ohad Levy wrote:

once new facts comes in, old facts (e.g. facts that dont exists in the new facts set) gets deleted automatically.

If I stop collecting a custom fact or rename the custom fact, does that fact automatically get deleted? The main reason I came up with the solution is that we were collecting some poorly built custom facts that resulted in ~174k fact_name entries and ~12 million fact values in the database. The sheer volume of the facts broke the javascript on the drop down box for "Trendable" when creating a new trend counter.

We have since stopped collecting the facts that were adding the extra entries that we weren't really using. I have come up with a coded solution similar to reports:expire that allows me to delete the fact name and values for the fact names that we are not longer collecting which allowed me to get the total values down far enough to use the trendable drop down box to create a new trend.

#3 Updated by Dominic Cleal over 7 years ago

  • Status changed from Need more information to New

Ryan Sabatini wrote:

Ohad Levy wrote:

once new facts comes in, old facts (e.g. facts that dont exists in the new facts set) gets deleted automatically.

If I stop collecting a custom fact or rename the custom fact, does that fact automatically get deleted?

It should delete the fact values, but not the fact names. If there were many custom fact names added, as you suggest, then these don't get cleaned up during an import of facts for a host (assuming no other host has a value for it).

I'm changing the ticket status as I think what you're describing is valid.

#4 Updated by Dominic Cleal over 6 years ago

  • Related to Bug #16576: Structured facts importer is extremely slow added

#5 Updated by Marek Hulán about 6 years ago

  • Has duplicate Feature #18479: Add a rake task to cleanup facts that are not used anymore added

#6 Updated by The Foreman Bot about 6 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Marek Hulán
  • Pull request https://github.com/theforeman/foreman/pull/4275 added

#7 Updated by Marek Hulán about 6 years ago

  • Bugzilla link set to 1422458

#8 Updated by Marek Hulán about 6 years ago

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

#9 Updated by Dominic Cleal almost 6 years ago

  • Legacy Backlogs Release (now unused) set to 209

Also available in: Atom PDF