Red Hat Bugzilla – Bug 802641
Deleting of lab controllers too slow
Last modified: 2014-12-07 20:11:49 EST
The loop that deletes the entries from distro_map_controller and appends the activities is too slow.
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
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.
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.
Note to self: cascade_backrefs=False can probably help here
I suspect this is fixed by https://git.beaker-project.org/cgit/beaker/commit/?id=cbb8ecd2c24086bde7ede40e2a7e613a1c4b93e6
Actually it wasn't, but I patched it:
Marking this as VERIFIED now that 19.0rc2 acceptance testing is complete.
Beaker 19.0 has been released.