lukecwik commented on code in PR #23882:
URL: https://github.com/apache/beam/pull/23882#discussion_r1009930422
##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnApiDoFnRunner.java:
##########
@@ -999,14 +1022,7 @@ public void onClaimFailed(PositionT position) {}
}
}
} finally {
Review Comment:
I don't think we need this finally block since the only way out is via the
break statement.
Any exceptional return will lead to the bundle being failed and these DoFns
being discarded.
Ditto for the other finally block.
##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnApiDoFnRunner.java:
##########
@@ -972,6 +993,8 @@ private void
processElementForWindowObservingTruncateRestriction(
synchronized (splitLock) {
windowCurrentIndex++;
if (windowCurrentIndex >= windowStopIndex) {
+ // Careful to reset the split state under the same synchronized
block.
+ resetSplitState();
break;
Review Comment:
might as well and make this a return
##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnApiDoFnRunner.java:
##########
@@ -961,6 +967,21 @@ public void onClaimFailed(PositionT position) {}
this.stateAccessor.finalizeState();
}
+ private void resetSplitState() {
+ synchronized (splitLock) {
Review Comment:
I wouldn't make this a separate method since we are removing the finally
blocks.
This would also prevent it from being called at an inappropriate time.
##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnApiDoFnRunner.java:
##########
@@ -1175,6 +1183,12 @@ private Progress
getProgressFromWindowObservingTruncate(double elementCompleted)
@VisibleForTesting
static Progress scaleProgress(Progress progress, int currentWindowIndex, int
stopWindowIndex) {
Review Comment:
`Progress SplittableFnDataReceiver.getProgress()` should check to see if the
current window is null just like `getProgressFromWindowObservingTruncate` does.
--
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]