github-actions[bot] commented on code in PR #41066:
URL: https://github.com/apache/beam/pull/41066#discussion_r4499818029
##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiSinkRowUpdateIT.java:
##########
@@ -202,8 +203,11 @@ private void assertRowsWritten(String tableSpec,
Iterable<TableRow> expected)
}
private void runPipelineAndWait(Pipeline p) {
- PipelineResult result = p.run();
+ // Run on a single DirectRunner thread so concurrent bundles do not share
a closed
+ // StreamWriter while the destination table is being created on the first
write retry.
+ p.getOptions().as(DirectOptions.class).setTargetParallelism(1);
try {
+ PipelineResult result = p.run();
result.waitUntilFinish();
Review Comment:
**🟡 Medium**: Moving `p.run()` inside the `try` block makes the `catch
(Pipeline.PipelineExecutionException e)` block active (since
`DirectOptions.isBlockOnRun()` is `true` by default, `p.run()` blocks and
throws `PipelineExecutionException` directly).
However, `StreamWriterClosedException` is thrown when
`writeStream.appendRows(...)` fails during `DestinationState.flush()`, and only
surfaces as a `PipelineExecutionException` after the `DirectRunner` exhausts
all 4 bundle retries and aborts the pipeline. If this exception is caught and
ignored here, the failed bundle's rows were never written to BigQuery, and the
test will immediately proceed to `assertRowsWritten` and fail with a misleading
row-mismatch `AssertionError` (or 404 table not found) while discarding the
actual pipeline failure stack trace.
With `setTargetParallelism(1)` preventing the concurrent bundle race,
consider removing the `try/catch` block that swallows
`StreamWriterClosedException` so that any unexpected failure surfaces with its
full exception cause.
--
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]