Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1585890 - foreman-rake foreman_tasks:cleanup does not remove tasks from foreman_tasks_locks table
foreman-rake foreman_tasks:cleanup does not remove tasks from foreman_tasks_l...
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Tasks Plugin (Show other bugs)
6.3.1
All Linux
medium Severity medium (vote)
: 6.3.3
: Unused
Assigned To: Ivan Necas
Kedar Bidarkar
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2018-06-04 22:27 EDT by Ram Nayan Singh
Modified: 2018-08-22 16:07 EDT (History)
6 users (show)

See Also:
Fixed In Version: tfm-rubygem-foreman-tasks-0.9.6.5-1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1596358 (view as bug list)
Environment:
Last Closed: 2018-08-22 16:07:12 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 23814 None None None 2018-06-05 07:04 EDT
Red Hat Product Errata RHBA-2018:2550 None None None 2018-08-22 16:07 EDT

  None (edit)
Description Ram Nayan Singh 2018-06-04 22:27:45 EDT
#foreman-rake foreman_tasks:cleanup does not remove tasks from foreman_tasks_locks table

Red Hat Satellite 6.3.1

#su - postgres -c "psql foreman -c 'select * from foreman_tasks_tasks'" |wc -l
19

#su - postgres -c "psql foreman -c 'select * from foreman_tasks_locks'"|wc -l
1125

#foreman-rake foreman_tasks:cleanup TASK_SEARCH="" AFTER=1d

After executing the cleanup script, below is the status of the tasks:

su - postgres -c "psql foreman -c 'select * from foreman_tasks_tasks'" |wc -l
17

su - postgres -c "psql foreman -c 'select * from foreman_tasks_locks'"|wc -l
1125

Expectation to delete old task from foreman_tasks_locks table.
Comment 1 Hao Chang Yu 2018-06-04 22:35:16 EDT
The following upstream commit has added a "dependent: :destroy" to the lock association to task model.

https://github.com/theforeman/foreman-tasks/commit/4c482f45f371edd0e71b5dc2d479c09ebdc52382#diff-20a816cf5bc6c5d3d8f9ff4de1395d55R21
Comment 3 Ivan Necas 2018-06-05 07:04:30 EDT
Created redmine issue http://projects.theforeman.org/issues/23814 from this bug
Comment 4 pm-sat@redhat.com 2018-06-05 08:07:04 EDT
Upstream bug assigned to inecas@redhat.com
Comment 5 pm-sat@redhat.com 2018-06-05 08:07:07 EDT
Upstream bug assigned to inecas@redhat.com
Comment 7 pm-sat@redhat.com 2018-06-07 10:07:10 EDT
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/23814 has been resolved.
Comment 9 Patrick Creech 2018-07-02 16:06:18 EDT
Hey Ivan, this failed to cherrypick.  Can you take a look?
Comment 12 Mike McCune 2018-07-16 16:46:30 EDT
Turns out we are also missed the cleanup on dynflow_envelopes.

We can either manage this as a different bug or include it in this bug
Comment 13 Ivan Necas 2018-07-17 03:06:48 EDT
I would consider this being new bug, I will put it here once I file one
Comment 14 Kedar Bidarkar 2018-08-03 05:32:00 EDT
[root@sat63-rhel7 ~]# su - postgres -c "psql foreman -c 'select * from foreman_tasks_tasks'" |wc -l
91
[root@sat63-rhel7 ~]# su - postgres -c "psql foreman -c 'select * from foreman_tasks_locks'"|wc -l
523
[root@sat63-rhel7 ~]# foreman-rake foreman_tasks:cleanup TASK_SEARCH="" AFTER=1d

Cleaning up 519 orphaned locks

[root@sat63-rhel7 ~]# 
[root@sat63-rhel7 ~]# su - postgres -c "psql foreman -c 'select * from foreman_tasks_tasks'" |wc -l
7
[root@sat63-rhel7 ~]# su - postgres -c "psql foreman -c 'select * from foreman_tasks_locks'"|wc -l

As seen it has cleaned up 519 orphaned locks.

VERIFIED with Sat6.3.3 snap2
Comment 16 errata-xmlrpc 2018-08-22 16:07:12 EDT
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/RHBA-2018:2550

Note You need to log in before you can comment on or make changes to this bug.