reuvenlax commented on code in PR #28050:
URL: https://github.com/apache/beam/pull/28050#discussion_r1379485049


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiWritesShardedRecords.java:
##########
@@ -664,21 +664,28 @@ public void process(
             boolean offsetMismatch =
                 statusCode.equals(Code.OUT_OF_RANGE) || 
statusCode.equals(Code.ALREADY_EXISTS);
 
-            // Invalidate the StreamWriter and force a new one to be created.
+            boolean quotaError = statusCode.equals(Code.RESOURCE_EXHAUSTED);
             if (!offsetMismatch) {
               // Don't log errors for expected offset mismatch. These will be 
logged as warnings
               // below.
               LOG.error(
                   "Got error " + failedContext.getError() + " closing " + 
failedContext.streamName);
             }
 
-            // TODO: Only do this on explicit NOT_FOUND errors once BigQuery 
reliably produces them.
             try {
+              // TODO: Only do this on explicit NOT_FOUND errors once BigQuery 
reliably produces
+              // them.
               tryCreateTable.call();
             } catch (Exception e) {
               throw new RuntimeException(e);
             }
-            clearClients.accept(failedContexts);
+
+            if (!quotaError) {
+              // This forces us to close and reopen all gRPC connections to 
Storage API on error,
+              // which empirically
+              // fixes random stuckness issues.
+              clearClients.accept(failedContexts);
+            }

Review Comment:
   I don't think that should happen on append. That sounds like an error that 
would happen when opening a stream



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

Reply via email to