Bug 802641 - Deleting of lab controllers too slow
Deleting of lab controllers too slow
Status: CLOSED CURRENTRELEASE
Product: Beaker
Classification: Community
Component: lab controller (Show other bugs)
0.8
Unspecified Unspecified
unspecified Severity unspecified (vote)
: 19.0
: ---
Assigned To: Dan Callaghan
tools-bugs
UX
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-13 02:50 EDT by Raymond Mancy
Modified: 2014-12-07 20:11 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-11-25 02:18:36 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Raymond Mancy 2012-03-13 02:50:05 EDT
The loop that deletes the entries from distro_map_controller and appends the activities is too slow.

bkr.server.labcontrollers:329 calls 
  distro.distro.activity.append(DistroActivity(etc etc))

Just the 'distro.distro.activity' makes the two following calls for each
distro entry that is to be deleted from the distro_lab_controller_map.


"SELECT distro.id AS distro_id, distro.install_name AS distro_install_name, distro.name AS distro_name, distro.breed_id AS distro_breed_id, distro.osversion_id AS distro_osversion_id, distro.arch_id AS distro_arch_id, distro.variant AS distro_variant, distro.virt AS distro_virt, distro.date_created AS distro_date_created 
FROM distro 
WHERE distro.id = %s"


"SELECT activity.id AS activity_id, distro_activity.id AS distro_activity_id, activity.user_id AS activity_user_id, activity.created AS activity_created, activity.type AS activity_type, activity.field_name AS activity_field_name, activity.service AS activity_service, activity.action AS activity_action, activity.old_value AS activity_old_value, activity.new_value AS activity_new_value, distro_activity.distro_id AS distro_activity_distro_id 
FROM activity INNER JOIN distro_activity ON activity.id = distro_activity.id 
WHERE %s = distro_activity.distro_id ORDER BY activity.created DESC, activity.id DESC"

Neither of these calls are needed.
Comment 1 Dan Callaghan 2012-03-15 01:49:23 EDT
This one might be my fault. I have got into the habit of always adding new Activity entries by appending to the existing list (e.g. distro.activity.append(DistroActivity(...))), in order to keep the session consistent. But in same cases (such as this one) it is clearly unnecessary, and causes a lot of wasteful queries.
Comment 2 Dan Callaghan 2012-10-24 23:42:51 EDT
Note to self: cascade_backrefs=False can probably help here
Comment 5 Dan Callaghan 2014-11-09 22:38:10 EST
Actually it wasn't, but I patched it:

http://gerrit.beaker-project.org/3469
Comment 7 Dan Callaghan 2014-11-19 19:52:04 EST
Marking this as VERIFIED now that 19.0rc2 acceptance testing is complete.
Comment 8 Dan Callaghan 2014-11-25 02:18:36 EST
Beaker 19.0 has been released.

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