stankiewicz opened a new issue, #41764:
URL: https://github.com/apache/beam/issues/41764

   ### What happened?
   
   
   When `SpannerIO.write()` (or `SpannerIO.write().grouped()`) is configured 
with both `FailureMode.REPORT_FAILURES` and `withWriteResults()`, failed 
mutations are silently lost:
   
   ```java
   PCollection<WriteResults> results =
       mutations.apply(
           SpannerIO.write()
               .withProjectId(...)
               .withInstanceId(...)
               .withDatabaseId(...)
               .withFailureMode(FailureMode.REPORT_FAILURES)
               .withWriteResults());
   ```
   
   **Current behavior:**
   1. In `WriteToSpannerFn.processElement()`, `FailureMode.REPORT_FAILURES` 
catches `SpannerException`, retries individual `MutationGroup`s, and outputs 
failures to `failedTag` (which populates 
`SpannerWriteResult.getFailedMutations()`) instead of throwing.
   2. `WriteWithResults` / `WriteGroupedWithResults` returns 
`PCollection<WriteResults>` (`result.getWriteResults()`) and discards 
`result.getFailedMutations()`.
   3. Neither `withWriteResults()` nor `WriteWithResults.expand()` rejects 
`FailureMode.REPORT_FAILURES`, so failures are neither thrown nor reachable by 
the caller.
   
   **Expected behavior:**
   - `WriteWithResults` / `WriteGroupedWithResults` should either fail fast at 
pipeline construction/validation time (`IllegalArgumentException`) when 
`failureMode == FailureMode.REPORT_FAILURES` (since `PCollection<WriteResults>` 
cannot expose `failedMutations`), **or**
   - Callers needing both `WriteResults` and `failedMutations` should be able 
to obtain `SpannerWriteResult` with `commitStats` enabled (note that 
`SpannerWriteResult` already exposes both `getFailedMutations()` and 
`getWriteResults()`, though `SpannerIO.Write` currently has no public builder 
method for `commitStats` without `withWriteResults()`).
   
   ### Issue Priority
   
   Priority: 2 (default / most bugs should be filed as P2)
   
   ### Issue Components
   
   - [ ] Component: Python SDK
   - [x] Component: Java SDK
   - [ ] Component: Go SDK
   - [ ] Component: Typescript SDK
   - [x] Component: IO connector
   - [ ] Component: Beam YAML
   - [ ] Component: Beam examples
   - [ ] Component: Beam playground
   - [ ] Component: Beam katas
   - [ ] Component: Website
   - [ ] Component: Infrastructure
   - [ ] Component: Spark Runner
   - [ ] Component: Flink Runner
   - [ ] Component: Prism Runner
   - [ ] Component: Hazelcast Jet Runner
   - [ ] Component: Google Cloud Dataflow Runner


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