Bug 1128496

Summary: Rule Engine should work correctly with multiple job queues
Product: [Community] Bugzilla Reporter: Simon Green <sgreen>
Component: Internal ToolsAssignee: Simon Green <sgreen>
Internal Tools sub component: Rules Engine QA Contact:
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: high    
Priority: high CC: ebaak, jmcdonal, qgong, rjoost
Version: 4.4   
Target Milestone: 4.4   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 4.4.5024 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-27 00:28:17 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 Simon Green 2014-08-10 21:34:51 UTC
Description of problem:
When dogfooding the Rules Engine, we found that some rules were been actioned twice (see bug 1128008).

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

How reproducible:
always

Steps to Reproduce:
1. Create a rule that runs on job creation time
2. Have multiple job queues running
3. Create a bug

Actual results:
The rule appears to fire multiple times

Expected results:
The rule should run once.

Additional info:
The root cause of this is when creating a bug, both a 'create' and an 'update' job is created for the job. Since Red Hat have multiple job queues, they both ran at the same time (one on each server) and weren't aware that the other queue was also processing the bug.

There are two thing that should be fixed.

1) If possible, we should create a 'create' job only when creating a bug.

2) The above doesn't fix the problem where a bug is updated multiple times (e.g. two RPC calls, or if the job queue was disabled and two updates were done in quick succession). To handle that unlikely situation, we need to check that there is no lowered numbered (ts_job.id) job in the queue for the same bug, excluding dry runs (which don't change the bug).

Comment 1 Simon Green 2014-08-11 05:48:58 UTC
(In reply to Simon Green from comment #0)
> There are two thing that should be fixed.
> 
> 1) If possible, we should create a 'create' job only when creating a bug.

This cannot be done. Upstream code calls update after setting the bug flags.

Comment 7 Simon Green 2014-08-27 00:28:17 UTC
This change is now live. If there are any issues, do not reopen this bug.
Instead, you should create a new bug and reference this bug.