Bug 1434918
Summary: | Orphaned Rows in vim_performance_states not being purged | ||
---|---|---|---|
Product: | Red Hat CloudForms Management Engine | Reporter: | Jared Deubel <jdeubel> |
Component: | Appliance | Assignee: | Nick Carboni <ncarboni> |
Status: | CLOSED ERRATA | QA Contact: | Tasos Papaioannou <tpapaioa> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 5.7.0 | CC: | abellott, cpelland, gtanzill, jfrey, jhardy, myoder, ncarboni, obarenbo, rspagnol, simaishi, tpapaioa |
Target Milestone: | GA | ||
Target Release: | 5.10.0 | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | 5.10.0.0 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2019-02-07 23:02:25 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
Jared Deubel
2017-03-22 15:15:24 UTC
If it's just VMs that you want to remove orphaned records, you can get that done in one (long) line in the rails console: VimPerformanceState.joins("LEFT OUTER JOIN vms ON vim_performance_states.resource_id = vms.id").where(:vms => {:id => nil}, :resource_type => "VmOrTemplate").in_batches(:of => 10000).delete_all This will likely take quite a while. You can also increase that batch number if that seems to help. I'm working on a more generic way to purge vim_performance_states for all the objects that they can point to. Ideally this will get rolled into our existing purging schedules. The script in comment 3 is also for vms that have been *deleted* not *archived* Archived vms can still be reported on so I don't think we would want to remove the vim_performance_states for those. The change made in the PR in comment 5 will create a schedule (daily by default) to remove vim_performance_state records which point to a resource which no-longer exists. New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/84ca04ce3c833cd94896ece5f6db662b4bb494ab commit 84ca04ce3c833cd94896ece5f6db662b4bb494ab Author: Nick Carboni <ncarboni> AuthorDate: Fri Jan 5 11:28:38 2018 -0500 Commit: Nick Carboni <ncarboni> CommitDate: Mon Jan 15 13:26:21 2018 -0500 Purge orphans from VimPerformanceState This uses the new "orhaned" purging mode to remove rows from vim_performance_states which have dangling pointers Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1434918 app/models/vim_performance_state.rb | 2 ++ app/models/vim_performance_state/purging.rb | 16 ++++++++++ config/settings.yml | 3 ++ spec/models/vim_performance_state/purging_spec.rb | 37 +++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 app/models/vim_performance_state/purging.rb create mode 100644 spec/models/vim_performance_state/purging_spec.rb New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/ea5394d58e5a60efcbd2261481b94dbe14e26d57 commit ea5394d58e5a60efcbd2261481b94dbe14e26d57 Author: Nick Carboni <ncarboni> AuthorDate: Fri Jan 5 11:59:09 2018 -0500 Commit: Nick Carboni <ncarboni> CommitDate: Mon Jan 15 13:26:21 2018 -0500 Add purge schedule for VimPerformanceState Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1434918 app/models/miq_schedule_worker/jobs.rb | 4 ++++ app/models/miq_schedule_worker/runner.rb | 5 +++++ config/settings.yml | 1 + 3 files changed, 10 insertions(+) Verified on 5.10.0.17. 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-2019:0212 |