Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1291507

Summary: Reduce amount of sql queries made on task page
Product: Red Hat Satellite Reporter: Chris Roberts <chrobert>
Component: Tasks PluginAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED DUPLICATE QA Contact: Katello QA List <katello-qa-list>
Severity: low Docs Contact:
Priority: low    
Version: NightlyCC: inecas
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
URL: http://projects.theforeman.org/issues/12867
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-12 18:39:53 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 Chris Roberts 2015-12-15 01:59:43 UTC
Description of problem:
Reduce the amount of repeated SQL queries made against the Monitor -> tasks page

Version-Release number of selected component (if applicable):

Installed Packages

candlepin-0.9.49.9-1.el7.noarch
candlepin-common-1.0.22-1.el7.noarch
candlepin-guice-3.0-2_redhat_1.el7.noarch
candlepin-scl-1-5.el7.noarch
candlepin-scl-quartz-2.1.5-6.el7.noarch
candlepin-scl-rhino-1.7R3-3.el7.noarch
candlepin-scl-runtime-1-5.el7.noarch
candlepin-selinux-0.9.49.9-1.el7.noarch
candlepin-tomcat-0.9.49.9-1.el7.noarch
elasticsearch-0.90.10-7.el7.noarch
katello-2.2.0.16-1.el7sat.noarch
katello-certs-tools-2.2.1-1.el7sat.noarch
katello-common-2.2.0.16-1.el7sat.noarch
katello-debug-2.2.0.16-1.el7sat.noarch
katello-default-ca-1.0-1.noarch
katello-installer-2.3.20-1.el7sat.noarch
katello-installer-base-2.3.20-1.el7sat.noarch
katello-server-ca-1.0-1.noarch
katello-service-2.2.0.16-1.el7sat.noarch
libqpid-dispatch-0.4-10.el7.x86_64
pulp-docker-plugins-0.2.5-1.el7sat.noarch
pulp-katello-0.5-1.el7sat.noarch
pulp-nodes-common-2.6.0.17-1.el7sat.noarch
pulp-nodes-parent-2.6.0.17-1.el7sat.noarch
pulp-puppet-plugins-2.6.0.17-1.el7sat.noarch
pulp-puppet-tools-2.6.0.17-1.el7sat.noarch
pulp-rpm-plugins-2.6.0.17-1.el7sat.noarch
pulp-selinux-2.6.0.17-1.el7sat.noarch
pulp-server-2.6.0.17-1.el7sat.noarch
python-gofer-qpid-2.6.6-2.el7sat.noarch
python-isodate-0.5.0-4.pulp.el7sat.noarch
python-kombu-3.0.24-10.pulp.el7sat.noarch
python-pulp-bindings-2.6.0.17-1.el7sat.noarch
python-pulp-common-2.6.0.17-1.el7sat.noarch
python-pulp-docker-common-0.2.5-1.el7sat.noarch
python-pulp-puppet-common-2.6.0.17-1.el7sat.noarch
python-pulp-rpm-common-2.6.0.17-1.el7sat.noarch
python-qpid-0.30-6.el7.noarch
python-qpid-qmf-0.30-5.el7.x86_64
qpid-cpp-client-0.30-9.el7.x86_64
qpid-cpp-client-devel-0.30-9.el7.x86_64
qpid-cpp-server-0.30-9.el7.x86_64
qpid-cpp-server-linearstore-0.30-9.el7.x86_64
qpid-dispatch-router-0.4-10.el7.x86_64
qpid-java-client-0.30-3.el7.noarch
qpid-java-common-0.30-3.el7.noarch
qpid-proton-c-0.9-7.el7.x86_64
qpid-qmf-0.30-5.el7.x86_64
qpid-tools-0.30-4.el7.noarch
ruby193-rubygem-katello-2.2.0.76-1.el7sat.noarch
ruby193-rubygem-qpid_messaging-0.30.0-1.el7sat.x86_64
rubygem-hammer_cli_katello-0.0.7.18-1.el7sat.noarch
rubygem-smart_proxy_pulp-1.0.1.2-1.el7sat.noarch
satellite2.released-el7.satellite.lab.eng.rdu2.redhat.com-qpid-broker-1.0-1.noarch
satellite2.released-el7.satellite.lab.eng.rdu2.redhat.com-qpid-client-cert-1.0-1.noarch
satellite2.released-el7.satellite.lab.eng.rdu2.redhat.com-qpid-router-client-1.0-1.noarch
satellite2.released-el7.satellite.lab.eng.rdu2.redhat.com-qpid-router-server-1.0-1.noarch

Additional info:

Filling under Webui/Katello due to the foreman_tasks in the katello folder in /opt instead of /usr/share/foreman.

This is the SQL statement that is run:
[D]   User Load (155.7ms)  SELECT "users".* FROM "users" INNER JOIN "foreman_tasks_locks" ON "users"."id" = "foreman_tasks_locks"."resource_id" WHERE "users"."id" IN (11, 8, 9, 10, 1, 2, 13, 3) AND "foreman_tasks_locks"."task_id" = '6dae4635-91c2-4bc9-b22f-2410e889c04a' AND "foreman_tasks_locks"."resource_type" = 'User' AND (foreman_tasks_locks.name = 'task_owner') ORDER BY firstname LIMIT 1

That the query was run 200 times once per row and each time that took 150 ms, sometimes 180

Comment 1 Bryan Kearney 2015-12-17 19:11:11 UTC
Created redmine issue http://projects.theforeman.org/issues/12867 from this bug

Comment 2 Bryan Kearney 2015-12-18 09:05:30 UTC
Upstream bug component is Tasks Plugin

Comment 3 Bryan Kearney 2016-07-26 19:08:16 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 6 Chris Roberts 2016-09-12 18:39:53 UTC

*** This bug has been marked as a duplicate of bug 1372073 ***

Comment 7 Ivan Necas 2016-09-13 06:42:14 UTC
is it actually a duplicated of bug 1372073, there were different duplicate calls dealt with there: dynflow_steps vs. foreman_tasks.locks. It seems to me more related to https://bugzilla.redhat.com/show_bug.cgi?id=1334924