Bug 802641 - Deleting of lab controllers too slow
Summary: Deleting of lab controllers too slow
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: lab controller
Version: 0.8
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 19.0
Assignee: Dan Callaghan
QA Contact: tools-bugs
URL:
Whiteboard: UX
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-03-13 06:50 UTC by Raymond Mancy
Modified: 2014-12-08 01:11 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-11-25 07:18:36 UTC
Embargoed:


Attachments (Terms of Use)

Description Raymond Mancy 2012-03-13 06:50:05 UTC
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 05:49:23 UTC
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-25 03:42:51 UTC
Note to self: cascade_backrefs=False can probably help here

Comment 5 Dan Callaghan 2014-11-10 03:38:10 UTC
Actually it wasn't, but I patched it:

http://gerrit.beaker-project.org/3469

Comment 7 Dan Callaghan 2014-11-20 00:52:04 UTC
Marking this as VERIFIED now that 19.0rc2 acceptance testing is complete.

Comment 8 Dan Callaghan 2014-11-25 07:18:36 UTC
Beaker 19.0 has been released.


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