liferoad opened a new issue, #26515: URL: https://github.com/apache/beam/issues/26515
### What happened? ### Bug details When users use the STORAGE_WRITE_API method with BigQuery IO as a sink to launch Dataflow batch jobs, a potential data loss could occur. The Dataflow job logs may contain errors like “OffsetAlreadyExists: ALREADY_EXISTS: The offset is within the stream, expected offset..”. This issue is reported here: https://lists.apache.org/thread/rpy8qbpkx4jtrxjfoor39skjp71gh0sx. ### Code to reproduce the bug Below code can reproduce the bug: ```java public static void main(String[] args) { BigQueryOptions options = PipelineOptionsFactory.fromArgs(args).create().as(BigQueryOptions.class); options.setStorageApiAppendThresholdRecordCount(5); Pipeline p= Pipeline.create(options); p.apply("ReadLines", TextIO.read().from("gs://apache-beam-samples/shakespeare/kinglear.txt")) .apply("Save Events To BigQuery", BigQueryIO.<String>write() .to("google.com:clouddfe:reprodataset.reprotable") .withFormatFunction(s -> new TableRow().set("words", s)) .withMethod(Write.Method.STORAGE_WRITE_API) .withCreateDisposition(CreateDisposition.CREATE_NEVER) .withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND)); p.run(); } ``` ### Workaround Using [FILE_LOADS](https://beam.apache.org/releases/javadoc/current/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.Write.Method.html#FILE_LOADS) works without any data loss issue for BigQuery IO as a sink for Dataflow batch jobs. ### Fix #26503 fix this bug. But the next Beam release (2.47.0) will not pick up this fix. ### Issue Priority Priority: 1 (data loss / total loss of function) ### Issue Components - [ ] Component: Python SDK - [X] Component: Java SDK - [ ] Component: Go SDK - [ ] Component: Typescript SDK - [ ] Component: IO connector - [ ] Component: Beam examples - [ ] Component: Beam playground - [ ] Component: Beam katas - [ ] Component: Website - [ ] Component: Spark Runner - [ ] Component: Flink Runner - [ ] Component: Samza Runner - [ ] Component: Twister2 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]
