[jboss-jira] [JBoss JIRA] Commented: (JBRULES-3044) Need BRMS-586/590 hotfix for Drools 5.1.1 / Salience firing order reversed or not observed on multple fact inserts post index

Armand Welsh (JIRA) jira-events at lists.jboss.org
Thu Sep 8 17:25:32 EDT 2011


    [ https://issues.jboss.org/browse/JBRULES-3044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12627365#comment-12627365 ] 

Armand Welsh commented on JBRULES-3044:
---------------------------------------

David Martin,

What you describe is what was fixed with this bug report.  The reverse salience issue issue is fixed in Drools 5.2 and 5.3

Something else that could be haunting you, is that when you insert a new fact, or update and existing fact, only the specific rules which have a direct reference to the fact are subject to firing.

if you have a scenario where 5 rules (rule 1 through rule 5) are all in one activation group, and each rule has a different salience in descending order (rule 1 = saliance 5, rule 2 = salience 4, etc), and rule 2 fires.  Then you insert a new fact which is only used by rule 3, then rule 3 will fire if the LHS of the rule is true, regardless of whether the LHS of rule 1 is still true.

That is to say, the conflict resolver is only considered when more than one rule is on the agenda stack.  When inserting new facts at runtime, or changing existing facts at runtime, only the rules that directly reference the modified fact are candidates for being place back on the agenda stack.

If you have a scenario like I did, where you need all the rules in a group of rules to be consider (top-down) on every modification or create of facts, then you need to create a control fact, and reference that control fact in every rule.  Then when you insert or modify you new fact, you need to immediately modify the control fact to force all rules that reference the control fact to be re-evaluated.

> Need BRMS-586/590 hotfix for Drools 5.1.1 / Salience firing order reversed or not observed on multple fact inserts post index
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBRULES-3044
>                 URL: https://issues.jboss.org/browse/JBRULES-3044
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler, drools-core
>    Affects Versions: 5.1.1.FINAL
>         Environment: Windows 7/64, ReHat Enterprise Linux 6, Drools 5.1.1 running Java 6 JRE/SDK (all versions currently available from Oracle), 2 GB RAM, 20+ GB Free HD Space
>            Reporter: Armand Welsh
>            Assignee: Mark Proctor
>            Priority: Critical
>
> When executing fireAllRules, all pre-index rules fire adhering to the salience prioritization.  If, however, during post-index execution, facts are inserted that are used in the conditions of lower salience rules in the same activation group, the rule will fire, regardless of the fact a higher salience rule has already fired.
> This is further complicated when defining default rules of default salience (though any salience value will suffice so long as the default rule has the lowest salience within the activation group).  When no pre-indexed facts are availble for the activation group, the default rule fires.  along, with other activation group rules.  During execution, a new fact is inserted that provides a hit for a higher salience rule in the same activation group as the default rule which already fired, however, the rule is not fired.
> In effect, pre-indexed facts are processed in descending salience order.  whereas post-indexed facts are processed in ascending salience order.
> In all scenarios described, there is not a fire once restriction assigned.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list