Fix StreamEvent,next reference leak when update in-memory table
It is the root cause of  CPU cost by getLastEvent while add/remove event in ComplexEventChunk
@@ -172,13 +172,16 @@ public class IndexOperator implements Operator {
}
storeEvents.add(toUpdateEventChunk);
} else {
- while (foundEventChunk.hasNext()) {
- StreamEvent streamEvent = foundEventChunk.next();
- streamEvent.setNext(null); // to make the chained state back to normal
+ StreamEvent first = foundEventChunk.getFirst();
+ while (first != null) {
+ StreamEvent streamEvent = first;
for (Map.Entry<Integer, ExpressionExecutor> entry :
compiledUpdateSet.getExpressionExecutorMap().entrySet()) {
streamEvent.setOutputData(entry.getValue().execute(overwritingOrAddingEvent), entry.getKey());
}
+ StreamEvent next = first.getNext();
+ first.setNext(null); // to make the chained state back to normal
+ first = next;
}
}
}
