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

    https://github.com/apache/incubator-apex-core/pull/185#discussion_r48784203
  
    --- Diff: 
engine/src/main/java/com/datatorrent/stram/engine/GenericNode.java ---
    @@ -364,29 +413,49 @@ else if (!doCheckpoint) {
                       if (tracker.ports[trackerIndex] == null) {
                         tracker.ports[trackerIndex++] = activePort;
                         break;
    -                  }
    -                  else if (tracker.ports[trackerIndex] == activePort) {
    +                  } else if (tracker.ports[trackerIndex] == activePort) {
                         break;
                       }
     
                       trackerIndex++;
                     }
     
    -                if (trackerIndex == totalQueues) {
    -                  trackerIterator = resetTupleTracker.iterator();
    +                if (trackerIndex == regularQueues) {
    +                  Iterator<TupleTracker> trackerIterator = 
resetTupleTracker.iterator();
                       while (trackerIterator.hasNext()) {
                         if (trackerIterator.next().tuple.getBaseSeconds() <= 
baseSeconds) {
                           trackerIterator.remove();
                         }
                       }
    -                  for (int s = sinks.length; s-- > 0; ) {
    -                    sinks[s].put(t);
    +                  if (!delay) {
    +                    for (int s = sinks.length; s-- > 0; ) {
    +                      sinks[s].put(t);
    +                    }
    +                    controlTupleCount++;
                       }
    -                  controlTupleCount++;
    -
    -                  assert (activeQueues.isEmpty());
    -                  activeQueues.addAll(inputs.values());
    +                  if (!activeQueues.isEmpty()) {
    +                    // make sure they are all queues from DelayOperator
    +                    for (Map.Entry<String, SweepableReservoir> entry : 
activeQueues) {
    +                      if 
(!isInputPortConnectedToDelayOperator(entry.getKey())) {
    +                        assert (false);
    +                      }
    +                    }
    +                    activeQueues.clear();
    +                  }
    +                  activeQueues.addAll(inputs.entrySet());
                       expectingBeginWindow = activeQueues.size();
    +
    +                  if (firstWindowId == -1) {
    +                    if (delay) {
    +                      for (int s = sinks.length; s-- > 0; ) {
    +                        sinks[s].put(t);
    +                      }
    +                      // if it's a DelayOperator and this is the first 
RESET_WINDOW (start) or END_STREAM
    --- End diff --
    
    We do need to send RESET_TUPLE downstream, because it's the reset tuple 
that sets the upper 32 bit (baseSeconds) within the buffer server subscriber 
downstream.


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