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

    https://github.com/apache/incubator-apex-core/pull/232#discussion_r53728392
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/engine/Node.java ---
    @@ -540,12 +545,23 @@ void checkpoint(long windowId)
           }
         }
     
    +    calculateNextCheckpointWindow();
    +    dagCheckpointOffsetCount = 0;
         checkpoint = new Checkpoint(windowId, applicationWindowCount, 
checkpointWindowCount);
         if (operator instanceof Operator.CheckpointListener) {
           ((Operator.CheckpointListener) operator).checkpointed(windowId);
         }
       }
     
    +  protected void calculateNextCheckpointWindow()
    +  {
    +    if (PROCESSING_MODE != ProcessingMode.EXACTLY_ONCE) {
    +      nextCheckpointWindowCount = 
(int)Math.ceil((double)(DAG_CHECKPOINT_WINDOW_COUNT - 
dagCheckpointOffsetCount)/CHECKPOINT_WINDOW_COUNT) * CHECKPOINT_WINDOW_COUNT;
    --- End diff --
    
    Converting an integer to a floating point to so that you can call the 
Math.ceil() is not a recommended practice since converting a large integer to a 
floating point may lose precision.  In this case, it probably will not happen 
since we are talking about a relatively small integer, but how about changing 
it to:
    ```
    nextCheckpointWindowCount = ((DAG_CHECKPOINT_WINDOW_COUNT - 
dagCheckpointOffsetCount + CHECKPOINT_WINDOW_COUNT - 1)  / 
CHECKPOINT_WINDOW_COUNT) * CHECKPOINT_WINDOW_COUNT;
    ```
    to avoid the casting?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to