Bug 1173376

Summary: system_recipe_map is not being cleared for Aborted/Cancelled recipes
Product: [Retired] Beaker Reporter: Dan Callaghan <dcallagh>
Component: schedulerAssignee: matt jia <mjia>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: aigao, asaha, dcallagh, dowang, mjia
Target Milestone: 20.0Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-20 02:22:45 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 Dan Callaghan 2014-12-12 01:32:37 UTC
A recipe should only have rows in system_recipe_map while it is still New/Processed/Queued. Once it is Scheduled the rows are removed.

However I am seeing a very large number of rows in system_recipe_map for recipes that are Cancelled or Aborted. I am guessing that we are missing a bit of logic to clear system_recipe_map when a recipe is aborted or cancelled before it reaches Scheduled.

I'm reasonably sure we used to have this so need to double-check that it wasn't intentionally removed to work around some other issue such as db deadlocks (we have some of those still open I think). But either way the current behaviour is not sustainable since the system_recipe_map table will grow unbounded.

On Red Hat's Beaker it is currently at 7 million rows.

Comment 1 Dan Callaghan 2014-12-12 01:38:26 UTC
(In reply to Dan Callaghan from comment #0)
> A recipe should only have rows in system_recipe_map while it is still
> New/Processed/Queued. Once it is Scheduled the rows are removed.

The cleanest solution might be to make update_status() or one of those related methods enforce this invariant.

We will also need to find a way to clean out existing leftover rows from system_recipe_map.

Comment 2 matt jia 2015-02-06 00:45:18 UTC
On gerrit:

  http://gerrit.beaker-project.org/#/c/3967/

Matt Jia

Comment 3 matt jia 2015-02-11 01:42:53 UTC
(In reply to matt jia from comment #2)
> On gerrit:
> 
>   http://gerrit.beaker-project.org/#/c/3967/
> 
> Matt Jia

Have uploaded a new patch:

 http://gerrit.beaker-project.org/#/c/3971/

Matt Jia

Comment 4 matt jia 2015-02-23 04:01:11 UTC
Verify steps:

1. Creat a job

2. cancel it from WEB UI or using bkr job-cancel

3. login to the database and check if rows in the system_recipe_map are cleared

the check sql statement could be sth like this:

select * from system_recipe_map where recipe_id = <any recipe id in your job>

it should return 0 as expected.

Cheers,Matt Jia

Comment 10 Dan Callaghan 2015-04-20 02:22:45 UTC
Beaker 20.0 has been released.