-
Bug
-
Resolution: Done
-
Major
-
6.3.0.Final
-
None
-
Medium
-
NEW
-
NEW
The issue was happening for us when LHS matches for some rules with thousands of rules in rulebase only one rule would fire in PHREAK algo however all matches will fire in REETO.
It turns out the root cause was that the two rules that had LHS matching criteria are defined in separate rule package name and was stemming from AlphaNode.equals returning false when it should return true. I believe underlying issue is further in MevelConstraint.equals compares the package name.
This can be reproduce using attached unit testcase.
I am not sure of the reasoning behind for the MevelConstraint.equals implementation...if it is important to keep that logic same way...following workaround has worked for me.
In class org.drools.core.reteoo.CompositeObjectSinkAdapter following function definitions..
org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(InternalFactHandle, ModifyPreviousTuples, PropagationContext, InternalWorkingMemory)
org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(InternalFactHandle, PropagationContext, InternalWorkingMemory)
org.drools.core.reteoo.CompositeObjectSinkAdapter.byPassModifyToBetaNode(InternalFactHandle, ModifyPreviousTuples, PropagationContext, InternalWorkingMemory)
I changed the call from this.hashedSinkMap.get( hashKey ) to this.hashedSinkMap.getAll( hashKey ) and defined a new function as following to retrieve all alpha nodes that have same HashKey.
public Object[] getAll(final Object key) {
final int hashCode = this.comparator.hashCodeOf( key );
final int index = indexOf( hashCode,
this.table.length );
List arr = new ArrayList();
ObjectEntry current = (ObjectEntry) this.table[index];
while ( current != null ) {
if ( hashCode == current.cachedHashCode && this.comparator.equal( key,
current.key ) )
current = (ObjectEntry) current.getNext();
}
return arr.toArray();
}