Github user aljoscha commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2277#discussion_r72067210
  
    --- Diff: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperator.java
 ---
    @@ -408,11 +410,22 @@ public void processWatermark(Watermark mark) throws 
Exception {
                                if (windowAssigner instanceof 
MergingWindowAssigner) {
                                        mergingWindows = getMergingWindowSet();
                                        W stateWindow = 
mergingWindows.getStateWindow(context.window);
    +                                   if (stateWindow == null) {
    +                                           // then the window is already 
purged and this is a cleanup
    +                                           // timer set due to allowed 
lateness that has nothing to clean,
    +                                           // so it is safe to just ignore
    +                                           continue;
    +                                   }
                                        windowState = 
getPartitionedState(stateWindow, windowSerializer, windowStateDescriptor);
                                } else {
                                        windowState = 
getPartitionedState(context.window, windowSerializer, windowStateDescriptor);
                                }
     
    +                           if (windowState.get() == null) {
    --- End diff --
    
    This doubles the amount of accesses to the state. For example, for RocksDB 
that's two DB lookups instead of one. I think we can get the state contents 
once and pass that to `fireOrContinue()` instead of the state object. 
    
    Same for other instances of this snipped. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to