m-trieu commented on code in PR #32774:
URL: https://github.com/apache/beam/pull/32774#discussion_r1813960319
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/windmill/client/grpc/GrpcGetDataStreamRequests.java:
##########
@@ -122,12 +132,62 @@ void addRequest(QueuedRequest request) {
byteSize += request.byteSize();
}
- void countDown() {
+ /** Let waiting for threads know that the request has been successfully
sent. */
+ synchronized void notifySent() {
sent.countDown();
}
- void await() throws InterruptedException {
+ /** Let waiting for threads know that a failure occurred. */
+ synchronized void notifyFailed() {
+ failed = true;
+ sent.countDown();
+ }
+
+ /**
+ * Block until notified of a successful send via {@link #notifySent()} or
a non-retryable
+ * failure via {@link #notifyFailed()}. On failure, throw an exception to
on calling threads.
+ */
+ void waitForSendOrFailNotification() throws InterruptedException {
sent.await();
+ if (failed) {
+ ImmutableList<String> cancelledRequests =
createStreamCancelledErrorMessage();
+ LOG.error("Requests failed for the following batches: {}",
cancelledRequests);
+ throw new WindmillStreamShutdownException(
+ "Requests failed for batch containing "
+ + String.join(", ", cancelledRequests)
+ + " ... requests. This is most likely due to the stream being
explicitly closed"
+ + " which happens when the work is marked as invalid on the
streaming"
+ + " backend when key ranges shuffle around. This is transient
and corresponding"
+ + " work will eventually be retried.");
+ }
+ }
+
+ ImmutableList<String> createStreamCancelledErrorMessage() {
Review Comment:
done
--
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]