Rikkola commented on code in PR #7135:
URL: https://github.com/apache/incubator-kie/pull/7135#discussion_r4195906172
##########
drools-core/src/main/java/org/drools/core/reteoo/SingleObjectSinkAdapter.java:
##########
@@ -120,17 +121,36 @@ public void doUnlinkSubnetwork(ReteEvaluator
reteEvaluator) {
public static void staticDoUnlinkSubnetwork(ObjectSink sink, ReteEvaluator
reteEvaluator) {
BetaMemory bm;
+ BetaNode betaNode;
if ( sink.getType() == NodeTypeEnums.AccumulateRightAdapterNode ) {
AccumulateNode accnode = ((AccumulateRight)sink).getBetaNode();
AccumulateMemory accMem = ( AccumulateMemory )
reteEvaluator.getNodeMemory( accnode );
bm = accMem.getBetaMemory();
- } else {
- BetaNode betaNode = ((RightInputAdapterNode) sink).getBetaNode();
+ betaNode = accnode;
+ } else {
+ betaNode = ((RightInputAdapterNode) sink).getBetaNode();
bm = RightInputAdapterNode.getBetaMemoryFromRightInput(betaNode,
reteEvaluator);
}
- if (sink.getType() == NodeTypeEnums.NotNode) {
- bm.linkNode( ( BetaNode ) sink, reteEvaluator );
+ if (betaNode.getType() == NodeTypeEnums.NotNode) {
+ bm.linkNode(betaNode, reteEvaluator);
+ // Stage left tuples that have no match records (contextObject ==
null) as INSERT.
+ // insertLeft in PhreakSubnetworkNotExistsNode only creates a
child when contextObject
+ // is null, so this is a no-op for tuples that were already
correctly handled by the
+ // normal deleteRight path (which leaves an empty-but-non-null
TupleList as contextObject).
+ // This rescues cross-package broken-path cases where deleteRight
never ran for a rule.
+ SegmentMemory smem = bm.getSegmentMemory();
+ if (smem != null) {
+ TupleMemory ltm = bm.getLeftTupleMemory();
+ if (ltm != null && ltm.size() > 0) {
+ FastIterator<TupleImpl> it = ltm.fullFastIterator();
+ for (TupleImpl lt = BetaNode.getFirstTuple(ltm, it); lt !=
null; lt = it.next(lt)) {
+ if (lt.getStagedType() == Tuple.NONE &&
lt.getContextObject() == null) {
+ smem.getStagedLeftTuples().addInsert(lt);
+ }
Review Comment:
Again issue that can not be reproduced from DRL or executable API.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]