Anurag-S1ngh opened a new pull request, #41719:
URL: https://github.com/apache/beam/pull/41719

   ## Summary
   
   Elide the finished-subtrigger bitset in `TriggerStateMachineRunner` when no 
trigger in the tree can leave a finished bit set. Today only 
`DefaultTriggerStateMachine` takes this shortcut. This extends the shortcut to 
`Repeatedly.forever(...)` over once-style triggers, plus `NeverStateMachine` 
and `ReshuffleTriggerStateMachine`.
   
   For these trees the bitset is read on every element and timer, but no bit 
can survive between calls. Bits set during `onFire` are cleared by `Repeatedly` 
before the state is persisted, and `onMerge` only sets a bit when a merging 
window already had one stored. So the state is always empty and the reads are 
wasted work.
   
   ## Changes
   
   - Compute whether the finished set is needed once in the constructor instead 
of on every call.
   - Add a conservative recursive check for elidable trees:
     - `DefaultTriggerStateMachine`, `NeverStateMachine`, 
`ReshuffleTriggerStateMachine`.
     - `RepeatedlyStateMachine` whose repeated subtree is once-style: 
`AfterPaneStateMachine`, `AfterDelayFromFirstElementStateMachine`, 
`AfterWatermarkStateMachine.FromEndOfWindow`, `AfterFirstStateMachine` or 
`AfterAllStateMachine` of once-style triggers, and nested 
`RepeatedlyStateMachine`.
   - Keep the finished set for `AfterEachStateMachine`, 
`OrFinallyStateMachine`, `AfterWatermarkStateMachine` with late firings, and 
when the new-window optimization is enabled.
   - Add tests covering elided and non-elided trigger shapes.
   
   ## Testing
   
   - `./gradlew :runners:core-java:test --tests 
"org.apache.beam.runners.core.triggers.*" --tests 
"org.apache.beam.runners.core.ReduceFnRunnerTest"` (142 tests passed)
   - `./gradlew :runners:core-java:spotlessCheck 
:runners:core-java:checkstyleMain :runners:core-java:checkstyleTest`
   
   Fixes #17961.
   


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

Reply via email to