Refactor #28564
improve fact cleanup performance
Description
`delete_orphaned_facts` step is very slow, it is loading all fact names and checking if they have fact values associated with them, then trying to also delete fact values unnecessarily.
Related issues
Associated revisions
History
#1
Updated by The Foreman Bot over 3 years ago
- Assignee set to Tomer Brisker
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/7288 added
#2
Updated by Tomer Brisker over 3 years ago
- Related to Feature #25227: Foreman-rake facts:cleanup batch/rolling support added
#3
Updated by The Foreman Bot about 3 years ago
- Fixed in Releases 2.0.0 added
#4
Updated by Tomer Brisker about 3 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 1f2c46e02a9ffe3e5bf14d7777e0bea89330a40c.
#5
Updated by Tomer Brisker about 3 years ago
- Fixed in Releases 1.24.2 added
#6
Updated by Tomer Brisker over 1 year ago
- Related to Bug #30028: foreman-rake facts:clean fails with foreign key constraint violation added
Fixes #28564 - improve performance of orphaned facts cleanup
This should greatly improve the performance of cleaning up orphaned
facts. First, we stop trying to delete fact_values for orphaned facts
since they don't exist. Then, instead of checking each compose fact's
descendants to see if they were all deleted, we get a set of all
remaining leaf's ancestors and delete any not on that list.