Re: [PR] Segment memory helpers [incubator-kie-drools]

2025-10-30 Thread via GitHub


pibizza commented on code in PR #6508:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6508#discussion_r2478325654


##
drools-core/src/main/java/org/drools/core/common/SegmentMemorySupport.java:
##
@@ -36,7 +35,7 @@ public interface SegmentMemorySupport {
 
 public SegmentMemory getQuerySegmentMemory(QueryElementNode queryNode);
 
-public void createChildSegments(LeftTupleSinkPropagator sinkProp, 
SegmentMemory smem);
+public void initializeChildSegmentsIfNeeded(SegmentMemory smem);

Review Comment:
   @mariofusco It is to clarify that the method is idempotent - you can call it 
twice and it won't get extra initailization.



-- 
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]



Re: [PR] Segment memory helpers [incubator-kie-drools]

2025-10-30 Thread via GitHub


pibizza commented on code in PR #6508:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6508#discussion_r2478336336


##
drools-core/src/main/java/org/drools/core/phreak/EagerPhreakBuilder.java:
##
@@ -1121,8 +1121,9 @@ private static TupleImpl 
insertPeerLeftTuple(InternalWorkingMemory wm,
 memory.getSegmentMemory().getStagedLeftTuples().addInsert(peer);
 } else {
 // If parent is Lian, then this must be called, so that any 
linking or unlinking can be done.
-LeftInputAdapterNode.doInsertSegmentMemoryWithFlush(wm, true, 
liaMem, memory.getSegmentMemory(), peer, node
-.getLeftTupleSource().isStreamMode());
+List pathsToFlush = 
LeftInputAdapterNode.doInsertSegmentMemory(wm, true, liaMem, 
memory.getSegmentMemory(), peer, node
+.getLeftTupleSource().isStreamMode() );
+wm.getRuleNetworkEvaluator().forceFlushPaths(pathsToFlush);

Review Comment:
   @mariofusco yes. If you see the method called originally was 
doInsertSegmentMemoryWithFlush. Now it is doInsertSegmentMemory.  See changes 
in LeftInputAdapterNode. 



-- 
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]



Re: [PR] Segment memory helpers [incubator-kie-drools]

2025-10-30 Thread via GitHub


pibizza commented on code in PR #6508:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6508#discussion_r2478325654


##
drools-core/src/main/java/org/drools/core/common/SegmentMemorySupport.java:
##
@@ -36,7 +35,7 @@ public interface SegmentMemorySupport {
 
 public SegmentMemory getQuerySegmentMemory(QueryElementNode queryNode);
 
-public void createChildSegments(LeftTupleSinkPropagator sinkProp, 
SegmentMemory smem);
+public void initializeChildSegmentsIfNeeded(SegmentMemory smem);

Review Comment:
   It is to clarify that the method is idempotent - you can call it twice and 
it won't get extra initailization.



-- 
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]



Re: [PR] Segment memory helpers [incubator-kie-drools]

2025-10-30 Thread via GitHub


mariofusco commented on code in PR #6508:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6508#discussion_r2478242616


##
drools-core/src/main/java/org/drools/core/phreak/EagerPhreakBuilder.java:
##
@@ -1121,8 +1121,9 @@ private static TupleImpl 
insertPeerLeftTuple(InternalWorkingMemory wm,
 memory.getSegmentMemory().getStagedLeftTuples().addInsert(peer);
 } else {
 // If parent is Lian, then this must be called, so that any 
linking or unlinking can be done.
-LeftInputAdapterNode.doInsertSegmentMemoryWithFlush(wm, true, 
liaMem, memory.getSegmentMemory(), peer, node
-.getLeftTupleSource().isStreamMode());
+List pathsToFlush = 
LeftInputAdapterNode.doInsertSegmentMemory(wm, true, liaMem, 
memory.getSegmentMemory(), peer, node
+.getLeftTupleSource().isStreamMode() );
+wm.getRuleNetworkEvaluator().forceFlushPaths(pathsToFlush);

Review Comment:
   Why is this force flush necessary now? Did it do this also before in a 
different way?



-- 
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]



Re: [PR] Segment memory helpers [incubator-kie-drools]

2025-10-30 Thread via GitHub


mariofusco commented on code in PR #6508:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6508#discussion_r2478237996


##
drools-core/src/main/java/org/drools/core/common/SegmentMemorySupport.java:
##
@@ -36,7 +35,7 @@ public interface SegmentMemorySupport {
 
 public SegmentMemory getQuerySegmentMemory(QueryElementNode queryNode);
 
-public void createChildSegments(LeftTupleSinkPropagator sinkProp, 
SegmentMemory smem);
+public void initializeChildSegmentsIfNeeded(SegmentMemory smem);

Review Comment:
   Nitpic: I would remove the `IfNeeded` bit from the name of this method 
(unless you have a good reason to keep it).



-- 
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]