Bug 1167110

Summary: Deleting a Cluster with many policy_events takes forever and times out.
Product: Red Hat CloudForms Management Engine Reporter: Josh Carter <jocarter>
Component: ApplianceAssignee: Jason Frey <jfrey>
Status: CLOSED ERRATA QA Contact: Aziza Karol <akarol>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.2.0CC: jfrey, jhardy, jocarter, jrafanie, mfeifer, obarenbo, psavage, snansi, xlecauch
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 5.4.0.0.11 Doc Type: Bug Fix
Doc Text:
In the previous version of CloudForms Management Engine, when a user tried to delete a cluster with many policy_events, the process timed out after being in an idle state for a long time. This issue was being caused because the purger for the policy events table did not exist. This issue was fixed by adding scheduler methods for purging policy_events. It is now possible to delete clusters with many policy_events in the latest version of CloudForms Management Engine.
Story Points: ---
Clone Of:
: 1171343 (view as bug list) Environment:
Last Closed: 2015-06-16 12:45:11 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:
Bug Depends On:    
Bug Blocks: 1171343    

Comment 10 Jason Frey 2014-11-25 20:52:26 UTC
Opened upstream PR for code changes to remove :dependent => :nullify and replace it with a proper time-based purger: https://github.com/ManageIQ/manageiq/pull/1117

Comment 11 CFME Bot 2014-12-02 01:35:59 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/19f2c3152314716ae512c3c57848f774192b44a4

commit 19f2c3152314716ae512c3c57848f774192b44a4
Author:     Jason Frey <jfrey>
AuthorDate: Mon Nov 24 16:51:10 2014 -0500
Commit:     Jason Frey <jfrey>
CommitDate: Mon Nov 24 16:56:30 2014 -0500

    Remove :dependent => :nullify for policy_events.
    
    policy_events will be handled by a purger much like ems_events.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1167110

 vmdb/app/models/ems_cluster.rb           | 2 +-
 vmdb/app/models/ext_management_system.rb | 2 +-
 vmdb/app/models/host.rb                  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comment 12 CFME Bot 2014-12-02 01:36:02 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/a4934ae472b6cf9265b78d5504390fb97bb09dd4

commit a4934ae472b6cf9265b78d5504390fb97bb09dd4
Author:     Jason Frey <jfrey>
AuthorDate: Mon Nov 24 16:55:48 2014 -0500
Commit:     Jason Frey <jfrey>
CommitDate: Tue Nov 25 18:36:56 2014 -0500

    Add purger for policy_events.
    
    PurgerMixin has been created as a set of common methods from all of the
    other purgers.  The other purgers will be modified to reuse these
    common methods in the future.  Initially this mixin has been created
    with methods for purging by date only, but ultimately it should include
    methods for purging "by remaining" as is found in the miq_report_result
    and drift_state purgers.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1167110

 vmdb/app/models/mixins/purging_mixin.rb       | 68 +++++++++++++++++++++++
 vmdb/app/models/policy_event.rb               |  2 +
 vmdb/app/models/policy_event/purging.rb       | 40 ++++++++++++++
 vmdb/config/vmdb.tmpl.yml                     |  4 ++
 vmdb/spec/factories/policy_event.rb           |  4 ++
 vmdb/spec/models/mixins/purging_mixin_spec.rb | 79 +++++++++++++++++++++++++++
 vmdb/spec/models/policy_event/purging_spec.rb | 34 ++++++++++++
 7 files changed, 231 insertions(+)
 create mode 100644 vmdb/app/models/mixins/purging_mixin.rb
 create mode 100644 vmdb/app/models/policy_event/purging.rb
 create mode 100644 vmdb/spec/factories/policy_event.rb
 create mode 100644 vmdb/spec/models/mixins/purging_mixin_spec.rb
 create mode 100644 vmdb/spec/models/policy_event/purging_spec.rb

Comment 13 CFME Bot 2014-12-02 01:36:06 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/c4db81438c91b03ef112f4e8ca63ca7ba769d399

commit c4db81438c91b03ef112f4e8ca63ca7ba769d399
Author:     Jason Frey <jfrey>
AuthorDate: Mon Nov 24 16:56:05 2014 -0500
Commit:     Jason Frey <jfrey>
CommitDate: Tue Nov 25 18:36:56 2014 -0500

    Added scheduler methods for purging policy_events.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1167110

 vmdb/config/vmdb.tmpl.yml                     |  1 +
 vmdb/lib/workers/schedule_worker.rb           |  6 ++++++
 vmdb/lib/workers/schedule_worker/jobs.rb      | 18 ++++++++++++------
 vmdb/spec/lib/workers/schedule_worker_spec.rb | 19 ++++++++++---------
 4 files changed, 29 insertions(+), 15 deletions(-)

Comment 14 CFME Bot 2014-12-05 22:51:06 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=d2f012392e19f165c673e5a8aaf93a2ad740f67b

commit d2f012392e19f165c673e5a8aaf93a2ad740f67b
Author:     Jason Frey <jfrey>
AuthorDate: Mon Nov 24 16:51:10 2014 -0500
Commit:     Jason Frey <jfrey>
CommitDate: Fri Dec 5 17:48:11 2014 -0500

    Remove :dependent => :nullify for policy_events.
    
    policy_events will be handled by a purger much like ems_events.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1167110
    https://bugzilla.redhat.com/show_bug.cgi?id=1171343

 vmdb/app/models/ems_cluster.rb           | 2 +-
 vmdb/app/models/ext_management_system.rb | 2 +-
 vmdb/app/models/host.rb                  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comment 15 CFME Bot 2014-12-05 22:51:21 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=11c33f0f275b2fcf9de22ee7246712726bb38b1d

commit 11c33f0f275b2fcf9de22ee7246712726bb38b1d
Author:     Jason Frey <jfrey>
AuthorDate: Mon Nov 24 16:56:05 2014 -0500
Commit:     Jason Frey <jfrey>
CommitDate: Fri Dec 5 17:48:23 2014 -0500

    Added scheduler methods for purging policy_events.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1167110
    https://bugzilla.redhat.com/show_bug.cgi?id=1171343

 vmdb/config/vmdb.tmpl.yml                     |  1 +
 vmdb/lib/workers/schedule_worker.rb           |  6 ++++++
 vmdb/lib/workers/schedule_worker/jobs.rb      | 18 ++++++++++++------
 vmdb/spec/lib/workers/schedule_worker_spec.rb | 19 ++++++++++---------
 4 files changed, 29 insertions(+), 15 deletions(-)

Comment 16 CFME Bot 2014-12-05 22:51:34 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=b4484b6674388904fd70fb7b640d832bd42513ff

commit b4484b6674388904fd70fb7b640d832bd42513ff
Author:     Jason Frey <jfrey>
AuthorDate: Mon Nov 24 16:55:48 2014 -0500
Commit:     Jason Frey <jfrey>
CommitDate: Fri Dec 5 17:48:19 2014 -0500

    Add purger for policy_events.
    
    PurgerMixin has been created as a set of common methods from all of the
    other purgers.  The other purgers will be modified to reuse these
    common methods in the future.  Initially this mixin has been created
    with methods for purging by date only, but ultimately it should include
    methods for purging "by remaining" as is found in the miq_report_result
    and drift_state purgers.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1167110
    https://bugzilla.redhat.com/show_bug.cgi?id=1171343

 vmdb/app/models/mixins/purging_mixin.rb       | 68 +++++++++++++++++++++++
 vmdb/app/models/policy_event.rb               |  2 +
 vmdb/app/models/policy_event/purging.rb       | 40 ++++++++++++++
 vmdb/config/vmdb.tmpl.yml                     |  4 ++
 vmdb/spec/factories/policy_event.rb           |  4 ++
 vmdb/spec/models/mixins/purging_mixin_spec.rb | 79 +++++++++++++++++++++++++++
 vmdb/spec/models/policy_event/purging_spec.rb | 34 ++++++++++++
 7 files changed, 231 insertions(+)
 create mode 100644 vmdb/app/models/mixins/purging_mixin.rb
 create mode 100644 vmdb/app/models/policy_event/purging.rb
 create mode 100644 vmdb/spec/factories/policy_event.rb
 create mode 100644 vmdb/spec/models/mixins/purging_mixin_spec.rb
 create mode 100644 vmdb/spec/models/policy_event/purging_spec.rb

Comment 20 Aziza Karol 2015-06-03 08:27:16 UTC
I tried deleting the cluster with few policy events and it got successful deleted in 5.4.0.4.if this verification is good to go, then we can mark this issue as verified.

If i have to test with many policy events then can you please provide me with the db used for deleting the cluster?


~Thanks
Aziza

Comment 24 errata-xmlrpc 2015-06-16 12:45:11 UTC
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://rhn.redhat.com/errata/RHBA-2015-1100.html