Bug 1585890 - foreman-rake foreman_tasks:cleanup does not remove tasks from foreman_tasks_locks table
Summary: foreman-rake foreman_tasks:cleanup does not remove tasks from foreman_tasks_l...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Tasks Plugin
Version: 6.3.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: Unspecified
Assignee: Ivan Necas
QA Contact: Kedar Bidarkar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-05 02:27 UTC by Ram Nayan Singh
Modified: 2019-08-12 16:03 UTC (History)
7 users (show)

Fixed In Version: tfm-rubygem-foreman-tasks-0.9.6.5-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1596358 (view as bug list)
Environment:
Last Closed: 2018-08-22 20:07:12 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 23814 0 Normal Closed foreman-rake foreman_tasks:cleanup does not remove tasks from foreman_tasks_locks table 2021-02-02 04:05:18 UTC
Red Hat Product Errata RHBA-2018:2550 0 None None None 2018-08-22 20:07:47 UTC

Description Ram Nayan Singh 2018-06-05 02:27:45 UTC
#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-05 02:35:16 UTC
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 11:04:30 UTC
Created redmine issue http://projects.theforeman.org/issues/23814 from this bug

Comment 4 pm-sat@redhat.com 2018-06-05 12:07:04 UTC
Upstream bug assigned to inecas@redhat.com

Comment 5 pm-sat@redhat.com 2018-06-05 12:07:07 UTC
Upstream bug assigned to inecas@redhat.com

Comment 7 pm-sat@redhat.com 2018-06-07 14:07:10 UTC
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 20:06:18 UTC
Hey Ivan, this failed to cherrypick.  Can you take a look?

Comment 12 Mike McCune 2018-07-16 20:46:30 UTC
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 07:06:48 UTC
I would consider this being new bug, I will put it here once I file one

Comment 14 Kedar Bidarkar 2018-08-03 09:32:00 UTC
[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 20:07:12 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://access.redhat.com/errata/RHBA-2018:2550


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