Github user davidyan74 commented on a diff in the pull request:
https://github.com/apache/incubator-apex-core/pull/185#discussion_r48784504
--- 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
+ // (recovery), fabricate the first window
+
fabricateFirstWindow((Operator.DelayOperator)operator, windowAhead);
+ }
+ firstWindowId = t.getWindowId();
--- End diff --
Even though firstWindowId is not used for now in the case of !delay, having
firstWindow == -1 in case of !delay is also not ideal since it could be used in
the future and can cause bugs because of confusion, and we are talking about a
negligible assignment instruction.
---
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.
---